summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <jb@kdenlive.org>2017-11-01 07:46:33 (GMT)
committerJean-Baptiste Mardelle <jb@kdenlive.org>2017-11-04 09:34:21 (GMT)
commit3f9180b5c092cabcae48afcf698bdd8c829fe61a (patch)
tree37fad372cd55e30fc5616f8b5b90102805e3dad9
parent4cfa2b978ac668aeec2a27d571c5d88261fe2c08 (diff)
Sort clip zones by position instead of name
-rw-r--r--src/bin/projectsortproxymodel.cpp12
-rw-r--r--src/bin/projectsubclip.cpp2
2 files changed, 11 insertions, 3 deletions
diff --git a/src/bin/projectsortproxymodel.cpp b/src/bin/projectsortproxymodel.cpp
index 6cc3bd1..bbaf424 100644
--- a/src/bin/projectsortproxymodel.cpp
+++ b/src/bin/projectsortproxymodel.cpp
@@ -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();
}
diff --git a/src/bin/projectsubclip.cpp b/src/bin/projectsubclip.cpp
index f6f6746..96f7c2b 100644
--- a/src/bin/projectsubclip.cpp
+++ b/src/bin/projectsubclip.cpp
@@ -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);