void Transition::setTransitionParameters(const QDomElement params) {
m_parameters = params;
m_name = m_parameters.elementsByTagName("name").item(0).toElement().text();
+ update();
}
void Transition::paint(QPainter *painter,
const QStyleOptionGraphicsItem *option,
QWidget *widget) {
- QRect rectInView = visibleRect();//this is the rect that is visible by the user
- if (rectInView.isNull())
- return;
- QPainterPath clippath;
- clippath.addRect(rectInView);
+ painter->setClipRect(option->exposedRect);
QRectF br = rect();
QPainterPath roundRectPathUpper = upperRectPart(br), roundRectPathLower = lowerRectPart(br);
-
QPainterPath resultClipPath = roundRectPathUpper.united(roundRectPathLower);
- painter->setClipPath(resultClipPath.intersected(clippath), Qt::IntersectClip);
+
#if 0
QRadialGradient radialGrad(QPointF(br.x() + 50, br.y() + 20), 70);
radialGrad.setColorAt(0, QColor(200, 200, 0, 100));
radialGrad.setColorAt(1, QColor(100, 100, 0, 100));
painter->fillRect(br.intersected(rectInView), QBrush(radialGrad)/*,Qt::Dense4Pattern*/);
#else
- m_gradient.setStart(0, br.y());
- m_gradient.setFinalStop(0, br.bottom());
- painter->fillRect(br.intersected(rectInView), m_gradient);
+ m_gradient.setStart(0, br.y());
+ m_gradient.setFinalStop(0, br.bottom());
+ painter->fillPath(resultClipPath, m_gradient);
#endif
- painter->setClipRect(option->exposedRect);
- int top = (int)(br.y() + br.height() / 2 - 7);
+
+ int top = (int)(br.y() + br.height() / 2 - 7);
painter->drawPixmap((int)(br.x() + 10), top, transitionPixmap());
- painter->drawPath(resultClipPath.intersected(clippath));
painter->setPen(QColor(0, 0, 0, 180));
- top += painter->fontInfo().pixelSize();
+ top += painter->fontInfo().pixelSize();
painter->drawText((int)br.x() + 31, top + 1, transitionName());
painter->setPen(QColor(255, 255, 255, 180));
painter->drawText((int)br.x() + 30, top, transitionName());
//pen.setWidth(1);
}
painter->setPen(pen);
- painter->setClipRect(option->exposedRect);
- painter->drawPath(resultClipPath.intersected(clippath));
+ painter->drawPath(resultClipPath);
}
int Transition::type() const {