Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.9.5
-
None
-
Ubuntu 18.04.1 LTS
Description
QComboBox up and down arrow scroll controls does not disappear once they are shown for the first time. I made simple example to show the bug. For first time, short list is good. When I set a lot of items to my combobox up and down arrow controls appear. When I set back just few items again, up and down scrolling buttons still appear and visual is broken.
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_pushButtonLongList_clicked() { int count = 100; ui->comboBox->clear(); for (int i = 1; i < count; ++i) { ui->comboBox->insertItem(ui->comboBox->count(),"Value"+QString::number(i)); } } void MainWindow::on_pushButtonShortList_clicked() { int count = 4; ui->comboBox->clear(); for (int i = 1; i < count; ++i) { ui->comboBox->insertItem(ui->comboBox->count(),"Value"+QString::number(i)); } }
Results can be seen on screenshot bellow. When I use:
ui->comboBox->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
Then scrollbar also does not hide even on short list in combobox. And btw, is there any way to hide these up and down scrolling buttons?