qt4

How do I compile a PyQt script (.py) to a single standalone executable file for windows (.exe) and/or linux?

試著忘記壹切 提交于 2020-01-09 12:18:07
问题 I started to fiddle with PyQt, and made a "beautiful" script from the pyqt whitepaper example app (pastebin) It works perfectly in Windows and Linux (with qt environment already installed on both). Now my question is: Since I am trying to use Qt because it is compiled (at least pure old C++ based Qt), how can I compile some .exe file to run it on Windows, or a standalone executable for Linux. The point is that I want the program to be compiled, because of speed and portability, instead of

Adding custom style to button added in QTableview

ε祈祈猫儿з 提交于 2020-01-07 04:58:43
问题 I have created one table by using QTableview and QAbstractTableModel . In the last column, I am also able to add a button for every row (right corner of that cell). Now I want to customize its style, like change the background color to black, border, etc. Is there any way to achieve this? 回答1: delegate.h: class MyDelegate : public QItemDelegate { Q_OBJECT public: MyDelegate(QObject *parent = 0); void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;

Start QPropertyAnimation delayed

[亡魂溺海] 提交于 2020-01-07 03:08:09
问题 I have a small animation showing/hiding a frame when the mouse hovers the parent widget (in the code snippet below "MyWidget"). The animation simply changing the maximumWidth property of the frame so the frame becomes visible as some "slide-in effect". (The frame itself is place in a grid layout.) My Question is how to start the animation delayed? Example: Start 500ms after the mouse leaveEvent, so the slide-out effect is delayed and did not start immediately. void MyWidget::enterEvent(

How to convert an array into QByteArray?

末鹿安然 提交于 2020-01-07 02:23:08
问题 I would like to convert an array into a QByteArray in Qt. Can someone explain the concept? Please provide an example. 回答1: QByteArray has a constructor that does just this. This is how to use it: const char* data; int size; // these variables should be correctly set to your array and size QByteArray ba(data, size); I used a pointer for the data, but arrays decay to pointers when passed as parameters so it's the same. This constructor will make a deep copy of the data. That means it will only

FFMPEG with QT memory leak

会有一股神秘感。 提交于 2020-01-06 14:29:06
问题 Let me start with a code clip: QByteArray ba; ba.resize(500000); int encsize = avcodec_encode_video(context, (uint8_t*)ba.data(), 500000, frame.unownedPointer()); What I'm doing is encoding the data from frame and putting the data into the buffer pointed at QByteArray. If I comment out the avcodec_encode_video line my memory leak goes away. unownedPointer() looks like this: if (this->frame != NULL) return this->frame; this->frame = avcodec_alloc_frame(); uchar *data = this->img.bits(); frame-

Build driver plugin QIBASE Qt 4.7.3

我怕爱的太早我们不能终老 提交于 2020-01-06 08:45:11
问题 I try to build QIBASE driver in Qt 4.7.3 ibase.pro TARGET = qsqlibase SOURCES = main.cpp INCLUDEPATH += "C:/Program Files/Firebird/Firebird_2_0/include" "C:/QtSDK/Desktop/Qt/4.7.3/mingw/lib" LIBS += -L"C:/Program Files/Firebird/Firebird_2_0/lib/fbclient_ms.lib" -L"C:/Program Files/Firebird/Firebird_2_0/lib/fbclient_bor.lib" include(../../../sql/drivers/ibase/qsql_ibase.pri) include(../qsqldriverbase.pri) sql\drivers\ibase\qsql_ibase.pri HEADERS += $$PWD/qsql_ibase.h SOURCES += $$PWD/qsql

Build driver plugin QIBASE Qt 4.7.3

只愿长相守 提交于 2020-01-06 08:45:07
问题 I try to build QIBASE driver in Qt 4.7.3 ibase.pro TARGET = qsqlibase SOURCES = main.cpp INCLUDEPATH += "C:/Program Files/Firebird/Firebird_2_0/include" "C:/QtSDK/Desktop/Qt/4.7.3/mingw/lib" LIBS += -L"C:/Program Files/Firebird/Firebird_2_0/lib/fbclient_ms.lib" -L"C:/Program Files/Firebird/Firebird_2_0/lib/fbclient_bor.lib" include(../../../sql/drivers/ibase/qsql_ibase.pri) include(../qsqldriverbase.pri) sql\drivers\ibase\qsql_ibase.pri HEADERS += $$PWD/qsql_ibase.h SOURCES += $$PWD/qsql

QtWebView — C++ — How to get javascript string returned from linkClicked event

随声附和 提交于 2020-01-06 07:25:35
问题 I have been unable to find a definitive answer to my problem. I currently have a QWebView control load an html file that is on my hard-drive, that implements a vector map with javascript actions. The html file loads a jvectormap US States Map. The click action on any state fires the onRegionClick action that is tied to the showCities function, which the event and code arguments are handled by the onRegionClick method implemented in the jquery-jvectormap.js file. The html file follows: <

QT do while loop

匆匆过客 提交于 2020-01-06 07:11:43
问题 I am learning QT these days and I wanted to test do while loop , the actual login works in normally, but in QT the application freezes .. I have defined randnum and guess in the header file ( public ) void MainWindow::on_pushButton_clicked() { srand (time(NULL)); randnum = rand() % 10 +1; do { guess = ui->spinBox->value(); if (guess < randnum) { ui->label->setText("try something big"); } else if (guess > randnum) { ui->label->setText("try something small"); } else ui->label->setText("YAY?");

QT do while loop

感情迁移 提交于 2020-01-06 07:11:18
问题 I am learning QT these days and I wanted to test do while loop , the actual login works in normally, but in QT the application freezes .. I have defined randnum and guess in the header file ( public ) void MainWindow::on_pushButton_clicked() { srand (time(NULL)); randnum = rand() % 10 +1; do { guess = ui->spinBox->value(); if (guess < randnum) { ui->label->setText("try something big"); } else if (guess > randnum) { ui->label->setText("try something small"); } else ui->label->setText("YAY?");