mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added display of class names to preferences
Use flag in pdmUiTreeViewEditor to control display of class names
This commit is contained in:
parent
dcf9ac9b50
commit
a4b57a11a4
@ -88,6 +88,7 @@
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "cafPdmUiTreeView.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
@ -1364,12 +1365,16 @@ void RiaApplication::applyPreferences()
|
||||
caf::EffectGenerator::setRenderingMode(caf::EffectGenerator::FIXED_FUNCTION);
|
||||
}
|
||||
|
||||
if (RiuMainWindow::instance() && RiuMainWindow::instance()->projectTreeView())
|
||||
{
|
||||
RiuMainWindow::instance()->projectTreeView()->enableAppendOfClassNameToUiItemText(m_preferences->appendClassNameToUiText());
|
||||
}
|
||||
|
||||
if (this->project())
|
||||
{
|
||||
this->project()->setScriptDirectories(m_preferences->scriptDirectories());
|
||||
this->project()->scriptCollection()->updateConnectedEditors();
|
||||
this->project()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -62,6 +62,7 @@ RiaPreferences::RiaPreferences(void)
|
||||
|
||||
CAF_PDM_InitField(&useShaders, "useShaders", true, "Use Shaders", "", "", "");
|
||||
CAF_PDM_InitField(&showHud, "showHud", false, "Show 3D Information", "", "", "");
|
||||
CAF_PDM_InitField(&appendClassNameToUiText, "appendClassNameToUiText", false, "[System] Show Class Names", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&lastUsedProjectFileName,"lastUsedProjectFileName", "Last Used Project File", "", "", "");
|
||||
lastUsedProjectFileName.uiCapability()->setUiHidden(true);
|
||||
|
@ -62,6 +62,7 @@ public: // Pdm Fields
|
||||
|
||||
caf::PdmField<bool> useShaders;
|
||||
caf::PdmField<bool> showHud;
|
||||
caf::PdmField<bool> appendClassNameToUiText;
|
||||
|
||||
caf::PdmField<QString> lastUsedProjectFileName;
|
||||
|
||||
|
@ -195,5 +195,13 @@ void PdmUiTreeView::setDragDropHandle(PdmUiDragDropHandle* dragDropHandle)
|
||||
m_treeViewEditor->setDragDropHandle(dragDropHandle);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTreeView::enableAppendOfClassNameToUiItemText(bool enable)
|
||||
{
|
||||
m_treeViewEditor->enableAppendOfClassNameToUiItemText(enable);
|
||||
}
|
||||
|
||||
} //End of namespace caf
|
||||
|
||||
|
@ -66,6 +66,7 @@ public:
|
||||
|
||||
void enableDefaultContextMenu(bool enable);
|
||||
void enableSelectionManagerUpdating(bool enable); // TODO: rename
|
||||
void enableAppendOfClassNameToUiItemText(bool enable);
|
||||
|
||||
void setUiConfigurationName(QString uiConfigName);
|
||||
void setPdmItem(caf::PdmUiItem* object);
|
||||
|
@ -63,6 +63,7 @@ PdmUiTreeViewEditor::PdmUiTreeViewEditor()
|
||||
{
|
||||
m_useDefaultContextMenu = false;
|
||||
m_updateSelectionManager = false;
|
||||
m_appendClassNameToUiItemText = false;
|
||||
|
||||
}
|
||||
|
||||
@ -324,5 +325,21 @@ void PdmUiTreeViewEditor::updateSelectionManager()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTreeViewEditor::enableAppendOfClassNameToUiItemText(bool enable)
|
||||
{
|
||||
m_appendClassNameToUiItemText = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool PdmUiTreeViewEditor::isAppendOfClassNameToUiItemTextEnabled()
|
||||
{
|
||||
return m_appendClassNameToUiItemText;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace caf
|
||||
|
@ -85,6 +85,9 @@ public:
|
||||
|
||||
void enableDefaultContextMenu(bool enable);
|
||||
void enableSelectionManagerUpdating(bool enable);
|
||||
|
||||
void enableAppendOfClassNameToUiItemText(bool enable);
|
||||
bool isAppendOfClassNameToUiItemTextEnabled();
|
||||
|
||||
QTreeView* treeView();
|
||||
|
||||
@ -133,6 +136,7 @@ private:
|
||||
|
||||
bool m_useDefaultContextMenu;
|
||||
bool m_updateSelectionManager;
|
||||
bool m_appendClassNameToUiItemText;
|
||||
};
|
||||
|
||||
|
||||
|
@ -501,16 +501,15 @@ QVariant PdmUiTreeViewModel::data(const QModelIndex &index, int role ) const
|
||||
|
||||
QString txt = v.toString();
|
||||
|
||||
// Uncomment following to show class names of objects in property viewer
|
||||
//#define SHOW_CLASS_NAME_IN_TREE
|
||||
#ifdef SHOW_CLASS_NAME_IN_TREE
|
||||
PdmObjectHandle* pdmObjHandle = pdmUiObject->objectHandle();
|
||||
if (pdmObjHandle)
|
||||
if (m_treeViewEditor->isAppendOfClassNameToUiItemTextEnabled())
|
||||
{
|
||||
txt += " - ";
|
||||
txt += typeid(*pdmObjHandle).name();
|
||||
PdmObjectHandle* pdmObjHandle = pdmUiObject->objectHandle();
|
||||
if (pdmObjHandle)
|
||||
{
|
||||
txt += " - ";
|
||||
txt += typeid(*pdmObjHandle).name();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return txt;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user