I have a list of values in a QComboBox. When the drop-down arrow is clicked, I need to update the list and display to the user for selection. How can I implement this? Which signal should I catch when the drop-down arrow is clicked?
Asked
Active
Viewed 179 times
1 Answers
0
I don't understand completely what you want to do, but to do something before showing the list you have to override the method :
void showPopup();
But I have to warn you. Usually it is not what you want. What you see clicking on the QComboBox is just a view. So what really happens when you click on the QComboBox is that the framework draws the widget and the items it contains. If you want to change the representation of your items (change text color, change background text, etc... ) you should inherit from QItemDelegate and re-implement the paint method.
If you want to change the selected text instead, you have to inherit from QComboBox and re-implement the paintEvent.
An example of how to do that is here : QComboBox elided text on selected item.

Community
- 1
- 1

andrea.marangoni
- 1,499
- 8
- 22
-
Thanks @andrea.marangoni. I went ahead with the solution by overriding showPopup(). – Aham Dec 29 '16 at 06:46
-
@Aham no problem! If you could kindly accept the answer you let others know you solved the problem you had. Thank you – andrea.marangoni Dec 29 '16 at 12:18