-rw-r--r-- | library/lightstyle.cpp | 10 | ||||
-rw-r--r-- | library/lightstyle.h | 2 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 4 | ||||
-rw-r--r-- | library/qpestyle.cpp | 4 | ||||
-rw-r--r-- | library/qpestyle.h | 2 |
5 files changed, 11 insertions, 11 deletions
diff --git a/library/lightstyle.cpp b/library/lightstyle.cpp index f18bdca..3bd1623 100644 --- a/library/lightstyle.cpp +++ b/library/lightstyle.cpp @@ -1,690 +1,690 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "lightstyle.h" -#if QT_VERSION < 300 +#if QT_VERSION < 0x030000 #define INCLUDE_MENUITEM_DEF #include "qmenubar.h" #include "qapplication.h" #include "qpainter.h" #include "qpalette.h" #include "qframe.h" #include "qpushbutton.h" #include "qdrawutil.h" #include "qscrollbar.h" #include "qtabbar.h" #include "qguardedptr.h" #include "qlayout.h" #include "qlineedit.h" class LightStylePrivate { public: LightStylePrivate() : hoverWidget(0), ref(1), savePalette(0) { } QGuardedPtr<QWidget> hoverWidget; QPalette oldPalette, hoverPalette; int ref; QPoint mousePos; QPalette *savePalette; }; static LightStylePrivate *singleton = 0; LightStyle::LightStyle() : QWindowsStyle() { if (! singleton) { singleton = new LightStylePrivate; QPalette pal = QApplication::palette(); singleton->oldPalette = pal; QColor bg = pal.color(QPalette::Active, QColorGroup::Background); QColor prelight; if ( (bg.red() + bg.green() + bg.blue()) / 3 > 128) prelight = pal.color(QPalette::Active, QColorGroup::Background).light(110); else prelight = pal.color(QPalette::Active, QColorGroup::Background).light(120); QColorGroup active2(pal.color(QPalette::Active, QColorGroup::Foreground), // foreground prelight, // button prelight.light(), // light prelight.dark(), // dark prelight.dark(120), // mid pal.color(QPalette::Active, QColorGroup::Text), // text pal.color(QPalette::Active, QColorGroup::BrightText), // bright text pal.color(QPalette::Active, QColorGroup::Base), // base bg); // background active2.setColor(QColorGroup::Highlight, pal.color(QPalette::Active, QColorGroup::Highlight)); singleton->hoverPalette = pal; singleton->hoverPalette.setActive(active2); singleton->hoverPalette.setInactive(active2); } else singleton->ref++; } LightStyle::~LightStyle() { if (singleton && singleton->ref-- <= 0) { delete singleton; singleton = 0; } } QSize LightStyle::scrollBarExtent() const { return QSize(12 + defaultFrameWidth(), 12 + defaultFrameWidth()); } int LightStyle::buttonDefaultIndicatorWidth() const { return 2; } int LightStyle::sliderThickness() const { return 16; } int LightStyle::sliderLength() const { return 13; } int LightStyle::buttonMargin() const { return 4; } QSize LightStyle::exclusiveIndicatorSize() const { return QSize(13, 13); } int LightStyle::defaultFrameWidth() const { return 2; } QSize LightStyle::indicatorSize() const { return QSize(13, 13); } void LightStyle::polish(QWidget *widget) { if (widget->inherits("QPushButton")) widget->installEventFilter(this); -#if QT_VERSION >= 300 +#if QT_VERSION >= 0x030000 if (widget->inherits("QLineEdit")) { QLineEdit *lineedit = (QLineEdit *) widget; lineedit->setFrameShape(QFrame::StyledPanel); lineedit->setLineWidth(2); } #endif QWindowsStyle::polish(widget); } void LightStyle::unPolish(QWidget *widget) { if (widget->inherits("QPushButton")) widget->removeEventFilter(this); -#if QT_VERSION >= 300 +#if QT_VERSION >= 0x030000 if (widget->inherits("QLineEdit")) { QLineEdit *lineedit = (QLineEdit *) widget; lineedit->setLineWidth(1); lineedit->setFrameShape(QFrame::WinPanel); } #endif QWindowsStyle::unPolish(widget); } void LightStyle::polish(QApplication *app) { QPalette pal = app->palette(); QColorGroup active(pal.color(QPalette::Active, QColorGroup::Foreground), // foreground pal.color(QPalette::Active, QColorGroup::Button), // button pal.color(QPalette::Active, QColorGroup::Background).light(), // light pal.color(QPalette::Active, QColorGroup::Background).dark(175), // dark pal.color(QPalette::Active, QColorGroup::Background).dark(110), // mid pal.color(QPalette::Active, QColorGroup::Text), // text pal.color(QPalette::Active, QColorGroup::BrightText), // bright text pal.color(QPalette::Active, QColorGroup::Base), // base pal.color(QPalette::Active, QColorGroup::Background)), // background disabled(pal.color(QPalette::Disabled, QColorGroup::Foreground), // foreground pal.color(QPalette::Disabled, QColorGroup::Button), // button pal.color(QPalette::Disabled, QColorGroup::Background).light(), // light pal.color(QPalette::Disabled, QColorGroup::Background).dark(), // dark pal.color(QPalette::Disabled, QColorGroup::Background).dark(110), // mid pal.color(QPalette::Disabled, QColorGroup::Text), // text pal.color(QPalette::Disabled, QColorGroup::BrightText), // bright text pal.color(QPalette::Disabled, QColorGroup::Base), // base pal.color(QPalette::Disabled, QColorGroup::Background)); // background active.setColor(QColorGroup::Highlight, pal.color(QPalette::Active, QColorGroup::Highlight)); disabled.setColor(QColorGroup::Highlight, pal.color(QPalette::Disabled, QColorGroup::Highlight)); active.setColor(QColorGroup::HighlightedText, pal.color(QPalette::Active, QColorGroup::HighlightedText)); disabled.setColor(QColorGroup::HighlightedText, pal.color(QPalette::Disabled, QColorGroup::HighlightedText)); pal.setActive(active); pal.setInactive(active); pal.setDisabled(disabled); singleton->oldPalette = pal; QColor bg = pal.color(QPalette::Active, QColorGroup::Background); QColor prelight; if ( (bg.red() + bg.green() + bg.blue()) / 3 > 128) prelight = pal.color(QPalette::Active, QColorGroup::Background).light(110); else prelight = pal.color(QPalette::Active, QColorGroup::Background).light(120); QColorGroup active2(pal.color(QPalette::Active, QColorGroup::Foreground), // foreground prelight, // button prelight.light(), // light prelight.dark(), // dark prelight.dark(120), // mid pal.color(QPalette::Active, QColorGroup::Text), // text pal.color(QPalette::Active, QColorGroup::BrightText), // bright text pal.color(QPalette::Active, QColorGroup::Base), // base bg); // background active2.setColor(QColorGroup::Highlight, pal.color(QPalette::Active, QColorGroup::Highlight)); singleton->hoverPalette = pal; singleton->hoverPalette.setActive(active2); singleton->hoverPalette.setInactive(active2); app->setPalette(pal); } void LightStyle::unPolish(QApplication *app) { app->setPalette(singleton->oldPalette); } void LightStyle::polishPopupMenu(QPopupMenu *menu) { menu->setMouseTracking(TRUE); } void LightStyle::drawPushButton(QPushButton *button, QPainter *p) { int x1, y1, x2, y2; button->rect().coords(&x1, &y1, &x2, &y2); if (button->isDefault()) { p->save(); p->setPen(button->palette().active().color(QColorGroup::Highlight)); p->setBrush(button->palette().active().brush(QColorGroup::Highlight)); p->drawRoundRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1, 15, 15); p->restore(); } if (button->isDefault() || button->autoDefault()) { x1 += buttonDefaultIndicatorWidth(); y1 += buttonDefaultIndicatorWidth(); x2 -= buttonDefaultIndicatorWidth(); y2 -= buttonDefaultIndicatorWidth(); if (button->isDefault()) { QPointArray pa(8); pa.setPoint(0, x1 + 2, y1 ); pa.setPoint(1, x2 - 1, y1 ); pa.setPoint(2, x2 + 1, y1 + 2); pa.setPoint(3, x2 + 1, y2 - 2); pa.setPoint(4, x2 - 2, y2 + 1); pa.setPoint(5, x1 + 2, y2 + 1); pa.setPoint(6, x1, y2 - 1); pa.setPoint(7, x1, y1 + 2); QRegion r(pa); p->setClipRegion(r); } } QBrush fill; if (button->isDown() || button->isOn()) fill = button->colorGroup().brush(QColorGroup::Mid); else fill = button->colorGroup().brush(QColorGroup::Button); if ( !button->isFlat() || button->isOn() || button->isDown() ) drawButton(p, x1, y1, x2 - x1 + 1, y2 - y1 + 1, button->colorGroup(), button->isOn() || button->isDown(), &fill); } void LightStyle::drawButton(QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken, const QBrush *fill) { p->save(); if ( fill ) p->fillRect(x + 2, y + 2, w - 4, h - 4, *fill); else p->fillRect(x + 2, y + 2, w - 4, h - 4, QBrush(sunken ? g.mid() : g.button())); // frame p->setPen(g.dark()); p->drawLine(x, y + 2, x, y + h - 3); // left p->drawLine(x + 2, y, x + w - 3, y); // top p->drawLine(x + w - 1, y + 2, x + w - 1, y + h - 3); // right p->drawLine(x + 2, y + h - 1, x + w - 3, y + h - 1); // bottom p->drawPoint(x + 1, y + 1); p->drawPoint(x + 1, y + h - 2); p->drawPoint(x + w - 2, y + 1); p->drawPoint(x + w - 2, y + h - 2); // bevel if (sunken) p->setPen(g.mid()); else p->setPen(g.light()); p->drawLine(x + 1, y + 2, x + 1, y + h - 3); // left p->drawLine(x + 2, y + 1, x + w - 3, y + 1); // top if (sunken) p->setPen(g.light()); else p->setPen(g.mid()); p->drawLine(x + w - 2, y + 2, x + w - 2, y + h - 3); // right + 1 p->drawLine(x + 2, y + h - 2, x + w - 3, y + h - 2); // bottom + 1 p->restore(); } void LightStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken, const QBrush *fill) { drawButton(p, x, y, w, h, g, sunken, fill); } void LightStyle::getButtonShift(int &x, int &y) const { x = y = 0; } void LightStyle::drawComboButton(QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool, bool editable, bool, const QBrush *fill) { drawButton(p, x, y, w, h, g, FALSE, fill); if (editable) { QRect r = comboButtonRect(x, y, w, h); qDrawShadePanel(p, r.x() - 1, r.y() - 1, r.width() + defaultFrameWidth(), r.height() + defaultFrameWidth(), g, TRUE); } int indent = ((y + h) / 2) - 3; int xpos = x; -#if QT_VERSION >= 300 +#if QT_VERSION >= 0x030000 if( QApplication::reverseLayout() ) xpos += indent; else #endif xpos += w - indent - 5; drawArrow(p, Qt::DownArrow, TRUE, xpos, indent, 5, 5, g, TRUE, fill); } QRect LightStyle::comboButtonRect( int x, int y, int w, int h ) const { QRect r(x + 3, y + 3, w - 6, h - 6); int indent = ((y + h) / 2) - 3; r.setRight(r.right() - indent - 10); -#if QT_VERSION >= 300 +#if QT_VERSION >= 0x030000 if( QApplication::reverseLayout() ) r.moveBy( indent + 10, 0 ); #endif return r; } QRect LightStyle::comboButtonFocusRect(int x, int y, int w, int h ) const { return comboButtonRect(x, y, w, h); } void LightStyle::drawPanel(QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken, int lw, const QBrush *fill) { if (lw >= 2) { if ( fill ) p->fillRect(x + 2, y + 2, w - 4, h - 4, *fill); QPen oldpen = p->pen(); // frame p->setPen(g.dark()); p->drawLine(x, y + 2, x, y + h - 3); // left p->drawLine(x + 2, y, x + w - 3, y); // top p->drawLine(x + w - 1, y + 2, x + w - 1, y + h - 3); // right p->drawLine(x + 2, y + h - 1, x + w - 3, y + h - 1); // bottom p->drawPoint(x + 1, y + 1); p->drawPoint(x + 1, y + h - 2); p->drawPoint(x + w - 2, y + 1); p->drawPoint(x + w - 2, y + h - 2); // bevel if (sunken) p->setPen(g.mid()); else p->setPen(g.light()); p->drawLine(x + 1, y + 2, x + 1, y + h - 3); // left p->drawLine(x + 2, y + 1, x + w - 3, y + 1); // top if (sunken) p->setPen(g.light()); else p->setPen(g.mid()); p->drawLine(x + w - 2, y + 2, x + w - 2, y + h - 3); // right + 1 p->drawLine(x + 2, y + h - 2, x + w - 3, y + h - 2); // bottom + 1 // corners p->setPen(g.background()); p->drawLine(x, y, x + 1, y); p->drawLine(x, y + h - 1, x + 1, y + h - 1); p->drawLine(x + w - 2, y, x + w - 1, y); p->drawLine(x + w - 2, y + h - 1, x + w - 1, y + h - 1); p->drawPoint(x, y + 1); p->drawPoint(x, y + h - 2); p->drawPoint(x + w - 1, y + 1); p->drawPoint(x + w - 1, y + h - 2); p->setPen(oldpen); } else qDrawShadePanel(p, x, y, w, h, g, sunken, lw, fill); } void LightStyle::drawIndicator(QPainter *p, int x, int y ,int w, int h, const QColorGroup &g, int state, bool down, bool) { drawButton(p, x, y, w, h, g, TRUE, &g.brush(down ? QColorGroup::Mid : QColorGroup::Base)); p->save(); p->setPen(g.foreground()); if (state == QButton::NoChange) { p->drawLine(x + 3, y + h / 2, x + w - 4, y + h / 2); p->drawLine(x + 3, y + 1 + h / 2, x + w - 4, y + 1 + h / 2); p->drawLine(x + 3, y - 1 + h / 2, x + w - 4, y - 1 + h / 2); } else if (state == QButton::On) { p->drawLine(x + 4, y + 3, x + w - 4, y + h - 5); p->drawLine(x + 3, y + 3, x + w - 4, y + h - 4); p->drawLine(x + 3, y + 4, x + w - 5, y + h - 4); p->drawLine(x + 3, y + h - 5, x + w - 5, y + 3); p->drawLine(x + 3, y + h - 4, x + w - 4, y + 3); p->drawLine(x + 4, y + h - 4, x + w - 4, y + 4); } p->restore(); } void LightStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool on, bool down, bool) { p->save(); p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); p->setPen(g.dark()); p->drawArc(x, y, w, h, 0, 16*360); p->setPen(g.mid()); p->drawArc(x + 1, y + 1, w - 2, h - 2, 45*16, 180*16); p->setPen(g.light()); p->drawArc(x + 1, y + 1, w - 2, h - 2, 235*16, 180*16); p->setPen(down ? g.mid() : g.base()); p->setBrush(down ? g.mid() : g.base()); p->drawEllipse(x + 2, y + 2, w - 4, h - 4); if (on) { p->setBrush(g.foreground()); p->drawEllipse(x + 3, y + 3, w - x - 6, h - y - 6); } p->restore(); } #if 1 //copied from QPE style void LightStyle::drawTab( QPainter *p, const QTabBar *tb, QTab *t, bool selected ) { #if 0 //We can't do this, because QTabBar::focusInEvent redraws the // tab label with the default font. QFont f = tb->font(); f.setBold( selected ); p->setFont( f ); #endif QRect r( t->rect() ); if ( tb->shape() == QTabBar::RoundedAbove ) { p->setPen( tb->colorGroup().light() ); p->drawLine( r.left(), r.bottom(), r.right(), r.bottom() ); if ( r.left() == 0 ) p->drawPoint( tb->rect().bottomLeft() ); else { p->setPen( tb->colorGroup().light() ); p->drawLine( r.left(), r.bottom(), r.right(), r.bottom() ); } if ( selected ) { p->setPen( tb->colorGroup().background() ); p->drawLine( r.left()+2, r.top()+1, r.right()-2, r.top()+1 ); p->fillRect( QRect( r.left()+1, r.top()+2, r.width()-2, r.height()-2), tb->colorGroup().brush( QColorGroup::Background )); } else { r.setRect( r.left() + 2, r.top() + 2, r.width() - 4, r.height() - 2 ); p->setPen( tb->colorGroup().button() ); p->drawLine( r.left()+2, r.top()+1, r.right()-2, r.top()+1 ); p->fillRect( QRect( r.left()+1, r.top()+2, r.width()-2, r.height()-3), tb->colorGroup().brush( QColorGroup::Button )); //do shading; will not work for pixmap brushes QColor bg = tb->colorGroup().button(); // int h,s,v; // bg.hsv( &h, &s, &v ); int n = r.height()/2; int dark = 100; for ( int i = 1; i < n; i++ ) { dark = (dark * (100+(i*15)/n) )/100; p->setPen( bg.dark( dark ) ); int y = r.bottom()-n+i; int x1 = r.left()+1; int x2 = r.right()-1; p->drawLine( x1, y, x2, y ); } } p->setPen( tb->colorGroup().light() ); p->drawLine( r.left(), r.bottom()-1, r.left(), r.top() + 2 ); p->drawPoint( r.left()+1, r.top() + 1 ); p->drawLine( r.left()+2, r.top(), r.right() - 2, r.top() ); p->setPen( tb->colorGroup().dark() ); p->drawPoint( r.right() - 1, r.top() + 1 ); p->drawLine( r.right(), r.top() + 2, r.right(), r.bottom() - 1); } else if ( tb->shape() == QTabBar::RoundedBelow ) { if ( selected ) { p->setPen( tb->colorGroup().background() ); p->drawLine( r.left()+2, r.bottom()-1, r.right()-2, r.bottom()-1 ); p->fillRect( QRect( r.left()+1, r.top(), r.width()-2, r.height()-2), tb->palette().normal().brush( QColorGroup::Background )); } else { p->setPen( tb->colorGroup().dark() ); p->drawLine( r.left(), r.top(), r.right(), r.top() ); r.setRect( r.left() + 2, r.top(), r.width() - 4, r.height() - 2 ); p->setPen( tb->colorGroup().button() ); p->drawLine( r.left()+2, r.bottom()-1, r.right()-2, r.bottom()-1 ); p->fillRect( QRect( r.left()+1, r.top()+1, r.width()-2, r.height()-3), tb->palette().normal().brush( QColorGroup::Button )); } p->setPen( tb->colorGroup().dark() ); p->drawLine( r.right(), r.top(), r.right(), r.bottom() - 2 ); p->drawPoint( r.right() - 1, r.bottom() - 1 ); p->drawLine( r.right() - 2, r.bottom(), r.left() + 2, r.bottom() ); p->setPen( tb->colorGroup().light() ); p->drawLine( r.left(), r.top()+1, r.left(), r.bottom() - 2 ); p->drawPoint( r.left() + 1, r.bottom() - 1 ); if ( r.left() == 0 ) p->drawPoint( tb->rect().topLeft() ); } else { QCommonStyle::drawTab( p, tb, t, selected ); } } #else void LightStyle::drawTab(QPainter *p, const QTabBar *tabbar, QTab *tab, bool selected) { p->save(); QColorGroup g = tabbar->colorGroup(); QRect fr(tab->r); fr.setLeft(fr.left() + 2); if (! selected) { if (tabbar->shape() == QTabBar::RoundedAbove || tabbar->shape() == QTabBar::TriangularAbove) { fr.setTop(fr.top() + 2); } else { fr.setBottom(fr.bottom() - 2); } } QRegion tabr(tab->r); QPointArray cliptri(4); cliptri.setPoint(0, fr.left(), fr.top()); cliptri.setPoint(1, fr.left(), fr.top() + 5); cliptri.setPoint(2, fr.left() + 5, fr.top()); cliptri.setPoint(3, fr.left(), fr.top()); QRegion trir(cliptri); p->setClipRegion(tabr - trir); p->setPen( NoPen ); p->setBrush(g.brush(selected ? QColorGroup::Background : QColorGroup::Mid)); diff --git a/library/lightstyle.h b/library/lightstyle.h index c377cc2..0392957 100644 --- a/library/lightstyle.h +++ b/library/lightstyle.h @@ -1,120 +1,120 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef LIGHTSTYLE_H #define LIGHTSTYLE_H #ifndef QT_H #include <qstyle.h> #include <qwindowsstyle.h> #endif // QT_H -#if QT_VERSION < 300 +#if QT_VERSION < 0x030000 #ifdef QT_PLUGIN_STYLE_LIGHT # define Q_EXPORT_STYLE_LIGHT #else # define Q_EXPORT_STYLE_LIGHT Q_EXPORT #endif // QT_PLUGIN_STYLE_LIGHT class Q_EXPORT_STYLE_LIGHT LightStyle : public QWindowsStyle { public: LightStyle(); virtual ~LightStyle(); void polish(QWidget *widget); void unPolish(QWidget*widget); void polish(QApplication *app); void unPolish(QApplication *app); void polishPopupMenu(QPopupMenu *menu); void drawPushButton(QPushButton *button, QPainter *p); void drawButton(QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken = FALSE, const QBrush *fill = 0); void drawBevelButton(QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken = FALSE, const QBrush *fill = 0); void getButtonShift(int &x, int &y) const; void drawComboButton(QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken = FALSE, bool editable = FALSE, bool = TRUE, const QBrush *fill = 0); QRect comboButtonRect(int x, int y, int w, int h) const; QRect comboButtonFocusRect(int x, int y, int w, int h) const; void drawIndicator(QPainter *p, int x, int y ,int w, int h, const QColorGroup &g, int state, bool = FALSE, bool = TRUE); QSize indicatorSize() const; void drawExclusiveIndicator(QPainter *p, int x, int y ,int w, int h, const QColorGroup &g, bool on, bool = FALSE, bool = TRUE); QSize exclusiveIndicatorSize() const; void drawPanel(QPainter * p, int x, int y, int w, int h, const QColorGroup &g, bool sunken = FALSE, int = 1, const QBrush * = 0); void scrollBarMetrics( const QScrollBar *, int &, int &, int &, int & ) const; void drawScrollBarControls(QPainter* p, const QScrollBar* sb, int sliderStart, uint controls, uint activeControl); QStyle::ScrollControl scrollBarPointOver(const QScrollBar *, int, const QPoint& p); void drawTab(QPainter *p, const QTabBar *tabbar, QTab *tab, bool selected); void drawSlider(QPainter *p, int x, int y, int w, int h, const QColorGroup &g, Qt::Orientation orientation, bool, bool); void drawSliderGroove(QPainter *p, int x, int y, int w, int h, const QColorGroup& g, QCOORD, Qt::Orientation ); void drawToolBarHandle(QPainter *, const QRect &, Qt::Orientation, bool, const QColorGroup &, bool = FALSE ); QSize scrollBarExtent() const; int buttonDefaultIndicatorWidth() const; int buttonMargin() const; int sliderThickness() const; int sliderLength() const; int defaultFrameWidth() const; int extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem*, const QFontMetrics& ); int popupMenuItemHeight( bool checkable, QMenuItem*, const QFontMetrics& ); void drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi, const QPalette& pal, bool act, bool enabled, int x, int y, int w, int h); protected: bool eventFilter(QObject *, QEvent *); }; #endif #endif // LIGHTSTYLE_H diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index af00f49..1c5ced3 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -1,319 +1,319 @@ /********************************************************************** ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** ** This file is part of the Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** */ #define QTOPIA_INTERNAL_LANGLIST #include <stdlib.h> #include <unistd.h> #ifndef Q_OS_MACX #include <linux/limits.h> // needed for some toolchains (PATH_MAX) #endif #include <qfile.h> #include <qqueue.h> #ifdef Q_WS_QWS #ifndef QT_NO_COP #if QT_VERSION <= 231 #define private public #define sendLocally processEvent #include "qcopenvelope_qws.h" #undef private #else #include "qcopenvelope_qws.h" #endif #endif #include <qwindowsystem_qws.h> #endif #include <qtextstream.h> #include <qpalette.h> #include <qbuffer.h> #include <qptrdict.h> #include <qregexp.h> #include <qdir.h> #include <qlabel.h> #include <qdialog.h> #include <qdragobject.h> #include <qtextcodec.h> #include <qevent.h> #include <qtooltip.h> #include <qsignal.h> #include <qmainwindow.h> #include <qwidgetlist.h> #include <qpixmapcache.h> #if defined(Q_WS_QWS) && !defined(QT_NO_COP) #define QTOPIA_INTERNAL_INITAPP #include "qpeapplication.h" #include "qpestyle.h" #include "styleinterface.h" -#if QT_VERSION >= 300 +#if QT_VERSION >= 0x030000 #include <qstylefactory.h> #else #include <qplatinumstyle.h> #include <qwindowsstyle.h> #include <qmotifstyle.h> #include <qmotifplusstyle.h> #include "lightstyle.h" #include <qpe/qlibrary.h> #endif #include "global.h" #include "resource.h" #if QT_VERSION <= 230 && defined(QT_NO_CODECS) #include "qutfcodec.h" #endif #include "config.h" #include "network.h" #ifdef QWS #include "fontmanager.h" #include "fontdatabase.h" #endif #include "alarmserver.h" #include "applnk.h" #include "qpemenubar.h" #include "textcodecinterface.h" #include "imagecodecinterface.h" #include <qtopia/qpeglobal.h> #include <unistd.h> #include <sys/file.h> #include <sys/ioctl.h> #ifndef QT_NO_SOUND #include <sys/soundcard.h> #endif #include "qt_override_p.h" #include <backend/rohfeedback.h> static bool useBigPixmaps = 0; class HackWidget : public QWidget { public: bool needsOk() { return (getWState() & WState_Reserved1 ); } QRect normalGeometry() { return topData()->normalGeometry; }; }; class QPEApplicationData { public: QPEApplicationData ( ) : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), keep_running( true ), qcopQok( false ), fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ), bigIconSize( 32 ), qpe_main_widget( 0 ) { Config cfg( "qpe" ); cfg.setGroup( "Appearance" ); useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false ); fontFamily = cfg.readEntry( "FontFamily", "Vera" ); fontSize = cfg.readNumEntry( "FontSize", 10 ); smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 ); bigIconSize = cfg.readNumEntry( "BigIconSize", 32 ); #ifdef OPIE_WITHROHFEEDBACK RoH = 0; #endif } int presstimer; QWidget* presswidget; QPoint presspos; #ifdef OPIE_WITHROHFEEDBACK Opie::Internal::RoHFeedback *RoH; #endif bool rightpressed : 1; bool kbgrabbed : 1; bool notbusysent : 1; bool preloaded : 1; bool forceshow : 1; bool nomaximize : 1; bool keep_running : 1; bool qcopQok : 1; QCString fontFamily; int fontSize; int smallIconSize; int bigIconSize; QString appName; struct QCopRec { QCopRec( const QCString &ch, const QCString &msg, const QByteArray &d ) : channel( ch ), message( msg ), data( d ) { } QCString channel; QCString message; QByteArray data; }; QWidget* qpe_main_widget; QGuardedPtr<QWidget> lastraised; QQueue<QCopRec> qcopq; QString styleName; QString decorationName; void enqueueQCop( const QCString &ch, const QCString &msg, const QByteArray &data ) { qcopq.enqueue( new QCopRec( ch, msg, data ) ); } void sendQCopQ() { if (!qcopQok ) return; QCopRec * r; while((r=qcopq.dequeue())) { // remove from queue before sending... // event loop can come around again before getting // back from sendLocally #ifndef QT_NO_COP QCopChannel::sendLocally( r->channel, r->message, r->data ); #endif delete r; } } static void show_mx(QWidget* mw, bool nomaximize, QString &strName) { if ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) { ( ( QMainWindow* ) mw )->setUsesBigPixmaps( useBigPixmaps ); } QPoint p; QSize s; bool max; if ( mw->isVisible() ) { if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { mw->resize(s); mw->move(p); } mw->raise(); } else { if ( mw->layout() && mw->inherits("QDialog") ) { if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { mw->resize(s); mw->move(p); if ( max && !nomaximize ) { mw->showMaximized(); } else { mw->show(); } } else { QPEApplication::showDialog((QDialog*)mw,nomaximize); } } else { if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { mw->resize(s); mw->move(p); } else { //no stored rectangle, make an estimation int x = (qApp->desktop()->width()-mw->frameGeometry().width())/2; int y = (qApp->desktop()->height()-mw->frameGeometry().height())/2; mw->move( QMAX(x,0), QMAX(y,0) ); #ifdef Q_WS_QWS if ( !nomaximize ) mw->showMaximized(); #endif } if ( max && !nomaximize ) mw->showMaximized(); else mw->show(); } } } static bool read_widget_rect(const QString &app, bool &maximized, QPoint &p, QSize &s) { maximized = TRUE; // 350 is the trigger in qwsdefaultdecoration for providing a resize button if ( qApp->desktop()->width() <= 350 ) return FALSE; Config cfg( "qpe" ); cfg.setGroup("ApplicationPositions"); QString str = cfg.readEntry( app, QString::null ); QStringList l = QStringList::split(",", str); if ( l.count() == 5) { p.setX( l[0].toInt() ); p.setY( l[1].toInt() ); s.setWidth( l[2].toInt() ); s.setHeight( l[3].toInt() ); maximized = l[4].toInt(); return TRUE; } return FALSE; } static bool validate_widget_size(const QWidget *w, QPoint &p, QSize &s) { #ifndef Q_WS_QWS QRect qt_maxWindowRect = qApp->desktop()->geometry(); #endif int maxX = qt_maxWindowRect.width(); int maxY = qt_maxWindowRect.height(); int wWidth = s.width() + ( w->frameGeometry().width() - w->geometry().width() ); int wHeight = s.height() + ( w->frameGeometry().height() - w->geometry().height() ); // total window size is not allowed to be larger than desktop window size if ( ( wWidth >= maxX ) && ( wHeight >= maxY ) ) return FALSE; if ( wWidth > maxX ) { s.setWidth( maxX - (w->frameGeometry().width() - w->geometry().width() ) ); wWidth = maxX; } if ( wHeight > maxY ) { s.setHeight( maxY - (w->frameGeometry().height() - w->geometry().height() ) ); wHeight = maxY; } // any smaller than this and the maximize/close/help buttons will be overlapping if ( wWidth < 80 || wHeight < 60 ) return FALSE; if ( p.x() < 0 ) p.setX(0); if ( p.y() < 0 ) p.setY(0); if ( p.x() + wWidth > maxX ) p.setX( maxX - wWidth ); if ( p.y() + wHeight > maxY ) p.setY( maxY - wHeight ); return TRUE; } @@ -1590,513 +1590,513 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data int t, v; stream >> t >> v; setTreble( t, v ); } else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> setTreble(); } else if ( msg == "getMarkedText()" ) { if ( type() == GuiServer ) { const ushort unicode = 'C'-'@'; const int scan = Key_C; qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE ); qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE ); } } else if ( msg == "newChannel(QString)") { QString myChannel = "QPE/Application/" + d->appName; QString channel; stream >> channel; if (channel == myChannel) { processQCopFile(); d->sendQCopQ(); } } #endif } /*! \internal */ bool QPEApplication::raiseAppropriateWindow() { bool r=FALSE; // 1. Raise the main widget QWidget *top = d->qpe_main_widget; if ( !top ) top = mainWidget(); if ( top && d->keep_running ) { if ( top->isVisible() ) r = TRUE; else if (d->preloaded) { // We are preloaded and not visible.. pretend we just started.. #ifndef QT_NO_COP QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); e << d->appName; #endif } d->show_mx(top,d->nomaximize, d->appName); top->raise(); } QWidget *topm = activeModalWidget(); // 2. Raise any parentless widgets (except top and topm, as they // are raised before and after this loop). Order from most // recently raised as deepest to least recently as top, so // that repeated calls cycle through widgets. QWidgetList *list = topLevelWidgets(); if ( list ) { bool foundlast = FALSE; QWidget* topsub = 0; if ( d->lastraised ) { for (QWidget* w = list->first(); w; w = list->next()) { if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { if ( w == d->lastraised ) foundlast = TRUE; if ( foundlast ) { w->raise(); topsub = w; } } } } for (QWidget* w = list->first(); w; w = list->next()) { if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { if ( w == d->lastraised ) break; w->raise(); topsub = w; } } d->lastraised = topsub; delete list; } // 3. Raise the active modal widget. if ( topm ) { topm->show(); topm->raise(); // If we haven't already handled the fastAppShowing message if (!top && d->preloaded) { #ifndef QT_NO_COP QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); e << d->appName; #endif } r = FALSE; } return r; } void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) { #ifdef Q_WS_QWS if ( msg == "quit()" ) { tryQuit(); } else if ( msg == "quitIfInvisible()" ) { if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() ) quit(); } else if ( msg == "close()" ) { hideOrQuit(); } else if ( msg == "disablePreload()" ) { d->preloaded = FALSE; d->keep_running = TRUE; /* so that quit will quit */ } else if ( msg == "enablePreload()" ) { if (d->qpe_main_widget) d->preloaded = TRUE; d->keep_running = TRUE; /* so next quit won't quit */ } else if ( msg == "raise()" ) { d->keep_running = TRUE; d->notbusysent = FALSE; raiseAppropriateWindow(); // Tell the system we're still chugging along... QCopEnvelope e("QPE/System", "appRaised(QString)"); e << d->appName; } else if ( msg == "flush()" ) { emit flush(); // we need to tell the desktop QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" ); e << d->appName; } else if ( msg == "reload()" ) { emit reload(); } else if ( msg == "setDocument(QString)" ) { d->keep_running = TRUE; QDataStream stream( data, IO_ReadOnly ); QString doc; stream >> doc; QWidget *mw = mainWidget(); if ( !mw ) mw = d->qpe_main_widget; if ( mw ) Global::setDocument( mw, doc ); } else if ( msg == "QPEProcessQCop()" ) { processQCopFile(); d->sendQCopQ(); }else { bool p = d->keep_running; d->keep_running = FALSE; emit appMessage( msg, data); if ( d->keep_running ) { d->notbusysent = FALSE; raiseAppropriateWindow(); if ( !p ) { // Tell the system we're still chugging along... #ifndef QT_NO_COP QCopEnvelope e("QPE/System", "appRaised(QString)"); e << d->appName; #endif } } if ( p ) d->keep_running = p; } #endif } /*! Sets widget \a mw as the mainWidget() and shows it. For small windows, consider passing TRUE for \a nomaximize rather than the default FALSE. \sa showMainDocumentWidget() */ void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) { // setMainWidget(mw); this breaks FastLoading because lastWindowClose() would quit d->show(mw, nomaximize ); } /*! Sets widget \a mw as the mainWidget() and shows it. For small windows, consider passing TRUE for \a nomaximize rather than the default FALSE. This calls designates the application as a \link docwidget.html document-oriented\endlink application. The \a mw widget \e must have this slot: setDocument(const QString&). \sa showMainWidget() */ void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) { if ( mw && argc() == 2 ) Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); // setMainWidget(mw); see above d->show(mw, nomaximize ); } /*! If an application is started via a \link qcop.html QCop\endlink message, the application will process the \link qcop.html QCop\endlink message and then quit. If the application calls this function while processing a \link qcop.html QCop\endlink message, after processing its outstanding \link qcop.html QCop\endlink messages the application will start 'properly' and show itself. \sa keepRunning() */ void QPEApplication::setKeepRunning() { if ( qApp && qApp->inherits( "QPEApplication" ) ) { QPEApplication * qpeApp = ( QPEApplication* ) qApp; qpeApp->d->keep_running = TRUE; } } /*! Returns TRUE if the application will quit after processing the current list of qcop messages; otherwise returns FALSE. \sa setKeepRunning() */ bool QPEApplication::keepRunning() const { return d->keep_running; } /*! \internal */ void QPEApplication::internalSetStyle( const QString &style ) { -#if QT_VERSION >= 300 +#if QT_VERSION >= 0x030000 if ( style == "QPE" ) { setStyle( new QPEStyle ); } else { QStyle *s = QStyleFactory::create( style ); if ( s ) setStyle( s ); } #else if ( style == "Windows" ) { setStyle( new QWindowsStyle ); } else if ( style == "QPE" ) { setStyle( new QPEStyle ); } else if ( style == "Light" ) { setStyle( new LightStyle ); } #ifndef QT_NO_STYLE_PLATINUM else if ( style == "Platinum" ) { setStyle( new QPlatinumStyle ); } #endif #ifndef QT_NO_STYLE_MOTIF else if ( style == "Motif" ) { setStyle( new QMotifStyle ); } #endif #ifndef QT_NO_STYLE_MOTIFPLUS else if ( style == "MotifPlus" ) { setStyle( new QMotifPlusStyle ); } #endif else { QStyle *sty = 0; QString path = QPEApplication::qpeDir ( ) + "plugins/styles/"; #ifdef Q_OS_MACX if ( style. find ( ".dylib" ) > 0 ) path += style; else path = path + "lib" + style. lower ( ) + ".dylib"; // compatibility #else if ( style. find ( ".so" ) > 0 ) path += style; else path = path + "lib" + style. lower ( ) + ".so"; // compatibility #endif static QLibrary *lastlib = 0; static StyleInterface *lastiface = 0; QLibrary *lib = new QLibrary ( path ); StyleInterface *iface = 0; if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) sty = iface-> style ( ); if ( sty ) { setStyle ( sty ); if ( lastiface ) lastiface-> release ( ); lastiface = iface; if ( lastlib ) { lastlib-> unload ( ); delete lastlib; } lastlib = lib; } else { if ( iface ) iface-> release ( ); delete lib; setStyle ( new LightStyle ( )); } } #endif } /*! \internal */ void QPEApplication::prepareForTermination( bool willrestart ) { if ( willrestart ) { QLabel *lblWait = new QLabel( tr( "Please wait..." ), 0, "wait hack", QWidget::WStyle_Customize | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); lblWait->setAlignment( QWidget::AlignCenter ); lblWait->show(); lblWait->showMaximized(); } { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); } processEvents(); // ensure the message goes out. } /*! \internal */ void QPEApplication::shutdown() { // Implement in server's QPEApplication subclass } /*! \internal */ void QPEApplication::restart() { // Implement in server's QPEApplication subclass } static QPtrDict<void>* stylusDict = 0; static void createDict() { if ( !stylusDict ) stylusDict = new QPtrDict<void>; } /*! Returns the current StylusMode for widget \a w. \sa setStylusOperation() StylusMode */ QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) { if ( stylusDict ) return ( StylusMode ) ( int ) stylusDict->find( w ); return LeftOnly; } /*! \enum QPEApplication::StylusMode \value LeftOnly the stylus only generates LeftButton events (the default). \value RightOnHold the stylus generates RightButton events if the user uses the press-and-hold gesture. \sa setStylusOperation() stylusOperation() */ /*! Causes widget \a w to receive mouse events according to the stylus \a mode. \sa stylusOperation() StylusMode */ void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode ) { createDict(); if ( mode == LeftOnly ) { stylusDict->remove ( w ); w->removeEventFilter( qApp ); } else { stylusDict->insert( w, ( void* ) mode ); connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); w->installEventFilter( qApp ); } } /*! \reimp */ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) { if ( !o->isWidgetType() ) return FALSE; if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { QMouseEvent * me = ( QMouseEvent* ) e; StylusMode mode = (StylusMode)(int)stylusDict->find(o); switch (mode) { case RightOnHold: switch ( me->type() ) { case QEvent::MouseButtonPress: if ( me->button() == LeftButton ) { static long Pref = 500; // #### pref. d->presswidget = (QWidget*)o; d->presspos = me->pos(); d->rightpressed = FALSE; #ifdef OPIE_WITHROHFEEDBACK if( ! d->RoH ) d->RoH = new Opie::Internal::RoHFeedback; d->RoH->init( me->globalPos(), d->presswidget ); Pref = d->RoH->delay(); #endif if (!d->presstimer ) d->presstimer = startTimer( Pref ); // #### pref. } break; case QEvent::MouseMove: if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { killTimer(d->presstimer); #ifdef OPIE_WITHROHFEEDBACK d->RoH->stop(); #endif d->presstimer = 0; } break; case QEvent::MouseButtonRelease: if ( me->button() == LeftButton ) { if ( d->presstimer ) { killTimer(d->presstimer); #ifdef OPIE_WITHROHFEEDBACK d->RoH->stop( ); #endif d->presstimer = 0; } if ( d->rightpressed && d->presswidget ) { printf( "Send ButtonRelease\n" ); // Right released postEvent( d->presswidget, new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), RightButton, LeftButton + RightButton ) ); // Left released, off-widget postEvent( d->presswidget, new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1), LeftButton, LeftButton ) ); postEvent( d->presswidget, new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1), LeftButton, LeftButton ) ); d->rightpressed = FALSE; return TRUE; // don't send the real Left release } } break; default: break; } break; default: ; } } else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { QKeyEvent *ke = (QKeyEvent *)e; if ( ke->key() == Key_Enter ) { if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) { postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ', ke->state(), " ", ke->isAutoRepeat(), ke->count() ) ); return TRUE; } } } return FALSE; } diff --git a/library/qpestyle.cpp b/library/qpestyle.cpp index b61ada4..0566f6b 100644 --- a/library/qpestyle.cpp +++ b/library/qpestyle.cpp @@ -1,688 +1,688 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "qpestyle.h" #define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) -#if QT_VERSION >= 300 +#if QT_VERSION >= 0x030000 #include <qdrawutil.h> #include <qcombobox.h> #include <qtabbar.h> QPEStyle::QPEStyle() { } QPEStyle::~QPEStyle() { } void QPEStyle::drawPrimitive( PrimitiveElement pe, QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, const QStyleOption &data) const { switch ( pe ) { case PE_ButtonTool: { QColorGroup mycg = cg; if ( flags & Style_On ) { QBrush fill( cg.mid(), Dense4Pattern ); mycg.setBrush( QColorGroup::Button, fill ); } drawPrimitive( PE_ButtonBevel, p, r, mycg, flags, data ); break; } case PE_ButtonCommand: case PE_ButtonDefault: case PE_ButtonBevel: case PE_HeaderSection: { QPen oldPen = p->pen(); p->fillRect( r.x()+1, r.y()+1, r.width()-2, r.height()-2, cg.brush(QColorGroup::Button) ); int x2 = r.right(); int y2 = r.bottom(); if ( flags & (Style_Sunken | Style_Down | Style_On) ) p->setPen( cg.dark() ); else p->setPen( cg.light() ); p->drawLine( r.x(), r.y()+1, r.x(), y2-1 ); p->drawLine( r.x()+1, r.y(), x2-1, r.y() ); if ( flags & (Style_Sunken | Style_Down | Style_On) ) p->setPen( cg.light() ); else p->setPen( cg.dark() ); p->drawLine( x2, r.y()+1, x2, y2-1 ); p->drawLine( r.x()+1, y2, x2-1, y2 ); p->setPen( oldPen ); break; } case PE_FocusRect: break; case PE_Indicator: { QColorGroup mycg( cg ); QBrush fill; if ( flags & Style_Down ) fill = cg.brush( QColorGroup::Button ); else fill = cg.brush( (flags&Style_Enabled) ? QColorGroup::Base : QColorGroup::Background ); mycg.setBrush( QColorGroup::Button, fill ); if ( flags&Style_Enabled ) flags |= Style_Sunken; drawPrimitive( PE_ButtonBevel, p, r, mycg, flags ); if ( flags & Style_On ) { QPointArray a( 7*2 ); int i, xx, yy; xx = r.x()+3; yy = r.y()+5; for ( i=0; i<3; i++ ) { a.setPoint( 2*i, xx, yy ); a.setPoint( 2*i+1, xx, yy+2 ); xx++; yy++; } yy -= 2; for ( i=3; i<7; i++ ) { a.setPoint( 2*i, xx, yy ); a.setPoint( 2*i+1, xx, yy+2 ); xx++; yy--; } if ( flags & Style_NoChange ) { p->setPen( mycg.dark() ); } else { p->setPen( mycg.text() ); } p->drawLineSegments( a ); } break; } case PE_ExclusiveIndicator: { static const QCOORD pts1[] = { // dark lines 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 }; static const QCOORD pts4[] = { // white lines 2,10, 3,10, 4,11, 7,11, 8,10, 9,10, 10,9, 10,8, 11,7, 11,4, 10,3, 10,2 }; static const QCOORD pts5[] = { // inner fill 4,2, 7,2, 9,4, 9,7, 7,9, 4,9, 2,7, 2,4 }; int x, y, w, h; r.rect( &x, &y, &w, &h ); p->eraseRect( x, y, w, h ); QPointArray a( QCOORDARRLEN(pts1), pts1 ); a.translate( x, y ); p->setPen( cg.dark() ); p->drawPolyline( a ); a.setPoints( QCOORDARRLEN(pts4), pts4 ); a.translate( x, y ); p->setPen( cg.light() ); p->drawPolyline( a ); a.setPoints( QCOORDARRLEN(pts5), pts5 ); a.translate( x, y ); QColor fillColor = ( flags&Style_Down || !(flags&Style_Enabled) ) ? cg.button() : cg.base(); p->setPen( fillColor ); p->setBrush( fillColor ) ; p->drawPolygon( a ); if ( flags&Style_On ) { p->setPen( NoPen ); p->setBrush( cg.text() ); p->drawRect( x+5, y+4, 2, 4 ); p->drawRect( x+4, y+5, 4, 2 ); } break; } default: QWindowsStyle::drawPrimitive( pe, p, r, cg, flags, data ); break; } } void QPEStyle::drawControl( ControlElement ce, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags how, const QStyleOption &data) const { switch ( ce ) { case CE_PushButton: { const QPushButton *btn = (QPushButton*)widget; SFlags flags; flags = Style_Default; if ( btn->isDown() ) flags |= Style_Down; if ( btn->isOn() ) flags |= Style_On; if ( btn->isEnabled() ) flags |= Style_Enabled; if ( btn->isDefault() ) flags |= Style_Default; if (! btn->isFlat() && !(flags & Style_Down)) flags |= Style_Raised; p->setPen( cg.foreground() ); p->setBrush( QBrush(cg.button(), NoBrush) ); QColorGroup mycg( cg ); if ( flags & Style_On ) { QBrush fill = QBrush( cg.mid(), Dense4Pattern ); mycg.setBrush( QColorGroup::Button, fill ); } drawPrimitive( PE_ButtonBevel, p, r, mycg, flags, data ); break; } case CE_TabBarTab: { if ( !widget || !widget->parentWidget() ) break; const QTabBar *tb = (const QTabBar *) widget; bool selected = how & Style_Selected; QRect r2(r); if ( tb->shape() == QTabBar::RoundedAbove ) { p->setPen( cg.light() ); p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() ); if ( r2.left() == 0 ) p->drawPoint( tb->rect().bottomLeft() ); else { p->setPen( cg.light() ); p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() ); } if ( selected ) { p->setPen( cg.background() ); p->drawLine( r2.left()+2, r2.top()+1, r2.right()-2, r2.top()+1 ); p->fillRect( QRect( r2.left()+1, r2.top()+2, r2.width()-2, r2.height()-2), cg.brush( QColorGroup::Background )); } else { r2.setRect( r2.left() + 2, r2.top() + 2, r2.width() - 4, r2.height() - 2 ); p->setPen( cg.button() ); p->drawLine( r2.left()+2, r2.top()+1, r2.right()-2, r2.top()+1 ); p->fillRect( QRect( r2.left()+1, r2.top()+2, r2.width()-2, r2.height()-3), cg.brush( QColorGroup::Button )); //do shading; will not work for pixmap brushes QColor bg = cg.button(); // int h,s,v; // bg.hsv( &h, &s, &v ); int n = r2.height()/2; int dark = 100; for ( int i = 1; i < n; i++ ) { dark = (dark * (100+(i*15)/n) )/100; p->setPen( bg.dark( dark ) ); int y = r2.bottom()-n+i; int x1 = r2.left()+1; int x2 = r2.right()-1; p->drawLine( x1, y, x2, y ); } } p->setPen( cg.light() ); p->drawLine( r2.left(), r2.bottom()-1, r2.left(), r2.top() + 2 ); p->drawPoint( r2.left()+1, r2.top() + 1 ); p->drawLine( r2.left()+2, r2.top(), r2.right() - 2, r2.top() ); p->setPen( cg.dark() ); p->drawPoint( r2.right() - 1, r2.top() + 1 ); p->drawLine( r2.right(), r2.top() + 2, r2.right(), r2.bottom() - 1); } else if ( tb->shape() == QTabBar::RoundedBelow ) { if ( selected ) { p->setPen( cg.background() ); p->drawLine( r2.left()+2, r2.bottom()-1, r2.right()-2, r2.bottom()-1 ); p->fillRect( QRect( r2.left()+1, r2.top(), r2.width()-2, r2.height()-2), tb->palette().normal().brush( QColorGroup::Background )); } else { p->setPen( cg.dark() ); p->drawLine( r2.left(), r2.top(), r2.right(), r2.top() ); r2.setRect( r2.left() + 2, r2.top(), r2.width() - 4, r2.height() - 2 ); p->setPen( cg.button() ); p->drawLine( r2.left()+2, r2.bottom()-1, r2.right()-2, r2.bottom()-1 ); p->fillRect( QRect( r2.left()+1, r2.top()+1, r2.width()-2, r2.height()-3), tb->palette().normal().brush( QColorGroup::Button )); } p->setPen( cg.dark() ); p->drawLine( r2.right(), r2.top(), r2.right(), r2.bottom() - 2 ); p->drawPoint( r2.right() - 1, r2.bottom() - 1 ); p->drawLine( r2.right() - 2, r2.bottom(), r2.left() + 2, r2.bottom() ); p->setPen( cg.light() ); p->drawLine( r2.left(), r2.top()+1, r2.left(), r2.bottom() - 2 ); p->drawPoint( r2.left() + 1, r2.bottom() - 1 ); if ( r2.left() == 0 ) p->drawPoint( tb->rect().topLeft() ); } else { QCommonStyle::drawControl( ce, p, widget, r, cg, how, data ); } break; } default: QWindowsStyle::drawControl( ce, p, widget, r, cg, how, data ); break; } } void QPEStyle::drawComplexControl( ComplexControl control, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags how, SCFlags sub, SCFlags subActive, const QStyleOption &data) const { switch ( control ) { case CC_ComboBox: if ( sub & SC_ComboBoxArrow ) { SFlags flags = Style_Default; drawPrimitive( PE_ButtonBevel, p, r, cg, flags, data ); QRect ar = QStyle::visualRect( querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxArrow ), widget ); if ( subActive == SC_ComboBoxArrow ) { p->setPen( cg.dark() ); p->setBrush( cg.brush( QColorGroup::Button ) ); p->drawRect( ar ); } ar.addCoords( 2, 2, -2, -2 ); if ( widget->isEnabled() ) flags |= Style_Enabled; if ( subActive & Style_Sunken ) { flags |= Style_Sunken; } drawPrimitive( PE_ArrowDown, p, ar, cg, flags ); } if ( sub & SC_ComboBoxEditField ) { const QComboBox * cb = (const QComboBox *) widget; QRect re = QStyle::visualRect( querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxEditField ), widget ); if ( cb->hasFocus() && !cb->editable() ) p->fillRect( re.x(), re.y(), re.width(), re.height(), cg.brush( QColorGroup::Highlight ) ); if ( cb->hasFocus() ) { p->setPen( cg.highlightedText() ); p->setBackgroundColor( cg.highlight() ); } else { p->setPen( cg.text() ); p->setBackgroundColor( cg.background() ); } if ( cb->hasFocus() && !cb->editable() ) { QRect re = QStyle::visualRect( subRect( SR_ComboBoxFocusRect, cb ), widget ); drawPrimitive( PE_FocusRect, p, re, cg, Style_FocusAtBorder, QStyleOption(cg.highlight())); } } break; default: QWindowsStyle::drawComplexControl( control, p, widget, r, cg, how, sub, subActive, data ); break; } } int QPEStyle::pixelMetric( PixelMetric metric, const QWidget *widget ) const { int ret; switch( metric ) { case PM_ButtonMargin: ret = 2; break; case PM_DefaultFrameWidth: ret = 1; break; case PM_ButtonDefaultIndicator: ret = 2; break; case PM_ButtonShiftHorizontal: case PM_ButtonShiftVertical: ret = -1; break; case PM_IndicatorWidth: ret = 15; break; case PM_IndicatorHeight: ret = 13; break; case PM_ExclusiveIndicatorHeight: case PM_ExclusiveIndicatorWidth: ret = 15; break; case PM_ScrollBarExtent: ret = 13; break; case PM_SliderLength: ret = 12; break; default: ret = QWindowsStyle::pixelMetric( metric, widget ); break; } return ret; } QSize QPEStyle::sizeFromContents( ContentsType contents, const QWidget *widget, const QSize &contentsSize, const QStyleOption &data) const { QSize sz(contentsSize); switch ( contents ) { case CT_PopupMenuItem: { if ( !widget || data.isDefault() ) break; sz = QWindowsStyle::sizeFromContents( contents, widget, contentsSize, data ); sz = QSize( sz.width(), sz.height()-2 ); break; } default: sz = QWindowsStyle::sizeFromContents( contents, widget, contentsSize, data ); break; } return sz; } #else #include <qfontmetrics.h> #include <qpalette.h> #include <qdrawutil.h> #include <qscrollbar.h> #include <qbutton.h> #include <qframe.h> #include <qtabbar.h> #define INCLUDE_MENUITEM_DEF #include <qmenudata.h> QPEStyle::QPEStyle() { -#if QT_VERSION < 300 +#if QT_VERSION < 0x030000 setButtonMargin(buttonMargin()); setScrollBarExtent(scrollBarExtent().width(),scrollBarExtent().height()); #endif } QPEStyle::~QPEStyle() { } int QPEStyle::buttonMargin() const { return 2; } QSize QPEStyle::scrollBarExtent() const { return QSize(13,13); } void QPEStyle::polish ( QPalette & ) { } void QPEStyle::polish( QWidget *w ) { if ( w->inherits( "QListBox" ) || w->inherits( "QListView" ) || w->inherits( "QPopupMenu" ) || w->inherits( "QSpinBox" ) ) { QFrame *f = (QFrame *)w; f->setFrameShape( QFrame::StyledPanel ); f->setLineWidth( 1 ); } } void QPEStyle::unPolish( QWidget *w ) { if ( w->inherits( "QListBox" ) || w->inherits( "QListView" ) || w->inherits( "QPopupMenu" ) || w->inherits( "QSpinBox" ) ) { QFrame *f = (QFrame *)w; f->setFrameShape( QFrame::StyledPanel ); f->setLineWidth( 2 ); } } int QPEStyle::defaultFrameWidth() const { return 1; } void QPEStyle::drawPanel ( QPainter * p, int x, int y, int w, int h, const QColorGroup &g, bool sunken, int lineWidth, const QBrush * fill ) { qDrawShadePanel( p, QRect(x, y, w, h), g, sunken, lineWidth, fill ); } void QPEStyle::drawButton( QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken, const QBrush* fill ) { QPen oldPen = p->pen(); if ( sunken ) p->setPen( g.dark() ); else p->setPen( g.light() ); int x2 = x+w-1; int y2 = y+h-1; p->drawLine( x, y, x, y2 ); p->drawLine( x, y, x2, y ); if ( sunken ) p->setPen( g.light() ); else p->setPen( g.dark() ); p->drawLine( x2, y, x2, y2 ); p->drawLine( x, y2, x2, y2 ); p->setPen( oldPen ); p->fillRect( x+1, y+1, w-2, h-2, fill?(*fill):g.brush(QColorGroup::Button) ); } void QPEStyle::drawButtonMask ( QPainter * p, int x, int y, int w, int h ) { p->fillRect( x, y, w, h, color1 ); } void QPEStyle::drawBevelButton( QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken, const QBrush* fill ) { drawButton( p, x, y, w, h, g, sunken, fill ); } QRect QPEStyle::comboButtonRect( int x, int y, int w, int h) { return QRect(x+1, y+1, w-2-14, h-2); } QRect QPEStyle::comboButtonFocusRect( int x, int y, int w, int h) { return QRect(x+2, y+2, w-4-14, h-4); } void QPEStyle::drawComboButton( QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken, bool /*editable*/, bool enabled, const QBrush *fill ) { drawBevelButton( p, x, y, w, h, g, FALSE, fill ); drawBevelButton( p, x+w-14, y, 14, h, g, sunken, fill ); drawArrow( p, QStyle::DownArrow, sunken, x+w-14+ 2, y+ 2, 14- 4, h- 4, g, enabled, &g.brush( QColorGroup::Button ) ); } void QPEStyle::drawExclusiveIndicator ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool on, bool down, bool enabled ) { static const QCOORD pts1[] = { // dark lines 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 }; static const QCOORD pts4[] = { // white lines 2,10, 3,10, 4,11, 7,11, 8,10, 9,10, 10,9, 10,8, 11,7, 11,4, 10,3, 10,2 }; static const QCOORD pts5[] = { // inner fill 4,2, 7,2, 9,4, 9,7, 7,9, 4,9, 2,7, 2,4 }; p->eraseRect( x, y, w, h ); QPointArray a( QCOORDARRLEN(pts1), pts1 ); a.translate( x, y ); p->setPen( g.dark() ); p->drawPolyline( a ); a.setPoints( QCOORDARRLEN(pts4), pts4 ); a.translate( x, y ); p->setPen( g.light() ); p->drawPolyline( a ); a.setPoints( QCOORDARRLEN(pts5), pts5 ); a.translate( x, y ); QColor fillColor = ( down || !enabled ) ? g.button() : g.base(); p->setPen( fillColor ); p->setBrush( fillColor ) ; p->drawPolygon( a ); if ( on ) { p->setPen( NoPen ); p->setBrush( g.text() ); p->drawRect( x+5, y+4, 2, 4 ); p->drawRect( x+4, y+5, 4, 2 ); } } void QPEStyle::drawIndicator ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, int state, bool down, bool enabled ) { QBrush fill; if ( state == QButton::NoChange ) { QBrush b = p->brush(); QColor c = p->backgroundColor(); p->setBackgroundMode( TransparentMode ); p->setBackgroundColor( green ); fill = QBrush(g.base(), Dense4Pattern); p->setBackgroundColor( c ); p->setBrush( b ); } else if ( down ) fill = g.brush( QColorGroup::Button ); else fill = g.brush( enabled ? QColorGroup::Base : QColorGroup::Background ); drawPanel( p, x, y, w, h, g, TRUE, 1, &fill ); if ( state != QButton::Off ) { QPointArray a( 7*2 ); int i, xx, yy; xx = x+3; yy = y+5; for ( i=0; i<3; i++ ) { a.setPoint( 2*i, xx, yy ); a.setPoint( 2*i+1, xx, yy+2 ); xx++; yy++; } yy -= 2; for ( i=3; i<7; i++ ) { a.setPoint( 2*i, xx, yy ); a.setPoint( 2*i+1, xx, yy+2 ); xx++; yy--; } if ( state == QButton::NoChange ) { p->setPen( g.dark() ); } else { p->setPen( g.text() ); } p->drawLineSegments( a ); } } #define HORIZONTAL (sb->orientation() == QScrollBar::Horizontal) #define VERTICAL !HORIZONTAL #define MOTIF_BORDER 2 #define SLIDER_MIN 9 // ### motif says 6 but that's too small /*! \reimp */ void QPEStyle::scrollBarMetrics( const QScrollBar* sb, int &sliderMin, int &sliderMax, int &sliderLength, int& buttonDim ) { int maxLength; int length = HORIZONTAL ? sb->width() : sb->height(); int extent = HORIZONTAL ? sb->height() : sb->width(); if ( length > (extent - 1)*2 ) buttonDim = extent; else buttonDim = length/2 - 1; sliderMin = 0; maxLength = length - buttonDim*2; if ( sb->maxValue() == sb->minValue() ) { sliderLength = maxLength; } else { sliderLength = (sb->pageStep()*maxLength)/ (sb->maxValue()-sb->minValue()+sb->pageStep()); uint range = sb->maxValue()-sb->minValue(); if ( sliderLength < SLIDER_MIN || range > INT_MAX/2 ) sliderLength = SLIDER_MIN; if ( sliderLength > maxLength ) sliderLength = maxLength; } sliderMax = sliderMin + maxLength - sliderLength; } /*!\reimp */ QStyle::ScrollControl QPEStyle::scrollBarPointOver( const QScrollBar* sb, int sliderStart, const QPoint& p ) { if ( !sb->rect().contains( p ) ) return NoScroll; int sliderMin, sliderMax, sliderLength, buttonDim, pos; scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim ); if (sb->orientation() == QScrollBar::Horizontal) pos = p.x(); else pos = p.y(); if (pos < sliderStart) return SubPage; if (pos < sliderStart + sliderLength) return Slider; if (pos < sliderMax + sliderLength) return AddPage; if (pos < sliderMax + sliderLength + buttonDim) diff --git a/library/qpestyle.h b/library/qpestyle.h index 19ef346..1bde0ff 100644 --- a/library/qpestyle.h +++ b/library/qpestyle.h @@ -1,102 +1,102 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef QPESTYLE_H #define QPESTYLE_H #ifndef QT_H #include "qwindowsstyle.h" #endif // QT_H -#if QT_VERSION >= 300 +#if QT_VERSION >= 0x030000 class Q_EXPORT QPEStyle : public QWindowsStyle { public: QPEStyle(); virtual ~QPEStyle(); virtual void drawPrimitive( PrimitiveElement pe, QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags=Style_Default, const QStyleOption & = QStyleOption::Default) const; virtual void drawControl( ControlElement ce, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags how=Style_Default, const QStyleOption & = QStyleOption::Default) const; virtual void drawComplexControl( ComplexControl control, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags how=Style_Default, SCFlags sub=SC_All, SCFlags subActive=SC_None, const QStyleOption & = QStyleOption::Default) const; virtual int pixelMetric( PixelMetric metric, const QWidget *widget=0 ) const; virtual QSize sizeFromContents( ContentsType contents, const QWidget *widget, const QSize &contentsSize, const QStyleOption & = QStyleOption::Default) const; }; #else class Q_EXPORT QPEStyle : public QWindowsStyle { public: QPEStyle(); virtual ~QPEStyle(); virtual void polish( QPalette &p ); virtual void polish( QWidget *w ); virtual void unPolish( QWidget *w ); int defaultFrameWidth () const; void drawPanel ( QPainter * p, int x, int y, int w, int h, const QColorGroup &, bool sunken=FALSE, int lineWidth = 1, const QBrush * fill = 0 ); void drawButton( QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken, const QBrush* fill ); void drawButtonMask ( QPainter * p, int x, int y, int w, int h ); void drawBevelButton( QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken=FALSE, const QBrush* fill=0 ); QRect comboButtonRect( int x, int y, int w, int h); QRect comboButtonFocusRect( int x, int y, int w, int h); void drawComboButton( QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken, bool, bool enabled, const QBrush *fill ); void drawExclusiveIndicator ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool on, bool down = FALSE, bool enabled = TRUE ); void drawIndicator ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, int state, bool down = FALSE, bool enabled = TRUE ); void scrollBarMetrics( const QScrollBar*, int&, int&, int&, int&); void drawScrollBarControls( QPainter*, const QScrollBar*, int sliderStart, uint controls, uint activeControl ); ScrollControl scrollBarPointOver( const QScrollBar* sb, int sliderStart, const QPoint& p ); void drawRiffles( QPainter* p, int x, int y, int w, int h, const QColorGroup &g, bool horizontal ); int sliderLength() const; void drawSlider( QPainter *p, int x, int y, int w, int h, const QColorGroup &g, Orientation, bool tickAbove, bool tickBelow ); void drawSliderMask( QPainter *p, int x, int y, int w, int h, Orientation, bool tickAbove, bool tickBelow ); void drawSliderGrooveMask( QPainter *p, int x, int y, int w, int h, const QColorGroup& , QCOORD c, Orientation orient ); void drawTab( QPainter *, const QTabBar *, QTab *, bool selected ); int extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem*, const QFontMetrics& ); int popupMenuItemHeight( bool checkable, QMenuItem*, const QFontMetrics& ); void drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi, const QPalette& pal, bool act, bool enabled, int x, int y, int w, int h); int buttonMargin() const; QSize scrollBarExtent() const; private: // Disabled copy constructor and operator= #if defined(Q_DISABLE_COPY) QPEStyle( const QPEStyle & ); QPEStyle& operator=( const QPEStyle & ); #endif }; #endif #endif // QPESTYLE_H |