1
votes

I have a QComboBox. And an implemented QAbstractItemView set as combo box view. What signal I need to emit from my view to make the combo know that the current item has been changed? When emitting "selectionChanged" or "currentItemChanged" the selected item does not appear on the combo and the view is still shown.

    QComboBox* c = new QComboBox();
    QAbstractItemView* v = new MyComboView();
    c->setView(v);

I will try to make the problem more clear. I have custom view on the combobox, it is shown, the mouse move, mouse over events are working correctly. But I have one real problem. It is the model item is not shown on the combo when I click on it. I have tried to emit selectionChanged and currentChanged signals, it was not helpful. Do I need to write my own slots for this signals to have it working or it should be done by QT?

1
Did you try the signal currentIndexChanged(int) from the QComboBox?IAmInPLS
Your question seems to describe a XY problem. Try to describe what you want to achieve, what you tried and how it differs from the expected result instead.Murphy
Murphy, sorry for bad explanation. I will try to make it more clear.Ani

1 Answers

2
votes

There is no such signal. QComboBox gets the information about it's view through the event filter:

Every time a mouse is moved over the view, the current index (of the view) is set according to the mouse cursor.

Every time a mouse button is released, the current index of the view is set as a current index of the QComboBox and the list (view) is hidden.