Sort clip zones by position instead of name

parent 4cfa2b97
......@@ -95,8 +95,16 @@ bool ProjectSortProxyModel::lessThan(const QModelIndex &left, const QModelIndex
int rightType = sourceModel()->data(right, AbstractProjectItem::ItemTypeRole).toInt();
if (leftType == rightType) {
// Let the normal alphabetical sort happen
QVariant leftData = sourceModel()->data(left, Qt::DisplayRole);
QVariant rightData = sourceModel()->data(right, Qt::DisplayRole);
QVariant leftData;
QVariant rightData;
if (leftType == AbstractProjectItem::SubClipItem) {
// Subclips, sort by start position
leftData = sourceModel()->data(left, AbstractProjectItem::DataDuration);
rightData = sourceModel()->data(right, AbstractProjectItem::DataDuration);
} else {
leftData = sourceModel()->data(left, Qt::DisplayRole);
rightData = sourceModel()->data(right, Qt::DisplayRole);
}
if (leftData.type() == QVariant::DateTime) {
return leftData.toDateTime() < rightData.toDateTime();
}
......
......@@ -34,6 +34,7 @@ ProjectSubClip::ProjectSubClip(ProjectClip *parent, int in, int out, const QStri
, m_in(in)
, m_out(out)
{
m_duration = timecode;
QPixmap pix(64, 36);
pix.fill(Qt::lightGray);
m_thumbnail = QIcon(pix);
......@@ -44,7 +45,6 @@ ProjectSubClip::ProjectSubClip(ProjectClip *parent, int in, int out, const QStri
}
m_clipStatus = StatusReady;
setParent(parent);
m_duration = timecode;
// Save subclip in MLT
parent->setProducerProperty("kdenlive:clipzone." + m_name, QString::number(in) + QLatin1Char(';') + QString::number(out));
connect(parent, &ProjectClip::thumbReady, this, &ProjectSubClip::gotThumb);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment