| 1 | /* |
| 2 | SPDX-FileCopyrightText: 2011-2018 Dominik Haumann <dhaumann@kde.org> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 | */ |
| 6 | |
| 7 | #ifndef VARIABLE_LIST_VIEW_H |
| 8 | #define VARIABLE_LIST_VIEW_H |
| 9 | |
| 10 | #include <QScrollArea> |
| 11 | #include <map> |
| 12 | |
| 13 | class VariableItem; |
| 14 | class VariableEditor; |
| 15 | |
| 16 | class VariableListView : public QScrollArea |
| 17 | { |
| 18 | Q_OBJECT |
| 19 | |
| 20 | public: |
| 21 | explicit VariableListView(const QString &variableLine, QWidget *parent = nullptr); |
| 22 | |
| 23 | void addItem(VariableItem *item); |
| 24 | |
| 25 | /// always returns the up-to-date variables line |
| 26 | QString variableLine(); |
| 27 | |
| 28 | Q_SIGNALS: |
| 29 | void aboutToHide(); |
| 30 | void changed(); // unused right now |
| 31 | |
| 32 | protected: |
| 33 | void resizeEvent(QResizeEvent *event) override; |
| 34 | void hideEvent(QHideEvent *event) override; |
| 35 | |
| 36 | void parseVariables(const QString &line); |
| 37 | |
| 38 | std::vector<VariableItem *> m_items; |
| 39 | std::vector<VariableEditor *> m_editors; |
| 40 | std::map<QString, QString> m_variables; |
| 41 | }; |
| 42 | |
| 43 | #endif |
| 44 | |