File indexing completed on 2024-04-14 03:55:33

0001 /*
0002     SPDX-FileCopyrightText: 2011-2018 Dominik Haumann <dhaumann@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef VARIABLE_LIST_VIEW_H
0008 #define VARIABLE_LIST_VIEW_H
0009 
0010 #include <QScrollArea>
0011 #include <map>
0012 
0013 class VariableItem;
0014 class VariableEditor;
0015 
0016 class VariableListView : public QScrollArea
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     explicit VariableListView(const QString &variableLine, QWidget *parent = nullptr);
0022 
0023     void addItem(VariableItem *item);
0024 
0025     /// always returns the up-to-date variables line
0026     QString variableLine();
0027 
0028 Q_SIGNALS:
0029     void aboutToHide();
0030     void changed(); // unused right now
0031 
0032 protected:
0033     void resizeEvent(QResizeEvent *event) override;
0034     void hideEvent(QHideEvent *event) override;
0035 
0036     void parseVariables(const QString &line);
0037 
0038     std::vector<VariableItem *> m_items;
0039     std::vector<VariableEditor *> m_editors;
0040     std::map<QString, QString> m_variables;
0041 };
0042 
0043 #endif