Close windows from TabBox QML
Model exposes a method to close a window by index which is invoked by the window strip QML.
This commit is contained in:
parent
9eb5a17e30
commit
245f84d835
6 changed files with 20 additions and 7 deletions
|
@ -235,5 +235,14 @@ void ClientModel::createClientList(int desktop, bool partialReset)
|
|||
reset();
|
||||
}
|
||||
|
||||
void ClientModel::close(int i)
|
||||
{
|
||||
QModelIndex ind = index(i, 0);
|
||||
if (!ind.isValid()) {
|
||||
return;
|
||||
}
|
||||
m_clientList.at(i)->close();
|
||||
}
|
||||
|
||||
} // namespace Tabbox
|
||||
} // namespace KWin
|
||||
|
|
|
@ -46,6 +46,7 @@ namespace TabBox
|
|||
class ClientModel
|
||||
: public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum {
|
||||
ClientRole = Qt::UserRole, ///< The TabBoxClient
|
||||
|
@ -95,6 +96,9 @@ public:
|
|||
return m_clientList;
|
||||
}
|
||||
|
||||
public Q_SLOTS:
|
||||
void close(int index);
|
||||
|
||||
private:
|
||||
TabBoxClientList m_clientList;
|
||||
};
|
||||
|
|
|
@ -135,13 +135,7 @@ Item {
|
|||
rightMargin: parent.margins.right
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
console.log("Close button clicked")
|
||||
/*var service = tasksSource.serviceForSource(winId)
|
||||
var operation = service.operationDescription("close")
|
||||
|
||||
service.startOperationCall(operation)*/
|
||||
}
|
||||
onClicked: thumbnailListView.model.close(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -275,6 +275,10 @@ bool TabBoxClientImpl::isCloseable() const
|
|||
return m_client->isCloseable();
|
||||
}
|
||||
|
||||
void TabBoxClientImpl::close()
|
||||
{
|
||||
m_client->closeWindow();
|
||||
}
|
||||
|
||||
/*********************************************************
|
||||
* TabBox
|
||||
|
|
|
@ -81,6 +81,7 @@ public:
|
|||
virtual int width() const;
|
||||
virtual int height() const;
|
||||
virtual bool isCloseable() const;
|
||||
virtual void close();
|
||||
|
||||
Client* client() const {
|
||||
return m_client;
|
||||
|
|
|
@ -385,6 +385,7 @@ public:
|
|||
virtual int width() const = 0;
|
||||
virtual int height() const = 0;
|
||||
virtual bool isCloseable() const = 0;
|
||||
virtual void close() = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue