author | sandman <sandman> | 2002-11-21 19:49:00 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-11-21 19:49:00 (UTC) |
commit | 440f1d4d439c83368a855355cdceda43660137f2 (patch) (unidiff) | |
tree | 1b7ffd5157d2c141b9f978d08e47699ea2d013ff /noncore/styles/liquid/liquid.cpp | |
parent | 0b0ebb03a1fc0a316b52ce147d87fa89d3b5af16 (diff) | |
download | opie-440f1d4d439c83368a855355cdceda43660137f2.zip opie-440f1d4d439c83368a855355cdceda43660137f2.tar.gz opie-440f1d4d439c83368a855355cdceda43660137f2.tar.bz2 |
- pixmaps in in menubars are now drawn (this is uncommon, but resulted in
blank icons in nethack for example)
- small size optimization
- updated the QPL diff
Diffstat (limited to 'noncore/styles/liquid/liquid.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index ba732aa..c8f8d20 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp | |||
@@ -1996,52 +1996,62 @@ void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, | |||
1996 | parent->erase(x, y, w, h); | 1996 | parent->erase(x, y, w, h); |
1997 | 1997 | ||
1998 | if(menuHandler->useShadowText()){ | 1998 | if(menuHandler->useShadowText()){ |
1999 | QColor shadow; | 1999 | QColor shadow; |
2000 | if(p->device() && p->device()->devType() == QInternal::Widget && | 2000 | if(p->device() && p->device()->devType() == QInternal::Widget && |
2001 | ((QWidget *)p->device())->inherits("QMenuBar")){ | 2001 | ((QWidget *)p->device())->inherits("QMenuBar")){ |
2002 | shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : | 2002 | shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : |
2003 | g.background().dark(130); | 2003 | g.background().dark(130); |
2004 | } | 2004 | } |
2005 | else | 2005 | else |
2006 | shadow = g.background().dark(130); | 2006 | shadow = g.background().dark(130); |
2007 | 2007 | ||
2008 | QPixmap *dummy = 0; | ||
2009 | |||
2010 | if ( mi-> pixmap ( ) && !mi-> pixmap ( )-> isNull ( )) { | ||
2011 | dummy = new QPixmap ( mi-> pixmap ( )-> size ( )); | ||
2012 | QBitmap dummy_mask ( dummy-> size ( )); | ||
2013 | dummy_mask. fill ( color1 ); | ||
2014 | dummy-> setMask ( dummy_mask ); | ||
2015 | } | ||
2016 | |||
2008 | if(active){ | 2017 | if(active){ |
2009 | drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); | 2018 | drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); |
2010 | QApplication::style().drawItem(p, x+1, y+1, w, h, | 2019 | QApplication::style().drawItem(p, x+1, y+1, w, h, |
2011 | AlignCenter|ShowPrefix|DontClip|SingleLine, | 2020 | AlignCenter|ShowPrefix|DontClip|SingleLine, |
2012 | g, mi->isEnabled(), NULL, mi->text(), | 2021 | g, mi->isEnabled(), dummy, mi->text(), |
2013 | -1, &shadow); | 2022 | -1, &shadow); |
2014 | QApplication::style().drawItem(p, x, y, w, h, | 2023 | QApplication::style().drawItem(p, x, y, w, h, |
2015 | AlignCenter|ShowPrefix|DontClip|SingleLine, | 2024 | AlignCenter|ShowPrefix|DontClip|SingleLine, |
2016 | g, mi->isEnabled(), NULL, mi->text(), | 2025 | g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), |
2017 | -1, &g.text()); | 2026 | -1, &g.text()); |
2018 | } | 2027 | } |
2019 | else{ | 2028 | else{ |
2020 | QApplication::style().drawItem(p, x+1, y+1, w, h, | 2029 | QApplication::style().drawItem(p, x+1, y+1, w, h, |
2021 | AlignCenter|ShowPrefix|DontClip|SingleLine, | 2030 | AlignCenter|ShowPrefix|DontClip|SingleLine, |
2022 | g, mi->isEnabled(), NULL, mi->text(), | 2031 | g, mi->isEnabled(), dummy, mi->text(), |
2023 | -1, &shadow); | 2032 | -1, &shadow); |
2024 | QApplication::style().drawItem(p, x, y, w, h, | 2033 | QApplication::style().drawItem(p, x, y, w, h, |
2025 | AlignCenter|ShowPrefix|DontClip|SingleLine, | 2034 | AlignCenter|ShowPrefix|DontClip|SingleLine, |
2026 | g, mi->isEnabled(), NULL, mi->text(), | 2035 | g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), |
2027 | -1, &g.text()); | 2036 | -1, &g.text()); |
2028 | } | 2037 | } |
2038 | delete dummy; | ||
2029 | } | 2039 | } |
2030 | else{ | 2040 | else{ |
2031 | if(active) | 2041 | if(active) |
2032 | drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); | 2042 | drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); |
2033 | QApplication::style().drawItem(p, x, y, w, h, | 2043 | QApplication::style().drawItem(p, x, y, w, h, |
2034 | AlignCenter|ShowPrefix|DontClip|SingleLine, | 2044 | AlignCenter|ShowPrefix|DontClip|SingleLine, |
2035 | g, mi->isEnabled(), NULL, mi->text(), | 2045 | g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), |
2036 | -1, &g.text()); | 2046 | -1, &g.text()); |
2037 | } | 2047 | } |
2038 | } | 2048 | } |
2039 | 2049 | ||
2040 | void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, | 2050 | void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, |
2041 | const QColorGroup &g, int /*lineWidth*/, | 2051 | const QColorGroup &g, int /*lineWidth*/, |
2042 | const QBrush * /*fill*/) | 2052 | const QBrush * /*fill*/) |
2043 | { | 2053 | { |
2044 | QColor c; | 2054 | QColor c; |
2045 | switch(menuHandler->transType()){ | 2055 | switch(menuHandler->transType()){ |
2046 | case None: | 2056 | case None: |
2047 | case StippledBg: | 2057 | case StippledBg: |