From: nds Date: Tue, 10 Mar 2015 09:08:03 +0000 (+0300) Subject: Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0 X-Git-Tag: V_1.1.0~143^2~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=baa32827d0f7eac19aca82eb41d2aa708b358181;p=modules%2Fshaper.git Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0 Conflicts: src/XGUI/XGUI_Workshop.cpp --- baa32827d0f7eac19aca82eb41d2aa708b358181 diff --cc src/XGUI/XGUI_Workshop.cpp index 7a7a82062,a1a872754..dacaa1512 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@@ -1405,10 -1405,9 +1405,10 @@@ bool XGUI_Workshop::canChangeColor() co //************************************************************** #include +#include #include #include - #include + #include void XGUI_Workshop::changeColor(const QObjectPtrList& theObjects) { // 1. find the initial value of the color @@@ -1422,18 -1419,17 +1420,19 @@@ } } // there is no object with the color attribute - if (aColorAttr.get() == NULL) + if (aColorAttr.get() == NULL || aColorAttr->size() == 0) return; - int aRed, aGreen, aBlue; - aColorAttr->values(aRed, aGreen, aBlue); + int aRed = aColorAttr->value(0); + int aGreen = aColorAttr->value(1); + int aBlue = aColorAttr->value(2); // 2. show the dialog to change the value - QDialog aDlg; - QHBoxLayout* aLay = new QHBoxLayout(&aDlg); + QDialog* aDlg = new QDialog(); + QVBoxLayout* aLay = new QVBoxLayout(aDlg); + + QtxColorButton* aColorBtn = new QtxColorButton(aDlg); + aColorBtn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - QtxColorButton* aColorBtn = new QtxColorButton(&aDlg); aLay->addWidget(aColorBtn); aColorBtn->setColor(QColor(aRed, aGreen, aBlue)); @@@ -1468,13 -1456,14 +1467,15 @@@ foreach(ObjectPtr anObj, theObjects) { ResultPtr aResult = std::dynamic_pointer_cast(anObj); if (aResult.get() != NULL) { - AttributePtr anAttr = aResult->data()->attribute(ModelAPI_Result::COLOR_ID()); - if (anAttr.get() != NULL) { - aColorAttr = std::dynamic_pointer_cast(anAttr); - if (aColorAttr.get() != NULL) { - aColorAttr->setValues(aRedResult, aGreenResult, aBlueResult); - ModelAPI_EventCreator::get()->sendUpdated(anObj, EVENT_DISP); + aColorAttr = aResult->data()->intArray(ModelAPI_Result::COLOR_ID()); + if (aColorAttr.get() != NULL) { + if (!aColorAttr->size()) { + aColorAttr->setSize(3); } + aColorAttr->setValue(0, aRedResult); + aColorAttr->setValue(1, aGreenResult); + aColorAttr->setValue(2, aBlueResult); ++ ModelAPI_EventCreator::get()->sendUpdated(anObj, EVENT_DISP); } } }