mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-21 22:13:25 -06:00
#2098 AppFwk : Add optional display of field keyword in tooltip text
This commit is contained in:
parent
c49db44909
commit
e6805d947b
@ -106,7 +106,7 @@ class PdmObjectCapability;
|
||||
AddXmlCapabilityToField(field); \
|
||||
AddUiCapabilityToField(field); \
|
||||
\
|
||||
static caf::PdmUiItemInfo objDescr(uiName, QIcon(QString(iconResourceName)), toolTip, whatsThis); \
|
||||
static caf::PdmUiItemInfo objDescr(uiName, QIcon(QString(iconResourceName)), toolTip, whatsThis, keyword); \
|
||||
addFieldUi(field, keyword, default, &objDescr); \
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ class PdmObjectCapability;
|
||||
AddXmlCapabilityToField(field); \
|
||||
AddUiCapabilityToField(field); \
|
||||
\
|
||||
static caf::PdmUiItemInfo objDescr(uiName, QIcon(QString(iconResourceName)), toolTip, whatsThis); \
|
||||
static caf::PdmUiItemInfo objDescr(uiName, QIcon(QString(iconResourceName)), toolTip, whatsThis, keyword); \
|
||||
addFieldUiNoDefault(field, keyword, &objDescr); \
|
||||
}
|
||||
|
||||
|
@ -154,6 +154,7 @@ QStringList PdmOptionItemInfo::extractUiTexts(const QList<PdmOptionItemInfo>& op
|
||||
/// PdmUiItem
|
||||
//==================================================================================================
|
||||
|
||||
bool PdmUiItem::sm_showExtraDebugText = false;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -196,11 +197,36 @@ const QString PdmUiItem::uiToolTip(QString uiConfigName) const
|
||||
const PdmUiItemInfo* defInfo = defaultInfo();
|
||||
const PdmUiItemInfo* sttInfo = m_staticItemInfo;
|
||||
|
||||
if (conInfo && !(conInfo->m_toolTip.isNull())) return conInfo->m_toolTip;
|
||||
if (defInfo && !(defInfo->m_toolTip.isNull())) return defInfo->m_toolTip;
|
||||
if (sttInfo && !(sttInfo->m_toolTip.isNull())) return sttInfo->m_toolTip;
|
||||
QString text;
|
||||
|
||||
return QString("");
|
||||
if (conInfo && !(conInfo->m_toolTip.isNull()))
|
||||
{
|
||||
text = conInfo->m_toolTip;
|
||||
if (PdmUiItem::showExtraDebugText())
|
||||
{
|
||||
text += QString(" (%1)").arg(conInfo->m_extraDebugText);
|
||||
}
|
||||
}
|
||||
|
||||
if (text.isEmpty() && defInfo && !(defInfo->m_toolTip.isNull()))
|
||||
{
|
||||
text = defInfo->m_toolTip;
|
||||
if (PdmUiItem::showExtraDebugText())
|
||||
{
|
||||
text += QString(" (%1)").arg(defInfo->m_extraDebugText);
|
||||
}
|
||||
}
|
||||
|
||||
if (text.isEmpty() && sttInfo && !(sttInfo->m_toolTip.isNull()))
|
||||
{
|
||||
text = sttInfo->m_toolTip;
|
||||
if (PdmUiItem::showExtraDebugText())
|
||||
{
|
||||
text += QString(" (%1)").arg(sttInfo->m_extraDebugText);
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -414,5 +440,21 @@ std::vector<PdmUiEditorHandle*> PdmUiItem::connectedEditors() const
|
||||
return editors;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool PdmUiItem::showExtraDebugText()
|
||||
{
|
||||
return sm_showExtraDebugText;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiItem::enableExtraDebugText(bool enable)
|
||||
{
|
||||
sm_showExtraDebugText = enable;
|
||||
}
|
||||
|
||||
} //End of namespace caf
|
||||
|
||||
|
@ -59,8 +59,8 @@ public:
|
||||
: m_editorTypeName(""), m_isHidden(-1), m_isTreeChildrenHidden(-1), m_isReadOnly(-1), m_labelAlignment(LEFT)
|
||||
{}
|
||||
|
||||
PdmUiItemInfo(const QString& uiName, QIcon icon = QIcon(), QString toolTip = "", QString whatsThis = "")
|
||||
: m_uiName(uiName), m_icon(icon), m_toolTip(toolTip), m_whatsThis(whatsThis),
|
||||
PdmUiItemInfo(const QString& uiName, QIcon icon = QIcon(), QString toolTip = "", QString whatsThis = "", QString extraDebugText = "")
|
||||
: m_uiName(uiName), m_icon(icon), m_toolTip(toolTip), m_whatsThis(whatsThis), m_extraDebugText(extraDebugText),
|
||||
m_editorTypeName(""), m_isHidden(false), m_isTreeChildrenHidden(false), m_isReadOnly(false), m_labelAlignment(LEFT)
|
||||
{ }
|
||||
|
||||
@ -70,6 +70,7 @@ private:
|
||||
friend class PdmUiItem;
|
||||
QString m_uiName;
|
||||
QString m_toolTip;
|
||||
QString m_extraDebugText;
|
||||
QString m_whatsThis;
|
||||
QIcon m_icon;
|
||||
QString m_editorTypeName; ///< Use this exact type of editor to edit this UiItem
|
||||
@ -240,6 +241,9 @@ public:
|
||||
std::vector<PdmUiEditorHandle*>
|
||||
connectedEditors() const;
|
||||
|
||||
static bool showExtraDebugText();
|
||||
static void enableExtraDebugText(bool enable);
|
||||
|
||||
public: // Pdm-Private only
|
||||
//==================================================================================================
|
||||
/// This method sets the GUI description pointer, which is supposed to be statically allocated
|
||||
@ -261,6 +265,8 @@ private:
|
||||
|
||||
PdmUiItemInfo* m_staticItemInfo;
|
||||
std::map< QString, PdmUiItemInfo > m_configItemInfos;
|
||||
|
||||
static bool sm_showExtraDebugText;
|
||||
};
|
||||
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafPdmUiTreeSelectionEditor.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "cafPdmUiItem.h"
|
||||
|
||||
|
||||
|
||||
@ -542,6 +543,8 @@ MainWindow* MainWindow::sm_mainWindowInstance = NULL;
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
MainWindow::MainWindow()
|
||||
{
|
||||
caf::PdmUiItem::enableExtraDebugText(true);
|
||||
|
||||
// Initialize command framework
|
||||
|
||||
// Register default command features (add/delete item in list)
|
||||
|
Loading…
Reference in New Issue
Block a user