Reimplementation of QComboBox showPopup() works only once
We are trying to reimplement QComboBox::showPopup(). The code below sets selected index and hidePopup is called(). It works only once per combobox instance. Consecutive clicks on the same combobox do not invoke showPopup(). It seems that call to hidePopup() has no effect and internal state of combobox is not reset...
int main(int argc, char *argv)
QApplication a(argc, argv);
[andreyc EDIT: added @ around the code]
You need to derive your own class from QComboBox if you need to re-implement its member functions.
In your example QComboBox::showPopup() is never called.
Thanks for your replying.
My showPopup() is called. Because the message, "QComboBox::showPopup() ", is shown.
What I want to do is to create a widget in the reimplemented showPopup().
Frankly speaking I don't see from your example how QComboBox::showPopup() can be called.
Did you modify QComboBox class?
[quote]What I want to do is to create a widget in the reimplemented showPopup().[/quote]You need to define a widget class manually or in designer and then create it in the function.
Linux does allow us to override these two methods (showPopup, hidePopup) directly.
Could you try the code I posted.