paceholder / nodeeditor

Qt Node Editor. Dataflow programming framework
BSD 3-Clause "New" or "Revised" License
2.94k stars 796 forks source link

Zoom Scaling Issue - Embedded Widgets #293

Open xemjeff opened 2 years ago

xemjeff commented 2 years ago

When I embed a combo box in a Node, the scaling of the node does not correctly scale the combo box. In this case, both combo boxes are in a QWidget with a vertical box layout.

See image:

NodeZoomProblem

.

paceholder commented 2 years ago

Hi Jeff,

I am afraid it is a Qt bug. The node library does not control the internal behavior of widgets. Can you share the code for such an embedded widget? I'll try to reproduce it on my computer.

Best,

Dmitry

On Mon, Nov 15, 2021 at 2:27 PM Jeff Sprenger @.***> wrote:

When I embed a combo box in a Node, the scaling of the node does not correctly scale the combo box. In this case, both combo boxes are in a QWidget with a vertical box layout.

See image:

[image: NodeZoomProblem] https://user-images.githubusercontent.com/8524620/141789725-245efd47-e1a1-488a-a59a-2751e387b61a.png ..

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/paceholder/nodeeditor/issues/293, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACO3CEGV7FS7GWMIHYKHCLUMEDF5ANCNFSM5IBWB4DQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

xemjeff commented 2 years ago

Here's the short version of code for the embedded widget, which is simply created in the constructor:

In FrameDisplayModel.cpp

FrameDisplayModel::
FrameDisplayModel()
  : _embeddedWidget(new QWidget()),
    _cboManipulator(new QComboBox()),
    _cboLink(new QComboBox())
{
  QVBoxLayout *layout = new QVBoxLayout();

  _cboManipulator->addItems(QStringList({"System", "Robot1", "Robot2"}));
  _cboLink->addItems(QStringList({"Link1", "Link2", "Wrist3"}));
  layout->addWidget(_cboManipulator);
  layout->addWidget(_cboLink);
  _embeddedWidget->setLayout(layout);
}

In FrameDisplayModel.hpp:

  QWidget *
  embeddedWidget() override { return _embeddedWidget; }

. . .

private:

  NodeValidationState modelValidationState = NodeValidationState::Valid;
  QString modelValidationError = QStringLiteral("Not Connected");

  QWidget   * _embeddedWidget;
  QComboBox * _cboManipulator;
  QComboBox * _cboLink;
};
paceholder commented 1 year ago

Just wanted to confirm that I saw the same issue in other qt-based projects. I'll try to submit a bug to Qt if the issue is reproducible on a minimal example.