X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FXGUI%2FXGUI_Workshop.cpp;h=dacaa1512da880587ec7efdc42d68434920aad24;hb=baa32827d0f7eac19aca82eb41d2aa708b358181;hp=a1a8727548a718536b40b6bd905349039ef206ea;hpb=416a42ef199bf4105302e79645ad6334dd74f41b;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index a1a872754..dacaa1512 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1335,7 +1335,6 @@ These features will be deleted also. Would you like to continue?")).arg(aNames), return; } - SessionPtr aMgr = ModelAPI_Session::get(); QString aDescription = tr("Delete %1"); QStringList aObjectNames; foreach (ObjectPtr aObj, theList) { @@ -1344,6 +1343,7 @@ These features will be deleted also. Would you like to continue?")).arg(aNames), aObjectNames << QString::fromStdString(aObj->data()->name()); } aDescription = aDescription.arg(aObjectNames.join(", ")); + SessionPtr aMgr = ModelAPI_Session::get(); aMgr->startOperation(aDescription.toStdString()); std::set::const_iterator anIt = aRefFeatures.begin(), aLast = aRefFeatures.end(); @@ -1405,6 +1405,7 @@ bool XGUI_Workshop::canChangeColor() const //************************************************************** #include +#include #include #include #include @@ -1426,17 +1427,23 @@ void XGUI_Workshop::changeColor(const QObjectPtrList& theObjects) 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)); - QPoint aPoint = QCursor::pos(); - aDlg.move(aPoint); + QDialogButtonBox* aButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, + Qt::Horizontal, aDlg); + connect(aButtons, SIGNAL(accepted()), aDlg, SLOT(accept())); + connect(aButtons, SIGNAL(rejected()), aDlg, SLOT(reject())); + aLay->addWidget(aButtons); - bool isDone = aDlg.exec() == QDialog::Accepted; + aDlg->move(QCursor::pos()); + bool isDone = aDlg->exec() == QDialog::Accepted; if (!isDone) return; @@ -1451,8 +1458,12 @@ void XGUI_Workshop::changeColor(const QObjectPtrList& theObjects) // 3. abort the previous operation and start a new one if(!isActiveOperationAborted()) return; + SessionPtr aMgr = ModelAPI_Session::get(); + QString aDescription = contextMenuMgr()->action("DELETE_CMD")->text(); + aMgr->startOperation(aDescription.toStdString()); // 4. set the value to all results + static Events_ID EVENT_DISP = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY); foreach(ObjectPtr anObj, theObjects) { ResultPtr aResult = std::dynamic_pointer_cast(anObj); if (aResult.get() != NULL) { @@ -1464,9 +1475,12 @@ void XGUI_Workshop::changeColor(const QObjectPtrList& theObjects) aColorAttr->setValue(0, aRedResult); aColorAttr->setValue(1, aGreenResult); aColorAttr->setValue(2, aBlueResult); + ModelAPI_EventCreator::get()->sendUpdated(anObj, EVENT_DISP); } } } + aMgr->finishOperation(); + updateCommandStatus(); } //**************************************************************