void PlantBrushDockWidget::doClose() { if (isCurrentProjectDirty()) { QMessageBox messageBox(this); messageBox.setWindowTitle(QWidget::tr("提示")); messageBox.setIcon(QMessageBox::Question); messageBox.setText(QWidget::tr("数据已被编辑,是否保存?")); QPushButton *yesButton = messageBox.addButton(QWidget::tr("确定"), QMessageBox::YesRole); QPushButton *noButton = messageBox.addButton(QWidget::tr("放弃"), QMessageBox::NoRole); messageBox.exec(); if (messageBox.clickedButton() != noButton) slotSaveButtonClicked(true); else slotCancelButtonClicked(true); } dirtyCurrentProject(_projectModify); CommandManager::instance().removeStack("PlantEdit"); CommandManager::instance().switchStack(); SignalsSlotsCenter::instance().emitActiveWidget(this, false); }
CCopasiPlotSelectionDialog::CCopasiPlotSelectionDialog(QWidget* parent, const char* name, bool modal, Qt::WFlags f): QDialog(parent, f) , mpOKButton(NULL) , mpCancelButton(NULL) , mpExpertCheckBox(NULL) , mpXAxisSelectionWidget(NULL) , mpYAxisSelectionWidget(NULL) , mpSplitter(NULL) , mpButtonBox(NULL) , mpMainLayout(NULL) , mpXAxisLabel(NULL) , mpYAxisLabel(NULL) , mpXAxisSelectionBox(NULL) , mpYAxisSelectionBox(NULL) , mpXAxisOutputVector(NULL) , mpYAxisOutputVector(NULL) { setObjectName(QString::fromUtf8(name)); setModal(modal); mpMainLayout = new QVBoxLayout(this); mpSplitter = new QSplitter(this); mpSplitter->setOrientation(Qt::Horizontal); mpMainLayout->addWidget(mpSplitter); mpButtonBox = new QHBoxLayout(this); mpMainLayout->addLayout(mpButtonBox); mpOKButton = new QPushButton(this); mpOKButton->setText("OK"); mpOKButton->setDefault(true); mpButtonBox->addWidget(mpOKButton); mpCancelButton = new QPushButton(this); mpCancelButton->setText("Cancel"); mpButtonBox->addWidget(mpCancelButton); mpExpertCheckBox = new QCheckBox(this); mpExpertCheckBox->setText("Expert Mode"); mpExpertCheckBox->setChecked(false); mpButtonBox->addWidget(mpExpertCheckBox); mpXAxisSelectionBox = new QWidget(mpSplitter); QVBoxLayout *vBox1 = new QVBoxLayout(mpXAxisSelectionBox); mpXAxisSelectionBox->setLayout(vBox1); mpXAxisSelectionBox->layout()->setContentsMargins(5, 5, 5, 5); mpYAxisSelectionBox = new QWidget(mpSplitter); QVBoxLayout *vBox2 = new QVBoxLayout(mpYAxisSelectionBox); mpYAxisSelectionBox->setLayout(vBox2); mpYAxisSelectionBox->layout()->setContentsMargins(5, 5, 5, 5); mpXAxisLabel = new QLabel("X-Axis:", mpXAxisSelectionBox); mpXAxisLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); mpXAxisSelectionBox->layout()->addWidget(mpXAxisLabel); mpYAxisLabel = new QLabel("Y-Axis:", mpYAxisSelectionBox); mpYAxisLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); mpYAxisSelectionBox->layout()->addWidget(mpYAxisLabel); mpXAxisSelectionWidget = new CCopasiSelectionWidget(mpXAxisSelectionBox); mpXAxisSelectionWidget->setSingleSelection(true); mpXAxisSelectionWidget->setOutputVector(mpXAxisOutputVector); mpXAxisSelectionBox->layout()->addWidget(mpXAxisSelectionWidget); mpYAxisSelectionWidget = new CCopasiSelectionWidget(mpYAxisSelectionBox); mpYAxisSelectionWidget->setSingleSelection(false); mpYAxisSelectionWidget->setOutputVector(mpYAxisOutputVector); mpYAxisSelectionBox->layout()->addWidget(mpYAxisSelectionWidget); connect(mpOKButton, SIGNAL(clicked()), this, SLOT(slotOKButtonClicked())); connect(mpCancelButton, SIGNAL(clicked()), this, SLOT(slotCancelButtonClicked())); connect(mpExpertCheckBox, SIGNAL(toggled(bool)), this, SLOT(slotExpertCheckBoxToggled(bool))); setTabOrder(); }
CPlotSelectionDialog::CPlotSelectionDialog(QWidget* parent, const char* name, bool modal, WFlags f): QDialog(parent, name, modal, f) , mpOKButton(NULL) , mpCancelButton(NULL) , mpExpertCheckBox(NULL) , mpXAxisSimpleSelectionWidget(NULL) , mpYAxisSimpleSelectionWidget(NULL) , mpXAxisObjectBrowserWidget(NULL) , mpYAxisObjectBrowserWidget(NULL) , mpXAxisSelectionWidget(NULL) , mpYAxisSelectionWidget(NULL) , mpSplitter(NULL) , mpButtonBox(NULL) , mpMainLayout(NULL) , mpXAxisLabel(NULL) , mpYAxisLabel(NULL) , mpXAxisSelectionBox(NULL) , mpYAxisSelectionBox(NULL) , mpXAxisOutputVector(NULL) , mpYAxisOutputVector(NULL) , mpXAxisTmpVector(new std::vector<CCopasiObject*>()) , mpYAxisTmpVector(new std::vector<CCopasiObject*>()) { this->mpMainLayout = new QVBoxLayout(this); this->mpMainLayout->setAutoAdd(true); this->mpSplitter = new QSplitter(this); this->mpSplitter->setOrientation(Qt::Horizontal); this->mpButtonBox = new QHBox(this); this->mpButtonBox->layout()->setAutoAdd(false); ((QHBoxLayout*)this->mpButtonBox->layout())->addStretch(); this->mpOKButton = new QPushButton(this->mpButtonBox); this->mpOKButton->setText("OK"); this->mpOKButton->setDefault(true); this->mpButtonBox->layout()->add(this->mpOKButton); this->mpCancelButton = new QPushButton(this->mpButtonBox); this->mpCancelButton->setText("Cancel"); this->mpButtonBox->layout()->add(this->mpCancelButton); this->mpExpertCheckBox = new QCheckBox(this->mpButtonBox); this->mpExpertCheckBox->setText("Expert Mode"); this->mpExpertCheckBox->setChecked(false); this->mpButtonBox->layout()->add(this->mpExpertCheckBox); ((QHBoxLayout*)this->mpButtonBox->layout())->addStretch(); this->mpXAxisSelectionBox = new QVBox(this->mpSplitter); this->mpXAxisSelectionBox->layout()->setMargin(5); this->mpXAxisSelectionBox->layout()->setAutoAdd(false); this->mpYAxisSelectionBox = new QVBox(this->mpSplitter); this->mpYAxisSelectionBox->layout()->setMargin(5); this->mpYAxisSelectionBox->layout()->setAutoAdd(false); this->mpXAxisLabel = new QLabel("X-Axis:", this->mpXAxisSelectionBox); this->mpXAxisLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); this->mpXAxisSelectionBox->layout()->add(this->mpXAxisLabel); this->mpYAxisLabel = new QLabel("Y-Axis:", this->mpYAxisSelectionBox); this->mpYAxisLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); this->mpYAxisSelectionBox->layout()->add(this->mpYAxisLabel); this->mpXAxisSimpleSelectionWidget = new SimpleSelectionWidget(this->mpXAxisSelectionBox); this->mpXAxisSelectionWidget = this->mpXAxisSimpleSelectionWidget; this->mpXAxisSimpleSelectionWidget->setSingleSelection(true); this->mpXAxisSimpleSelectionWidget->setOutputVector(this->mpXAxisTmpVector); this->mpXAxisSelectionBox->layout()->add(this->mpXAxisSelectionWidget); this->mpYAxisSimpleSelectionWidget = new SimpleSelectionWidget(this->mpYAxisSelectionBox); this->mpYAxisSelectionWidget = this->mpYAxisSimpleSelectionWidget; this->mpYAxisSimpleSelectionWidget->setOutputVector(this->mpYAxisTmpVector); this->mpYAxisSelectionBox->layout()->add(this->mpYAxisSelectionWidget); connect(this->mpOKButton, SIGNAL(clicked()), this, SLOT(slotOKButtonClicked())); connect(this->mpCancelButton, SIGNAL(clicked()), this, SLOT(slotCancelButtonClicked())); connect(this->mpExpertCheckBox, SIGNAL(toggled(bool)), this, SLOT(slotExpertCheckBoxToggled(bool))); this->setTabOrder(); }