paceholder / nodeeditor

Qt Node Editor. Dataflow programming framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Embedded widget with wrong size when content has changed

yvanblanchard opened this issue · comments

Hello,

I have a node with an embedded widget (QtLabel).
This Label widget contained a quite long text, and after updating the flow graph, this node was updated and text was shorter.
Problem is that the lable widget kept its previous size, instead of being resized as expected.
The node (container) of this widget was correctly resized (smaller), but not the widget child..

Before:
image

After:
image

Any idea ?

Can you try to use a QLayout to manage the size of the label?

QWidget* embeddedWidget() {
    auto* widget = new QWidget;
    auto* lay = new QVBoxLayout; // or QHBoxLayout
    auto* label = new QLabel; // your label
    lay->addWidget(label);
    widget->setLayout(lay);
    return widget;
}

@mariusalexander
thank you, but I had already used layout for my embedded widget.
it seems like this issue is possibly related to a Qt bug (related to zooming effect): #121

...when also using 'embeddedWidgetSizeUpdated' in eventFilter of the widget (Qlabel orother), it works fine!