kwin/kcmkwin/kwindecoration/declarative-plugin/buttonsmodel.h
Vlad Zahorodnii 1fb9f6f13a Switch to SPDX license markers
The main advantage of SPDX license identifiers over the traditional
license headers is that it's more difficult to overlook inappropriate
licenses for kwin, for example GPL 3. We also don't have to copy a
lot of boilerplate text.

In order to create this change, I ran licensedigger -r -c from the
toplevel source directory.
2020-08-07 19:57:56 +00:00

52 lines
1.4 KiB
C++

/*
* SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#ifndef KDECOARTIONS_PREVIEW_BUTTONS_MODEL_H
#define KDECOARTIONS_PREVIEW_BUTTONS_MODEL_H
#include <KDecoration2/DecorationButton>
#include <QAbstractListModel>
namespace KDecoration2
{
namespace Preview
{
class PreviewBridge;
class ButtonsModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit ButtonsModel(const QVector< DecorationButtonType > &buttons, QObject *parent = nullptr);
explicit ButtonsModel(QObject *parent = nullptr);
~ButtonsModel() override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QHash< int, QByteArray > roleNames() const override;
QVector< DecorationButtonType > buttons() const {
return m_buttons;
}
Q_INVOKABLE void clear();
Q_INVOKABLE void remove(int index);
Q_INVOKABLE void up(int index);
Q_INVOKABLE void down(int index);
Q_INVOKABLE void move(int sourceIndex, int targetIndex);
void replace(const QVector< DecorationButtonType > &buttons);
void add(DecorationButtonType type);
Q_INVOKABLE void add(int index, int type);
private:
QVector< DecorationButtonType > m_buttons;
};
}
}
#endif