Posts Tagged ‘code’

Just a short thought on Qt

June 19, 2015 Leave a comment

Qt has (sometimes huge) design mistakes in my opinion but it’s far from bad. But try to look up unrelated information about it, and you’ll find the fanboys defending every silly thing about it.

For example, when you design a window in the Qt Designer, it creates an XML file with the .ui extension. That file is then translated to source files. The generated header has code like this:

class Ui_MainForm
    // ... Declarations of widgets and some helper functions.

below it another class is generated in this exact way:

namespace Ui {
    class MainForm: public Ui_MainForm {};
} // namespace Ui

The class in the Ui namespace can then be used as a private member in another header file, which is provided for the programmer to change: (because the code above is auto generated)

class MainForm : public QMainWindow
    // ... some things you add here
    Ui::MainForm ui;

Not one, but more people asked why is there a Ui::MainForm generated, when there is also a Ui_MainForm, which is the exact same thing. They were just curious and asked politely but the fanboys attacked. “It seems to me you do not get what namespaces are” (exact quote).

(This is the end of the post. If you don’t understand why I’m troubled by such reactions you are either not a programmer (it’s normal then, not your fault), or you are smarter than I am and the way Qt does this appears right to you.)

Categories: Rant Tags: , ,