[Interest] Interest Digest, Vol 89, Issue 32

Roland Hughes roland at logikalsolutions.com
Tue Mar 19 01:30:44 CET 2019

To further add to the documentational mud


void QLayout::addWidget(QWidget * w)

Adds widget w to this layout in a manner specific to the layout. This 
function uses addItem().

Putting it in human terms:

You are the parent of your child. When your child takes a job a 
part-time job at say, a gas station (feel free to insert whatever for 
the place of employment) they will have a manager at that place of 
employment. That manager may have many other layers of management but 
your child reports to their manager and you are still their parent.

Bringing it back to Qt.

A widget can have only one layout manager at a time, yet it can have 
many other managers. Your widget could have, say, an alarm manager. It 
and many other widgets on many other screens in other layouts could have 
also been added to an alarm manager. When some alarm condition happens 
the alarm manager tells the list of widgets it managers to change to a 
flashing border or a color indicating the alarm level.

On 2/23/19 4:00 AM, interest-request at qt-project.org wrote:
> The docs are indeed unclear, but look at what you're quoting -- a
> function to add QLayoutItems to a layout. A QWidget is NOT a QLayoutItem
> (but it is possibly managed by one). QLayout::addItem will add a
> QLayoutItem to a layout, passing ownership of the_item_  to the layout
> (but not of the widget the layout item is managing).

Roland Hughes, President
Logikal Solutions
(630)-205-1593  (cell)

More information about the Interest mailing list