[BeFree CVS] neptune/libneptune ChangeLog,1.34,1.35 bclassicstyle.cpp,1.13,1.14 bclassicstyle.h,1.5,
Status: Planning
Brought to you by:
plfiorini
|
From: Pier L. F. <plf...@us...> - 2005-01-05 18:32:23
|
Update of /cvsroot/befree/neptune/libneptune In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19060 Modified Files: ChangeLog bclassicstyle.cpp bclassicstyle.h Log Message: Polish QAbstractItemView setting even color to base from palette and odd color to background from palette, lighter by a factor of 130 (30%). Draw frame, menu bar and header. Index: bclassicstyle.cpp =================================================================== RCS file: /cvsroot/befree/neptune/libneptune/bclassicstyle.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- bclassicstyle.cpp 3 Jan 2005 11:49:08 -0000 1.13 +++ bclassicstyle.cpp 5 Jan 2005 18:32:13 -0000 1.14 @@ -24,6 +24,7 @@ #include <QStyleOption> #include <QPainter> +#include <QAbstractItemView> #include "bclassicstyle.h" @@ -41,6 +42,28 @@ { } +void BClassicStyle::polish(QWidget *widget) +{ + if (!widget) + return; + + // Set even and odd color in model views + if (widget->inherits("QAbstractItemView")) + { + QAbstractItemView *view = (QAbstractItemView *)widget; + QColor oddColor = QPalette().background().color().light(115); + + // Actually set colors + view->setEvenRowColor(QPalette().base().color()); + view->setOddRowColor(oddColor); + } + // Call original polish method + else + { + QWindowsStyle::polish(widget); + } +} + void BClassicStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const { @@ -49,6 +72,21 @@ switch (pe) { + case PE_Frame: + if (opt->state & Style_Sunken) + p->setPen(opt->palette.mid().color()); + else + p->setPen(opt->palette.light().color()); + p->drawLine(opt->rect.topLeft(), opt->rect.topRight()); + p->drawLine(opt->rect.topLeft(), opt->rect.bottomLeft()); + + if (opt->state & Style_Sunken) + p->setPen(opt->palette.light().color()); + else + p->setPen(opt->palette.mid().color()); + p->drawLine(opt->rect.topRight(), opt->rect.bottomRight()); + p->drawLine(opt->rect.bottomLeft(), opt->rect.bottomRight()); + break; case PE_FrameLineEdit: case PE_IndicatorCheckBox: { @@ -63,6 +101,7 @@ break; case PE_FrameButtonBevel: case PE_PanelButtonBevel: + case PE_PanelHeader: drawButton(opt->rect, opt->state, opt->palette, p); break; case PE_PanelButtonCommand: @@ -75,6 +114,8 @@ drawButton(btn->rect, btn->state, btn->palette, p); } break; + case PE_PanelMenuBar: + break; case PE_IndicatorBranch: // TODO: Use button text color when w is enabled // If children draw an arrow, otherwise nothing Index: bclassicstyle.h =================================================================== RCS file: /cvsroot/befree/neptune/libneptune/bclassicstyle.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- bclassicstyle.h 2 Jan 2005 22:14:36 -0000 1.5 +++ bclassicstyle.h 5 Jan 2005 18:32:13 -0000 1.6 @@ -33,6 +33,8 @@ public: BClassicStyle(); + virtual void polish(QWidget *widget); + void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w = 0) const; void drawControl(ControlElement ce, const QStyleOption *opt, QPainter *p, Index: ChangeLog =================================================================== RCS file: /cvsroot/befree/neptune/libneptune/ChangeLog,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- ChangeLog 2 Jan 2005 22:14:36 -0000 1.34 +++ ChangeLog 5 Jan 2005 18:32:05 -0000 1.35 @@ -1,3 +1,12 @@ +2005-01-05 Pier Luigi Fiorini <pie...@mo...> + + * bclassicstyle.cpp (BClassicStyle::polish): + Polish QAbstractItemView setting even color to base from palette and odd + color to background from palette, lighter by a factor of 130 (30%). + + * bclassicstyle.cpp (BClassicStyle::drawPrimitive): + Draw frame, menu bar and header. + 2005-01-02 Pier Luigi Fiorini <pie...@mo...> * bclassicstyle.cpp: Draw combo box and fix line edit state when it doesn't |