[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/runtime/kstyles/oxygen
From: Hugo Pereira Da Costa <hugo.pereira () free ! fr>
Date: 2010-02-17 18:29:16
Message-ID: 1266431356.804122.8743.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1091864 by hpereiradacosta:
Use renderWindowBackground for QHeaderView background, and extend it properly for \
header 'empty area'.
M +74 -24 oxygen.cpp
M +3 -0 oxygen.h
--- trunk/KDE/kdebase/runtime/kstyles/oxygen/oxygen.cpp #1091863:1091864
@@ -664,10 +664,24 @@
}
+ case CE_HeaderEmptyArea:
+ {
+ // use the same background as in drawHeaderPrimitive
+ QPalette pal( option->palette );
+ QRect r( option->rect );
+ bool horizontal( option->state & QStyle::State_Horizontal );
+ bool reverse( horizontal && option->direction == Qt::RightToLeft );
+ renderHeaderBackground( r, pal, p, widget, horizontal, reverse );
+
+ return;
+ }
+
default: break;
}
+
KStyle::drawControl(element, option, p, widget);
+
}
//_________________________________________________________________________
@@ -2736,7 +2750,6 @@
Q_UNUSED( flags );
Q_UNUSED( widget );
Q_UNUSED( kOpt );
- const bool reverseLayout = opt->direction == Qt::RightToLeft;
switch (primitive)
{
case Header::SectionHor:
@@ -2745,33 +2758,30 @@
if (const QStyleOptionHeader *header = qstyleoption_cast<const \
QStyleOptionHeader *>(opt)) {
- bool isFirst = (primitive==Header::SectionHor)&&(header->position == \
QStyleOptionHeader::Beginning); + const bool isFirst = \
(primitive==Header::SectionHor)&&(header->position == QStyleOptionHeader::Beginning); \
+ const bool horizontal( primitive == Header::SectionHor ); + \
const bool reverse( opt->direction == Qt::RightToLeft ); +
+ // background
+ renderHeaderBackground( r, pal, p, widget, horizontal, reverse );
+
+ // dots
p->save();
p->setPen(pal.color(QPalette::Text));
-
- QColor color = pal.color(QPalette::Button);
- QColor dark = _helper.calcDarkColor(color);
- QColor light = _helper.calcLightColor(color);
-
+ QColor color = pal.color(QPalette::Window);
QRect rect(r);
- p->fillRect(r, color);
if(primitive == Header::SectionHor)
{
if(header->section != 0 || isFirst)
{
int center = r.center().y();
- int pos = (reverseLayout)? r.left()+1 : r.right()-1;
+ int pos = reverse ? r.left()+1 : r.right()-1;
renderDot(p, QPointF(pos, center-3), color);
renderDot(p, QPointF(pos, center), color);
renderDot(p, QPointF(pos, center+3), color);
}
- p->setPen(dark);
- p->drawLine(rect.bottomLeft(), rect.bottomRight());
- rect.adjust(0,0,0,-1);
- p->setPen(light);
- p->drawLine(rect.bottomLeft(), rect.bottomRight());
} else {
@@ -2781,16 +2791,6 @@
renderDot(p, QPointF(center, pos), color);
renderDot(p, QPointF(center+3, pos), color);
- if (reverseLayout)
- {
- p->setPen(dark); p->drawLine(rect.topLeft(), \
rect.bottomLeft());
- rect.adjust(1,0,0,0);
- p->setPen(light); p->drawLine(rect.topLeft(), \
rect.bottomLeft());
- } else {
- p->setPen(dark); p->drawLine(rect.topRight(), \
rect.bottomRight());
- rect.adjust(0,0,-1,0);
- p->setPen(light); p->drawLine(rect.topRight(), \
rect.bottomRight());
- }
}
p->restore();
@@ -3999,6 +3999,56 @@
}
//__________________________________________________________________________
+void OxygenStyle::renderHeaderBackground( const QRect& r, const QPalette& pal, \
QPainter* p, const QWidget* widget, bool horizontal, bool reverse ) const +{
+
+ // use window background for the background
+ _helper.renderWindowBackground(p, r, widget, pal);
+
+ // add horizontal lines
+ QColor color = pal.color(QPalette::Window);
+ QColor dark = _helper.calcDarkColor(color);
+ QColor light = _helper.calcLightColor(color);
+
+ p->save();
+ QRect rect( r );
+ if( horizontal )
+ {
+
+ p->setPen(dark);
+ p->drawLine(rect.bottomLeft(), rect.bottomRight());
+
+ rect.adjust(0,0,0,-1);
+ p->setPen(light);
+ p->drawLine(rect.bottomLeft(), rect.bottomRight());
+
+ } else if( reverse ) {
+
+ p->setPen(dark);
+ p->drawLine(rect.topLeft(), rect.bottomLeft());
+
+ rect.adjust(1,0,0,0);
+ p->setPen(light);
+ p->drawLine(rect.topLeft(), rect.bottomLeft());
+
+ } else {
+
+ p->setPen(dark);
+ p->drawLine(rect.topRight(), rect.bottomRight());
+
+ rect.adjust(0,0,-1,0);
+ p->setPen(light);
+ p->drawLine(rect.topRight(), rect.bottomRight());
+
+ }
+
+ p->restore();
+
+ return;
+
+}
+
+//__________________________________________________________________________
void OxygenStyle::renderMenuItemRect( const QStyleOption* opt, const QRect& r, const \
QColor& base, const QPalette& pal, QPainter* p, qreal opacity ) const {
--- trunk/KDE/kdebase/runtime/kstyles/oxygen/oxygen.h #1091863:1091864
@@ -185,6 +185,9 @@
private:
+ //! header background
+ void renderHeaderBackground( const QRect&, const QPalette&, QPainter*, const \
QWidget*, bool horizontal, bool reverse ) const; +
//! menu item
void renderMenuItemRect( const QStyleOption* opt, const QRect& rect, const \
QPalette& pal, QPainter* p, qreal opacity = -1 ) const
{ renderMenuItemRect( opt, rect, pal.color(QPalette::Window), p, opacity ); }
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic