PDA

View Full Version : QCombobox remove checkbox



ucomesdag
31st July 2007, 17:44
Hi,

I have for some reason check boxes on all QComboBoxes, when I use the plastic style and set a minimum width with view(). I wonder how can I get rid of them.


comboBox->view()->setMinimumWidth( lenght );

marcel
31st July 2007, 20:58
Hi,

I have for some reason check boxes on all QComboBoxes, when I use the plastic style and set a minimum width with view(). I wonder how can I get rid of them.


comboBox->view()->setMinimumWidth( lenght );

But that's weird. Shouldn't happen. What about other styles?

Regards

ucomesdag
31st July 2007, 21:22
But that's weird. Shouldn't happen. What about other styles?


On windows the same code is fine and without the plastik style on linux it is also fine.

...But without the plastik style it screwsup the layout...

marcel
31st July 2007, 21:25
Then it must be a bug in the style somewhere.
Probably a wrong condition in an "if" statement, and there you have your checkboxes.

Just saying... I am not sure exactly if that is the error, but the style is definitely to blame.

Regards

ucomesdag
31st July 2007, 23:24
Seems that setting any style on Linux generates check boxes with QCombobox.
When using view() it seems to set all possible option, I noticed a big scroll Button on top and bottom of the list with all other styles...
If someone has a hint or way to get rid of them or set the width of the list without using view() ....

marcel
31st July 2007, 23:33
Could you post an example reproducing the problem?
Or at least a portion of your code? For example, where do you create and initialize the combo box.

AFAIK, Jpn did something like this( a custom combo with checkable items ), just because it did not existed by default.

So, I say it again, it is pretty weird.
Check this out: http://jpnurmi.kapsi.fi/blog/2007/07/26/qt-centre-programming-contest-2007/#respond

Regards

ucomesdag
1st August 2007, 01:38
Could you post an example reproducing the problem?
Or at least a portion of your code? For example, where do you create and initialize the combo box.

AFAIK, Jpn did something like this( a custom combo with checkable items ), just because it did not existed by default.

So, I say it again, it is pretty weird.
Check this out: http://jpnurmi.kapsi.fi/blog/2007/07/26/qt-centre-programming-contest-2007/#respond

Regards

The original code:

QComboBox comboBox = new QComboBox(this);
comboBox ->setGeometry(geometry);
comboBox ->setEditable(false);
comboBox ->setFrame(false);
comboBox ->setMaxVisibleItems(itemsCount);
comboBox ->view()->setMinimumWidth(width);This fixed the check box thing but has some weird scroll issues:

QListView *view = new QListView;
view->setAutoScroll(false);
view->setMinimumWidth(width);

QComboBox comboBox = new QComboBox(this);
comboBox ->setGeometry(geometry);
comboBox ->setEditable(false);
comboBox ->setFrame(false);
comboBox ->setMaxVisibleItems(itemsCount);
comboBox ->setView(view);Btw. The parent widget has setStyle(QStyleFactory::create("plastique"));