Unity 8
|
A model of top-level surfaces. More...
#include <plugins/WindowManager/TopLevelWindowModel.h>
Inherits QAbstractListModel.
Public Types | |
enum | Roles { WindowRole = Qt::UserRole, ApplicationRole = Qt::UserRole + 1 } |
The Roles supported by the model. More... | |
Signals | |
void | countChanged () |
void | inputMethodSurfaceChanged (unity::shell::application::MirSurfaceInterface *inputMethodSurface) |
void | focusedWindowChanged (Window *focusedWindow) |
void | applicationManagerChanged (unity::shell::application::ApplicationManagerInterface *) |
void | surfaceManagerChanged (unity::shell::application::SurfaceManagerInterface *) |
void | listChanged () |
Emitted when the list changes. More... | |
void | nextIdChanged () |
Public Member Functions | |
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
QVariant | data (const QModelIndex &index, int role) const override |
QHash< int, QByteArray > | roleNames () const override |
unity::shell::application::MirSurfaceInterface * | inputMethodSurface () const |
Window * | focusedWindow () const |
unity::shell::application::ApplicationManagerInterface * | applicationManager () const |
void | setApplicationManager (unity::shell::application::ApplicationManagerInterface *) |
unity::shell::application::SurfaceManagerInterface * | surfaceManager () const |
void | setSurfaceManager (unity::shell::application::SurfaceManagerInterface *) |
int | nextId () const |
Q_INVOKABLE unity::shell::application::MirSurfaceInterface * | surfaceAt (int index) const |
Returns the surface at the given index. More... | |
Q_INVOKABLE Window * | windowAt (int index) const |
Returns the window at the given index. More... | |
Q_INVOKABLE unity::shell::application::ApplicationInfoInterface * | applicationAt (int index) const |
Returns the application at the given index. | |
Q_INVOKABLE int | idAt (int index) const |
Returns the unique id of the element at the given index. | |
Q_INVOKABLE int | indexForId (int id) const |
Returns the index where the row with the given id is located. More... | |
Q_INVOKABLE void | raiseId (int id) |
Raises the row with the given id to the top of the window stack (index == count-1) | |
Properties | |
int | count |
Number of top-level surfaces in this model. More... | |
unity::shell::application::MirSurfaceInterface | inputMethodSurface |
The input method surface, if any. More... | |
Window | focusedWindow |
The currently focused window, if any. | |
unity::shell::application::SurfaceManagerInterface | surfaceManager |
unity::shell::application::ApplicationManagerInterface | applicationManager |
int | nextId |
A model of top-level surfaces.
It's an abstraction of top-level application windows.
When an entry first appears, it normaly doesn't have a surface yet, meaning that the application is still starting up. A shell should then display a splash screen or saved screenshot of the application until its surface comes up.
As applications can have multiple surfaces and you can also have entries without surfaces at all, the only way to unambiguously refer to an entry in this model is through its id.
Definition at line 52 of file TopLevelWindowModel.h.
The Roles supported by the model.
WindowRole - A Window. ApplicationRole - An ApplicationInfoInterface
Definition at line 98 of file TopLevelWindowModel.h.
int TopLevelWindowModel::indexForId | ( | int | id | ) | const |
Returns the index where the row with the given id is located.
Returns -1 if there's no row with the given id.
Definition at line 563 of file TopLevelWindowModel.cpp.
|
signal |
Emitted when the list changes.
Emitted when model gains an element, loses an element or when elements exchange positions.
unityapi::MirSurfaceInterface * TopLevelWindowModel::surfaceAt | ( | int | index | ) | const |
Returns the surface at the given index.
It will be a nullptr if the application is still starting up and thus hasn't yet created and drawn into a surface.
Same as windowAt(index).surface()
Definition at line 582 of file TopLevelWindowModel.cpp.
Window * TopLevelWindowModel::windowAt | ( | int | index | ) | const |
Returns the window at the given index.
Will always be valid
Definition at line 573 of file TopLevelWindowModel.cpp.
|
read |
Number of top-level surfaces in this model.
This is the same as rowCount, added in order to keep compatibility with QML ListModels.
Definition at line 61 of file TopLevelWindowModel.h.
|
read |
The input method surface, if any.
The surface of a onscreen keyboard (akak "virtual keyboard") would be kept here and not in the model itself.
Definition at line 68 of file TopLevelWindowModel.h.
|
read |
The id to be used on the next entry created Useful for tests
Definition at line 89 of file TopLevelWindowModel.h.