put mask calculation in separate method, to be used in preview mode. In preview mode, set painter clipMask so that it matches widget mask, to fix corner painting
svn path=/trunk/KDE/kdebase/workspace/; revision=1017184
This commit is contained in:
parent
6d329bb015
commit
bc78e76281
2 changed files with 15 additions and 7 deletions
|
@ -227,6 +227,8 @@ WebClient::paintEvent(QPaintEvent * pe)
|
||||||
titleEdgeBottomBottom-(r_y+titleEdgeTop) );
|
titleEdgeBottomBottom-(r_y+titleEdgeTop) );
|
||||||
titleRect.setTop(1);
|
titleRect.setTop(1);
|
||||||
|
|
||||||
|
QRegion mask( calcMask() );
|
||||||
|
|
||||||
QPainter p(widget());
|
QPainter p(widget());
|
||||||
|
|
||||||
p.setPen(Qt::black);
|
p.setPen(Qt::black);
|
||||||
|
@ -235,13 +237,15 @@ WebClient::paintEvent(QPaintEvent * pe)
|
||||||
p.setBrush( pal.background() );
|
p.setBrush( pal.background() );
|
||||||
|
|
||||||
p.setClipRegion(pe->region() - titleRect);
|
p.setClipRegion(pe->region() - titleRect);
|
||||||
|
if( isPreview() && shape_ ) p.setClipRegion( mask, Qt::IntersectClip );
|
||||||
|
|
||||||
|
|
||||||
QRect r(widget()->rect());
|
QRect r(widget()->rect());
|
||||||
r.adjust(0, 0, -1, -1);
|
r.adjust(0, 0, -1, -1);
|
||||||
p.drawRect(r);
|
p.drawRect(r);
|
||||||
|
|
||||||
p.setClipRegion(pe->region());
|
p.setClipRegion(pe->region());
|
||||||
|
if( isPreview() && shape_ ) p.setClipRegion( mask, Qt::IntersectClip );
|
||||||
p.fillRect(titleRect, options()->color(ColorTitleBar, isActive()));
|
p.fillRect(titleRect, options()->color(ColorTitleBar, isActive()));
|
||||||
|
|
||||||
if (shape_)
|
if (shape_)
|
||||||
|
@ -289,11 +293,8 @@ WebClient::paintEvent(QPaintEvent * pe)
|
||||||
p.drawText(titleRect, Qt::AlignCenter, caption());
|
p.drawText(titleRect, Qt::AlignCenter, caption());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebClient::updateWindowShape()
|
QRegion WebClient::calcMask(void) const
|
||||||
{
|
{
|
||||||
if (!shape_)
|
|
||||||
return;
|
|
||||||
|
|
||||||
QRegion mask(0, 0, width(), height());
|
QRegion mask(0, 0, width(), height());
|
||||||
|
|
||||||
int r(width());
|
int r(width());
|
||||||
|
@ -326,8 +327,14 @@ void WebClient::updateWindowShape()
|
||||||
mask -= QRegion(r - 3, b - 2, 3, 1);
|
mask -= QRegion(r - 3, b - 2, 3, 1);
|
||||||
mask -= QRegion(r - 2, b - 3, 2, 1);
|
mask -= QRegion(r - 2, b - 3, 2, 1);
|
||||||
mask -= QRegion(r - 1, b - 5, 1, 2);
|
mask -= QRegion(r - 1, b - 5, 1, 2);
|
||||||
|
return mask;
|
||||||
|
}
|
||||||
|
|
||||||
setMask(mask);
|
void WebClient::updateWindowShape()
|
||||||
|
{
|
||||||
|
if (!shape_)
|
||||||
|
return;
|
||||||
|
setMask(calcMask());
|
||||||
}
|
}
|
||||||
|
|
||||||
KDecoration* WebFactory::createDecoration( KDecorationBridge* b )
|
KDecoration* WebFactory::createDecoration( KDecorationBridge* b )
|
||||||
|
|
|
@ -45,6 +45,7 @@ namespace Web
|
||||||
virtual int layoutMetric(LayoutMetric lm, bool respectWindowState = true, const KCommonDecorationButton * = 0) const;
|
virtual int layoutMetric(LayoutMetric lm, bool respectWindowState = true, const KCommonDecorationButton * = 0) const;
|
||||||
virtual KCommonDecorationButton *createButton(ButtonType type);
|
virtual KCommonDecorationButton *createButton(ButtonType type);
|
||||||
|
|
||||||
|
virtual QRegion calcMask( void ) const;
|
||||||
virtual void updateWindowShape();
|
virtual void updateWindowShape();
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
|
|
Loading…
Reference in a new issue