Diffstat (limited to 'noncore/styles/liquid/liquid.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index 51814e7..77cf198 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp | |||
@@ -1294,25 +1294,29 @@ void LiquidStyle::drawPushButtonLabel(QPushButton *btn, QPainter *p) | |||
1294 | bool act = btn->isOn() || btn->isDown(); | 1294 | bool act = btn->isOn() || btn->isDown(); |
1295 | if(act){ | 1295 | if(act){ |
1296 | ++x1, ++y1; | 1296 | ++x1, ++y1; |
1297 | } | 1297 | } |
1298 | 1298 | ||
1299 | // Draw iconset first, if any | 1299 | // Draw iconset first, if any |
1300 | if ( btn->iconSet() && !btn->iconSet()->isNull() ) | 1300 | if ( btn->iconSet() && !btn->iconSet()->isNull() ) |
1301 | { | 1301 | { |
1302 | QIconSet::Mode mode = btn->isEnabled() | 1302 | QIconSet::Mode mode = btn->isEnabled() |
1303 | ? QIconSet::Normal : QIconSet::Disabled; | 1303 | ? QIconSet::Normal : QIconSet::Disabled; |
1304 | if ( mode == QIconSet::Normal && btn->hasFocus() ) | 1304 | if ( mode == QIconSet::Normal && btn->hasFocus() ) |
1305 | mode = QIconSet::Active; | 1305 | mode = QIconSet::Active; |
1306 | QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Small, mode ); | 1306 | QPixmap pixmap; |
1307 | if ( mode == QIconSet::Disabled ) | ||
1308 | pixmap = btn->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
1309 | else | ||
1310 | pixmap = btn->iconSet()->pixmap(); | ||
1307 | int pixw = pixmap.width(); | 1311 | int pixw = pixmap.width(); |
1308 | int pixh = pixmap.height(); | 1312 | int pixh = pixmap.height(); |
1309 | 1313 | ||
1310 | p->drawPixmap( x1+6, y1+h/2-pixh/2, pixmap ); | 1314 | p->drawPixmap( x1+6, y1+h/2-pixh/2, pixmap ); |
1311 | x1 += pixw + 8; | 1315 | x1 += pixw + 8; |
1312 | w -= pixw + 8; | 1316 | w -= pixw + 8; |
1313 | } | 1317 | } |
1314 | 1318 | ||
1315 | if(act){ | 1319 | if(act){ |
1316 | QFont font = btn->font(); | 1320 | QFont font = btn->font(); |
1317 | font.setBold(true); | 1321 | font.setBold(true); |
1318 | p->setFont(font); | 1322 | p->setFont(font); |
@@ -2146,25 +2150,29 @@ static const int windowsRightBorder = 12; | |||
2146 | c = menuHandler->bgColor(); | 2150 | c = menuHandler->bgColor(); |
2147 | } | 2151 | } |
2148 | p->setPen(c.dark(140)); | 2152 | p->setPen(c.dark(140)); |
2149 | p->drawLine(x, y, x+w, y ); | 2153 | p->drawLine(x, y, x+w, y ); |
2150 | p->setPen(c.light(115)); | 2154 | p->setPen(c.light(115)); |
2151 | p->drawLine(x, y+1, x+w, y+1 ); | 2155 | p->drawLine(x, y+1, x+w, y+1 ); |
2152 | return; | 2156 | return; |
2153 | } | 2157 | } |
2154 | if(mi->iconSet()) { | 2158 | if(mi->iconSet()) { |
2155 | QIconSet::Mode mode = dis? QIconSet::Disabled : QIconSet::Normal; | 2159 | QIconSet::Mode mode = dis? QIconSet::Disabled : QIconSet::Normal; |
2156 | if (!dis) | 2160 | if (!dis) |
2157 | mode = QIconSet::Active; | 2161 | mode = QIconSet::Active; |
2158 | QPixmap pixmap = mi->iconSet()->pixmap(QIconSet::Small, mode); | 2162 | QPixmap pixmap; |
2163 | if ( mode == QIconSet::Disabled ) | ||
2164 | pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
2165 | else | ||
2166 | pixmap = mi->iconSet()->pixmap(); | ||
2159 | int pixw = pixmap.width(); | 2167 | int pixw = pixmap.width(); |
2160 | int pixh = pixmap.height(); | 2168 | int pixh = pixmap.height(); |
2161 | QRect cr(x, y, checkcol, h); | 2169 | QRect cr(x, y, checkcol, h); |
2162 | QRect pmr(0, 0, pixw, pixh); | 2170 | QRect pmr(0, 0, pixw, pixh); |
2163 | pmr.moveCenter( cr.center() ); | 2171 | pmr.moveCenter( cr.center() ); |
2164 | p->setPen(itemg.highlightedText()); | 2172 | p->setPen(itemg.highlightedText()); |
2165 | p->drawPixmap(pmr.topLeft(), pixmap ); | 2173 | p->drawPixmap(pmr.topLeft(), pixmap ); |
2166 | 2174 | ||
2167 | } | 2175 | } |
2168 | else if(checkable) { | 2176 | else if(checkable) { |
2169 | int mw = checkcol + motifItemFrame; | 2177 | int mw = checkcol + motifItemFrame; |
2170 | int mh = h - 2*motifItemFrame; | 2178 | int mh = h - 2*motifItemFrame; |
@@ -2227,26 +2235,25 @@ static const int windowsRightBorder = 12; | |||
2227 | 2235 | ||
2228 | int LiquidStyle::popupMenuItemHeight(bool /*checkable*/, QMenuItem *mi, | 2236 | int LiquidStyle::popupMenuItemHeight(bool /*checkable*/, QMenuItem *mi, |
2229 | const QFontMetrics &fm) | 2237 | const QFontMetrics &fm) |
2230 | { | 2238 | { |
2231 | if (mi->isSeparator()) | 2239 | if (mi->isSeparator()) |
2232 | return 2; | 2240 | return 2; |
2233 | 2241 | ||
2234 | int h = 0; | 2242 | int h = 0; |
2235 | if (mi->pixmap()) | 2243 | if (mi->pixmap()) |
2236 | h = mi->pixmap()->height(); | 2244 | h = mi->pixmap()->height(); |
2237 | 2245 | ||
2238 | if (mi->iconSet()) | 2246 | if (mi->iconSet()) |
2239 | h = QMAX(mi->iconSet()-> | 2247 | h = QMAX(mi->iconSet()->pixmap().height(), h); |
2240 | pixmap(QIconSet::Small, QIconSet::Normal).height(), h); | ||
2241 | 2248 | ||
2242 | h = QMAX(fm.height() + 4, h); | 2249 | h = QMAX(fm.height() + 4, h); |
2243 | 2250 | ||
2244 | // we want a minimum size of 18 | 2251 | // we want a minimum size of 18 |
2245 | h = QMAX(h, 18); | 2252 | h = QMAX(h, 18); |
2246 | 2253 | ||
2247 | return h; | 2254 | return h; |
2248 | } | 2255 | } |
2249 | 2256 | ||
2250 | 2257 | ||
2251 | void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, | 2258 | void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, |
2252 | const QColorGroup &g, const QColor *c, | 2259 | const QColorGroup &g, const QColor *c, |