mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-28 18:01:08 -06:00
Add pin icon and rename to Pin Field to Quick Access
This commit is contained in:
parent
c56cd59080
commit
5ced7e1d2f
@ -290,6 +290,7 @@
|
||||
<file>cloud-and-server.svg</file>
|
||||
<file>Cloud.svg</file>
|
||||
<file>CloudBlobs.svg</file>
|
||||
<file>pin.svg</file>
|
||||
</qresource>
|
||||
<qresource prefix="/Shader">
|
||||
<file>fs_CellFace.glsl</file>
|
||||
|
4
ApplicationExeCode/Resources/pin.svg
Normal file
4
ApplicationExeCode/Resources/pin.svg
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg" fill="none">
|
||||
<path stroke="#535358" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M28 11.333L20.667 4l-6.076 6.38a2 2 0 01-1.448.62H9.414c-.89 0-1.337 1.077-.707 1.707l10.586 10.586c.63.63 1.707.184 1.707-.707v-3.729a2 2 0 01.62-1.448L28 11.333zM14 18l-8 8"/>
|
||||
</svg>
|
After Width: | Height: | Size: 497 B |
@ -18,15 +18,12 @@
|
||||
|
||||
#include "RicAddFieldToQuickAccessFeature.h"
|
||||
|
||||
/*
|
||||
#include "RiaApplication.h"
|
||||
#include "RimFieldReference.h"
|
||||
#include "RimPinnedFieldCollection.h"
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimGridView.h"
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
#include "RiuViewerCommands.h"
|
||||
*/
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@ -41,6 +38,20 @@ void RicAddFieldToQuickAccessFeature::onActionTriggered( bool isChecked )
|
||||
if ( objects.empty() ) return;
|
||||
|
||||
auto firstObject = objects.front();
|
||||
|
||||
RimFieldReference fieldRef;
|
||||
fieldRef.setObject( firstObject );
|
||||
|
||||
caf::PdmUiPropertyViewDialog propertyDialog( Riu3DMainWindowTools::mainWindowWidget(), &fieldRef, "Select Field", "" );
|
||||
if ( propertyDialog.exec() == QDialog::Accepted )
|
||||
{
|
||||
auto field = fieldRef.field();
|
||||
if ( field )
|
||||
{
|
||||
RimPinnedFieldCollection::instance()->addField( field );
|
||||
RimPinnedFieldCollection::instance()->updateAllRequiredEditors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -48,6 +59,6 @@ void RicAddFieldToQuickAccessFeature::onActionTriggered( bool isChecked )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAddFieldToQuickAccessFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Add Field To Quick Access" );
|
||||
// actionToSetup->setIcon( QIcon( ":/SummaryEnsemble.svg" ) );
|
||||
actionToSetup->setText( "Pin Field To Quick Access" );
|
||||
actionToSetup->setIcon( QIcon( ":/pin.svg" ) );
|
||||
}
|
||||
|
@ -1125,6 +1125,8 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicPasteAsciiDataCurveFeature";
|
||||
menuBuilder << "RicPasteSummaryCaseFeature";
|
||||
menuBuilder.addSeparator();
|
||||
menuBuilder << "RicAddFieldToQuickAccessFeature";
|
||||
menuBuilder.addSeparator();
|
||||
menuBuilder << "RicCopyReferencesToClipboardFeature";
|
||||
|
||||
menuBuilder << "RicLinkViewFeature";
|
||||
|
@ -31,6 +31,20 @@ RimFieldReference::RimFieldReference()
|
||||
CAF_PDM_InitFieldNoDefault( &m_fieldName, "FieldName", "FieldName" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFieldReference::setObject( caf::PdmObject* object )
|
||||
{
|
||||
m_object = object;
|
||||
|
||||
std::vector<QString> fieldNames = RimFieldReference::fieldNames( object );
|
||||
if ( !fieldNames.empty() )
|
||||
{
|
||||
m_fieldName = fieldNames[0];
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -38,10 +52,29 @@ void RimFieldReference::setField( caf::PdmFieldHandle* field )
|
||||
{
|
||||
if ( !field ) return;
|
||||
|
||||
auto ownerObject = field->ownerObject();
|
||||
auto ownerObject = dynamic_cast<caf::PdmObject*>( field->ownerObject() );
|
||||
if ( !ownerObject ) return;
|
||||
|
||||
setField( field->ownerObject(), field->keyword() );
|
||||
setField( ownerObject, field->keyword() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RimFieldReference::fieldNames( caf::PdmObject* object )
|
||||
{
|
||||
std::vector<QString> names;
|
||||
|
||||
if ( object )
|
||||
{
|
||||
auto allFields = object->fields();
|
||||
for ( auto field : allFields )
|
||||
{
|
||||
names.push_back( field->keyword() );
|
||||
}
|
||||
}
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -49,12 +82,44 @@ void RimFieldReference::setField( caf::PdmFieldHandle* field )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFieldReference::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
if ( field() )
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimFieldReference::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_fieldName )
|
||||
{
|
||||
uiOrdering.add( field() );
|
||||
auto fieldNames = RimFieldReference::fieldNames( m_object );
|
||||
for ( const auto& name : fieldNames )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( name, name ) );
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_object )
|
||||
{
|
||||
if ( m_objectsForSelection.empty() )
|
||||
{
|
||||
if ( m_object )
|
||||
{
|
||||
QString text = m_object()->uiName();
|
||||
options.push_back( caf::PdmOptionItemInfo( text, m_object ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( auto obj : m_objectsForSelection )
|
||||
{
|
||||
QString text = obj->uiName();
|
||||
options.push_back( caf::PdmOptionItemInfo( text, obj ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uiOrdering.skipRemainingFields();
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -70,7 +135,7 @@ caf::PdmFieldHandle* RimFieldReference::field() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimFieldReference::object() const
|
||||
caf::PdmObject* RimFieldReference::object() const
|
||||
{
|
||||
return m_object;
|
||||
}
|
||||
@ -78,7 +143,15 @@ caf::PdmObjectHandle* RimFieldReference::object() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFieldReference::setField( caf::PdmObjectHandle* object, const QString& fieldName )
|
||||
void RimFieldReference::setObjectsForSelection( const std::vector<caf::PdmObject*>& objectsForSelection )
|
||||
{
|
||||
m_objectsForSelection = objectsForSelection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFieldReference::setField( caf::PdmObject* object, const QString& fieldName )
|
||||
{
|
||||
m_object = object;
|
||||
m_fieldName = fieldName;
|
||||
|
@ -37,17 +37,25 @@ class RimFieldReference : public caf::PdmObject
|
||||
public:
|
||||
RimFieldReference();
|
||||
|
||||
void setObject( caf::PdmObject* object );
|
||||
|
||||
void setField( caf::PdmFieldHandle* field );
|
||||
caf::PdmFieldHandle* field() const;
|
||||
|
||||
caf::PdmObjectHandle* object() const;
|
||||
caf::PdmObject* object() const;
|
||||
void setObjectsForSelection( const std::vector<caf::PdmObject*>& objectsForSelection );
|
||||
|
||||
private:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
void setField( caf::PdmObjectHandle* object, const QString& fieldName );
|
||||
void setField( caf::PdmObject* object, const QString& fieldName );
|
||||
|
||||
static std::vector<QString> fieldNames( caf::PdmObject* object );
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<caf::PdmObjectHandle*> m_object;
|
||||
caf::PdmField<QString> m_fieldName;
|
||||
caf::PdmPtrField<caf::PdmObject*> m_object;
|
||||
caf::PdmField<QString> m_fieldName;
|
||||
|
||||
std::vector<caf::PdmObject*> m_objectsForSelection;
|
||||
};
|
||||
|
@ -131,11 +131,7 @@ void RimPinnedFieldCollection::defineUiOrdering( QString uiConfigName, caf::PdmU
|
||||
for ( auto fieldRef : fieldRefs )
|
||||
{
|
||||
group->add( fieldRef->field() );
|
||||
}
|
||||
|
||||
if ( !fieldRefs.empty() )
|
||||
{
|
||||
group->add( fieldRefs.front()->selectObjectButton(), { .newRow = false } );
|
||||
group->add( fieldRef->selectObjectButton(), { .newRow = false } );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -139,6 +139,14 @@ QString RiuDockWidgetTools::mainWindowUndoStackName()
|
||||
return "dockUndoStack_mainWindow";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiuDockWidgetTools::mainWindowQuickAccessName()
|
||||
{
|
||||
return "dockQuickAccess_mainWindow";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -147,6 +155,14 @@ QString RiuDockWidgetTools::plotMainWindowPlotManagerName()
|
||||
return "dockSummaryPlotManager";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiuDockWidgetTools::plotWindowQuickAccessName()
|
||||
{
|
||||
return "dockQuickAccess_plotWindow";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -383,6 +399,8 @@ QIcon RiuDockWidgetTools::dockIcon( const QString dockWidgetName )
|
||||
return QIcon( ":/graph.svg" );
|
||||
else if ( dockWidgetName == plotMainWindowCloudTreeName() )
|
||||
return QIcon( ":/Cloud.svg" );
|
||||
else if ( dockWidgetName == plotWindowQuickAccessName() || dockWidgetName == mainWindowQuickAccessName() )
|
||||
return QIcon( ":/pin.svg" );
|
||||
|
||||
return QIcon( ":/view.svg" );
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ public:
|
||||
static QString mainWindowMessagesName();
|
||||
static QString mainWindowMohrsCirclePlotName();
|
||||
static QString mainWindowUndoStackName();
|
||||
static QString mainWindowQuickAccessName();
|
||||
|
||||
static QString mainWindowProjectTreeName();
|
||||
static QString mainWindowDataSourceTreeName();
|
||||
@ -74,6 +75,7 @@ public:
|
||||
static QString plotMainWindowMessagesName();
|
||||
static QString plotMainWindowUndoStackName();
|
||||
static QString plotMainWindowPlotManagerName();
|
||||
static QString plotWindowQuickAccessName();
|
||||
|
||||
static QString dockState3DEclipseName();
|
||||
static QString dockState3DGeoMechName();
|
||||
|
@ -822,7 +822,8 @@ void RiuMainWindow::createDockPanels()
|
||||
}
|
||||
|
||||
{
|
||||
auto dockWidget = RiuDockWidgetTools::createDockWidget( "Quick Access", "Quick Access", dockManager() );
|
||||
auto dockWidget =
|
||||
RiuDockWidgetTools::createDockWidget( "Quick Access", RiuDockWidgetTools::mainWindowQuickAccessName(), dockManager() );
|
||||
|
||||
m_pinnedFieldView = new caf::PdmUiPropertyView( dockWidget );
|
||||
dockWidget->setWidget( m_pinnedFieldView );
|
||||
|
Loading…
Reference in New Issue
Block a user