0

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.

Hanwen
  • 9
  • 2

1 Answers1

0

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)
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Hanwen
  • 9
  • 2