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();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientModel::close(int i)
|
||||||
|
{
|
||||||
|
QModelIndex ind = index(i, 0);
|
||||||
|
if (!ind.isValid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_clientList.at(i)->close();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Tabbox
|
} // namespace Tabbox
|
||||||
} // namespace KWin
|
} // namespace KWin
|
||||||
|
|
|
@ -46,6 +46,7 @@ namespace TabBox
|
||||||
class ClientModel
|
class ClientModel
|
||||||
: public QAbstractItemModel
|
: public QAbstractItemModel
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum {
|
enum {
|
||||||
ClientRole = Qt::UserRole, ///< The TabBoxClient
|
ClientRole = Qt::UserRole, ///< The TabBoxClient
|
||||||
|
@ -95,6 +96,9 @@ public:
|
||||||
return m_clientList;
|
return m_clientList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void close(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TabBoxClientList m_clientList;
|
TabBoxClientList m_clientList;
|
||||||
};
|
};
|
||||||
|
|
|
@ -135,13 +135,7 @@ Item {
|
||||||
rightMargin: parent.margins.right
|
rightMargin: parent.margins.right
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: thumbnailListView.model.close(index)
|
||||||
console.log("Close button clicked")
|
|
||||||
/*var service = tasksSource.serviceForSource(winId)
|
|
||||||
var operation = service.operationDescription("close")
|
|
||||||
|
|
||||||
service.startOperationCall(operation)*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,6 +275,10 @@ bool TabBoxClientImpl::isCloseable() const
|
||||||
return m_client->isCloseable();
|
return m_client->isCloseable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabBoxClientImpl::close()
|
||||||
|
{
|
||||||
|
m_client->closeWindow();
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************************************
|
/*********************************************************
|
||||||
* TabBox
|
* TabBox
|
||||||
|
|
|
@ -81,6 +81,7 @@ public:
|
||||||
virtual int width() const;
|
virtual int width() const;
|
||||||
virtual int height() const;
|
virtual int height() const;
|
||||||
virtual bool isCloseable() const;
|
virtual bool isCloseable() const;
|
||||||
|
virtual void close();
|
||||||
|
|
||||||
Client* client() const {
|
Client* client() const {
|
||||||
return m_client;
|
return m_client;
|
||||||
|
|
|
@ -385,6 +385,7 @@ public:
|
||||||
virtual int width() const = 0;
|
virtual int width() const = 0;
|
||||||
virtual int height() const = 0;
|
virtual int height() const = 0;
|
||||||
virtual bool isCloseable() const = 0;
|
virtual bool isCloseable() const = 0;
|
||||||
|
virtual void close() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue