X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fsubprojectitem.cpp;h=7b1f7450db93ac536663b68537d65bcebba08d6e;hb=c3302003093710ee247ad84c0fe2ef3c579d417f;hp=1e296354c164ca87d1f5e47a5deb59f48809ea79;hpb=8bcc799b522e6e5ae0299973b4d296bef831a17f;p=kdenlive diff --git a/src/subprojectitem.cpp b/src/subprojectitem.cpp index 1e296354..7b1f7450 100644 --- a/src/subprojectitem.cpp +++ b/src/subprojectitem.cpp @@ -24,22 +24,27 @@ #include "kdenlivesettings.h" #include "docclipbase.h" + #include #include #include const int DurationRole = Qt::UserRole + 1; +const int itemHeight = 30; -SubProjectItem::SubProjectItem(QTreeWidgetItem * parent, int in, int out, QString description) : +SubProjectItem::SubProjectItem(double display_ratio, QTreeWidgetItem * parent, int in, int out, const QString &description) : QTreeWidgetItem(parent, PROJECTSUBCLIPTYPE), m_in(in), m_out(out), m_description(description) { - setSizeHint(0, QSize(65, 30)); - setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable); + setSizeHint(0, QSize((int) (itemHeight * display_ratio) + 2, itemHeight + 2)); + setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsDropEnabled); QString name = Timecode::getStringTimecode(in, KdenliveSettings::project_fps()); setText(0, name); setText(1, description); GenTime duration = GenTime(out - in, KdenliveSettings::project_fps()); if (duration != GenTime()) setData(0, DurationRole, Timecode::getEasyTimecode(duration, KdenliveSettings::project_fps())); + QPixmap pix((int) (itemHeight * display_ratio), itemHeight); + pix.fill(Qt::gray); + setData(0, Qt::DecorationRole, pix); //setFlags(Qt::NoItemFlags); //kDebug() << "Constructed with clipId: " << m_clipId; } @@ -54,6 +59,12 @@ int SubProjectItem::numReferences() const return 0; } +//static +int SubProjectItem::itemDefaultHeight() +{ + return itemHeight; +} + QDomElement SubProjectItem::toXml() const { //return m_clip->toXML(); @@ -66,7 +77,7 @@ QPoint SubProjectItem::zone() const return z; } -void SubProjectItem::setZone(QPoint p) +void SubProjectItem::setZone(const QPoint& p) { m_in = p.x(); m_out = p.y(); @@ -86,7 +97,7 @@ QString SubProjectItem::description() const return m_description; } -void SubProjectItem::setDescription(QString desc) +void SubProjectItem::setDescription(const QString &desc) { m_description = desc; setText(1, m_description);