#include <QStyleOptionGraphicsItem>
-Transition::Transition(const ItemInfo info, int transitiontrack, double fps, QDomElement params, bool automaticTransition) :
+Transition::Transition(const ItemInfo &info, int transitiontrack, double fps, QDomElement params, bool automaticTransition) :
AbstractClipItem(info, QRectF(), fps),
m_forceTransitionTrack(false),
m_automaticTransition(automaticTransition),
{
setZValue(3);
m_info.cropDuration = info.endPos - info.startPos;
- setPos(info.startPos.frames(fps), (qreal)(info.track * KdenliveSettings::trackheight() + itemOffset() + 1));
+ setPos(info.startPos.frames(fps), (int)(info.track * KdenliveSettings::trackheight() + itemOffset() + 1));
#if QT_VERSION >= 0x040600
m_startAnimation = new QPropertyAnimation(this, "rect");
m_info.cropStart = GenTime();
m_maxDuration = GenTime(600);
- if (m_automaticTransition) setBrush(QColor(200, 200, 50, 100));
- else setBrush(QColor(200, 100, 50, 100));
+ if (m_automaticTransition) setBrush(QColor(200, 200, 50, 180));
+ else setBrush(QColor(200, 100, 50, 180));
//m_referenceClip = clipa;
if (params.isNull()) {
m_automaticTransition = automatic;
if (automatic) {
m_parameters.setAttribute("automatic", 1);
- setBrush(QColor(200, 200, 50, 150));
+ setBrush(QColor(200, 200, 50, 180));
} else {
m_parameters.removeAttribute("automatic");
- setBrush(QColor(200, 50, 50, 150));
+ setBrush(QColor(200, 100, 50, 180));
}
update();
}
const QRectF exposed = option->exposedRect;
painter->setClipRect(exposed);
const QRectF br = rect();
- const QRectF mapped = painter->matrix().mapRect(br);
+ QPen framePen;
+ const QRectF mapped = painter->worldTransform().mapRect(br);
painter->fillRect(exposed, brush());
- //int top = (int)(br.y() + br.height() / 2 - 7);
QPointF p1(br.x(), br.y() + br.height() / 2 - 7);
- painter->setMatrixEnabled(false);
- //painter->drawPixmap(painter->matrix().map(p1) + QPointF(5, 0), transitionPixmap());
+ painter->setWorldMatrixEnabled(false);
const QString text = m_name + (m_forceTransitionTrack ? "|>" : QString());
// Draw clip name
- QColor frameColor(brush().color().darker());
if (isSelected() || (parentItem() && parentItem()->isSelected())) {
- frameColor = QColor(Qt::red);
+ framePen.setColor(Qt::red);
+ framePen.setWidthF(2.0);
+ }
+ else {
+ framePen.setColor(brush().color().darker());
}
- frameColor.setAlpha(160);
const QRectF txtBounding = painter->boundingRect(mapped, Qt::AlignHCenter | Qt::AlignVCenter, ' ' + text + ' ');
- //painter->fillRect(txtBounding2, frameColor);
- painter->setBrush(frameColor);
+ painter->setBrush(framePen.color());
painter->setPen(Qt::NoPen);
painter->drawRoundedRect(txtBounding, 3, 3);
painter->setBrush(QBrush(Qt::NoBrush));
painter->drawText(txtBounding, Qt::AlignCenter, text);
// Draw frame
- QPen pen = painter->pen();
- pen.setColor(frameColor);
- painter->setPen(pen);
+ painter->setPen(framePen);
painter->setClipping(false);
- painter->drawRect(painter->matrix().mapRect(rect()));
+ painter->drawRect(mapped.adjusted(0, 0, -0.5, -0.5));
}
int Transition::type() const
int newTrack = newPos.y() / KdenliveSettings::trackheight();
newTrack = qMin(newTrack, projectScene()->tracksCount() - 1);
newTrack = qMax(newTrack, 0);
- newPos.setY((int)(newTrack * KdenliveSettings::trackheight() + KdenliveSettings::trackheight() / 3 * 2));
+ newPos.setY((int)(newTrack * KdenliveSettings::trackheight() + itemOffset() + 1));
// Only one clip is moving
QRectF sceneShape = rect();
sceneShape.translate(newPos);