How to make QComboBox popup upwards?

qcombobox, qt

Solution

With the information found in Qt Centre — [QComboBox] problem with popup position, I was able to get it done this way:

void SteuerQComboBox::showPopup() {
    QComboBox::showPopup();
    QWidget *popup = this->findChild<QFrame*>(); 
    popup->move(popup->x(),popup->y()-this->height()-popup->height());
}

Note that it's crucially important to call the base classes "showPopup" first.

Problem

My `QComboBox` derived class is contained in a `QGraphicsScene` at the bottom end of the (visible) screen - but it pops up downwards, thus out of view. How is it possible to force the popup to open upwards, not downwards? I've tried re-implementing `showPopup` like this: ``` void MyComboBox::showPopup() { QAbstractItemView *popupView = view(); popupView->move(0,-100); //popupView->window->move(0,-100); QComboBox::showPopup(); } ``` The result is, that the content seems to be shifted, but not the underlying popup object.

Original source