Commit 7fd21d22 authored by hjk's avatar hjk

ProjectExplorer: Use Utils::TreeModel for KitModel

Simplifies code.

Change-Id: I3db07f8b0ffd980856e65abee856559a0a85dfdb
Reviewed-by: default avatarTobias Hunger <>
parent e62e47f0
This diff is collapsed.
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "projectexplorer_export.h" #include "projectexplorer_export.h"
#include <QAbstractItemModel> #include <utils/treemodel.h>
class QBoxLayout; class QBoxLayout;
...@@ -54,22 +54,12 @@ class KitNode; ...@@ -54,22 +54,12 @@ class KitNode;
// KitModel: // KitModel:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
class KitModel : public QAbstractItemModel class KitModel : public Utils::TreeModel
{ {
public: public:
explicit KitModel(QBoxLayout *parentLayout, QObject *parent = 0); explicit KitModel(QBoxLayout *parentLayout, QObject *parent = 0);
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
Kit *kit(const QModelIndex &); Kit *kit(const QModelIndex &);
QModelIndex indexOf(Kit *k) const; QModelIndex indexOf(Kit *k) const;
...@@ -95,19 +85,16 @@ private slots: ...@@ -95,19 +85,16 @@ private slots:
void updateKit(ProjectExplorer::Kit *k); void updateKit(ProjectExplorer::Kit *k);
void removeKit(ProjectExplorer::Kit *k); void removeKit(ProjectExplorer::Kit *k);
void changeDefaultKit(); void changeDefaultKit();
void setDirty();
void validateKitNames(); void validateKitNames();
private: private:
QModelIndex index(KitNode *, int column = 0) const; QModelIndex index(KitNode *, int column = 0) const;
KitNode *findWorkingCopy(Kit *k) const; KitNode *findWorkingCopy(Kit *k) const;
KitNode *createNode(KitNode *parent, Kit *k); KitNode *createNode(Kit *k);
void setDefaultNode(KitNode *node); void setDefaultNode(KitNode *node);
QList<Kit *> kitList(KitNode *node) const;
KitNode *m_root; Utils::TreeItem *m_autoRoot;
KitNode *m_autoRoot; Utils::TreeItem *m_manualRoot;
KitNode *m_manualRoot;
QList<KitNode *> m_toRemoveList; QList<KitNode *> m_toRemoveList;
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