aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/environmentmodel.h
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2019-05-07 16:51:22 +0200
committerMarco Bubke <marco.bubke@qt.io>2019-06-13 16:51:48 +0000
commit4bae5de36b530bbef06ec7cb1fbfb7453fd59dc7 (patch)
treee8631b82915aef669fd63e6b0a72a1088185fa7e /src/libs/utils/environmentmodel.h
parentf636f06b458782289340a61e42e6bbc1e523f937 (diff)
Enable macro editing for the Clang indexer
Refactor much of the code from Environment* classes to NameValue* classes to share it with the preprocessor macro settings. Change-Id: Ica4ee817aa338230c422b30d91240d266248d226 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src/libs/utils/environmentmodel.h')
-rw-r--r--src/libs/utils/environmentmodel.h44
1 files changed, 3 insertions, 41 deletions
diff --git a/src/libs/utils/environmentmodel.h b/src/libs/utils/environmentmodel.h
index db202246519..ac5f017448c 100644
--- a/src/libs/utils/environmentmodel.h
+++ b/src/libs/utils/environmentmodel.h
@@ -25,55 +25,17 @@
#pragma once
-#include "utils_global.h"
-
-#include <QAbstractTableModel>
+#include "namevaluemodel.h"
namespace Utils {
-class Environment;
-class EnvironmentItem;
-
-namespace Internal { class EnvironmentModelPrivate; }
-class QTCREATOR_UTILS_EXPORT EnvironmentModel : public QAbstractTableModel
+class QTCREATOR_UTILS_EXPORT EnvironmentModel : public NameValueModel
{
Q_OBJECT
public:
- explicit EnvironmentModel(QObject *parent = nullptr);
- ~EnvironmentModel() override;
-
- int rowCount(const QModelIndex &parent) const override;
- int columnCount(const QModelIndex &parent) const override;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
- bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
- Qt::ItemFlags flags(const QModelIndex &index) const override;
- QVariant headerData(int section, Qt::Orientation orientation,
- int role = Qt::DisplayRole) const override;
-
- QModelIndex addVariable();
- QModelIndex addVariable(const EnvironmentItem &item);
- void resetVariable(const QString &name);
- void unsetVariable(const QString &name);
- bool canUnset(const QString &name);
- bool canReset(const QString &name);
- QString indexToVariable(const QModelIndex &index) const;
- QModelIndex variableToIndex(const QString &name) const;
- bool changes(const QString &key) const;
- Environment baseEnvironment() const;
+ const Environment &baseEnvironment() const;
void setBaseEnvironment(const Environment &env);
- QList<EnvironmentItem> userChanges() const;
- void setUserChanges(const QList<EnvironmentItem> &list);
-
-signals:
- void userChangesChanged();
- /// Hint to the view where it should make sense to focus on next
- // This is a hack since there is no way for a model to suggest
- // the next interesting place to focus on to the view.
- void focusIndex(const QModelIndex &index);
-
-private:
- Internal::EnvironmentModelPrivate *d;
};
} // namespace Utils