[kwin/kcm-tabbox] Implemented ExampleClientModel::longestCaption()
REVIEW: 114608icc-effect-5.14.5
parent
d7e2df674a
commit
26f390f4ed
|
@ -170,6 +170,18 @@ QVariant ExampleClientModel::data(const QModelIndex &index, int role) const
|
||||||
return QVariant();
|
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
|
int ExampleClientModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent)
|
Q_UNUSED(parent)
|
||||||
|
|
|
@ -53,6 +53,7 @@ public:
|
||||||
|
|
||||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||||
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
|
Q_INVOKABLE QString longestCaption() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
|
|
Loading…
Reference in New Issue