What are CMake vs qmake pros and cons?

Both are build systems, but they’re not very similar at all. If your project uses Qt, you’re probably best off using qmake. CMake is more generic, and fits pretty much any type of project. Both qmake and CMake generate a Makefile, which is read by make to build the project. Not all build systems generate … 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

Why doesn’t Qt use exception handling?

For historic reasons, mostly. Exception support in compilers took quite some time to mature. Citing Nokia’s Tobias Hunger: “When Qt was started exceptions were not available for all the compilers that needed to be supported by Qt. Today we are trying to keep the APIs consistent, so modules that have a history of not using … Read more

How to make a column in QTableWidget read only?

Insert into the QTableWidget following kind of items: QTableWidgetItem *item = new QTableWidgetItem(); item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled); Works fine! EDIT: QTableWidgetItem *item = new QTableWidgetItem(); item->setFlags(item->flags() ^ Qt::ItemIsEditable); This is a better solution. Thanks to @priomsrb.

can the Open File dialog be used to select a Folder?

You can try this one: QString QFileDialog::getExistingDirectory ( QWidget * parent = 0, const QString & caption = QString(), const QString & dir = QString(), Options options = ShowDirsOnly ) [static] This one is used to choose a directory, and will popup a dialog like you show at last. Demo: QString dir = QFileDialog::getExistingDirectory(this, tr(“Open … Read more

Non-resizeable QDialog with fixed size in Qt?

The compile error you get is because you try to pass a QSizePolicy::Policy to setSizePolicy(QSizePolicy), but there’s no implicit conversion from QSizePolicy::Policy (which is the policy for one dimension) to QSizePolicy (which is a class containing, among other things, one Policy per dimension (height, width)). QSizePolicy doesn’t work on top-level widgets (windows) anyway, though. setFixedSize() … Read more