3 Attachment(s)
QComboBox popup arrows [Mac OS X]
I have noticed some strange behavior when applied the stylesheet to QComboBox on Mac OS X: changing properties like margin or padding produces arrows for the popup. Here is the code:
Code:
#include <QVBoxLayout>
#include <QLineEdit>
#include "mainwindow.h"
{
this->setObjectName("cbo1");
this->cbo2->setObjectName("cbo2");
this->cbo3->setObjectName("cbo3");
for (int i = 0; i < 10; ++i)
{
this
->cbo1
->addItem
("item " + QString::number(i
));
this
->cbo2
->addItem
("item " + QString::number(i
));
this
->cbo3
->addItem
("item " + QString::number(i
));
}
layout->addWidget(this->cbo1);
layout->addWidget(this->cbo2);
layout->addWidget(this->cbo3);
setCentralWidget(frame);
}
MainWindow::~MainWindow()
{
}
There are three comboboxes: cbo1, cbo2, cbo3. For cbo1 I didn't change neither margin nor padding, for cbo2 I changed margin-bottom and for cbo3 I changed padding-left. The stylesheet is shown below:
Code:
{
background-color: red;
}
{
background-color: yellow;
/*margin-left: 5px;*/
margin-bottom: 2px;
}
{
background-color: yellow;
margin-top: 0px;
padding-top: 0px;
margin-bottom: 0px;
padding-bottom: 0px;
background-clip: margin;
outline: none;
}
{
background-color: #c0c0c0;
padding-left: 5px;
}
It looks like this:
Attachment 8790(cbo1)Attachment 8789(cbo2)Attachment 8791(cbo3)
As you can see, cbo2 and cbo3 have some strange arrows in their popup. Is it possible to prevent this or change appearance of those arrows so they better fit to the control style?
Re: QComboBox popup arrows [Mac OS X]
This is a Mac OS issue. I read about a work around somewhere. I recall manipulating the position of the arrow so it goes off screen, and or not setting the current item... I have no mac Os so I can't test it for you.