[kwin] Add a method longestCaption() in TabBox::DesktopModel.
REVIEW: 114585
This commit is contained in:
parent
22640e26f3
commit
d7e2df674a
2 changed files with 13 additions and 0 deletions
|
@ -73,6 +73,18 @@ QVariant DesktopModel::data(const QModelIndex& index, int role) const
|
|||
}
|
||||
}
|
||||
|
||||
QString DesktopModel::longestCaption() const
|
||||
{
|
||||
QString caption;
|
||||
for (int desktop : m_desktopList) {
|
||||
QString desktopName = tabBox->desktopName(desktop);
|
||||
if (desktopName.size() > caption.size()) {
|
||||
caption = desktopName;
|
||||
}
|
||||
}
|
||||
return caption;
|
||||
}
|
||||
|
||||
int DesktopModel::columnCount(const QModelIndex& parent) const
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
|
||||
virtual QModelIndex parent(const QModelIndex& child) const;
|
||||
virtual QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const;
|
||||
Q_INVOKABLE QString longestCaption() const;
|
||||
|
||||
/**
|
||||
* Generates a new list of desktops based on the current config.
|
||||
|
|
Loading…
Reference in a new issue