summaryrefslogtreecommitdiff
path: root/noncore/styles/theme/othemestyle.cpp
Unidiff
Diffstat (limited to 'noncore/styles/theme/othemestyle.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/theme/othemestyle.cpp53
1 files changed, 28 insertions, 25 deletions
diff --git a/noncore/styles/theme/othemestyle.cpp b/noncore/styles/theme/othemestyle.cpp
index 98e7253..106d206 100644
--- a/noncore/styles/theme/othemestyle.cpp
+++ b/noncore/styles/theme/othemestyle.cpp
@@ -38,11 +38,11 @@ QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl);
38 38
39/* !! HACK !! Beware 39/* !! HACK !! Beware
40 * 40 *
41 * TT forgot to make the QProgressBar widget styleable in Qt 2.x 41 * TT forgot to make the QProgressBar widget styleable in Qt 2.x
42 * So the only way to customize the drawing, is to intercept the 42 * So the only way to customize the drawing, is to intercept the
43 * paint event - since we have to use protected functions, we need 43 * paint event - since we have to use protected functions, we need
44 * to derive a "hack" class from QProgressBar and do the painting 44 * to derive a "hack" class from QProgressBar and do the painting
45 * in there. 45 * in there.
46 * 46 *
47 * - sandman 47 * - sandman
48 */ 48 */
@@ -51,5 +51,5 @@ class HackProgressBar : public QProgressBar {
51public: 51public:
52 HackProgressBar ( ); 52 HackProgressBar ( );
53 53
54 void paint ( QPaintEvent *event, OThemeStyle *style ) 54 void paint ( QPaintEvent *event, OThemeStyle *style )
55 { 55 {
@@ -76,7 +76,7 @@ public:
76 int perc = prog * 100 / total; 76 int perc = prog * 100 / total;
77 77
78 style-> drawProgressBar ( &p, x, y, w, h, colorGroup ( ), perc ); 78 style-> drawProgressBar ( &p, x, y, w, h, colorGroup ( ), perc );
79 79
80 if ( progress ( ) >= 0 && totalSteps ( ) > 0 ) { 80 if ( progress ( ) >= 0 && totalSteps ( ) > 0 ) {
81 QString pstr; 81 QString pstr;
82 pstr. sprintf ( "%d%%", 100 * progress()/totalSteps ()); 82 pstr. sprintf ( "%d%%", 100 * progress()/totalSteps ());
@@ -110,5 +110,5 @@ void OThemeStyle::polish( QPalette &p )
110{ 110{
111 oldPalette = p; 111 oldPalette = p;
112 112
113 QColor bg = oldPalette. color ( QPalette::Normal, QColorGroup::Background ); 113 QColor bg = oldPalette. color ( QPalette::Normal, QColorGroup::Background );
114 114
@@ -116,5 +116,5 @@ void OThemeStyle::polish( QPalette &p )
116 bg = bgcolor; 116 bg = bgcolor;
117 117
118 if ( isColor ( Background )) 118 if ( isColor ( Background ))
119 bg = colorGroup ( oldPalette. active ( ), Background )-> background ( ); 119 bg = colorGroup ( oldPalette. active ( ), Background )-> background ( );
120 120
@@ -125,16 +125,16 @@ void OThemeStyle::polish( QPalette &p )
125 125
126 if ( fgcolor. isValid ( )) { 126 if ( fgcolor. isValid ( )) {
127 p. setColor ( QColorGroup::Foreground, fgcolor ); 127 p. setColor ( QColorGroup::Foreground, fgcolor );
128 p. setColor ( QColorGroup::ButtonText, fgcolor ); 128 p. setColor ( QColorGroup::ButtonText, fgcolor );
129 } 129 }
130 if ( selfgcolor. isValid ( )) 130 if ( selfgcolor. isValid ( ))
131 p. setColor ( QColorGroup::HighlightedText, selfgcolor ); 131 p. setColor ( QColorGroup::HighlightedText, selfgcolor );
132 if ( selbgcolor. isValid ( )) 132 if ( selbgcolor. isValid ( ))
133 p. setColor ( QColorGroup::Highlight, selbgcolor ); 133 p. setColor ( QColorGroup::Highlight, selbgcolor );
134 if ( winfgcolor. isValid ( )) 134 if ( winfgcolor. isValid ( ))
135 p. setColor ( QColorGroup::Text, winfgcolor ); 135 p. setColor ( QColorGroup::Text, winfgcolor );
136 if ( winbgcolor. isValid ( )) 136 if ( winbgcolor. isValid ( ))
137 p. setColor ( QColorGroup::Base, winbgcolor ); 137 p. setColor ( QColorGroup::Base, winbgcolor );
138 138
139} 139}
140 140
@@ -1184,5 +1184,5 @@ void OThemeStyle::drawPushButtonLabel( QPushButton *btn, QPainter *p )
1184 if ( mode == QIconSet::Normal && btn->hasFocus() ) 1184 if ( mode == QIconSet::Normal && btn->hasFocus() )
1185 mode = QIconSet::Active; 1185 mode = QIconSet::Active;
1186 QPixmap pixmap = btn->iconSet() ->pixmap( QIconSet::Small, mode ); 1186 QPixmap pixmap = btn->iconSet() ->pixmap( QIconSet::Automatic, mode );
1187 int pixw = pixmap.width(); 1187 int pixw = pixmap.width();
1188 int pixh = pixmap.height(); 1188 int pixh = pixmap.height();
@@ -1247,6 +1247,5 @@ int OThemeStyle::popupMenuItemHeight( bool /*checkable*/, QMenuItem *mi,
1247 } 1247 }
1248 if ( mi->iconSet() ) { 1248 if ( mi->iconSet() ) {
1249 h2 = mi->iconSet() -> 1249 h2 = mi->iconSet() ->pixmap().height() + offset;
1250 pixmap( QIconSet::Small, QIconSet::Normal ).height() + offset;
1251 h = h2 > h ? h2 : h; 1250 h = h2 > h ? h2 : h;
1252 } 1251 }
@@ -1326,5 +1325,9 @@ void OThemeStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw,
1326 if ( act && !dis ) 1325 if ( act && !dis )
1327 mode = QIconSet::Active; 1326 mode = QIconSet::Active;
1328 QPixmap pixmap = mi->iconSet() ->pixmap( QIconSet::Small, mode ); 1327 QPixmap pixmap;
1328 if ( mode == QIconSet::Disabled )
1329 pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, mode );
1330 else
1331 pixmap = mi->iconSet()->pixmap();
1329 int pixw = pixmap.width(); 1332 int pixw = pixmap.width();
1330 int pixh = pixmap.height(); 1333 int pixh = pixmap.height();
@@ -1435,9 +1438,9 @@ void OThemeStyle::drawKMenuBar( QPainter *p, int x, int y, int w, int h,
1435 1438
1436void OThemeStyle::drawMenuBarItem( QPainter *p, int x, int y, int w, int h, 1439void OThemeStyle::drawMenuBarItem( QPainter *p, int x, int y, int w, int h,
1437 QMenuItem *mi, const QColorGroup &g, 1440 QMenuItem *mi, const QColorGroup &g,
1438 bool /*enabled*/, bool active ) 1441 bool /*enabled*/, bool active )
1439{ 1442{
1440 if(active){ 1443 if(active){
1441 x -= 2; // Bug in Qt/E 1444 x -= 2; // Bug in Qt/E
1442 y -= 2; 1445 y -= 2;
1443 w += 2; 1446 w += 2;
@@ -1465,9 +1468,9 @@ void OThemeStyle::drawProgressBar ( QPainter *p, int x, int y, int w, int h, con
1465 if ( isPixmap( ProgressBg ) ) 1468 if ( isPixmap( ProgressBg ) )
1466 bg.setPixmap( *uncached( ProgressBg ) ); 1469 bg.setPixmap( *uncached( ProgressBg ) );
1467 1470
1468 int pw = w * percent / 100; 1471 int pw = w * percent / 100;
1469 1472
1470 p-> fillRect ( x + pw, y, w - pw, h, bg ); // ### TODO 1473 p-> fillRect ( x + pw, y, w - pw, h, bg ); // ### TODO
1471 1474
1472 drawBaseButton( p, x, y, pw, h, *cg, false, false, ProgressBar ); 1475 drawBaseButton( p, x, y, pw, h, *cg, false, false, ProgressBar );
1473} 1476}