paceholder / nodeeditor

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

Big issue when using combo embedded widget #422

Open yvanblanchard opened 1 month ago

yvanblanchard commented 1 month ago

Hello

I noticed that when using comboxBox widgets in Node, there are some very strange behaviors , typically the node disappears (except the combo). When zooming out, the node UI appears again...

image

Zooming out: image

shaharzfrn commented 1 month ago

I had this problem too,

Try to use QListWidget as a model and view for your QComboBox widget.

QListWidget *pListModel = new QListWidget();
QComboBox *pComboBox = new QComboBox();
pComboBox->setModel(pListModel->model());
pComboBox->setView(pListModel);

And to add items:

pListModel->addItem("Item 1");
pListModel->addItem("Item 2");
pListModel->addItem("Item 3");

OR

pListModel->addItem({"Item 1", "Item 2", "Item 3"});

I don't know why it's happening if you don't use QListWidget, but this solution work for me.

Note: It's important to call setModel before call setView (see: https://doc.qt.io/qt-6/qcombobox.html#setView).

yvanblanchard commented 1 month ago

Thank you very much @shaharzfrn ! I will test it soon.

It's strange, it does not happen all the time. I noticed that if I instanciate the node (containing the combo list widget) when zooming a lot, the problem does not appear..

@paceholder any idea about the root cause ?