return;
}
- SessionPtr aMgr = ModelAPI_Session::get();
QString aDescription = tr("Delete %1");
QStringList aObjectNames;
foreach (ObjectPtr aObj, theList) {
aObjectNames << QString::fromStdString(aObj->data()->name());
}
aDescription = aDescription.arg(aObjectNames.join(", "));
+ SessionPtr aMgr = ModelAPI_Session::get();
aMgr->startOperation(aDescription.toStdString());
std::set<FeaturePtr>::const_iterator anIt = aRefFeatures.begin(),
aLast = aRefFeatures.end();
//**************************************************************
#include <QDialog>
+#include <QDialogButtonBox>
#include <QHBoxLayout>
#include <QtxColorButton.h>
#include <ModelAPI_AttributeColor.h>
aColorAttr->values(aRed, aGreen, aBlue);
// 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;
// 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<ModelAPI_Result>(anObj);
if (aResult.get() != NULL) {
AttributePtr anAttr = aResult->data()->attribute(ModelAPI_Result::COLOR_ID());
if (anAttr.get() != NULL) {
aColorAttr = std::dynamic_pointer_cast<ModelAPI_AttributeColor>(anAttr);
- if (aColorAttr.get() != NULL)
+ if (aColorAttr.get() != NULL) {
aColorAttr->setValues(aRedResult, aGreenResult, aBlueResult);
+ ModelAPI_EventCreator::get()->sendUpdated(anObj, EVENT_DISP);
+ }
}
}
}
+ aMgr->finishOperation();
+ updateCommandStatus();
}
//**************************************************************