KWin
Loading...
Searching...
No Matches
clientmodel.h
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 2009 Martin Gräßlin <mgraesslin@kde.org>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9
10#pragma once
11#include "tabboxhandler.h"
12
13#include <QModelIndex>
22namespace KWin
23{
24namespace TabBox
25{
26
34 : public QAbstractItemModel
35{
36 Q_OBJECT
37public:
38 enum {
39 ClientRole = Qt::UserRole,
40 CaptionRole = Qt::UserRole + 1,
41 DesktopNameRole = Qt::UserRole + 2,
42 IconRole = Qt::UserRole + 3, // TODO: to be removed
43 WIdRole = Qt::UserRole + 5,
44 MinimizedRole = Qt::UserRole + 6,
45 CloseableRole = Qt::UserRole + 7
46 };
47 explicit ClientModel(QObject *parent = nullptr);
48 ~ClientModel() override;
49 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
50 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
51 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
52 QModelIndex parent(const QModelIndex &child) const override;
53 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
54 QHash<int, QByteArray> roleNames() const override;
55 Q_INVOKABLE QString longestCaption() const;
56
62 QModelIndex index(Window *client) const;
63
72 void createClientList(bool partialReset = false);
76 QList<Window *> clientList() const
77 {
78 return m_mutableClientList;
79 }
80
81public Q_SLOTS:
82 void close(int index);
87 void activate(int index);
88
89private:
90 void createFocusChainClientList(Window *start);
91 void createStackingOrderClientList(Window *start);
92
93 QList<Window *> m_clientList;
94 QList<Window *> m_mutableClientList;
95};
96
97} // namespace Tabbox
98} // namespace KWin
QHash< int, QByteArray > roleNames() const override
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
@ CloseableRole
Window can be closed.
Definition clientmodel.h:45
@ CaptionRole
The caption of Window.
Definition clientmodel.h:40
@ DesktopNameRole
The name of the desktop the Window is on.
Definition clientmodel.h:41
@ MinimizedRole
Window is minimized.
Definition clientmodel.h:44
@ WIdRole
The window ID of Window.
Definition clientmodel.h:43
QList< Window * > clientList() const
Definition clientmodel.h:76
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
QModelIndex parent(const QModelIndex &child) const override
ClientModel(QObject *parent=nullptr)
int rowCount(const QModelIndex &parent=QModelIndex()) const override
void createClientList(bool partialReset=false)
Q_INVOKABLE QString longestCaption() const
int columnCount(const QModelIndex &parent=QModelIndex()) const override