summaryrefslogtreecommitdiffstats
path: root/smtreemodel.h
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2012-03-02 20:08:40 +0100
committerArno <am@disconnect.de>2012-03-02 20:08:40 +0100
commitee29bb41dc9c4d4dd6fc9bfd3fb9ad5cc3bd1569 (patch)
tree4801c4b23215259cec9620a32593c656fdfd8ede /smtreemodel.h
parent11bf52b6cf1c27a75715a8379e7893b8d1e16bf0 (diff)
downloadSheMov-ee29bb41dc9c4d4dd6fc9bfd3fb9ad5cc3bd1569.tar.gz
SheMov-ee29bb41dc9c4d4dd6fc9bfd3fb9ad5cc3bd1569.tar.bz2
SheMov-ee29bb41dc9c4d4dd6fc9bfd3fb9ad5cc3bd1569.zip
Make it possible to move mappings
Move mappings by context menu. Select new parent by QComboBox with available paths, items separated by "/". Note that hell will break loose if a mapping name contains "/". Will be fixed later. Since mapping views don't have setSortingEnabled(), make SmTreeModel::addRow() sort items. This fixes a long standing bug in SmTreeModel::reparent(): Since it alters the model, newParent has to be a QPersistentModelIndex to stay consistent.
Diffstat (limited to 'smtreemodel.h')
-rw-r--r--smtreemodel.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/smtreemodel.h b/smtreemodel.h
index e097d60..515f7b3 100644
--- a/smtreemodel.h
+++ b/smtreemodel.h
@@ -43,12 +43,12 @@ class SmTreeModel : public QAbstractItemModel {
bool setRoot(SmTreeItem *rootItem);
SmTreeItem *root() const { return mRootItem; }
SmTreeItem *parentItem(const QModelIndex &child) const;
- void reparent(const QModelIndex &idx, const QModelIndex &newParent);
+ void reparent(const QModelIndex &idx, const QModelIndex &newParent, bool sorted = false);
// row manipulation
- virtual bool insertRows(int row, int count, const QModelIndex &parent);
+ virtual bool insertRows(int row, int count, const QModelIndex &parent);
virtual bool removeRows(int row, int count, const QModelIndex &parent);
- bool addRow(const QList<QVariant> &data, const QModelIndex &parent);
+ bool addRow(const QList<QVariant> &data, const QModelIndex &parent, bool sorted = false);
//misc
void setDecorationIcon(const QIcon &icon) { mDecorationIcon = icon; }