File indexing completed on 2024-04-28 15:52:01

0001 /*
0002     SPDX-FileCopyrightText: 2015 Laurent Montel <montel@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef WIDGETCONFIGURATIONTOOLSBASE_H
0008 #define WIDGETCONFIGURATIONTOOLSBASE_H
0009 
0010 #include <QWidget>
0011 class QListWidget;
0012 class QPushButton;
0013 
0014 class WidgetConfigurationToolsBase : public QWidget
0015 {
0016     Q_OBJECT
0017 
0018     Q_PROPERTY(QStringList tools READ tools WRITE setTools NOTIFY changed USER true)
0019 
0020 public:
0021     explicit WidgetConfigurationToolsBase(QWidget *parent = nullptr);
0022     ~WidgetConfigurationToolsBase() override;
0023 
0024     virtual QStringList tools() const = 0;
0025     virtual void setTools(const QStringList &items) = 0;
0026 
0027 Q_SIGNALS:
0028     void changed();
0029 
0030 protected:
0031     QListWidget *m_list;
0032 
0033 private:
0034     QPushButton *m_btnAdd;
0035     QPushButton *m_btnEdit;
0036     QPushButton *m_btnRemove;
0037     QPushButton *m_btnMoveUp;
0038     QPushButton *m_btnMoveDown;
0039 
0040 protected Q_SLOTS:
0041     virtual void slotAdd() = 0;
0042     virtual void slotEdit() = 0;
0043     void updateButtons();
0044     void slotRemove();
0045     void slotMoveUp();
0046     void slotMoveDown();
0047 };
0048 
0049 #endif // WIDGETCONFIGURATIONTOOLSBASE_H