PDA

View Full Version : Styling QComboBox like Find/Find&Replace selector in Mac OSX



eSKon
25th May 2012, 08:16
Hello all.
I'm trying to implement find panel like another mac os x software has.
It should look like:
7748
And active it looks like:
7749
To do it i used following style sheet:

QComboBox {
font-size: 11px;
border-image: url(:/Resources/findbuttonborderimage.png) 8px 8px 8px 8px stretch stretch;
border-width: 8px 8px 8px 8px;
padding-top: -5px;
padding-bottom: -3px;
}
QComboBox:on{
border-image: url(:/Resources/findbuttonborderimagepressed.png) 8px 8px 8px 8px stretch stretch;
}
QComboBox::drop-down {
subcontrol-origin: padding;
subcontrol-position: center right;
width: 10px;
height: 10px;
border: none;
background: none;
}
QComboBox::down-arrow {
image: url(:/Resources/findselectoricon.png);
}
QComboBox QAbstractItemView
{
background: none;
}

Closed my combo looks fine:
7750
But open is wrong:
7751

Then i changed style sheet a little:

QComboBox QAbstractItemView
{
background: none;
padding: 10px 10px 10px 10px;
}

But it didn't help:
7752

As you can to see on last image there is few problems:
1. Extra background under items
2. Rounding rects are hidden behind padding. Increasing padding draw correct rounding rects.
3. Items being selected only in extra background area

Could anybody help with it?

Spitfire
28th May 2012, 15:06
All your attachments are missing so it's difficult to tell what may be wrong.