Scrolling QComboBox's parent widget while combo's popup is shown
-
@
#include <QApplication>
#include <QComboBox>
#include <QScrollArea>
#include <QVBoxLayout>
#include <QWidget>int main( int argc, char* argv[] )
{
QApplication a(argc, argv);const QStringList choiceTexts = QStringList() << "Choice 1" << "Choice 2" << "Choice 3"; QWidget* const combosContainer = new QWidget; QVBoxLayout* const combosLayout = new QVBoxLayout( combosContainer ); for ( int i = 0; i < 30; ++ i ) { QComboBox* const combo = new QComboBox; combo->addItems( choiceTexts ); combosLayout->addWidget( combo ); } QScrollArea scrollArea; scrollArea.setWidget( combosContainer ); scrollArea.show(); return a.exec();
}
@Steps to reproduce:
- Run the app and resize the scroll area, so that the vertical scrollbar appears.
- Click on any of the combos, so that their popup is shown.
- Now, no matter whether the mouse's cursor is over the combo's popup or outside it, if one scrolls with the mouse wheel the scroll area moves its contents but the combo's popup does not move and is somehow detached from the combo itself.
Any suggestions how to make the combo's popup be always "attached" to the combo when scrolling?
-
Hi,
That sound like a bug. Did you take a look at the "bug report system":http://bugreports.qt-project.org ? If there's nothing, you could consider opening a new bug report providing all the informations you have (what you wrote here)
-
I've used it many times. I will file a bug but I am sure it won't get resolved as all the others I've filed. And moreover I need a solution now not after years.
-
You should also post the link to your bug report here, it might be useful for others.
If you need a fix in a timely fashion you could consider becoming a client of Digia or hire a good developer to fix the bug(s) in question
-
No, I post the problem here, rather than in the bug report system because the possibility of getting a solution is much greater.
Anyway, if there is workaround solution, it would be welcome.
-
I have reported this as a bug: https://bugreports.qt-project.org/browse/QTBUG-40656
Note that it doesn't happen on Linux, only Windows, because the parent scroll area doesn't respond to mouse wheel events while the combo is open there.
I tried several work-arounds to force Windows to behave like Linux (see the comments at the bug report), but none of them worked.