author | sandman <sandman> | 2002-12-17 19:23:17 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-12-17 19:23:17 (UTC) |
commit | 7459ea6f560b01290086a0919fc5808291973b33 (patch) (unidiff) | |
tree | fb74789d6229c61a0f629939a7402a31f734f7f7 | |
parent | f36c70938c8c2907a1b61637af3bd589262b4b5e (diff) | |
download | opie-7459ea6f560b01290086a0919fc5808291973b33.zip opie-7459ea6f560b01290086a0919fc5808291973b33.tar.gz opie-7459ea6f560b01290086a0919fc5808291973b33.tar.bz2 |
- small fix to reset the palette when changing styles
-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 25 | ||||
-rw-r--r-- | noncore/settings/appearance2/sample.cpp | 4 | ||||
-rw-r--r-- | noncore/settings/appearance2/sample.h | 2 |
3 files changed, 18 insertions, 13 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index 2f3ba74..e9e0ad9 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp | |||
@@ -419,14 +419,16 @@ Appearance::Appearance( QWidget* parent, const char* name, WFlags ) | |||
419 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); | 419 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); |
420 | 420 | ||
421 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 421 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
422 | QWidget *styletab; | 422 | QWidget *styletab; |
423 | 423 | ||
424 | tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance/style.png", tr( "Style" )); | 424 | m_color_list = 0; |
425 | tw-> addTab ( createFontTab ( tw, config ), "appearance/font.png", tr( "Font" )); | 425 | |
426 | tw-> addTab ( createColorTab ( tw, config ), "appearance/color.png", tr( "Colors" ) ); | 426 | tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance/style", tr( "Style" )); |
427 | tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco.png", tr( "Windows" ) ); | 427 | tw-> addTab ( createFontTab ( tw, config ), "appearance/font", tr( "Font" )); |
428 | tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "appearance/advanced.png", tr( "Advanced" ) ); | 428 | tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); |
429 | tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); | ||
430 | tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "appearance/advanced", tr( "Advanced" ) ); | ||
429 | 431 | ||
430 | top-> addWidget ( tw, 10 ); | 432 | top-> addWidget ( tw, 10 ); |
431 | top-> addWidget ( m_sample, 1 ); | 433 | top-> addWidget ( m_sample, 1 ); |
432 | 434 | ||
@@ -527,12 +529,15 @@ void Appearance::done ( int r ) | |||
527 | void Appearance::styleClicked ( int index ) | 529 | void Appearance::styleClicked ( int index ) |
528 | { | 530 | { |
529 | StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); | 531 | StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); |
530 | m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); | 532 | m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); |
531 | 533 | ||
532 | if ( m_sample && sli && sli-> style ( )) | 534 | if ( m_sample && sli && sli-> style ( )) { |
533 | m_sample-> setStyle2 ( sli-> style ( )); | 535 | int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; |
534 | 536 | ||
537 | m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); | ||
538 | } | ||
539 | |||
535 | m_style_changed |= ( index != m_original_style ); | 540 | m_style_changed |= ( index != m_original_style ); |
536 | } | 541 | } |
537 | 542 | ||
538 | void Appearance::styleSettingsClicked ( ) | 543 | void Appearance::styleSettingsClicked ( ) |
diff --git a/noncore/settings/appearance2/sample.cpp b/noncore/settings/appearance2/sample.cpp index 6bbed4b..b3a9d48 100644 --- a/noncore/settings/appearance2/sample.cpp +++ b/noncore/settings/appearance2/sample.cpp | |||
@@ -108,16 +108,16 @@ static void setStyleRecursive ( QWidget *w, QStyle *s ) | |||
108 | } | 108 | } |
109 | } | 109 | } |
110 | 110 | ||
111 | 111 | ||
112 | void SampleWindow::setStyle2 ( QStyle *sty ) | 112 | void SampleWindow::setStyle2 ( QStyle *sty, const QPalette &pal ) |
113 | { | 113 | { |
114 | typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, QColorGroup &, bool, bool); | 114 | typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, QColorGroup &, bool, bool); |
115 | 115 | ||
116 | extern QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl); | 116 | extern QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl); |
117 | 117 | ||
118 | QPixmapCache::clear ( ); | 118 | QPixmapCache::clear ( ); |
119 | QPalette p = palette ( ); | 119 | QPalette p = pal; // ette ( ); |
120 | sty-> polish ( p ); | 120 | sty-> polish ( p ); |
121 | qt_set_draw_menu_bar_impl ( 0 ); | 121 | qt_set_draw_menu_bar_impl ( 0 ); |
122 | setStyleRecursive ( this, sty ); | 122 | setStyleRecursive ( this, sty ); |
123 | setPalette ( p ); | 123 | setPalette ( p ); |
diff --git a/noncore/settings/appearance2/sample.h b/noncore/settings/appearance2/sample.h index c861228..27e6db5 100644 --- a/noncore/settings/appearance2/sample.h +++ b/noncore/settings/appearance2/sample.h | |||
@@ -46,9 +46,9 @@ public: | |||
46 | QSize sizeHint() const; | 46 | QSize sizeHint() const; |
47 | 47 | ||
48 | virtual void setFont( const QFont &f ); | 48 | virtual void setFont( const QFont &f ); |
49 | 49 | ||
50 | void setStyle2 ( QStyle *sty ); | 50 | void setStyle2 ( QStyle *sty, const QPalette &p ); |
51 | void setDecoration( WindowDecorationInterface *i ); | 51 | void setDecoration( WindowDecorationInterface *i ); |
52 | void setPalette ( const QPalette & ); | 52 | void setPalette ( const QPalette & ); |
53 | 53 | ||
54 | virtual void paintEvent( QPaintEvent * ); | 54 | virtual void paintEvent( QPaintEvent * ); |