PDA

View Full Version : How to change QComboBox background with a picture?



mulei
24th September 2010, 08:00
I wish to use qComboBox->setStyleSheet("*******");
to change QComboBox background with a picture.

First, I change QComboBox background with color, it works.
qComboBox->setStyleSheet("QComboBox:editable{background: red;});

Second, I try to change QComboBox background with a picture, it does not works.
qComboBox->setStyleSheet("QComboBox:editable{background: url(:/QReaderFrame/Resources/settingdialog/combox_normal.png);});
qComboBox->setStyleSheet("QComboBox {background: url(:/QReaderFrame/Resources/settingdialog/combox_normal.png);});


So why I swith color with picture, it does not work?
And what should I do for this situation?

Thanks!

tbscope
24th September 2010, 08:19
It should be background-image

mulei
24th September 2010, 08:48
I found the solution,
change QComboBox background with a picture, should use border-image

But thanks the same

tbscope
24th September 2010, 08:59
Nice that you found a solution.

It is not only changing the background image though.