mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +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();
|
return pluginEntry->pluginInfo.icon();
|
||||||
case Qt::CheckStateRole:
|
case Qt::CheckStateRole:
|
||||||
return pluginEntry->checked;
|
return pluginEntry->checked;
|
||||||
|
case Qt::ToolTipRole:
|
||||||
|
return pluginEntry->tooltip;
|
||||||
case KCategorizedSortFilterProxyModel::CategoryDisplayRole: // fall through
|
case KCategorizedSortFilterProxyModel::CategoryDisplayRole: // fall through
|
||||||
case KCategorizedSortFilterProxyModel::CategorySortRole:
|
case KCategorizedSortFilterProxyModel::CategorySortRole:
|
||||||
return pluginEntry->category;
|
return pluginEntry->category;
|
||||||
|
@ -486,6 +488,9 @@ bool KPluginSelector::Private::PluginModel::setData(const QModelIndex &index, co
|
||||||
if (role == Qt::CheckStateRole) {
|
if (role == Qt::CheckStateRole) {
|
||||||
static_cast<PluginEntry*>(index.internalPointer())->checked = value.toBool();
|
static_cast<PluginEntry*>(index.internalPointer())->checked = value.toBool();
|
||||||
ret = true;
|
ret = true;
|
||||||
|
} else if (role == Qt::ToolTipRole) {
|
||||||
|
static_cast<PluginEntry*>(index.internalPointer())->tooltip = value.toString();
|
||||||
|
ret = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -689,6 +694,7 @@ void KPluginSelector::Private::PluginDelegate::updateItemWidgets(const QList<QWi
|
||||||
} else {
|
} else {
|
||||||
checkBox->setChecked(index.model()->data(index, Qt::CheckStateRole).toBool());
|
checkBox->setChecked(index.model()->data(index, Qt::CheckStateRole).toBool());
|
||||||
checkBox->setEnabled(index.model()->data(index, IsCheckableRole).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->setVisible(index.model()->data(index, ServicesCountRole).toBool());
|
||||||
configurePushButton->setEnabled(index.model()->data(index, Qt::CheckStateRole).toBool());
|
configurePushButton->setEnabled(index.model()->data(index, Qt::CheckStateRole).toBool());
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,6 +91,7 @@ public:
|
||||||
KConfigGroup cfgGroup;
|
KConfigGroup cfgGroup;
|
||||||
KPluginSelector::PluginLoadMethod pluginLoadMethod;
|
KPluginSelector::PluginLoadMethod pluginLoadMethod;
|
||||||
bool isCheckable;
|
bool isCheckable;
|
||||||
|
QString tooltip;
|
||||||
|
|
||||||
bool operator==(const PluginEntry &pe) const
|
bool operator==(const PluginEntry &pe) const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue