mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Octave interface: Added the path to ResInsight binary as search path for oct files in octave.
p4#: 22256
This commit is contained in:
parent
336eb56e3f
commit
e0f5b15499
@ -545,6 +545,8 @@ void RimUiTreeView::slotExecuteScript()
|
|||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
arguments.append("--path");
|
arguments.append("--path");
|
||||||
arguments << octaveFunctionSearchPath;
|
arguments << octaveFunctionSearchPath;
|
||||||
|
arguments.append("--path");
|
||||||
|
arguments << QApplication::applicationDirPath();
|
||||||
|
|
||||||
arguments.append("-q");
|
arguments.append("-q");
|
||||||
arguments << calcScript->absolutePath();
|
arguments << calcScript->absolutePath();
|
||||||
@ -597,6 +599,8 @@ void RimUiTreeView::slotExecuteScriptForSelectedCases()
|
|||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
arguments.append("--path");
|
arguments.append("--path");
|
||||||
arguments << octaveFunctionSearchPath;
|
arguments << octaveFunctionSearchPath;
|
||||||
|
arguments.append("--path");
|
||||||
|
arguments << QApplication::applicationDirPath();
|
||||||
|
|
||||||
arguments.append("-q");
|
arguments.append("-q");
|
||||||
arguments << calcScript->absolutePath();
|
arguments << calcScript->absolutePath();
|
||||||
|
@ -11,14 +11,24 @@ qt4_wrap_cpp( MOC_FILES_CPP ${QOBJECT_HEADERS} )
|
|||||||
|
|
||||||
add_library( ${PROJECT_NAME}
|
add_library( ${PROJECT_NAME}
|
||||||
cafEffectCache.cpp
|
cafEffectCache.cpp
|
||||||
|
cafEffectCache.h
|
||||||
cafEffectGenerator.cpp
|
cafEffectGenerator.cpp
|
||||||
|
cafEffectGenerator.h
|
||||||
cafLog.cpp
|
cafLog.cpp
|
||||||
|
cafLog.h
|
||||||
cafMessagePanel.cpp
|
cafMessagePanel.cpp
|
||||||
|
cafMessagePanel.h
|
||||||
cafMouseState.cpp
|
cafMouseState.cpp
|
||||||
|
cafMouseState.h
|
||||||
cafUtils.cpp
|
cafUtils.cpp
|
||||||
|
cafUtils.h
|
||||||
cvfStructGrid.cpp
|
cvfStructGrid.cpp
|
||||||
|
cvfStructGrid.h
|
||||||
|
|
||||||
|
cvfStructGridCutPlane.h
|
||||||
cvfStructGridGeometryGenerator.cpp
|
cvfStructGridGeometryGenerator.cpp
|
||||||
|
cvfStructGridGeometryGenerator.h
|
||||||
|
cvfStructGridScalarDataAccess.h
|
||||||
|
|
||||||
${MOC_FILES_CPP}
|
${MOC_FILES_CPP}
|
||||||
)
|
)
|
||||||
|
@ -10,5 +10,7 @@ include_directories(
|
|||||||
|
|
||||||
add_library( ${PROJECT_NAME}
|
add_library( ${PROJECT_NAME}
|
||||||
cafPdmFieldCvfColor.cpp
|
cafPdmFieldCvfColor.cpp
|
||||||
|
cafPdmFieldCvfColor.h
|
||||||
cafPdmFieldCvfMat4d.cpp
|
cafPdmFieldCvfMat4d.cpp
|
||||||
|
cafPdmFieldCvfMat4d.h
|
||||||
)
|
)
|
||||||
|
@ -3,13 +3,29 @@ cmake_minimum_required (VERSION 2.8)
|
|||||||
project (cafProjectDataModel)
|
project (cafProjectDataModel)
|
||||||
|
|
||||||
add_library( ${PROJECT_NAME}
|
add_library( ${PROJECT_NAME}
|
||||||
cafPdmObject.cpp
|
cafAppEnum.h
|
||||||
|
cafFactory.h
|
||||||
|
cafFixedArray.h
|
||||||
|
cafOmpMutex.h
|
||||||
cafPdmDocument.cpp
|
cafPdmDocument.cpp
|
||||||
|
cafPdmDocument.h
|
||||||
cafPdmField.cpp
|
cafPdmField.cpp
|
||||||
|
cafPdmField.h
|
||||||
|
cafPdmField.inl
|
||||||
|
cafPdmFieldImpl.h
|
||||||
|
cafPdmObject.cpp
|
||||||
|
cafPdmObject.h
|
||||||
|
cafPdmObjectFactory.h
|
||||||
cafPdmPointer.cpp
|
cafPdmPointer.cpp
|
||||||
cafPdmUiItem.cpp
|
cafPdmPointer.h
|
||||||
cafPdmUiOrdering.cpp
|
|
||||||
cafPdmUiEditorHandle.cpp
|
cafPdmUiEditorHandle.cpp
|
||||||
|
cafPdmUiEditorHandle.h
|
||||||
cafPdmUiFieldEditorHandle.cpp
|
cafPdmUiFieldEditorHandle.cpp
|
||||||
|
cafPdmUiFieldEditorHandle.h
|
||||||
|
cafPdmUiItem.cpp
|
||||||
|
cafPdmUiItem.h
|
||||||
cafPdmUiObjectEditorHandle.cpp
|
cafPdmUiObjectEditorHandle.cpp
|
||||||
|
cafPdmUiObjectEditorHandle.h
|
||||||
|
cafPdmUiOrdering.cpp
|
||||||
|
cafPdmUiOrdering.h
|
||||||
)
|
)
|
||||||
|
@ -34,22 +34,38 @@ endif()
|
|||||||
|
|
||||||
add_library( ${PROJECT_NAME}
|
add_library( ${PROJECT_NAME}
|
||||||
cafBasicAboutDialog.cpp
|
cafBasicAboutDialog.cpp
|
||||||
cafUiTreeModelPdm.cpp
|
cafBasicAboutDialog.h
|
||||||
cafUiProcess.cpp
|
|
||||||
cafPdmUiDefaultObjectEditor.cpp
|
|
||||||
cafProgressInfo.cpp
|
|
||||||
|
|
||||||
cafPdmUiLineEditor.cpp
|
|
||||||
cafPdmUiCheckBoxEditor.cpp
|
cafPdmUiCheckBoxEditor.cpp
|
||||||
cafPdmUiComboBoxEditor.cpp
|
cafPdmUiCheckBoxEditor.h
|
||||||
cafPdmUiPushButtonEditor.cpp
|
|
||||||
cafPdmUiFilePathEditor.cpp
|
|
||||||
cafPdmUiListEditor.cpp
|
|
||||||
cafPdmUiSliderEditor.cpp
|
|
||||||
cafPdmUiDoubleSliderEditor.cpp
|
|
||||||
cafPdmUiColorEditor.cpp
|
cafPdmUiColorEditor.cpp
|
||||||
cafPdmUiTextEditor.cpp
|
cafPdmUiColorEditor.h
|
||||||
|
cafPdmUiComboBoxEditor.cpp
|
||||||
|
cafPdmUiComboBoxEditor.h
|
||||||
|
cafPdmUiDefaultObjectEditor.cpp
|
||||||
|
cafPdmUiDefaultObjectEditor.h
|
||||||
|
cafPdmUiDoubleSliderEditor.cpp
|
||||||
|
cafPdmUiDoubleSliderEditor.h
|
||||||
|
cafPdmUiFilePathEditor.cpp
|
||||||
|
cafPdmUiFilePathEditor.h
|
||||||
|
cafPdmUiLineEditor.cpp
|
||||||
|
cafPdmUiLineEditor.h
|
||||||
|
cafPdmUiListEditor.cpp
|
||||||
|
cafPdmUiListEditor.h
|
||||||
cafPdmUiPropertyView.cpp
|
cafPdmUiPropertyView.cpp
|
||||||
|
cafPdmUiPropertyView.h
|
||||||
|
cafPdmUiPushButtonEditor.cpp
|
||||||
|
cafPdmUiPushButtonEditor.h
|
||||||
|
cafPdmUiSliderEditor.cpp
|
||||||
|
cafPdmUiSliderEditor.h
|
||||||
|
cafPdmUiTextEditor.cpp
|
||||||
|
cafPdmUiTextEditor.h
|
||||||
|
cafProgressInfo.cpp
|
||||||
|
cafProgressInfo.h
|
||||||
|
cafUiProcess.cpp
|
||||||
|
cafUiProcess.h
|
||||||
|
cafUiTreeItem.h
|
||||||
|
cafUiTreeModelPdm.cpp
|
||||||
|
cafUiTreeModelPdm.h
|
||||||
|
|
||||||
${MOC_FILES_CPP}
|
${MOC_FILES_CPP}
|
||||||
)
|
)
|
||||||
|
@ -1,374 +0,0 @@
|
|||||||
//##################################################################################################
|
|
||||||
//
|
|
||||||
// Custom Visualization Core library
|
|
||||||
// Copyright (C) 2011-2012 Ceetron AS
|
|
||||||
//
|
|
||||||
// This library is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
//
|
|
||||||
// See the GNU General Public License at <<http://www.gnu.org/licenses/gpl.html>>
|
|
||||||
// for more details.
|
|
||||||
//
|
|
||||||
//##################################################################################################
|
|
||||||
|
|
||||||
#include "cafUiPropertyCreatorPdm.h"
|
|
||||||
|
|
||||||
#include <QDockWidget>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QItemSelectionModel>
|
|
||||||
|
|
||||||
#include "cafPdmField.h"
|
|
||||||
#include "cafPdmObject.h"
|
|
||||||
#include "cafUiTreeModelPdm.h"
|
|
||||||
|
|
||||||
#include "qtvariantproperty.h"
|
|
||||||
#include "qtpropertymanager.h"
|
|
||||||
#include "qteditorfactory.h"
|
|
||||||
|
|
||||||
#include <QTimer>
|
|
||||||
|
|
||||||
namespace caf
|
|
||||||
{
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
UiPropertyCreatorPdm::UiPropertyCreatorPdm(QObject * parent)
|
|
||||||
: QObject(parent),
|
|
||||||
m_treeModel(NULL),
|
|
||||||
m_selectionModel(NULL),
|
|
||||||
m_propertyBrowser(NULL)
|
|
||||||
{
|
|
||||||
m_variantPropertyManager = new QtVariantPropertyManager();
|
|
||||||
m_variantEditorFactory = new QtVariantEditorFactory();
|
|
||||||
|
|
||||||
m_doublePropertyManager = new QtStringPropertyManager();
|
|
||||||
m_doubleEditorFactory = new QtLineEditFactory();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
UiPropertyCreatorPdm::~UiPropertyCreatorPdm()
|
|
||||||
{
|
|
||||||
delete m_variantPropertyManager;
|
|
||||||
delete m_variantEditorFactory;
|
|
||||||
|
|
||||||
|
|
||||||
delete m_doublePropertyManager;
|
|
||||||
delete m_doubleEditorFactory;
|
|
||||||
}
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void UiPropertyCreatorPdm::setPropertyBrowser(QtAbstractPropertyBrowser* propertyBrowser)
|
|
||||||
{
|
|
||||||
m_propertyBrowser = propertyBrowser;
|
|
||||||
|
|
||||||
if (m_propertyBrowser)
|
|
||||||
{
|
|
||||||
m_propertyBrowser->setFactoryForManager(m_variantPropertyManager, m_variantEditorFactory);
|
|
||||||
m_propertyBrowser->setFactoryForManager(m_doublePropertyManager, m_doubleEditorFactory);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void UiPropertyCreatorPdm::setModel(UiTreeModelPdm* treeModel, QItemSelectionModel* selectionModel)
|
|
||||||
{
|
|
||||||
clearWidgetsAndProperties();
|
|
||||||
|
|
||||||
m_treeModel = treeModel;
|
|
||||||
if (m_treeModel)
|
|
||||||
{
|
|
||||||
connect(m_treeModel, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), SLOT(slotDataChanged(const QModelIndex &, const QModelIndex &)));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_selectionModel = selectionModel;
|
|
||||||
if (m_selectionModel)
|
|
||||||
{
|
|
||||||
connect(m_selectionModel, SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)), SLOT(slotCurrentChanged(const QModelIndex&, const QModelIndex&)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void UiPropertyCreatorPdm::createAndShowPropertiesForIndex(const QModelIndex& index)
|
|
||||||
{
|
|
||||||
if (index.isValid())
|
|
||||||
{
|
|
||||||
caf::PdmUiTreeItem* treeItem = caf::UiTreeModelPdm::getTreeItemFromIndex(index);
|
|
||||||
assert(treeItem);
|
|
||||||
|
|
||||||
caf::PdmObject* pdmObj = treeItem->dataObject();
|
|
||||||
|
|
||||||
if (m_propertyBrowser)
|
|
||||||
{
|
|
||||||
createAndShowPropertiesForObject(pdmObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit selectedObjectChanged(pdmObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void UiPropertyCreatorPdm::createAndShowPropertiesForObject(caf::PdmObject* object)
|
|
||||||
{
|
|
||||||
assert(m_propertyBrowser);
|
|
||||||
|
|
||||||
if (!object) return;
|
|
||||||
|
|
||||||
// Disconnect listening on property manager during building of property browser content
|
|
||||||
m_variantPropertyManager->disconnect(this);
|
|
||||||
m_doublePropertyManager->disconnect(this);
|
|
||||||
{
|
|
||||||
std::vector<caf::PdmFieldHandle*> fields;
|
|
||||||
uiFields(object, fields);
|
|
||||||
|
|
||||||
size_t i;
|
|
||||||
for (i = 0; i < fields.size(); i++)
|
|
||||||
{
|
|
||||||
caf::PdmFieldHandle* field = fields[i];
|
|
||||||
assert(field);
|
|
||||||
|
|
||||||
|
|
||||||
QString uiName = field->uiName();
|
|
||||||
|
|
||||||
QtProperty* qtProperty = NULL;
|
|
||||||
bool fromMenuOnly = false;
|
|
||||||
QList<PdmOptionItemInfo> enumNames = field->valueOptions(&fromMenuOnly);
|
|
||||||
|
|
||||||
// Check if we have an option menu to only show
|
|
||||||
if (!enumNames.isEmpty() && fromMenuOnly == true)
|
|
||||||
{
|
|
||||||
QtVariantProperty* variantProperty = m_variantPropertyManager->addProperty(QtVariantPropertyManager::enumTypeId(), uiName);
|
|
||||||
if (variantProperty)
|
|
||||||
{
|
|
||||||
variantProperty->setAttribute("enumNames", PdmOptionItemInfo::extractUiTexts(enumNames));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
assert(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
qtProperty = variantProperty;
|
|
||||||
}
|
|
||||||
else if (!enumNames.isEmpty() )
|
|
||||||
{
|
|
||||||
assert(false); // This is not yet supprted
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QVariant uiValue = field->uiValue();
|
|
||||||
|
|
||||||
if (uiValue.type() == QVariant::Double)
|
|
||||||
{
|
|
||||||
qtProperty = m_doublePropertyManager->addProperty(uiName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qtProperty = m_variantPropertyManager->addProperty(uiValue.type(), uiName);
|
|
||||||
|
|
||||||
if (uiValue.type() == QVariant::Color)
|
|
||||||
{
|
|
||||||
QList<QtProperty *> subProperties = qtProperty->subProperties();
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < subProperties.size(); i++)
|
|
||||||
{
|
|
||||||
qtProperty->removeSubProperty(subProperties[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (qtProperty)
|
|
||||||
{
|
|
||||||
qtProperty->setToolTip(field->uiToolTip());
|
|
||||||
qtProperty->setWhatsThis(field->uiWhatsThis());
|
|
||||||
|
|
||||||
m_properties[qtProperty] = field;
|
|
||||||
if (!field->isUiHidden())
|
|
||||||
{
|
|
||||||
m_propertyBrowser->addProperty(qtProperty);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setAllPropertyValuesFromDataSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Establish listening on property manager when all properties are updated from data source
|
|
||||||
connect(m_variantPropertyManager, SIGNAL(valueChanged(QtProperty*, const QVariant&)), SLOT(slotWriteValueToDataSource(QtProperty*, const QVariant&)));
|
|
||||||
connect(m_doublePropertyManager, SIGNAL(valueChanged(QtProperty*, const QString&)), SLOT(slotWriteDoubleValueToDataSource(QtProperty*, const QString&)));
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void UiPropertyCreatorPdm::clearWidgetsAndProperties()
|
|
||||||
{
|
|
||||||
if (m_propertyBrowser)
|
|
||||||
{
|
|
||||||
m_propertyBrowser->clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_properties.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void UiPropertyCreatorPdm::setAllPropertyValuesFromDataSource()
|
|
||||||
{
|
|
||||||
std::map<QtProperty*, caf::PdmFieldHandle*>::iterator it;
|
|
||||||
for (it = m_properties.begin(); it != m_properties.end(); it++)
|
|
||||||
{
|
|
||||||
#if 1
|
|
||||||
if (it->second->isUiHidden())
|
|
||||||
{
|
|
||||||
QtProperty* prop = it->first;
|
|
||||||
#if 0
|
|
||||||
it++;
|
|
||||||
m_properties.erase(prop);
|
|
||||||
delete prop;
|
|
||||||
#endif
|
|
||||||
m_propertyBrowser->removeProperty(prop);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
m_propertyBrowser->addProperty(it->first);
|
|
||||||
QVariant uiValue = it->second->uiValue();
|
|
||||||
|
|
||||||
if (uiValue.type() == QVariant::Double)
|
|
||||||
{
|
|
||||||
QString text = uiValue.toString();
|
|
||||||
m_doublePropertyManager->setValue(it->first, text);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_variantPropertyManager->setValue(it->first, uiValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString uiName = it->second->uiName();
|
|
||||||
it->first->setPropertyName(uiName);
|
|
||||||
|
|
||||||
bool fromMenuOnly = false;
|
|
||||||
QList<PdmOptionItemInfo> enumNames = it->second->valueOptions(&fromMenuOnly);
|
|
||||||
if (!enumNames.isEmpty() && fromMenuOnly == true)
|
|
||||||
{
|
|
||||||
QtVariantProperty* variantProperty = dynamic_cast<QtVariantProperty*>(it->first);
|
|
||||||
if (variantProperty)
|
|
||||||
{
|
|
||||||
variantProperty->setAttribute("enumNames", PdmOptionItemInfo::extractUiTexts(enumNames));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void UiPropertyCreatorPdm::slotWriteValueToDataSource(QtProperty* uiProperty, const QVariant& newValue)
|
|
||||||
{
|
|
||||||
assert(uiProperty);
|
|
||||||
|
|
||||||
caf::PdmFieldHandle* field = NULL;
|
|
||||||
|
|
||||||
std::map<QtProperty*, caf::PdmFieldHandle*>::iterator it;
|
|
||||||
for (it = m_properties.begin(); it != m_properties.end(); it++)
|
|
||||||
{
|
|
||||||
if (it->first == uiProperty)
|
|
||||||
{
|
|
||||||
field = it->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!field) return;
|
|
||||||
|
|
||||||
// Make sure we return a QVariant of unsigned int to tell pdm that we are using an option
|
|
||||||
// index, and not an int value.
|
|
||||||
QtVariantProperty* variantProperty = dynamic_cast<QtVariantProperty*> (uiProperty);
|
|
||||||
if (variantProperty && variantProperty->propertyType() == QtVariantPropertyManager::enumTypeId())
|
|
||||||
{
|
|
||||||
QVariant uintValue(newValue.toUInt());
|
|
||||||
field->setValueFromUi(uintValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
field->setValueFromUi(newValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_selectionModel)
|
|
||||||
{
|
|
||||||
m_treeModel->emitDataChanged(m_selectionModel->currentIndex());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void UiPropertyCreatorPdm::slotWriteDoubleValueToDataSource(QtProperty* uiProperty, const QString& newValue)
|
|
||||||
{
|
|
||||||
double doubleValue = newValue.toDouble();
|
|
||||||
|
|
||||||
slotWriteValueToDataSource(uiProperty, doubleValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void UiPropertyCreatorPdm::slotDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
|
|
||||||
{
|
|
||||||
if (m_selectionModel)
|
|
||||||
{
|
|
||||||
if (topLeft == m_selectionModel->currentIndex())
|
|
||||||
{
|
|
||||||
// We must delay update of widgets to after the signal has returned
|
|
||||||
QTimer::singleShot(0, this, SLOT(slotUpdateProperties()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void UiPropertyCreatorPdm::slotCurrentChanged(const QModelIndex& current, const QModelIndex& previous)
|
|
||||||
{
|
|
||||||
clearWidgetsAndProperties();
|
|
||||||
|
|
||||||
createAndShowPropertiesForIndex(current);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void UiPropertyCreatorPdm::slotUpdateProperties()
|
|
||||||
{
|
|
||||||
setAllPropertyValuesFromDataSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UiPropertyCreatorPdm::uiFields(const caf::PdmObject* object, std::vector<caf::PdmFieldHandle*>& fields) const
|
|
||||||
{
|
|
||||||
assert(object);
|
|
||||||
object->fields(fields);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // end namespace caf
|
|
@ -1,93 +0,0 @@
|
|||||||
//##################################################################################################
|
|
||||||
//
|
|
||||||
// Custom Visualization Core library
|
|
||||||
// Copyright (C) 2011-2012 Ceetron AS
|
|
||||||
//
|
|
||||||
// This library is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
//
|
|
||||||
// See the GNU General Public License at <<http://www.gnu.org/licenses/gpl.html>>
|
|
||||||
// for more details.
|
|
||||||
//
|
|
||||||
//##################################################################################################
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <map>
|
|
||||||
#include <QAbstractItemModel>
|
|
||||||
|
|
||||||
class QDockWidget;
|
|
||||||
class QLabel;
|
|
||||||
class QtAbstractPropertyBrowser;
|
|
||||||
class QItemSelectionModel;
|
|
||||||
|
|
||||||
// Property browser
|
|
||||||
class QtVariantEditorFactory;
|
|
||||||
class QtVariantPropertyManager;
|
|
||||||
class QtProperty;
|
|
||||||
class QtStringPropertyManager;
|
|
||||||
class QtLineEditFactory;
|
|
||||||
|
|
||||||
namespace caf {
|
|
||||||
class PdmObject;
|
|
||||||
class PdmFieldHandle;
|
|
||||||
class UiTreeModelPdm;
|
|
||||||
|
|
||||||
|
|
||||||
class UiPropertyCreatorPdm : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
UiPropertyCreatorPdm(QObject* parent);
|
|
||||||
~UiPropertyCreatorPdm();
|
|
||||||
void setPropertyBrowser(QtAbstractPropertyBrowser* propertyBrowser);
|
|
||||||
void setModel(UiTreeModelPdm* treeModel, QItemSelectionModel* selectionModel);
|
|
||||||
|
|
||||||
virtual void uiFields(const caf::PdmObject* object, std::vector<caf::PdmFieldHandle*>& fields) const;
|
|
||||||
|
|
||||||
void createAndShowPropertiesForObject(caf::PdmObject* dataSource);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void selectedObjectChanged(caf::PdmObject* object);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void createAndShowPropertiesForIndex(const QModelIndex& index);
|
|
||||||
|
|
||||||
void setAllPropertyValuesFromDataSource();
|
|
||||||
void clearWidgetsAndProperties();
|
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
|
|
||||||
void slotWriteValueToDataSource(QtProperty* uiProperty, const QVariant& newValue);
|
|
||||||
void slotWriteDoubleValueToDataSource(QtProperty* uiProperty, const QString& newValue);
|
|
||||||
void slotDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
|
|
||||||
void slotCurrentChanged(const QModelIndex& current, const QModelIndex& previous);
|
|
||||||
|
|
||||||
void slotUpdateProperties();
|
|
||||||
|
|
||||||
private:
|
|
||||||
UiTreeModelPdm* m_treeModel;
|
|
||||||
QItemSelectionModel* m_selectionModel;
|
|
||||||
QtAbstractPropertyBrowser* m_propertyBrowser;
|
|
||||||
|
|
||||||
QtVariantPropertyManager* m_variantPropertyManager;
|
|
||||||
QtVariantEditorFactory* m_variantEditorFactory;
|
|
||||||
|
|
||||||
QtStringPropertyManager* m_doublePropertyManager;
|
|
||||||
QtLineEditFactory* m_doubleEditorFactory;
|
|
||||||
|
|
||||||
std::map<QtProperty*, caf::PdmFieldHandle*> m_properties;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // end namespace caf
|
|
@ -17,10 +17,16 @@ endif()
|
|||||||
|
|
||||||
|
|
||||||
add_library( ${PROJECT_NAME}
|
add_library( ${PROJECT_NAME}
|
||||||
cafViewer.cpp
|
|
||||||
cafNavigationPolicy.cpp
|
|
||||||
cafCadNavigation.cpp
|
cafCadNavigation.cpp
|
||||||
|
cafCadNavigation.h
|
||||||
cafCeetronNavigation.cpp
|
cafCeetronNavigation.cpp
|
||||||
|
cafCeetronNavigation.h
|
||||||
|
cafNavigationPolicy.cpp
|
||||||
|
cafNavigationPolicy.h
|
||||||
cafOpenGLWidget.cpp
|
cafOpenGLWidget.cpp
|
||||||
|
cafOpenGLWidget.h
|
||||||
|
cafViewer.cpp
|
||||||
|
cafViewer.h
|
||||||
|
|
||||||
${MOC_FILES_CPP}
|
${MOC_FILES_CPP}
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user