PDA

View Full Version : [QtDesigner] Automatically generated source code & C++ design



Mareq
1st August 2009, 09:05
Hello,
I recently started to learn Qt4 (using the official book), but there are some issues I am little confused about:
- Source code generated by QtDesigner is not exception safe:

// excrept from setupUi function
// ...
buttonBox = new QDialogButtonBox(Dialog);
// ...
pushButton = new QPushButton(Dialog); // what happens when this new throws an exception? (buttonBox memory will be leaked)
// ...


- The book suggests that "the cleanest way" for creating dialog window class (e.g. MyDialog) is to publicaly inherit from Ui_Dialog (created by QtDesigner) and QDialog - both of them. But that is not necessary multiple inheritance. Is there really no way to tell QtDesigner to inherit the Ui_Dialog class from QDialog and then make MyDialog inherit only from Ui_Dialog? Yes, I know, multiple inheritance like this particular one is more or less harmless, but still, it would be much nicer not to use it when it is not really needed.

So, is it just me, the beginner, not knowing about ways around these things (I know I can write whole code by hand, but I would like to use tools like QtDesigner) or am I too much of detailist?