Not a troll but willing to take a bit of a stab.
If one is removing a widget from a layout it's generally to reparent it.
You needed to copy the line above the note.
---
Removes the widget /widget/ from the layout. After this call, it is the
caller's responsibility to give the widget a
On 22/02/2019 15.19, Jason H wrote:
> 1.
> '''
> void QLayout::addItem(QLayoutItem *item)
> ...
> void QLayout::addWidget(QWidget *w)
> Adds widget w to this layout in a manner specific to the layout.
> This function uses addItem().
> '''
>
> How can addWidget(QWidget *w) use addItem(QLayoutItem
On Friday February 22 2019 20:31:57 Jason H wrote:
>removeItem: Note: The ownership of widget remains the same as when it was
>added.
This is the part that isn't clear. "Ownership [as] when it was added", I
decided that this had to mean "before it was added" instead of "after it was
added"
Il 22/02/19 20:42, Jason H ha scritto:
'''
When you use a layout, you do not need to pass a parent when constructing the
child widgets. The layout will automatically reparent the widgets (using
QWidget::setParent()) so that they are children of the widget on which the
layout is installed.
> Sent: Friday, February 22, 2019 at 3:10 PM
> From: "Matthew Woehlke"
> To: "Jason H" , "interest@qt-project.org"
>
> Subject: Re: Taking back a widget from a QBoxLayout?
>
> On 22/02/2019 14.42, Jason H wrote:
> >>> https://doc.qt.io/qt-5/layout.html#tips-for-using-layouts
> > From that:
>
On 22/02/2019 14.31, Jason H wrote:
> addItem: Note: The ownership of item is transferred to the layout,
>
> and it's the layout's responsibility to delete it.
> removeItem: Note: The ownership of widget remains the same as when it
> was added.
>
> So addItem parents it as it's own, then
On 22/02/2019 14.42, Jason H wrote:
>>> https://doc.qt.io/qt-5/layout.html#tips-for-using-layouts
> From that:
> '''
> When you use a layout, you do not need to pass a parent when
> constructing the child widgets. The layout will automatically
> reparent the widgets (using QWidget::setParent())
> Sent: Friday, February 22, 2019 at 2:27 PM
> From: "Giuseppe D'Angelo via Interest"
> To: interest@qt-project.org
> Subject: Re: [Interest] Taking back a widget from a QBoxLayout?
>
> Il 22/02/19 19:04, René J.V. Bertin ha scritto:
> >> I am not 100%
> Sent: Friday, February 22, 2019 at 1:04 PM
> From: "René J.V. Bertin"
> To: "Jason H"
> Cc: "interest@qt-project.org Interest"
> Subject: Re: [Interest] Taking back a widget from a QBoxLayout?
>
> On Friday February 22 2019 17:45:05 Jason H
Il 22/02/19 19:04, René J.V. Bertin ha scritto:
I am not 100% sure, it's been a while, but I would assume that the layout is
not the true parent, combined is.
The docs aren't exactly clear on this subject, at least not with the sort of
reading glasses I usually have on when I don't exactly
On Friday February 22 2019 17:45:05 Jason H wrote:
>I am not 100% sure, it's been a while, but I would assume that the layout is
>not the true parent, combined is.
The docs aren't exactly clear on this subject, at least not with the sort of
reading glasses I usually have on when I don't
> Sent: Friday, February 22, 2019 at 11:27 AM
> From: "René J.V. Bertin"
> To: "interest@qt-project.org Interest"
> Subject: [Interest] Taking back a widget from a QBoxLayout?
>
> Hi,
>
> Consider
>
> ```
> SomeWidgetClass *a
Hi,
Consider
```
SomeWidgetClass *a = maybeReturnSomeWidget();
SomeOtherQWidgetClass *b = maybeReturnSomeOtherWidget();
QWidget *combined = new QWidget();
QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(a);
layout->addWidget(b);
combined->setLayout(layout);
if (doWeLikeItCombined) {
13 matches
Mail list logo