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 @@ #include <qscrollbar.h> #include <qlayout.h> #include <qwhatsthis.h> #include <qpixmapcache.h> #include <qtimer.h> #include <qobjectlist.h> +#include <qcommonstyle.h> #include "sample.h" class SampleText : public QWidget { @@ -64,31 +65,37 @@ void SampleWindow::setFont( const QFont &f ) popup->setFont( f ); QTimer::singleShot ( 0, this, SLOT( fixGeometry ( ))); } static void setStyleRecursive ( QWidget *w, QStyle *s ) { + w->setStyle( s ); QObjectList *childObjects=(QObjectList*)w->children(); if ( childObjects ) { QObject * o; for(o=childObjects->first();o!=0;o=childObjects->next()) { if( o->isWidgetType() ) { setStyleRecursive((QWidget *)o,s); } } } - w->setStyle( s ); } void SampleWindow::setStyle2 ( QStyle *sty ) { + typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, QColorGroup &, bool, bool); + + extern QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl); + QPixmapCache::clear ( ); QPalette p = palette ( ); sty-> polish ( p ); + qt_set_draw_menu_bar_impl ( 0 ); setStyleRecursive ( this, sty ); + setPalette ( p ); QTimer::singleShot ( 0, this, SLOT( fixGeometry ( ))); } void SampleWindow::setDecoration( WindowDecorationInterface *i ) { @@ -203,18 +210,18 @@ void SampleWindow::paletteChange( const QPalette &old ) { QWidget::paletteChange ( old ); wd. palette = palette ( ); popup-> setPalette ( palette ( )); } + void SampleWindow::setPalette ( const QPalette &pal ) { QPixmapCache::clear ( ); QPalette p = pal; style ( ). polish ( p ); - QWidget::setPalette ( p ); } void SampleWindow::resizeEvent( QResizeEvent *re ) { wd.rect = QRect( 0, 0, 150, 75 ); |