nodeeditor icon indicating copy to clipboard operation
nodeeditor copied to clipboard

Big issue when using combo embedded widget

Open yvanblanchard opened this issue 1 year ago • 3 comments

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

yvanblanchard avatar May 14 '24 11:05 yvanblanchard

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).

shaharzfrn avatar May 15 '24 06:05 shaharzfrn

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 ?

yvanblanchard avatar May 15 '24 07:05 yvanblanchard

Maybe its #410?

vlad-mod avatar Dec 17 '24 09:12 vlad-mod

Duplicate of #121

Llcoolsouder avatar Jul 24 '25 21:07 Llcoolsouder