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:
Martin Gräßlin 2011-11-27 14:15:49 +01:00
parent efe439e2bc
commit 9eb5a17e30
6 changed files with 13 additions and 2 deletions

View file

@ -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();
}

View file

@ -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();

View file

@ -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

View file

@ -270,6 +270,11 @@ int TabBoxClientImpl::height() const
return m_client->height();
}
bool TabBoxClientImpl::isCloseable() const
{
return m_client->isCloseable();
}
/*********************************************************
* TabBox

View file

@ -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;

View file

@ -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;
};
/**