Bo Thorsen wrote:
> On torsdag den 23. August 2007, Lingfa Yang wrote:
>> Why QWidget::show () is not virtual?
>> I want my dialog class has a clean constructor, which benefits none-gui
>> mode. Only after I switch from none-gui to gui mode I may want to "show"
>> the dialog. So my show means "build" and "show" --- that's why I need
>> QWidget::show () to be virtual to hook my "build", unfortunately, it is
>> not. Does anyone has thought on this?
> I don't understand why you want to abuse the visible property of a dialog
> for this. It would be much cleaner if you introduce a system around it
> that would call show() once you go to gui mode.
I believe that is what the OP wants to do, but as show() isn't virtual, you
can not delay setting up the GUI by doing that in a reimplemented show()
instead of in the constructor. So, in that sense, I think the question is
However, I think the problem can (and should) be solved in another way. If
you also can run your work in a non-GUI "mode", why don't you create a
separate object that does the actual work, and let your dialog just be a
GUI that you create when going to GUI mode, after which you set up the
needed connections between your worker object and your dialog. This way,
you get a nice and clean separation between the components. It might even
make it possible to compile your app completely without GUI support if
needed, and it makes it possible to let the worker run in it's own thread
if you want.
thermiek is een keuze!
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/