Add QML specific export of ClientList

Sometimes Qt is surprising. Apparently QML has problems with a
QList<KWin::Client*> and wants to have a QList<QObject*> which
cannot be used in QtScript.

There ends my dream of having one API for both JavaScript and QML.
So with QtScript it is:
workspace.clientList()
and in QML it is:
workspace.getClientList()
This commit is contained in:
Martin Gräßlin 2012-03-27 22:21:06 +02:00
parent 27926dc74a
commit e0f97946af
2 changed files with 18 additions and 0 deletions

View file

@ -186,6 +186,15 @@ QString WorkspaceWrapper::supportInformation() const
return Workspace::self()->supportInformation();
}
QList< QObject* > WorkspaceWrapper::getClientList() const
{
QList<QObject*> list;
foreach (Client* client, Workspace::self()->clientList()) {
list << client;
}
return list;
}
void WorkspaceWrapper::setupClientConnections(KWin::Client *client)
{
connect(client, SIGNAL(clientMinimized(KWin::Client*,bool)), SIGNAL(clientMinimized(KWin::Client*)));

View file

@ -136,6 +136,15 @@ void setter( rettype val );
int activeScreen() const;
int numScreens() const;
/**
* List of Clients currently managed by KWin.
* Use this method in QML scripts.
**/
Q_INVOKABLE QList< QObject* > getClientList() const;
/**
* List of Clients currently managed by KWin.
* Use this method in JavaScript scripts.
**/
Q_INVOKABLE QList< KWin::Client* > clientList() const;
/**
* Returns the geometry a Client can use with the specified option.