shift-shell/components/mobileshell/taskswitcher/displaysmodel.h
Devin Lin 210042a6bf libmobileshell: Move back to QML plugin
Move from a C++ library + QML plugin to a QML plugin only for simplicity, since the homescreen switching architecture will be done from Plasma, and so use of the shell library only needs to be from QML.
2022-03-21 10:00:09 -04:00

44 lines
1.2 KiB
C++

/*
* SPDX-FileCopyrightText: 2021 Aleix Pol <apol@kde.org>
* SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <QAbstractListModel>
#include <QRect>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/output.h>
#include <KWayland/Client/plasmashell.h>
#include <KWayland/Client/plasmawindowmanagement.h>
#include <KWayland/Client/registry.h>
#include <KWayland/Client/surface.h>
class DisplaysModel : public QAbstractListModel
{
public:
enum Roles {
Model = Qt::DisplayRole,
Geometry = Qt::UserRole,
Position,
Output,
};
DisplaysModel(QObject *parent = nullptr);
void createOutput(wl_output *output);
Q_INVOKABLE void sendWindowToOutput(const QString &uuid, KWayland::Client::Output *output);
QHash<int, QByteArray> roleNames() const override;
int rowCount(const QModelIndex &parent) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
private:
KWayland::Client::PlasmaWindowManagement *m_windowManagement = nullptr;
QVector<KWayland::Client::Output *> m_outputs;
};