author | sandman <sandman> | 2002-07-15 00:52:50 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-07-15 00:52:50 (UTC) |
commit | ecf2a873be3274bb30be0c659b7db6ef8a43be84 (patch) (side-by-side diff) | |
tree | 5c80fb0863966fffd245f6ed44c6bf524c11842b /noncore/styles/liquid/liquid.cpp | |
parent | 4feeec8b5b41cfd3d13274411f515524f687da09 (diff) | |
download | opie-ecf2a873be3274bb30be0c659b7db6ef8a43be84.zip opie-ecf2a873be3274bb30be0c659b7db6ef8a43be84.tar.gz opie-ecf2a873be3274bb30be0c659b7db6ef8a43be84.tar.bz2 |
Added an option to make toolbar buttons flat
Diffstat (limited to 'noncore/styles/liquid/liquid.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index 87b5488..22bf8af 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp @@ -169,6 +169,8 @@ LiquidStyle::LiquidStyle() { setName ( "LiquidStyle" ); + flatTBButtons = false; + btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); btnMaskBmp.setMask(btnMaskBmp); htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); @@ -831,6 +833,13 @@ void LiquidStyle::polish(QWidget *w) if(w->inherits("QMenuBar")){ //((QFrame*)w)->setLineWidth(0); w->setBackgroundMode(QWidget::PaletteBackground); + w->setBackgroundOrigin(QWidget::ParentOrigin); + return; + } + if(w->inherits("QToolBar")){ + w->installEventFilter(this); + w->setBackgroundMode(QWidget::PaletteBackground); + w->setBackgroundOrigin(QWidget::WidgetOrigin); return; } if(w->inherits("QPopupMenu")) @@ -893,8 +902,10 @@ void LiquidStyle::polish(QWidget *w) w->setMouseTracking(true); w->installEventFilter(this); } - if(w-> inherits("QToolButton")) { - ((QToolButton*)w)->setAutoRaise (false); + if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) { + ((QToolButton*)w)->setAutoRaise (flatTBButtons); + if ( flatTBButtons ) + w->setBackgroundOrigin(QWidget::ParentOrigin); } if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ return; @@ -912,11 +923,6 @@ void LiquidStyle::polish(QWidget *w) w->setBackgroundMode(QWidget::X11ParentRelative); } } - if(w->inherits("QToolBar")){ - w->installEventFilter(this); - w->setBackgroundMode(QWidget::PaletteBackground); - return; - } } @@ -1001,6 +1007,8 @@ void LiquidStyle::polish(QApplication *app) if ( config. readBoolEntry ( "WinDecoration", true )) QApplication::qwsSetDecoration ( new LiquidDecoration ( )); + + flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); } void LiquidStyle::unPolish(QApplication *app) @@ -1999,7 +2007,9 @@ void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, h += 2; } - p-> fillRect ( x, y, w, h, g.brush(QColorGroup::Background)); + QWidget *parent = (QWidget *)p->device(); + p->setBrushOrigin(parent->pos()); + parent->erase(x, y, w, h); if(menuHandler->useShadowText()){ QColor shadow; |