summaryrefslogtreecommitdiff
path: root/noncore/styles/phase/phasestyle.cpp
Side-by-side diff
Diffstat (limited to 'noncore/styles/phase/phasestyle.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/phase/phasestyle.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/noncore/styles/phase/phasestyle.cpp b/noncore/styles/phase/phasestyle.cpp
index 746354e..c2b9de8 100644
--- a/noncore/styles/phase/phasestyle.cpp
+++ b/noncore/styles/phase/phasestyle.cpp
@@ -369,49 +369,52 @@ void PhaseStyle::drawPushButtonLabel (QPushButton *button, QPainter *painter) {
drawArrow(painter, Qt::DownArrow, active,
x+w-dx, y+2, dx-4, h-4, group,button->isEnabled() );
w -= dx;
}
if (button->iconSet() && !button->iconSet()->isNull()) { // draw icon
if (button->isEnabled()) {
if (button->hasFocus()) {
mode = QIconSet::Active;
} else {
mode = QIconSet::Normal;
}
} else {
mode = QIconSet::Disabled;
}
#if 0
if (button->isToggleButton() && button->isOn()) {
state = true;
} else {
state = false;
}
#endif
- pixmap = button->iconSet()->pixmap(QIconSet::Small, mode);
+ if ( mode == QIconSet::Disabled )
+ pixmap = button->iconSet()->pixmap( QIconSet::Automatic, mode );
+ else
+ pixmap = button->iconSet()->pixmap();
if (button->text().isEmpty() && !button->pixmap()) {
painter->drawPixmap(x+w/2 - pixmap.width()/2,
y+h/2 - pixmap.height()/2, pixmap);
} else {
painter->drawPixmap(x+4, y+h/2 - pixmap.height()/2, pixmap);
}
x += pixmap.width() + 4;
w -= pixmap.width() + 4;
}
if (active || button->isDefault()) { // default button
for(int n=0; n<2; n++) {
drawItem(painter, x+n, y, w, h,
AlignCenter | ShowPrefix,
button->colorGroup(),
button->isEnabled(),
button->pixmap(),
button->text(), -1,
(button->isEnabled()) ?
&button->colorGroup().buttonText() :
&button->colorGroup().mid());
}
} else { // normal button
drawItem(painter, x, y, w, h,
@@ -548,50 +551,49 @@ void PhaseStyle::drawExclusiveIndicatorMask(QPainter *painter, int x, int y, int
int PhaseStyle::defaultFrameWidth()const {
return 1;
}
int PhaseStyle::popupMenuItemHeight ( bool ,
QMenuItem * mi,
const QFontMetrics & fm ) {
int h = 0;
if (mi->custom() ) {
h = mi->custom()->sizeHint().height();
if (!mi->custom()->fullSpan() )
h += ITEMVMARGIN*2 + ITEMFRAME*2;
}else if (mi->isSeparator() ) {
h = 1;
}else {
if ( mi->pixmap() ) {
h = QMAX(h, mi->pixmap()->height() + ITEMFRAME*2);
}else {
h = QMAX(h, MINICONSIZE+ITEMFRAME*2 );
h = QMAX(h, fm.height()
+ ITEMVMARGIN*2 + ITEMFRAME*2 );
}
if ( mi->iconSet() )
- h = QMAX(h, mi->iconSet()->
- pixmap(QIconSet::Small, QIconSet::Normal ).height()
+ h = QMAX(h, mi->iconSet()->pixmap().height()
+ ITEMFRAME*2 );
}
return h;
}
int PhaseStyle::extraPopupMenuItemWidth(bool checkable, int maxpmw,
QMenuItem* mi, const QFontMetrics& ) {
int w = 0;
if (mi->isSeparator() )
return 3;
else if ( mi->pixmap() )
w = mi->pixmap()->width();
if (!mi->text().isNull() &&
mi->text().find('\t' ) >= 0 )
w += 12;
else if ( mi->popup() )
w += 2*ARROWMARGIN;
if ( maxpmw )
w += maxpmw +4;
@@ -640,49 +642,53 @@ void PhaseStyle::drawPopupMenuItem ( QPainter * p, bool checkable,
p->fillRect(x, y, w, h, g.background() );
// draw seperator
if (mi->isSeparator() ) {
p->setPen( g.dark() );
p->drawLine( x+8, y+1, x+w-8, y+1 );
p->setPen( g.mid() );
p->drawLine( x+8, y, x+w-8, y );
p->drawPoint(x+w,y+1);
p->setPen( g.midlight() );
p->drawLine( x+8, y-1, x+w-8, y-1 );
p->drawPoint(x+8, y );
return;
}
// draw icon
QIconSet::Mode mode;
if ( mi->iconSet() && !mi->isChecked() ) {
if ( act )
mode = enabled ? QIconSet::Active : QIconSet::Disabled;
else
mode = enabled ? QIconSet::Normal : QIconSet::Disabled;
- QPixmap pixmap = mi->iconSet()->pixmap(QIconSet::Small, mode );
+ QPixmap pixmap;
+ if ( mode == QIconSet::Disabled )
+ pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, mode );
+ else
+ pixmap = mi->iconSet()->pixmap();
QRect pmrect(0, 0, pixmap.width(), pixmap.height() );
QRect cr(x, y, maxpmw, h );
pmrect.moveCenter( cr.center() );
p->drawPixmap(pmrect.topLeft(), pixmap);
}
// draw check
if(mi->isChecked() ) {
drawCheckMark(p, x, y, maxpmw, h, itemg, act, !enabled );
}
// draw text
int xm = maxpmw + 2;
int xp = x + xm;
int tw = w -xm - 2;
p->setPen( enabled ? ( act ? g.highlightedText() : g.buttonText() ) :
g.mid() );
if ( mi->custom() ) {
p->save();
mi->custom()->paint(p, g, act, enabled,