Skip to content

Commit

Permalink
Refs #6616. Specialized version of property manager for parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
arturbekasov committed Mar 7, 2014
1 parent 62ba1c1 commit a3210c0
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 6 deletions.
Expand Up @@ -26,6 +26,8 @@ class QtIntPropertyManager;
class QtBoolPropertyManager;
class QtStringPropertyManager;
class QtEnumPropertyManager;
class ParameterPropertyManager;

class QtProperty;
class QtBrowserItem;

Expand Down Expand Up @@ -360,7 +362,7 @@ private slots:
QtGroupPropertyManager *m_vectorManager;
QtIntPropertyManager *m_vectorSizeManager;
QtDoublePropertyManager *m_vectorDoubleManager;
QtDoublePropertyManager *m_parameterManager;
ParameterPropertyManager *m_parameterManager;

QtProperty *m_workspace;
QtProperty *m_workspaceIndex;
Expand Down
6 changes: 4 additions & 2 deletions Code/Mantid/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp
Expand Up @@ -29,6 +29,8 @@

#include "qttreepropertybrowser.h"
#include "qtpropertymanager.h"
#include "ParameterPropertyManager.h"

// Suppress a warning coming out of code that isn't ours
#if defined(__INTEL_COMPILER)
#pragma warning disable 1125
Expand Down Expand Up @@ -185,7 +187,7 @@ m_mantidui(mantidui)
m_vectorManager = new QtGroupPropertyManager(w);
m_vectorSizeManager = new QtIntPropertyManager(w);
m_vectorDoubleManager = new QtDoublePropertyManager(w);
m_parameterManager = new QtDoublePropertyManager(w);
m_parameterManager = new ParameterPropertyManager(w);
}


Expand Down Expand Up @@ -449,7 +451,7 @@ void FitPropertyBrowser::createEditors(QWidget *w)
m_browser->setFactoryForManager(m_columnManager, comboBoxFactory);
m_browser->setFactoryForManager(m_vectorSizeManager, spinBoxFactory);
m_browser->setFactoryForManager(m_vectorDoubleManager, doubleEditorFactory);
m_browser->setFactoryForManager(m_parameterManager, doubleEditorFactory);
m_browser->setFactoryForManager(static_cast<QtDoublePropertyManager*>(m_parameterManager), doubleEditorFactory);
}


Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/MantidQt/MantidWidgets/src/PropertyHandler.cpp
Expand Up @@ -18,6 +18,7 @@

#include "qttreepropertybrowser.h"
#include "qtpropertymanager.h"
#include "ParameterPropertyManager.h"

#include <QMessageBox>
#include <QMenu>
Expand Down
8 changes: 5 additions & 3 deletions Code/Mantid/QtPropertyBrowser/CMakeLists.txt
Expand Up @@ -20,9 +20,10 @@ set( QTPROPERTYBROWSER_SRCS
src/qtbuttonpropertybrowser.cpp
src/qtgroupboxpropertybrowser.cpp
src/qtpropertybrowserutils.cpp
src/DoubleEditorFactory.cpp
src/StringDialogEditorFactory.cpp
src/StringEditorFactory.cpp
src/DoubleEditorFactory.cpp
src/StringDialogEditorFactory.cpp
src/StringEditorFactory.cpp
src/ParameterPropertyManager.cpp
)

# moc'd files will end up in build directory, so add to include path
Expand Down Expand Up @@ -106,6 +107,7 @@ set (
qt4_wrap_cpp ( EXTRA_MOCS src/DoubleEditorFactory.h
src/StringDialogEditorFactory.h
src/StringEditorFactory.h
src/ParameterPropertyManager.h
)

set (
Expand Down
17 changes: 17 additions & 0 deletions Code/Mantid/QtPropertyBrowser/src/ParameterPropertyManager.cpp
@@ -0,0 +1,17 @@
#include "ParameterPropertyManager.h"
#include "qtpropertymanager.h"

ParameterPropertyManager::ParameterPropertyManager(QObject *parent)
: QtDoublePropertyManager(parent)
{}

/**
* Adds error parameter value to property display
* @param property :: Property we want to display
* @return Text representation of the property
* @see QtAbstractPropertyManager
*/
QString ParameterPropertyManager::valueText(const QtProperty* property) const
{
return QtDoublePropertyManager::valueText(property) + " (Error here)";
}
42 changes: 42 additions & 0 deletions Code/Mantid/QtPropertyBrowser/src/ParameterPropertyManager.h
@@ -0,0 +1,42 @@
#ifndef PARAMETERPROPERTYMANAGER_H
#define PARAMETERPROPERTYMANAGER_H

#include "qtpropertymanager.h"

/** ParameterPropertyManager : specialized version of QtDoublePropertyManager for fitting parameters.
Is capable to store/display parameter errors in addition to value.
Copyright &copy; 2014 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
This file is part of Mantid.
Mantid 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.
Mantid 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 for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class ParameterPropertyManager : public QtDoublePropertyManager
{
Q_OBJECT

public:
ParameterPropertyManager(QObject *parent = 0);

protected:
/// Text representation of the property
virtual QString valueText(const QtProperty *property) const;
};

#endif // PARAMETERPROPERTYMANAGER_H

0 comments on commit a3210c0

Please sign in to comment.