nodeeditor icon indicating copy to clipboard operation
nodeeditor copied to clipboard

Embedded widget with wrong size when content has changed

Open yvanblanchard opened this issue 1 year ago • 2 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 ?

yvanblanchard avatar Jan 24 '24 21:01 yvanblanchard

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 avatar Mar 06 '24 10:03 mariusalexander

@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

yvanblanchard avatar Apr 02 '24 07:04 yvanblanchard

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

yvanblanchard avatar May 15 '24 07:05 yvanblanchard