Diffstat (limited to 'noncore/settings/appearance2/sample.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/appearance2/sample.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/noncore/settings/appearance2/sample.cpp b/noncore/settings/appearance2/sample.cpp index ee27d60..e447002 100644 --- a/noncore/settings/appearance2/sample.cpp +++ b/noncore/settings/appearance2/sample.cpp | |||
@@ -7,12 +7,13 @@ | |||
7 | #include <qscrollbar.h> | 7 | #include <qscrollbar.h> |
8 | #include <qlayout.h> | 8 | #include <qlayout.h> |
9 | #include <qwhatsthis.h> | 9 | #include <qwhatsthis.h> |
10 | #include <qpixmapcache.h> | 10 | #include <qpixmapcache.h> |
11 | #include <qtimer.h> | 11 | #include <qtimer.h> |
12 | #include <qobjectlist.h> | 12 | #include <qobjectlist.h> |
13 | #include <qcommonstyle.h> | ||
13 | 14 | ||
14 | #include "sample.h" | 15 | #include "sample.h" |
15 | 16 | ||
16 | 17 | ||
17 | class SampleText : public QWidget | 18 | class SampleText : public QWidget |
18 | { | 19 | { |
@@ -64,31 +65,37 @@ void SampleWindow::setFont( const QFont &f ) | |||
64 | popup->setFont( f ); | 65 | popup->setFont( f ); |
65 | QTimer::singleShot ( 0, this, SLOT( fixGeometry ( ))); | 66 | QTimer::singleShot ( 0, this, SLOT( fixGeometry ( ))); |
66 | } | 67 | } |
67 | 68 | ||
68 | static void setStyleRecursive ( QWidget *w, QStyle *s ) | 69 | static void setStyleRecursive ( QWidget *w, QStyle *s ) |
69 | { | 70 | { |
71 | w->setStyle( s ); | ||
70 | QObjectList *childObjects=(QObjectList*)w->children(); | 72 | QObjectList *childObjects=(QObjectList*)w->children(); |
71 | if ( childObjects ) { | 73 | if ( childObjects ) { |
72 | QObject * o; | 74 | QObject * o; |
73 | for(o=childObjects->first();o!=0;o=childObjects->next()) { | 75 | for(o=childObjects->first();o!=0;o=childObjects->next()) { |
74 | if( o->isWidgetType() ) { | 76 | if( o->isWidgetType() ) { |
75 | setStyleRecursive((QWidget *)o,s); | 77 | setStyleRecursive((QWidget *)o,s); |
76 | } | 78 | } |
77 | } | 79 | } |
78 | } | 80 | } |
79 | w->setStyle( s ); | ||
80 | } | 81 | } |
81 | 82 | ||
82 | 83 | ||
83 | void SampleWindow::setStyle2 ( QStyle *sty ) | 84 | void SampleWindow::setStyle2 ( QStyle *sty ) |
84 | { | 85 | { |
86 | typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, QColorGroup &, bool, bool); | ||
87 | |||
88 | extern QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl); | ||
89 | |||
85 | QPixmapCache::clear ( ); | 90 | QPixmapCache::clear ( ); |
86 | QPalette p = palette ( ); | 91 | QPalette p = palette ( ); |
87 | sty-> polish ( p ); | 92 | sty-> polish ( p ); |
93 | qt_set_draw_menu_bar_impl ( 0 ); | ||
88 | setStyleRecursive ( this, sty ); | 94 | setStyleRecursive ( this, sty ); |
95 | setPalette ( p ); | ||
89 | QTimer::singleShot ( 0, this, SLOT( fixGeometry ( ))); | 96 | QTimer::singleShot ( 0, this, SLOT( fixGeometry ( ))); |
90 | } | 97 | } |
91 | 98 | ||
92 | 99 | ||
93 | void SampleWindow::setDecoration( WindowDecorationInterface *i ) | 100 | void SampleWindow::setDecoration( WindowDecorationInterface *i ) |
94 | { | 101 | { |
@@ -203,18 +210,18 @@ void SampleWindow::paletteChange( const QPalette &old ) | |||
203 | { | 210 | { |
204 | QWidget::paletteChange ( old ); | 211 | QWidget::paletteChange ( old ); |
205 | wd. palette = palette ( ); | 212 | wd. palette = palette ( ); |
206 | popup-> setPalette ( palette ( )); | 213 | popup-> setPalette ( palette ( )); |
207 | } | 214 | } |
208 | 215 | ||
216 | |||
209 | void SampleWindow::setPalette ( const QPalette &pal ) | 217 | void SampleWindow::setPalette ( const QPalette &pal ) |
210 | { | 218 | { |
211 | QPixmapCache::clear ( ); | 219 | QPixmapCache::clear ( ); |
212 | QPalette p = pal; | 220 | QPalette p = pal; |
213 | style ( ). polish ( p ); | 221 | style ( ). polish ( p ); |
214 | |||
215 | QWidget::setPalette ( p ); | 222 | QWidget::setPalette ( p ); |
216 | } | 223 | } |
217 | 224 | ||
218 | void SampleWindow::resizeEvent( QResizeEvent *re ) | 225 | void SampleWindow::resizeEvent( QResizeEvent *re ) |
219 | { | 226 | { |
220 | wd.rect = QRect( 0, 0, 150, 75 ); | 227 | wd.rect = QRect( 0, 0, 150, 75 ); |