QString to char* conversion

Well, the Qt FAQ says: int main(int argc, char **argv) { QApplication app(argc, argv); QString str1 = “Test”; QByteArray ba = str1.toLocal8Bit(); const char *c_str2 = ba.data(); printf(“str2: %s”, c_str2); return app.exec(); } So perhaps you’re having other problems. How exactly doesn’t this work?

“Failed to load platform plugin “xcb” ” while launching qt5 app on linux without qt installed

Use ldd (man ldd) to show shared library dependencies. Running this on libqxcb.so …/platforms$ ldd libqxcb.so shows that xcb depends on libQt5DBus.so.5 in addition to libQt5Core.so.5 and libQt5Gui.so.5 (and many other system libs). Add libQt5DBus.so.5 to your collection of shared libs and you should be ready to move on.

Qt Creator – Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild

>= Xcode 8 In Xcode 8, as Bruce said, this happens when Qt tries to find xcrun when it should be looking for xcodebuild. Open the file: Qt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.prf Replace: isEmpty($$list($$system(“/usr/bin/xcrun -find xcrun 2>/dev/null”))) With: isEmpty($$list($$system(“/usr/bin/xcrun -find xcodebuild 2>/dev/null”))) ~> Xcode 8 Before Xcode 8, this problem occurs when command line tools are installed after Xcode … Read more

Yes/No message box using QMessageBox

You would use QMessageBox::question for that. Example in a hypothetical widget’s slot: #include <QApplication> #include <QMessageBox> #include <QDebug> // … void MyWidget::someSlot() { QMessageBox::StandardButton reply; reply = QMessageBox::question(this, “Test”, “Quit?”, QMessageBox::Yes|QMessageBox::No); if (reply == QMessageBox::Yes) { qDebug() << “Yes was clicked”; QApplication::quit(); } else { qDebug() << “Yes was *not* clicked”; } } Should work … Read more

How to build Qt for Visual Studio 2010

First of all, it’s very important to understand that for using Qt with Visual Studio 2010, it’s not possible to use the pre-built binaries which were made for Visual Studio 2008, but you have to compile it from source. Downloading Qt On https://www.qt.io/download/ Update 2017: the latest Qt 4.x branch (Qt 4.8.6) has 2 pre-built … Read more