widgetconfigurationtoolsbase.h 1.63 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/***************************************************************************
 *   Copyright (C) 2015 by Laurent Montel <montel@kde.org>                 *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/

#ifndef WIDGETCONFIGURATIONTOOLSBASE_H
#define WIDGETCONFIGURATIONTOOLSBASE_H

#include <QWidget>
class QListWidget;
class QPushButton;

class WidgetConfigurationToolsBase : public QWidget
{
    Q_OBJECT

    Q_PROPERTY( QStringList tools READ tools WRITE setTools NOTIFY changed USER true )

    public:
Albert Astals Cid's avatar
Albert Astals Cid committed
24
        explicit WidgetConfigurationToolsBase( QWidget * parent = nullptr );
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
        ~WidgetConfigurationToolsBase();

        virtual QStringList tools() const = 0;
        virtual void setTools(const QStringList& items) = 0;

    Q_SIGNALS:
        void changed();

    protected:
        QListWidget *m_list;
    private:
        QPushButton *m_btnAdd;
        QPushButton *m_btnEdit;
        QPushButton *m_btnRemove;
        QPushButton *m_btnMoveUp;
        QPushButton *m_btnMoveDown;

42
    protected Q_SLOTS:
43 44 45 46 47 48 49 50 51
        virtual void slotAdd() = 0;
        virtual void slotEdit() = 0;
        void updateButtons();
        void slotRemove();
        void slotMoveUp();
        void slotMoveDown();
};

#endif // WIDGETCONFIGURATIONTOOLSBASE_H