[kwin/kcm-tabbox] Implemented ExampleClientModel::longestCaption()
REVIEW: 114608
This commit is contained in:
parent
d7e2df674a
commit
26f390f4ed
2 changed files with 13 additions and 0 deletions
|
@ -170,6 +170,18 @@ QVariant ExampleClientModel::data(const QModelIndex &index, int role) const
|
|||
return QVariant();
|
||||
}
|
||||
|
||||
QString ExampleClientModel::longestCaption() const
|
||||
{
|
||||
QString caption;
|
||||
for (QString item : m_nameList) {
|
||||
QString name = KDesktopFile(item).readName();
|
||||
if (name.size() > caption.size()) {
|
||||
caption = name;
|
||||
}
|
||||
}
|
||||
return caption;
|
||||
}
|
||||
|
||||
int ExampleClientModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
|
|
|
@ -53,6 +53,7 @@ public:
|
|||
|
||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
Q_INVOKABLE QString longestCaption() const;
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
|
Loading…
Reference in a new issue