diff options
| author | Arno <am@disconnect.de> | 2014-06-29 09:41:30 +0200 | 
|---|---|---|
| committer | Arno <am@disconnect.de> | 2014-06-29 09:41:30 +0200 | 
| commit | f295cfb8672d97bb5c804499bdb311a9a0d8039b (patch) | |
| tree | 77b54514e17d6bb453bd9431707f9f37954c9fc2 /mappingtreemodel.h | |
| parent | b5bd9cf0b981ee0c87ead9e20c36247932de7818 (diff) | |
| download | SheMov-f295cfb8672d97bb5c804499bdb311a9a0d8039b.tar.gz SheMov-f295cfb8672d97bb5c804499bdb311a9a0d8039b.tar.bz2 SheMov-f295cfb8672d97bb5c804499bdb311a9a0d8039b.zip | |
Major rework of MappingTreeResultView + Model
Well, I hope this fixes the crashes for good. String comparison for
looking up the parents really wasn't a prudent thing to do...
Use the ParentIds instead.
Diffstat (limited to 'mappingtreemodel.h')
| -rw-r--r-- | mappingtreemodel.h | 17 | 
1 files changed, 5 insertions, 12 deletions
| diff --git a/mappingtreemodel.h b/mappingtreemodel.h index efc4e2d..a730aaa 100644 --- a/mappingtreemodel.h +++ b/mappingtreemodel.h @@ -33,18 +33,14 @@ class MappingTreeModel : public SmTreeModel {          //data          QVariant data(const QModelIndex &index, int role) const;          QList<QVariant> childList(const QVariant &value, int column = 0) const; -        QStringList path(QModelIndex &idx) const; -        QModelIndex indexFromPath(const QString &path, int column = 0) const; +        QModelIndex indexFromParentPath(const QList<int> &pPath, bool reverse) const;          bool setData(const QModelIndex &idx, const QVariant &value, int role); -        bool move(const QModelIndex &source, const QModelIndex &dest);          bool addMappingType(const QString &type);          bool deleteMappingType(int typeId);          bool addChild(const QVariant &name, const QModelIndex &parent);          bool renameChild(const QModelIndex &idx, const QString newName);          bool deleteChild(const QModelIndex &idx);          MappingData mappingDataFromIndex(QModelIndex &idx) const; -        QStringList paths() const; -        const QString &forbidden() const { return mForbidden; }          const QSqlError &lastError() const { return mLastError; }      public slots: @@ -65,7 +61,6 @@ class MappingTreeModel : public SmTreeModel {          void getMappingTypes();          void getChildrenRecursive(SmTreeItem *item);          bool updateChild(SmTreeItem *item, const QVariant &value); -        QStringList getPathsRecursive(SmTreeItem *parent) const;          QList<QVariant> getChildListRecursive(SmTreeItem *item, int column) const;          QString basePath(SmTreeItem *item) const;          int lowerBound(SmTreeItem *item, const QVariant &value, int column = 0) const; @@ -88,8 +83,8 @@ class MappingTreeResultModel : public SmTreeModel {          //data + flags          Qt::ItemFlags flags(const QModelIndex &index) const; -        bool setData(const QModelIndex &index, const QVariant &value, int role); -        QModelIndex insertChild(const QVariant &data, int mappingId, int parentId, int descId, SmTreeItem *parent); +        virtual QVariant data(const QModelIndex &index, int role) const; +        virtual bool setData(const QModelIndex &index, const QVariant &value, int role);          QList<QVariant> columnValues(int column) const;          void clearData(); @@ -105,12 +100,10 @@ struct MappingData {      MappingData();      bool isValid();      int mappingId; -    int parentId;      int descId;      QString name; -    QList<QStringList> path; +    QList<int> parents; +    QStringList path;  }; -Q_DECLARE_METATYPE(QList<QStringList>) -  #endif // MAPPINGTREEMODEL_H | 
