[Qt-interest] Configure QtDesigner ui.h

Ian Thomson Ian.Thomson at iongeo.com
Fri Sep 2 18:15:43 CEST 2011


You can do it but it can be a bit of a pain if you do it that way.

There a few reasons why but the best one is this: If you make a library 
with a widget using ui through inheritance, when you include the header 
for the library in another project that project also has to have access 
to the produced ui_whatever.h file to be able to compile. As the 
ui_whatever.h file is merely a side-effect of the build process, it 
should not be part of the library's headers. If that file is cleaned up 
with a build-clean then your project which includes the library header 
will no longer compile. That's not a very nice side-effect.

Ian.

John Weeks wrote:
> Sorry, Bo. I always forget to change the To: field to send to the list...
> 
> On Sep 1, 2011, at 10:27 PM, Bo Thorsen wrote:
> 
>> Just remember to make the ui a pointer in the class and do a "new 
>> MyUIThing" in the constructor. Don't let your class inherit the UI class.
> 
> This caught my eye. Why do you say that? C++ GUI Programming with Qt 4, 
> second edition, page 27 shows their simple example dialog doing exactly 
> that. I rather like the readability of simply naming the widgets instead 
> of lots of "ui->..." stuff.
> 
> Regards, John Weeks
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list