Qt5 – setting background color to QPushButton and QCheckBox

I had the same issue, but finally got this to work. I’m using Qt 5 with the Fusion color theme: QPalette pal = button->palette(); pal.setColor(QPalette::Button, QColor(Qt::blue)); button->setAutoFillBackground(true); button->setPalette(pal); button->update(); Try these commands in the exact order as above, and if that still doesn’t work, set your theme to Fusion and try again. Good luck!

Enabling JPEG support for QImage in py2exe-compiled Python scripts?

After hours of stumbling around with the same issue, Iā€™d like to share the solution that worked for me on windows vista: using python2.6 copy the following directory into your dist directory generated by py2exe: C:\Python26\Lib\site-packages\PyQt4\plugins\imageformats I just dropped the imageformats directory directly into my dist directory, without any further modifications to qt.conf or anything … Read more

Access sqlite from a remote server

SQLite isn’t a network database, so it doesn’t have any network connection ability built into it. You would need to either: Make the SQLite DB available on a network-accessible shared drive OR Write/find an existing network server/web service for it A web application is essentially a web service. If you happen to be running a … Read more

qmake pre-build step before ANY compilation

Another option would be to start with the project file snippet in your original question, and also ensure that qmake is aware that versioning.h is a dependency for the other build targets in your project file ā€” Add the full path to versioning.h to your HEADERS variable. Add the folder in which versioning.h resides to … Read more

How do I copy object in Qt?

It seems the copy constructor and assignment operator are disabled. From this. No copy constructor or assignment operator QObject has neither a copy constructor nor an assignment operator. This is by design. Actually, they are declared, but in a private section with the macro Q_DISABLE_COPY(). In fact, all Qt classes derived from QObject (direct or … Read more

How to use QMake’s subdirs template?

In addition to Troubadour’s comment, I would note that the SUBDIRS target is only good for specifying subdirectories. Therefore, your extra line of SOURCES += main.cpp in your project.pro file is incorrect, and will likely fail to build your main.cpp file, at worst. At best, qmake will refuse to parse the file, since it has … Read more

How to build Qt 4.8/5.2 statically under VS2012, using the static MSVC runtime, with Windows XP support?

Qt 5.2 Assuming that the environment was prepared for XP targeting, and relevant XP-targeting qt5xp.patch and the bug fix qt5fixes.patch available – both from my other answer, we have to do the following: Create a separate win32-msvc2012-static and win32-msvc2012-static-xp qmake specs by copying them from qtbase/mkspecs/win32-msvc2012 and qtbase/mkspecs/win32-msvc2012-xp, respectively. Modify the qmake specs. Teach configure … Read more

How to Include OpenSSL in a Qt project

Assuming Windows, you can download its installation from Win32 OpenSSL Installation Project page. You can choose one for 64-bit windows developing or for 32-bit. Just run the setup and everything will be done easily. The default installation directory is : C:\OpenSSL-Win32 In Qt creator, if you then want to link a library to your project … Read more