Commit 3c7443df authored by Tusooa Zhu's avatar Tusooa Zhu 🔼

Make items in SnapshotView editable

parent 9038e32c
......@@ -127,6 +127,15 @@ bool KisSnapshotModel::setData(const QModelIndex &index, const QVariant &value,
return false;
}
Qt::ItemFlags KisSnapshotModel::flags(const QModelIndex &index) const
{
if (!index.isValid()) {
return Qt::ItemIsEnabled;
}
return QAbstractListModel::flags(index) | Qt::ItemIsEditable;
}
void KisSnapshotModel::setCanvas(QPointer<KisCanvas2> canvas)
{
if (m_d->curCanvas == canvas) {
......
......@@ -34,6 +34,8 @@ public:
int rowCount(const QModelIndex &parent) const override;
QVariant data(const QModelIndex &index, int role) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
// this function is re-implemented to make the items editable
Qt::ItemFlags flags(const QModelIndex &index) const override;
void setCanvas(QPointer<KisCanvas2> canvas);
public Q_SLOTS:
......
......@@ -30,7 +30,7 @@ KisSnapshotView::KisSnapshotView()
: QListView()
, m_d(new Private)
{
setEditTriggers(QAbstractItemView::SelectedClicked);
setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::SelectedClicked);
}
KisSnapshotView::~KisSnapshotView()
......
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