summaryrefslogtreecommitdiff
path: root/noncore/settings/appearance2/sample.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/appearance2/sample.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/appearance2/sample.cpp11
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
@@ -1,24 +1,25 @@
#include <qvbox.h>
#include <qpopupmenu.h>
#include <qpainter.h>
#include <qmenubar.h>
#include <qcheckbox.h>
#include <qpushbutton.h>
#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
{
public:
SampleText( const QString &t, bool h, QWidget *parent )
: QWidget( parent ), hl(h), text(t)
{
if ( hl )
setBackgroundMode( PaletteHighlight );
@@ -58,43 +59,49 @@ QSize SampleWindow::sizeHint() const
return container->sizeHint() + QSize( 10, 35 );
}
void SampleWindow::setFont( const QFont &f )
{
QWidget::setFont( 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 )
{
iface = i;
wd.rect = QRect( 0, 0, 150, 75 );
wd.caption = tr("Sample");
wd.palette = palette();
wd.flags = WindowDecorationInterface::WindowData::Dialog |
WindowDecorationInterface::WindowData::Active;
@@ -197,30 +204,30 @@ bool SampleWindow::eventFilter( QObject *, QEvent *e )
}
return FALSE;
}
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 );
wd.rect.setX( 0 );
wd.rect.setWidth( width() - lb - rb );
wd.rect.setY( 0 );
wd.rect.setHeight( height() - th - tb - bb );