From 67ed715eba23f7e0b29a4b373dbec657e0571464 Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 20 Apr 2016 11:40:06 +0300 Subject: [PATCH] Correction of Boolean crash --- src/FeaturesPlugin/boolean_widget.xml | 2 +- src/ModuleBase/ModuleBase_WidgetAction.cpp | 3 ++- src/ModuleBase/ModuleBase_WidgetChoice.cpp | 2 +- src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp | 3 ++- src/ModuleBase/ModuleBase_WidgetIntValue.cpp | 3 ++- src/ModuleBase/ModuleBase_WidgetLineEdit.cpp | 3 ++- src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp | 3 ++- src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp | 3 ++- src/PartSet/PartSet_Module.cpp | 3 ++- src/SketchPlugin/SketchPlugin_Sketch.cpp | 4 +++- 10 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/FeaturesPlugin/boolean_widget.xml b/src/FeaturesPlugin/boolean_widget.xml index 109fa58cb..53a10a97b 100644 --- a/src/FeaturesPlugin/boolean_widget.xml +++ b/src/FeaturesPlugin/boolean_widget.xml @@ -8,7 +8,7 @@ tooltip="Type of boolean operation" string_list="Cut Fuse Common Smash" use_in_title="true" - icons_list="icons/Features/bool_cut.png :icons/bool_fuse.png :icons/bool_common.png :icons/bool_smash.png" + icons_list="icons/Features/bool_cut.png icons/Features/bool_fuse.png icons/Features/bool_common.png icons/Features/bool_smash.png" default="0" /> #include +#include #include @@ -35,7 +36,7 @@ ModuleBase_WidgetAction::ModuleBase_WidgetAction(QWidget* theParent, QString aLabelIcon = QString::fromStdString(theData->widgetIcon()); if (!aLabelIcon.isEmpty()) - myButton->setIcon(QPixmap(aLabelIcon)); + myButton->setIcon(ModuleBase_IconFactory::loadPixmap(aLabelIcon)); else myButton->setText(aText); myButton->setToolTip(aToolTip); diff --git a/src/ModuleBase/ModuleBase_WidgetChoice.cpp b/src/ModuleBase/ModuleBase_WidgetChoice.cpp index 3d26909bf..5797e7cc8 100644 --- a/src/ModuleBase/ModuleBase_WidgetChoice.cpp +++ b/src/ModuleBase/ModuleBase_WidgetChoice.cpp @@ -84,7 +84,7 @@ ModuleBase_WidgetChoice::ModuleBase_WidgetChoice(QWidget* theParent, } else { myLabel = new QLabel(aLabelText, this); if (!aLabelIcon.isEmpty()) - myLabel->setPixmap(QPixmap(aLabelIcon)); + myLabel->setPixmap(ModuleBase_IconFactory::loadPixmap(aLabelIcon)); aLayout->addWidget(myLabel); std::string aToolstr = theData->widgetTooltip(); diff --git a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp index 5bbf18447..e6408e212 100644 --- a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -44,7 +45,7 @@ ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent, QString aLabelIcon = QString::fromStdString(theData->widgetIcon()); myLabel = new QLabel(aLabelText, this); if (!aLabelIcon.isEmpty()) - myLabel->setPixmap(QPixmap(aLabelIcon)); + myLabel->setPixmap(ModuleBase_IconFactory::loadPixmap(aLabelIcon)); bool aAcceptVariables = theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true); diff --git a/src/ModuleBase/ModuleBase_WidgetIntValue.cpp b/src/ModuleBase/ModuleBase_WidgetIntValue.cpp index 996e16fb5..dae84951a 100644 --- a/src/ModuleBase/ModuleBase_WidgetIntValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetIntValue.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -45,7 +46,7 @@ ModuleBase_WidgetIntValue::ModuleBase_WidgetIntValue(QWidget* theParent, QString aLabelIcon = QString::fromStdString(theData->widgetIcon()); myLabel = new QLabel(aLabelText, this); if (!aLabelIcon.isEmpty()) - myLabel->setPixmap(QPixmap(aLabelIcon)); + myLabel->setPixmap(ModuleBase_IconFactory::loadPixmap(aLabelIcon)); mySpinBox = new ModuleBase_ParamIntSpinBox(this); QString anObjName = QString::fromStdString(attributeID()); diff --git a/src/ModuleBase/ModuleBase_WidgetLineEdit.cpp b/src/ModuleBase/ModuleBase_WidgetLineEdit.cpp index 54223e6d2..ef869fdcd 100644 --- a/src/ModuleBase/ModuleBase_WidgetLineEdit.cpp +++ b/src/ModuleBase/ModuleBase_WidgetLineEdit.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -84,7 +85,7 @@ ModuleBase_WidgetLineEdit::ModuleBase_WidgetLineEdit(QWidget* theParent, QString aLabelIcon = QString::fromStdString(theData->widgetIcon()); QLabel* aLabel = new QLabel(aLabelText, this); if (!aLabelIcon.isEmpty()) - aLabel->setPixmap(QPixmap(aLabelIcon)); + aLabel->setPixmap(ModuleBase_IconFactory::loadPixmap(aLabelIcon)); myLineEdit = new CustomLineEdit( this, QString::fromStdString( thePlaceHolder ) ); // Here we do not use the Qt's standard method setPlaceHolderText() since it diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index 57852847b..a4dc15377 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -122,7 +123,7 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen QString aLabelIcon = QString::fromStdString(theData->widgetIcon()); if (!aLabelIcon.isEmpty()) { QLabel* aSelectedLabel = new QLabel("", this); - aSelectedLabel->setPixmap(QPixmap(aLabelIcon)); + aSelectedLabel->setPixmap(ModuleBase_IconFactory::loadPixmap(aLabelIcon)); aMainLay->addWidget(aSelectedLabel, 1, 1); } aMainLay->setColumnStretch(2, 1); diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp index c59fdceaf..013b89d3c 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -77,7 +78,7 @@ ModuleBase_WidgetShapeSelector::ModuleBase_WidgetShapeSelector(QWidget* theParen QString aLabelIcon = QString::fromStdString(theData->widgetIcon()); myLabel = new QLabel(aLabelText, this); if (!aLabelIcon.isEmpty()) - myLabel->setPixmap(QPixmap(aLabelIcon)); + myLabel->setPixmap(ModuleBase_IconFactory::loadPixmap(aLabelIcon)); QString aToolTip = QString::fromStdString(theData->widgetTooltip()); diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 5cf3d5e5a..e2e1f3600 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -1305,7 +1305,8 @@ void PartSet_Module::onChoiceChanged(ModuleBase_ModelWidget* theWidget, if (!aOperation) return; ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel(); - aPanel->setWindowTitle(aChoiceTitle); + if (aPanel) + aPanel->setWindowTitle(aChoiceTitle); } } diff --git a/src/SketchPlugin/SketchPlugin_Sketch.cpp b/src/SketchPlugin/SketchPlugin_Sketch.cpp index e30faa17a..053957cc5 100644 --- a/src/SketchPlugin/SketchPlugin_Sketch.cpp +++ b/src/SketchPlugin/SketchPlugin_Sketch.cpp @@ -55,9 +55,11 @@ void SketchPlugin_Sketch::initAttributes() ModelAPI_Session::get()->validators()->registerNotObligatory( getKind(), SketchPlugin_SketchEntity::EXTERNAL_ID()); data()->addAttribute(SketchPlugin_Sketch::SOLVER_ERROR(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(SketchPlugin_Sketch::SOLVER_DOF(), ModelAPI_AttributeString::typeId()); ModelAPI_Session::get()->validators()->registerNotObligatory( getKind(), SketchPlugin_Sketch::SOLVER_ERROR()); + data()->addAttribute(SketchPlugin_Sketch::SOLVER_DOF(), ModelAPI_AttributeString::typeId()); + ModelAPI_Session::get()->validators()->registerNotObligatory( + getKind(), SketchPlugin_Sketch::SOLVER_DOF()); } void SketchPlugin_Sketch::execute() -- 2.30.2