mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 10:22:48 +00:00
kutils: implement Qt::ToolTipRole for the KPluginSelector model
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
f31b45f071
commit
94733df29a
2 changed files with 7 additions and 0 deletions
|
@ -467,6 +467,8 @@ QVariant KPluginSelector::Private::PluginModel::data(const QModelIndex &index, i
|
|||
return pluginEntry->pluginInfo.icon();
|
||||
case Qt::CheckStateRole:
|
||||
return pluginEntry->checked;
|
||||
case Qt::ToolTipRole:
|
||||
return pluginEntry->tooltip;
|
||||
case KCategorizedSortFilterProxyModel::CategoryDisplayRole: // fall through
|
||||
case KCategorizedSortFilterProxyModel::CategorySortRole:
|
||||
return pluginEntry->category;
|
||||
|
@ -486,6 +488,9 @@ bool KPluginSelector::Private::PluginModel::setData(const QModelIndex &index, co
|
|||
if (role == Qt::CheckStateRole) {
|
||||
static_cast<PluginEntry*>(index.internalPointer())->checked = value.toBool();
|
||||
ret = true;
|
||||
} else if (role == Qt::ToolTipRole) {
|
||||
static_cast<PluginEntry*>(index.internalPointer())->tooltip = value.toString();
|
||||
ret = false;
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
|
@ -689,6 +694,7 @@ void KPluginSelector::Private::PluginDelegate::updateItemWidgets(const QList<QWi
|
|||
} else {
|
||||
checkBox->setChecked(index.model()->data(index, Qt::CheckStateRole).toBool());
|
||||
checkBox->setEnabled(index.model()->data(index, IsCheckableRole).toBool());
|
||||
checkBox->setToolTip(index.model()->data(index, Qt::ToolTipRole).toString());
|
||||
configurePushButton->setVisible(index.model()->data(index, ServicesCountRole).toBool());
|
||||
configurePushButton->setEnabled(index.model()->data(index, Qt::CheckStateRole).toBool());
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ public:
|
|||
KConfigGroup cfgGroup;
|
||||
KPluginSelector::PluginLoadMethod pluginLoadMethod;
|
||||
bool isCheckable;
|
||||
QString tooltip;
|
||||
|
||||
bool operator==(const PluginEntry &pe) const
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue