[Qt-interest] update contents of QWidget
John McClurkin
jwm at nei.nih.gov
Thu Jun 3 14:38:53 CEST 2010
Dr. X wrote:
> Thanks, Nikos.
> It works! But is there a mechanism of calling a top level function to
> show/hide all the children objects?
> Appreciate your help.
> Best,
> x
Put all of the children in a single parent widget that is a child of
QMainWindow. Call show() on each child, then call show() on the parent.
>
> On 6/2/2010 11:15 PM, Nikos Chantziaras wrote:
>> On 06/03/2010 06:05 AM, Dr. X wrote:
>>
>>> Hi All,
>>>
>>> I would like to dynamically add a set of QPushButton objects in a
>>> QWidget object after the program is in the main .exec() loop. The data
>>> hierarchy is like this:
>>> QMainWindow -> QWidget -> QPushButton
>>> ...
>>> -> QPushButton
>>> I know how to create and position QPushButton objects in a QWidget
>>> object before QMainWindow::show(). But after the program enter the main
>>> loop, any newly created objects under that QWidget are not shown. I
>>> checked out the painter example. But that is not what I want. Would you
>>> please help? Thanks a lot.
>>>
>> I assume the QWidget has been made the central widget with
>> QMainWindow::setCentralWidget(). In that case, anything you add to the
>> central widget must be shown explicitly. In your case,
>> QPushButton::show().
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
More information about the Qt-interest-old
mailing list