API change:
changed paintPanel(QPainter* painter, const QRectF& rect, const QPointF& pos = QPointF(0, 0)); into void paintPanel(QPainter* painter, const QRectF& target, const QRectF& source); and void paintPanel(QPainter* painter, const QPointF& pos = QPointF(0, 0)); to be more similat di QPainter::drawPixmap api svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=838379
This commit is contained in:
parent
41b82ff620
commit
aaab3a310a
@ -880,7 +880,7 @@ void Applet::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QW
|
||||
formFactor() != Plasma::Vertical &&
|
||||
formFactor() != Plasma::Horizontal) {
|
||||
//kDebug() << "option rect is" << option->rect;
|
||||
d->background->paintPanel(p, option->rect, QPointF(0,0));
|
||||
d->background->paintPanel(p);
|
||||
}
|
||||
|
||||
if (!d->failed) {
|
||||
|
@ -94,7 +94,7 @@ void Dialog::paintEvent(QPaintEvent *e)
|
||||
p.setClipRect(e->rect());
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source );
|
||||
p.fillRect(rect(), Qt::transparent);
|
||||
d->background->paintPanel(&p, e->rect());
|
||||
d->background->paintPanel(&p);
|
||||
}
|
||||
|
||||
void Dialog::resizeEvent(QResizeEvent *e)
|
||||
|
16
panelsvg.cpp
16
panelsvg.cpp
@ -353,16 +353,26 @@ void PanelSvg::clearCache()
|
||||
}
|
||||
}
|
||||
|
||||
void PanelSvg::paintPanel(QPainter* painter, const QRectF& rect, const QPointF& pos)
|
||||
void PanelSvg::paintPanel(QPainter* painter, const QRectF& target, const QRectF& source)
|
||||
{
|
||||
//kDebug();
|
||||
PanelData *panel = d->panels[d->prefix];
|
||||
if (!panel->cachedBackground) {
|
||||
d->generateBackground(panel);
|
||||
Q_ASSERT(panel->cachedBackground);
|
||||
}
|
||||
|
||||
painter->drawPixmap(rect, *(panel->cachedBackground), rect.translated(-pos.x(),-pos.y()));
|
||||
painter->drawPixmap(target, *(panel->cachedBackground), source);
|
||||
}
|
||||
|
||||
void PanelSvg::paintPanel(QPainter* painter, const QPointF& pos)
|
||||
{
|
||||
PanelData *panel = d->panels[d->prefix];
|
||||
if (!panel->cachedBackground) {
|
||||
d->generateBackground(panel);
|
||||
Q_ASSERT(panel->cachedBackground);
|
||||
}
|
||||
|
||||
painter->drawPixmap(pos, *(panel->cachedBackground));
|
||||
}
|
||||
|
||||
void PanelSvgPrivate::generateBackground(PanelData *panel)
|
||||
|
13
panelsvg.h
13
panelsvg.h
@ -191,9 +191,18 @@ class PLASMA_EXPORT PanelSvg : public Svg
|
||||
/**
|
||||
* Paints the loaded SVG with the elements that represents the border
|
||||
* @arg painter the QPainter to use
|
||||
* @arg rect the exposed rect to draw into
|
||||
* @arg target the target rectangle on the paint device
|
||||
* @arg source the portion rectangle of the source image
|
||||
*/
|
||||
Q_INVOKABLE void paintPanel(QPainter* painter, const QRectF& rect, const QPointF& pos = QPointF(0, 0));
|
||||
Q_INVOKABLE void paintPanel(QPainter* painter, const QRectF& target, const QRectF& source);
|
||||
|
||||
/**
|
||||
* Paints the loaded SVG with the elements that represents the border
|
||||
* This is an overloaded member provided for convenience
|
||||
* @arg painter the QPainter to use
|
||||
* @arg pos where to paint the svg
|
||||
*/
|
||||
Q_INVOKABLE void paintPanel(QPainter* painter, const QPointF& pos = QPointF(0, 0));
|
||||
|
||||
private:
|
||||
PanelSvgPrivate * const d;
|
||||
|
@ -169,7 +169,7 @@ void ToolTip::paintEvent(QPaintEvent *e)
|
||||
painter.setCompositionMode(QPainter::CompositionMode_Source );
|
||||
painter.fillRect(rect(), Qt::transparent);
|
||||
|
||||
d->background->paintPanel(&painter, rect());
|
||||
d->background->paintPanel(&painter);
|
||||
}
|
||||
|
||||
void ToolTip::sourceDestroyed()
|
||||
|
Loading…
Reference in New Issue
Block a user