Sync r937674 from Oxygen.
svn path=/trunk/KDE/kdebase/workspace/; revision=980082
This commit is contained in:
parent
dd913d6657
commit
681caee432
2 changed files with 20 additions and 16 deletions
|
@ -353,12 +353,14 @@ void OxygenClient::paintEvent(QPaintEvent *e)
|
||||||
if (align & Qt::AlignLeft) {
|
if (align & Qt::AlignLeft) {
|
||||||
int left = titleLeft + QFontMetrics(options()->font(isActive(), false)).width(caption()) + 4;
|
int left = titleLeft + QFontMetrics(options()->font(isActive(), false)).width(caption()) + 4;
|
||||||
int right = titleLeft + titleWidth;
|
int right = titleLeft + titleWidth;
|
||||||
drawScratch(&painter, palette, left, right, titleTop+6);
|
if (left < right)
|
||||||
|
drawStripes(&painter, palette, left, right, titleTop+6);
|
||||||
}
|
}
|
||||||
if (align & Qt::AlignRight) {
|
if (align & Qt::AlignRight) {
|
||||||
int left = titleLeft;
|
int left = titleLeft;
|
||||||
int right = titleLeft + titleWidth - QFontMetrics(options()->font(isActive(), false)).width(caption()) - 4;
|
int right = titleLeft + titleWidth - QFontMetrics(options()->font(isActive(), false)).width(caption()) - 4;
|
||||||
drawScratch(&painter, palette, right, left, titleTop+6);
|
if (left < right)
|
||||||
|
drawStripes(&painter, palette, right, left, titleTop+6);
|
||||||
}
|
}
|
||||||
if (align & Qt::AlignHCenter) {
|
if (align & Qt::AlignHCenter) {
|
||||||
int textWidth = QFontMetrics(options()->font(isActive(), false)).width(caption());
|
int textWidth = QFontMetrics(options()->font(isActive(), false)).width(caption());
|
||||||
|
@ -366,8 +368,10 @@ void OxygenClient::paintEvent(QPaintEvent *e)
|
||||||
int centerLeft = titleLeft + titleWidth/2 - textWidth/2 - 4;
|
int centerLeft = titleLeft + titleWidth/2 - textWidth/2 - 4;
|
||||||
int centerRight = titleLeft + titleWidth/2 + textWidth/2 + 4;
|
int centerRight = titleLeft + titleWidth/2 + textWidth/2 + 4;
|
||||||
int right = titleLeft + titleWidth;
|
int right = titleLeft + titleWidth;
|
||||||
drawScratch(&painter, palette, centerLeft, left, titleTop+6);
|
if (left < centerLeft && right > centerRight) {
|
||||||
drawScratch(&painter, palette, centerRight, right, titleTop+6);
|
drawStripes(&painter, palette, centerLeft, left, titleTop+6);
|
||||||
|
drawStripes(&painter, palette, centerRight, right, titleTop+6);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,19 +402,19 @@ void OxygenClient::paintEvent(QPaintEvent *e)
|
||||||
renderDot(&painter, QPointF(6.5, 2.5), 1.8);
|
renderDot(&painter, QPointF(6.5, 2.5), 1.8);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OxygenClient::drawScratch(QPainter *p, QPalette &palette, const int start, const int end, const int topMargin)
|
void OxygenClient::drawStripes(QPainter *p, QPalette &palette, const int start, const int end, const int topMargin)
|
||||||
{
|
{
|
||||||
QLinearGradient scratchlg(QPoint(start,0), QPoint(end,0));
|
QLinearGradient stripeGradient(QPoint(start,0), QPoint(end,0));
|
||||||
scratchlg.setColorAt(0.0, Qt::transparent);
|
stripeGradient.setColorAt(0.0, Qt::transparent);
|
||||||
scratchlg.setColorAt(0.05, KDecoration::options()->color(ColorTitleBar));
|
stripeGradient.setColorAt(0.05, KDecoration::options()->color(ColorTitleBar));
|
||||||
scratchlg.setColorAt(1.0, Qt::transparent);
|
stripeGradient.setColorAt(1.0, Qt::transparent);
|
||||||
QPen pen1(scratchlg, 0.5);
|
QPen pen1(stripeGradient, 0.5);
|
||||||
|
|
||||||
QLinearGradient scratchlg2(QPoint(start,0), QPoint(end,0));
|
QLinearGradient stripeGradient2(QPoint(start,0), QPoint(end,0));
|
||||||
scratchlg2.setColorAt(0.0, Qt::transparent);
|
stripeGradient2.setColorAt(0.0, Qt::transparent);
|
||||||
scratchlg2.setColorAt(0.05, helper_.calcLightColor(palette.color(QPalette::Window)));
|
stripeGradient2.setColorAt(0.05, helper_.calcLightColor(palette.color(QPalette::Window)));
|
||||||
scratchlg2.setColorAt(1.0, Qt::transparent);
|
stripeGradient2.setColorAt(1.0, Qt::transparent);
|
||||||
QPen pen2(scratchlg2, 0.5);
|
QPen pen2(stripeGradient2, 0.5);
|
||||||
|
|
||||||
bool antialiasing = p->testRenderHint(QPainter::Antialiasing);
|
bool antialiasing = p->testRenderHint(QPainter::Antialiasing);
|
||||||
p->setRenderHint(QPainter::Antialiasing, false);
|
p->setRenderHint(QPainter::Antialiasing, false);
|
||||||
|
|
|
@ -58,7 +58,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void paintEvent(QPaintEvent *e);
|
void paintEvent(QPaintEvent *e);
|
||||||
void drawScratch(QPainter *p, QPalette &palette, const int start, const int end, const int topMargin);
|
void drawStripes(QPainter *p, QPalette &palette, const int start, const int end, const int topMargin);
|
||||||
QColor titlebarTextColor(const QPalette &palette);
|
QColor titlebarTextColor(const QPalette &palette);
|
||||||
bool colorCacheInvalid_;
|
bool colorCacheInvalid_;
|
||||||
QColor cachedTitlebarTextColor_;
|
QColor cachedTitlebarTextColor_;
|
||||||
|
|
Loading…
Reference in a new issue