diff --git a/Modules/RTUI/Helper/mitkRTUIConstants.h b/Modules/RTUI/Helper/mitkRTUIConstants.h index 87fed4df09..47d870d3d6 100644 --- a/Modules/RTUI/Helper/mitkRTUIConstants.h +++ b/Modules/RTUI/Helper/mitkRTUIConstants.h @@ -1,84 +1,93 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef _MITK_RT_UI_CONSTANTS_H_ #define _MITK_RT_UI_CONSTANTS_H_ #include #include #include "MitkRTUIExports.h" +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable:4251) +#endif + namespace mitk { struct MITKRTUI_EXPORT RTUIConstants { /** ID/Path of main preference node for RT UI. */ static const std::string ROOT_PREFERENCE_NODE_ID; /** Bool that indicates how the prescribed dose should be defined, if unkown. True: UNKNOWN_PRESCRIBED_DOSE_HANDLING_VALUE should be used as default dose value in Gy; False: it should be used as fraction of the max dose to determin the prescribed dose.*/ static const std::string UNKNOWN_PRESCRIBED_DOSE_HANDLING_AS_DEFAULT_ID; /** Value that is used to determin unknown prescribed doses.*/ static const std::string UNKNOWN_PRESCRIBED_DOSE_HANDLING_VALUE_ID; /** ID/Path of main preference node where all iso dose level presets are stored (e.g. ROOT_ISO_PRESETS_PREFERENCE_NODE_ID+"/[Preset1]"). */ static const std::string ROOT_ISO_PRESETS_PREFERENCE_NODE_ID; /** ID/Path of main preference for dose visualization preferences. */ static const std::string ROOT_DOSE_VIS_PREFERENCE_NODE_ID; /** ID for the reference dose stored as preference. */ static const std::string REFERENCE_DOSE_ID; /** ID for the preference flag that indicates if the reference dose is synced for all nodes*/ static const std::string GLOBAL_REFERENCE_DOSE_SYNC_ID; /** ID for the flag if dose should be displayed as absoulte dose. */ static const std::string DOSE_DISPLAY_ABSOLUTE_ID; /** ID for the global visiblity switch for iso line visualization. */ static const std::string GLOBAL_VISIBILITY_ISOLINES_ID; /** ID for the global visiblity switch for color wash visualization. */ static const std::string GLOBAL_VISIBILITY_COLORWASH_ID; /** ID for the selected iso preset that should be used (value of ROOT_ISO_PRESETS_PREFERENCE_NODE_ID + value of this key can be used to construct the passed to the selected preset. */ static const std::string SELECTED_ISO_PRESET_ID; /** ID for the relative dose value of an iso dose level. */ static const std::string ISO_LEVEL_DOSE_VALUE_ID; /** ID for the color (red component) of an iso dose level. */ static const std::string ISO_LEVEL_COLOR_RED_ID; /** ID for the color (green component) of an iso dose level. */ static const std::string ISO_LEVEL_COLOR_GREEN_ID; /** ID for the color (blue component) of an iso dose level. */ static const std::string ISO_LEVEL_COLOR_BLUE_ID; /** ID for the visiblity switch for iso line visualization. */ static const std::string ISO_LEVEL_VISIBILITY_ISOLINES_ID; /** ID for the visiblity switch for color wash visualization. */ static const std::string ISO_LEVEL_VISIBILITY_COLORWASH_ID; /** Default value used as reference_dose_if not defined by application or data node*/ static const DoseValueAbs DEFAULT_REFERENCE_DOSE_VALUE; }; struct MITKRTUI_EXPORT RTCTKEventConstants { /** ID/Path of main preference node for RT UI. */ static const std::string TOPIC_REFERENCE_DOSE; static const std::string TOPIC_REFERENCE_DOSE_CHANGED; static const std::string TOPIC_ISO_DOSE_LEVEL_PRESETS; static const std::string TOPIC_ISO_DOSE_LEVEL_PRESETS_CHANGED; static const std::string TOPIC_GLOBAL_VISIBILITY_CHANGED; }; } +#ifdef _MSC_VER +# pragma warning(pop) +#endif + #endif diff --git a/Modules/RTUI/Qmitk/QmitkDoseValueDelegate.cpp b/Modules/RTUI/Qmitk/QmitkDoseValueDelegate.cpp index d38df7e3bb..0c7f90fc21 100644 --- a/Modules/RTUI/Qmitk/QmitkDoseValueDelegate.cpp +++ b/Modules/RTUI/Qmitk/QmitkDoseValueDelegate.cpp @@ -1,113 +1,113 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "QmitkDoseValueDelegate.h" #include #include #include #include QmitkDoseValueDelegate::QmitkDoseValueDelegate(QObject * /*parent*/) { } void QmitkDoseValueDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option , const QModelIndex &index) const { QVariant data = index.data(Qt::DisplayRole); - QStyleOptionViewItemV4 opt = option; + QStyleOptionViewItem opt = option; initStyleOption(&opt, index); QStyle *style = QApplication::style(); style->drawItemText(painter, opt.rect.adjusted(0,0,-5,0), Qt::AlignRight | Qt::AlignVCenter, opt.palette,true, data.toString()); } QWidget* QmitkDoseValueDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem & , const QModelIndex &index) const { QVariant data = index.data(Qt::EditRole); QVariant displayData = index.data(Qt::DisplayRole); QVariant absoluteDose = index.data(Qt::UserRole+1); if(data.isValid()) { QDoubleSpinBox* spinBox = new QDoubleSpinBox(parent); spinBox->setDecimals(2); if (absoluteDose.toBool()) { spinBox->setSingleStep(0.5); spinBox->setSuffix(QString(" Gy")); } else { spinBox->setSingleStep(1.0); spinBox->setSuffix(QString(" %")); } spinBox->setMinimum(0.0); spinBox->setMaximum(9999.0); spinBox->installEventFilter( const_cast(this) ); return spinBox; } else return new QLabel(displayData.toString(), parent); } void QmitkDoseValueDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const { QVariant data = index.data(Qt::EditRole); if(data.isValid()) { QDoubleSpinBox* spinBox = qobject_cast(editor); if (spinBox) { spinBox->setValue(data.toDouble()); } else { QStyledItemDelegate::setEditorData(editor, index); } } } void QmitkDoseValueDelegate::setModelData(QWidget *editor, QAbstractItemModel* model , const QModelIndex &index) const { QVariant data = index.data(Qt::EditRole); if(data.isValid()) { QDoubleSpinBox* spinBox = qobject_cast(editor); double doubleValue = spinBox->value(); QVariant doubleValueVariant(doubleValue); model->setData(index, doubleValueVariant); } else { QStyledItemDelegate::setModelData(editor, model, index); } }