aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cmakeprojectmanager/configmodel.h
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2017-09-05 13:55:08 +0200
committerTobias Hunger <tobias.hunger@qt.io>2017-09-12 12:55:51 +0000
commitcacb6b17d06b1a3a62a2be30d124162bf329c309 (patch)
treed2ccff6e89edcf5cce23809519cfee57ab953861 /src/plugins/cmakeprojectmanager/configmodel.h
parent8e96bc91765efc8e0c376897ceb2c7451a9341e3 (diff)
CMake: Group entries in project configuration
Change-Id: I6aa797f5ff49a5cc33dfbdf0b25dcd78abbff66e Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/cmakeprojectmanager/configmodel.h')
-rw-r--r--src/plugins/cmakeprojectmanager/configmodel.h46
1 files changed, 34 insertions, 12 deletions
diff --git a/src/plugins/cmakeprojectmanager/configmodel.h b/src/plugins/cmakeprojectmanager/configmodel.h
index f9629f702f..f9b5b67ae6 100644
--- a/src/plugins/cmakeprojectmanager/configmodel.h
+++ b/src/plugins/cmakeprojectmanager/configmodel.h
@@ -26,17 +26,21 @@
#pragma once
#include <QAbstractTableModel>
+#include <utils/treemodel.h>
namespace CMakeProjectManager {
-class ConfigModel : public QAbstractTableModel
+namespace Internal { class ConfigModelTreeItem; }
+
+class ConfigModel : public Utils::TreeModel<>
{
Q_OBJECT
public:
enum Roles {
ItemTypeRole = Qt::UserRole,
- ItemValuesRole
+ ItemValuesRole,
+ ItemIsAdvancedRole
};
class DataItem {
@@ -54,14 +58,9 @@ public:
};
explicit ConfigModel(QObject *parent = nullptr);
+ ~ConfigModel() override;
- // QAbstractItemModel interface
- int rowCount(const QModelIndex &parent) const override;
- int columnCount(const QModelIndex &parent) const override;
- Qt::ItemFlags flags(const QModelIndex &index) const override;
- QVariant data(const QModelIndex &index, int role) const override;
- bool setData(const QModelIndex &index, const QVariant &value, int role) override;
- QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
+ QVariant data(const QModelIndex &idx, int role) const final;
void appendConfiguration(const QString &key,
const QString &value = QString(),
@@ -92,12 +91,35 @@ private:
bool isUserNew = false;
bool isCMakeChanged = false;
QString newValue;
+ QString kitValue;
};
- InternalDataItem &itemAtRow(int row);
- const InternalDataItem &itemAtRow(int row) const;
+ void setConfiguration(const QList<InternalDataItem> &config);
+ void generateTree();
+
QList<InternalDataItem> m_configuration;
- QHash<QString, QString> m_kitConfiguartion;
+ QHash<QString, QString> m_kitConfiguration;
+
+ friend class Internal::ConfigModelTreeItem;
+};
+
+namespace Internal {
+
+class ConfigModelTreeItem : public Utils::TreeItem
+{
+public:
+ ConfigModelTreeItem(ConfigModel::InternalDataItem *di = nullptr) : dataItem(di) {}
+ virtual ~ConfigModelTreeItem() override;
+
+ QVariant data(int column, int role) const final;
+ bool setData(int column, const QVariant &data, int role) final;
+ Qt::ItemFlags flags(int column) const final;
+
+ QString toolTip() const;
+ QString currentValue() const;
+
+ ConfigModel::InternalDataItem *dataItem;
};
+} // namespace Internal
} // namespace CMakeProjectManager