Support Closeable in TabBox
Needed by window strip to not add a close button to non-closeable windows such as the desktop shell.
This commit is contained in:
parent
efe439e2bc
commit
9eb5a17e30
6 changed files with 13 additions and 2 deletions
|
@ -43,6 +43,7 @@ ClientModel::ClientModel(QObject* parent)
|
|||
roles[DesktopNameRole] = "desktopName";
|
||||
roles[MinimizedRole] = "minimized";
|
||||
roles[WIdRole] = "windowId";
|
||||
roles[CloseableRole] = "closeable";
|
||||
setRoleNames(roles);
|
||||
}
|
||||
|
||||
|
@ -80,6 +81,8 @@ QVariant ClientModel::data(const QModelIndex& index, int role) const
|
|||
return qulonglong(m_clientList[ clientIndex ]->window());
|
||||
case MinimizedRole:
|
||||
return m_clientList[ clientIndex ]->isMinimized();
|
||||
case CloseableRole:
|
||||
return m_clientList[ clientIndex ]->isCloseable();
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
|
|
@ -54,7 +54,8 @@ public:
|
|||
IconRole = Qt::UserRole + 3, // TODO: to be removed
|
||||
EmptyRole = Qt::UserRole + 4, ///< Indicates if the model contains TabBoxClients
|
||||
WIdRole = Qt::UserRole + 5, ///< The window ID of TabBoxClient
|
||||
MinimizedRole = Qt::UserRole + 6 ///< TabBoxClient is minimized
|
||||
MinimizedRole = Qt::UserRole + 6, ///< TabBoxClient is minimized
|
||||
CloseableRole = Qt::UserRole + 7 ///< TabBoxClient can be closed
|
||||
};
|
||||
ClientModel(QObject* parent = 0);
|
||||
~ClientModel();
|
||||
|
|
|
@ -105,7 +105,7 @@ Item {
|
|||
prefix: "shadow"
|
||||
width: closeButton.width + margins.left + margins.right
|
||||
height: closeButton.height + margins.top + margins.bottom
|
||||
visible: true//model["actionClose"] && (model["className"] != shellName)
|
||||
visible: closeable
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
|
|
|
@ -270,6 +270,11 @@ int TabBoxClientImpl::height() const
|
|||
return m_client->height();
|
||||
}
|
||||
|
||||
bool TabBoxClientImpl::isCloseable() const
|
||||
{
|
||||
return m_client->isCloseable();
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************
|
||||
* TabBox
|
||||
|
|
|
@ -80,6 +80,7 @@ public:
|
|||
virtual int y() const;
|
||||
virtual int width() const;
|
||||
virtual int height() const;
|
||||
virtual bool isCloseable() const;
|
||||
|
||||
Client* client() const {
|
||||
return m_client;
|
||||
|
|
|
@ -384,6 +384,7 @@ public:
|
|||
virtual int y() const = 0;
|
||||
virtual int width() const = 0;
|
||||
virtual int height() const = 0;
|
||||
virtual bool isCloseable() const = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue