}
-void ClipItem::refreshClip()
-{
- m_maxDuration = m_clip->maxDuration();
+void ClipItem::refreshClip(bool checkDuration)
+{
+ if (checkDuration && (m_maxDuration != m_clip->maxDuration())) {
+ m_maxDuration = m_clip->maxDuration();
+ if (m_clipType != IMAGE && m_clipType != TEXT && m_clipType != COLOR) {
+ if (m_cropStart + m_cropDuration > m_maxDuration) {
+ // Clip duration changed, make sure to stay in correct range
+ if (m_cropStart > m_maxDuration) {
+ m_cropStart = GenTime();
+ m_cropDuration = qMin(m_cropDuration, m_maxDuration);
+ updateRectGeometry();
+ } else {
+ m_cropDuration = m_maxDuration;
+ updateRectGeometry();
+ }
+ }
+ }
+ }
if (m_clipType == COLOR) {
QString colour = m_clip->getProperty("colour");
colour = colour.replace(0, 2, "#");
painter->setClipRect(exposed);
//Fill clip rectangle
- QRectF bgRect = br;
- bgRect.setLeft(br.left() + xoffset);
- painter->fillRect(bgRect, paintColor);
+ /*QRectF bgRect = br;
+ bgRect.setLeft(br.left() + xoffset);*/
+ painter->fillRect(exposed, paintColor);
//painter->setClipPath(resultClipPath, Qt::IntersectClip);
}
// Draw clip name
- // draw frame around clip
QColor frameColor(Qt::black);
int alphaBase = 60;
if (isSelected() || (parentItem() && parentItem()->isSelected())) {