mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3353 AppFwk: TableViewEditor: Support pr cell tooltip.
Use ForegroundRole text color for highlighted cells also. Use PdmUiItem::uiContentTextColor as ForegroundRoleText
This commit is contained in:
@@ -173,14 +173,27 @@ bool PdmUiTableViewQModel::setData(const QModelIndex &index, const QVariant &val
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QVariant PdmUiTableViewQModel::data(const QModelIndex &index, int role /*= Qt::DisplayRole */) const
|
||||
{
|
||||
if (role == Qt::TextColorRole)
|
||||
if (role == Qt::ForegroundRole)
|
||||
{
|
||||
PdmFieldHandle* fieldHandle = getField(index);
|
||||
if (fieldHandle && fieldHandle->uiCapability())
|
||||
{
|
||||
QColor textColor = fieldHandle->uiCapability()->uiContentTextColor(m_currentConfigName);
|
||||
|
||||
if (fieldHandle->uiCapability()->isUiReadOnly(m_currentConfigName))
|
||||
{
|
||||
return Qt::lightGray;
|
||||
if (textColor.isValid())
|
||||
{
|
||||
return textColor.lighter(150);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Qt::lightGray;
|
||||
}
|
||||
}
|
||||
else if (textColor.isValid())
|
||||
{
|
||||
return textColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -317,7 +330,18 @@ QVariant PdmUiTableViewQModel::data(const QModelIndex &index, int role /*= Qt::D
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ( role == Qt::ToolTipRole )
|
||||
{
|
||||
PdmUiFieldHandle* uiFieldHandle = getField(index)->uiCapability();
|
||||
if ( uiFieldHandle )
|
||||
{
|
||||
return uiFieldHandle->uiToolTip();
|
||||
}
|
||||
else
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user