I would like my QComboBox
-derived class that's contained in a QGraphicsScene
to expand its popup view upwards.
I tried this:
void MyComboBox::showPopup() {
QComboBox::showPopup();
QWidget *popup = this->findChild<QFrame*>();
popup->move(popup->x(),popup->y()-this->height()-popup->height());
}
but there are two problems:
My popup widget will animate opening downwards at first, and then move above the text box.
QComboBox::showPopup()
makes the popup widget appear on the screen, so, move
method would cause it to flick, as it appears in the first place, and then moves to the next.
The solutions mentioned in How to make QComboBox popup upwards? work, but only after installing an event filter on view()
in MyComboBox::setView
:
view()->installEventFilter(this)