PresetWidget::PresetWidget(QWidget* parent) : BaseWidget(parent, "PresetWidget", "Presets"), mLayout(new QVBoxLayout(this)) { this->setToolTip("Select a predefined set of options"); mPresetsComboBox = new QComboBox(this); mPresetsComboBox->setToolTip("Select a preset to use"); connect(mPresetsComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(presetsBoxChangedSlot(const QString&))); mActionGroup = new QActionGroup(this); this->createAction(mActionGroup, QIcon(":/icons/preset_reset.png"), "Reset all transfer function values to the defaults", "", SLOT(resetSlot())); this->createAction(mActionGroup, QIcon(":/icons/preset_remove.png"), "Delete the current preset", "", SLOT(deleteSlot())); this->createAction(mActionGroup, QIcon(":/icons/preset_save.png"), "Add the current setting as a preset", "", SLOT(saveSlot())); mLayout->addWidget(mPresetsComboBox); mButtonLayout = NULL; this->populateButtonLayout(); this->setLayout(mLayout); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), changed(false), pictureWidget(0), pictureProject(0), unmarkedModel(0), markedModel(0) { setupUi(this); connect(actionOpen, SIGNAL(triggered()), this, SLOT(openSlot())); connect(actionSave, SIGNAL(triggered()), this, SLOT(saveSlot())); connect(actionExit, SIGNAL(triggered()), this, SLOT(close())); connect(unmarkedList, SIGNAL(activated(const QModelIndex &)), this, SLOT(unmarkedListObjectSelectSlot(const QModelIndex &))); connect(markedList, SIGNAL(activated(const QModelIndex &)), this, SLOT(markedListObjectSelectSlot(const QModelIndex &))); connect(unmarkedList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(unmarkedListDoubleClickedSlot(const QModelIndex &))); connect(markedList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(markedListDoubleClickedSlot(const QModelIndex &))); }
void SceneSaveLoad::play(GameObject * _game_obj) { game_obj = _game_obj; button_press = menu->verificaEventos(EGL_CLIQUE_ESQ); switch(button_press){ case 0: saveSlot(1); break; case 1: loadSlot(1); break; } button_press = panel->verificaEventos(EGL_CLIQUE_ESQ); switch(button_press){ case SceneActual::WORKSHOP: nextScene(SceneActual::WORKSHOP); break; } if(key[SDLK_ESCAPE]){ game_obj->exit = true; } }
FilePreviewWidget::FilePreviewWidget(QWidget* parent) : FileWatcherWidget(parent, "FilePreviewWidget", "File Preview"), mTextDocument(new QTextDocument(this)), mTextEdit(new QTextEdit(this)), mSaveButton(new QPushButton("Save", this)) { this->setToolTip("Preview and edit a file"); mSyntaxHighlighter = NULL; connect(mSaveButton, SIGNAL(clicked()), this, SLOT(saveSlot())); mSaveButton->setEnabled(false); QHBoxLayout* buttonLayout = new QHBoxLayout(); buttonLayout->addStretch(); buttonLayout->setMargin(0); buttonLayout->addWidget(mSaveButton); QVBoxLayout* layout = new QVBoxLayout(this); layout->setMargin(0); layout->addWidget(mTextEdit); layout->addLayout(buttonLayout); connect(mTextEdit, SIGNAL(textChanged()), this, SLOT(textChangedSlot())); mTextEdit->setDocument(mTextDocument); mTextEdit->setLineWrapMode(QTextEdit::NoWrap); this->setSyntaxHighLighter<snw::SyntaxHighlighter>(); }
void patternWindow::constructToolbar() { saveToPdfButton_ = new QPushButton(tr("To pdf (4/4)"), this); saveToPdfButton_->setShortcut(QKeySequence("Ctrl+return")); saveToPdfButton_->setToolTip(tr("Save the pattern as a pdf file")); connect(saveToPdfButton_, SIGNAL(clicked()), this, SLOT(saveSlot())); imageListBox_ = new comboBox(this); connect(imageListBox_, SIGNAL(activated(const QString& )), this, SLOT(processImageBox(const QString& ))); addToolbarSeparator(); addToolbarSeparator(); addToolbarWidget(saveToPdfButton_); addToolbarSeparator(); addToolbarSeparator(); addToolbarAction(switchAction_); addToolbarAction(gridAction_); addToolbarSeparator(); addToolbarSeparator(); addToolbarAction(backHistoryAction_); addToolbarAction(forwardHistoryAction_); addToolbarSeparator(); addToolbarSeparator(); addToolbarAction(zoomInAction()); addToolbarAction(zoomOutAction()); addToolbarAction(originalSizeAction()); addToolbarSeparator(); addToolbarSeparator(); addToolbarWidget(imageListBox_); addToolbarSeparator(); addToolbarSeparator(); }
void SaverSettingDialog::initConnects() { connect(ui->browseBtn, SIGNAL(clicked()), this, SLOT(openDirDialogSlot())); connect(ui->saveBtn, SIGNAL(clicked()), this, SLOT(saveSlot())); connect(ui->saveBtn, SIGNAL(clicked()), this, SLOT(close())); connect(ui->cancelBtn, SIGNAL(clicked()), this, SLOT(close())); }
Item *Constructor::construct(const QUuid &_id) { QUuid id = _id.isNull() ? QUuid::createUuid() : _id; Item *res = createItem(id); if(!res) return NULL; res -> setType(type()); res -> setState(_id.isNull() ? Item::New : Item::Normal); connect(res, SIGNAL(saveSignal()), this, SLOT(saveSlot())); return res; }
void FFCP::createActions() { newAct = new QAction( tr("新建"), this); //QIcon("./images/open.png"), 暂时不设置图片 newAct->setShortcut(tr("N")); connect(newAct, SIGNAL(triggered()), this, SLOT(newSlot())); openAct = new QAction(tr("打开"), this); openAct->setShortcut(tr("O")); connect(openAct, SIGNAL(triggered()), this, SLOT(openSlot())); saveAct = new QAction(tr("保存"), this); saveAct->setShortcut(tr("S")); connect(saveAct, SIGNAL(triggered()), this, SLOT(saveSlot())); quitAct = new QAction(tr("退出"), this); quitAct->setShortcut(tr("Q")); connect(quitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("关于"), this); aboutAct->setShortcut(tr("A")); connect(aboutAct, SIGNAL(triggered()), this, SLOT(aboutSlot())); compileAct = new QAction(tr("编译"), this); compileAct->setShortcut(tr("F7")); connect(compileAct, SIGNAL(triggered()), this, SLOT(compileSlot())); simulationAct = new QAction(tr("仿真"), this); simulationAct->setShortcut(tr("F6")); connect(simulationAct, SIGNAL(triggered()), this, SLOT(simulationSlot())); downloadAct = new QAction(tr("下载"), this); downloadAct->setShortcut(tr("F5")); connect(downloadAct, SIGNAL(triggered()), this, SLOT(downloadSlot())); clearAct = new QAction(tr("清除"), this); clearAct->setShortcut(tr("F8")); connect(clearAct, SIGNAL(triggered()), this, SLOT(clearSlot())); //在工具中添加变量定义 defineAct = new QAction(tr("变量定义"),this); defineAct->setShortcut(tr("F1")); connect(defineAct, SIGNAL(triggered()), this, SLOT(defineSlot())); hardwareAct = new QAction(tr("硬件结构图"), this); defineAct->setShortcut(tr("F3")); connect(hardwareAct, SIGNAL(triggered()), this, SLOT(hardwareSlot())); softwareAct = new QAction(tr("软件流程图"), this); defineAct->setShortcut(tr("F2")); connect(softwareAct, SIGNAL(triggered()), this, SLOT(softwareSlot())); }
CFrmSettings::CFrmSettings() { this->gvc = gvContext(); Ui_Dialog tempDia; tempDia.setupUi(this); graph = NULL; activeWindow = NULL; QString path; #ifndef WIN32 char *s = getenv("GVEDIT_PATH"); if (s) path = s; else path = GVEDIT_DATADIR; #endif connect(WIDGET(QPushButton, pbAdd), SIGNAL(clicked()), this, SLOT(addSlot())); connect(WIDGET(QPushButton, pbNew), SIGNAL(clicked()), this, SLOT(newSlot())); connect(WIDGET(QPushButton, pbOpen), SIGNAL(clicked()), this, SLOT(openSlot())); connect(WIDGET(QPushButton, pbSave), SIGNAL(clicked()), this, SLOT(saveSlot())); connect(WIDGET(QPushButton, btnOK), SIGNAL(clicked()), this, SLOT(okSlot())); connect(WIDGET(QPushButton, btnCancel), SIGNAL(clicked()), this, SLOT(cancelSlot())); connect(WIDGET(QPushButton, pbOut), SIGNAL(clicked()), this, SLOT(outputSlot())); connect(WIDGET(QPushButton, pbHelp), SIGNAL(clicked()), this, SLOT(helpSlot())); connect(WIDGET(QComboBox, cbScope), SIGNAL(currentIndexChanged(int)), this, SLOT(scopeChangedSlot(int))); scopeChangedSlot(0); #ifndef WIN32 loadAttrs(path + "/attrs.txt", WIDGET(QComboBox, cbNameG), WIDGET(QComboBox, cbNameN), WIDGET(QComboBox, cbNameE)); #else loadAttrs("../share/graphviz/gvedit/attributes.txt", WIDGET(QComboBox, cbNameG), WIDGET(QComboBox, cbNameN), WIDGET(QComboBox, cbNameE)); #endif setWindowIcon(QIcon(":/images/icon.png")); }
bool MainWindow::closePictureProject() { if (pictureProject == 0) { return true; } if (changed) { const int result = QMessageBox::question( this, "Save changes", "Save changes?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Save ); //TODO better replace "switch" by "if" switch (result) { case QMessageBox::Save: saveSlot(); break; case QMessageBox::Discard: // do nothing, just return true break; case QMessageBox::Cancel: return false; default: assert(false); } } delete pictureProject; pictureProject = 0; delete markedModel; markedModel = 0; delete unmarkedModel; unmarkedModel = 0; return true; }
void MainWindow::initConnects() { connect(ui->newFileAct, SIGNAL(triggered()), this, SLOT(newFileSlot())); connect(ui->openFileAct, SIGNAL(triggered()), this, SLOT(openFileSlot())); connect(ui->saveAct, SIGNAL(triggered()), this, SLOT(saveSlot())); connect(ui->saveasAct, SIGNAL(triggered()), this, SLOT(saveAsSlot())); connect(ui->exitAct, SIGNAL(triggered()), this, SLOT(close())); connect(ui->undoAct, SIGNAL(triggered()), ui->textEdit, SLOT(undo())); connect(ui->cutAct, SIGNAL(triggered()), ui->textEdit, SLOT(cut())); connect(ui->copyAct, SIGNAL(triggered()), ui->textEdit, SLOT(copy())); connect(ui->pasteAct, SIGNAL(triggered()), ui->textEdit, SLOT(paste())); connect(ui->fontAct, SIGNAL(triggered()), this, SLOT(selectFontSlot())); connect(ui->statuBarAct, SIGNAL(triggered()), this, SLOT(changStatuBarSlot())); connect(ui->aboutAct, SIGNAL(triggered()), this, SLOT(openAboutSlot())); connect(ui->aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(ui->findAct, SIGNAL(triggered()), this, SLOT(openFindDialog())); connect(ui->dateAct, SIGNAL(triggered()), this, SLOT(newDateSlot())); }
int netanim::AnimatorMode::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: gridLinesSlot((*reinterpret_cast< int(*)>(_a[1]))); break; case 1: nodeSizeSlot((*reinterpret_cast< QString(*)>(_a[1]))); break; case 2: gridSlot(); break; case 3: traceFileOpenSlot(); break; case 4: testSlot(); break; case 5: playSlot(); break; case 6: showNodeIdSlot(); break; case 7: updateRateChangedSlot((*reinterpret_cast< int(*)>(_a[1]))); break; case 8: updateRateTimeoutSlot(); break; case 9: zoomInSlot(); break; case 10: zoomOutSlot(); break; case 11: showWirelessCirclesSlot(); break; case 12: packetStatsSlot(); break; case 13: nodePositionStatsSlot(); break; case 14: timelineSlot((*reinterpret_cast< int(*)>(_a[1]))); break; case 15: pktFilterFromSlot((*reinterpret_cast< QString(*)>(_a[1]))); break; case 16: pktFilterToSlot((*reinterpret_cast< QString(*)>(_a[1]))); break; case 17: showPacketSlot(); break; case 18: precisionSlot(); break; case 19: saveSlot(); break; case 20: resetSlot(); break; case 21: fastFwdSlot(); break; case 22: showMetaSlot(); break; case 23: packetPersistenceSlot((*reinterpret_cast< QString(*)>(_a[1]))); break; case 24: metaFontSizeSlot((*reinterpret_cast< int(*)>(_a[1]))); break; default: ; } _id -= 25; } return _id; }
void MainWindow::changedSlot() { changed = true; saveSlot(); updateLabels(); }
EraserWidget::EraserWidget(PatientModelServicePtr patientModelService, VisualizationServicePtr visualizationService, QWidget* parent) : BaseWidget(parent, "EraserWidget", "Eraser"), mPreviousCenter(0,0,0), mPreviousRadius(0), mActiveImageProxy(ActiveImageProxyPtr()), mPatientModelService(patientModelService), mVisualizationService(visualizationService) { QVBoxLayout* layout = new QVBoxLayout(this); this->setToolTip("Erase parts of volumes/models"); mContinousEraseTimer = new QTimer(this); connect(mContinousEraseTimer, SIGNAL(timeout()), this, SLOT(continousRemoveSlot())); // this signal will be executed in the thread of THIS, i.e. the main thread. QHBoxLayout* buttonLayout = new QHBoxLayout; layout->addLayout(buttonLayout); QHBoxLayout* buttonLayout2 = new QHBoxLayout; layout->addLayout(buttonLayout2); mShowEraserCheckBox = new QCheckBox("Show"); mShowEraserCheckBox->setToolTip("Show eraser sphere in the views."); connect(mShowEraserCheckBox, SIGNAL(toggled(bool)), this, SLOT(toggleShowEraser(bool))); buttonLayout->addWidget(mShowEraserCheckBox); mContinousEraseCheckBox = new QCheckBox("Continous"); mContinousEraseCheckBox->setToolTip("Erase continously using the sphere. (might be slow)"); connect(mContinousEraseCheckBox, SIGNAL(toggled(bool)), this, SLOT(toggleContinous(bool))); buttonLayout2->addWidget(mContinousEraseCheckBox); mDuplicateAction = this->createAction(this, QIcon(), "Duplicate", "Duplicate active volume - do this before erasing!", SLOT(duplicateSlot()), buttonLayout); mSaveAction = this->createAction(this, QIcon(), "Save", "Save modified image to disk", SLOT(saveSlot()), buttonLayout); mRemoveAction = this->createAction(this, QIcon(), "Erase", "Erase everything inside sphere", SLOT(removeSlot()), buttonLayout2); double sphereRadius = 10; mSphereSizeAdapter = DoubleProperty::initialize("SphereSize", "Sphere Size", "Radius of Eraser Sphere", sphereRadius, DoubleRange(0,200,1), 0, QDomNode()); connect(mSphereSizeAdapter.get(), &DoubleProperty::changed, this, &EraserWidget::sphereSizeChangedSlot); mSphereSize = new SpinBoxAndSliderGroupWidget(this, mSphereSizeAdapter); layout->addWidget(mSphereSize); ImagePtr image = mPatientModelService->getActiveImage(); int eraseValue = 0; if(image) eraseValue = image->getMin(); mEraseValueAdapter = DoubleProperty::initialize("EraseValue", "Erase value", "Erase/draw with value", eraseValue, DoubleRange(1,200,1), 0, QDomNode()); mActiveImageProxy = ActiveImageProxy::New(mPatientModelService); connect(mActiveImageProxy.get(), &ActiveImageProxy::activeImageChanged, this, &EraserWidget::activeImageChangedSlot); mEraseValueWidget = new SpinBoxAndSliderGroupWidget(this, mEraseValueAdapter); layout->addWidget(mEraseValueWidget); layout->addStretch(); this->enableButtons(); }
void ImageViewer::createActions() { openAct = new QAction(tr("&Open..."), this); // openAct->setShortcut(tr("Ctrl+O")); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); printAct = new QAction(tr("&Print..."), this); // printAct->setShortcut(tr("Ctrl+P")); printAct->setEnabled(false); connect(printAct, SIGNAL(triggered()), this, SLOT(print())); exitAct = new QAction(tr("E&xit"), this); // exitAct->setShortcut(tr("Ctrl+Q")); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); zoomInAct = new QAction(tr("Zoom &In (10%)"), this); // zoomInAct->setShortcut(tr("Ctrl++")); zoomInAct->setEnabled(false); connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn())); zoomOutAct = new QAction(tr("Zoom &Out (10%)"), this); // zoomOutAct->setShortcut(tr("Ctrl+-")); zoomOutAct->setEnabled(false); connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut())); normalSizeAct = new QAction(tr("&Normal Size"), this); // normalSizeAct->setShortcut(tr("Ctrl+S")); normalSizeAct->setEnabled(false); connect(normalSizeAct, SIGNAL(triggered()), this, SLOT(normalSize())); fitToWindowAct = new QAction(tr("&Fit to Window"), this); fitToWindowAct->setEnabled(false); fitToWindowAct->setCheckable(true); // fitToWindowAct->setShortcut(tr("Ctrl+F")); connect(fitToWindowAct, SIGNAL(triggered()), this, SLOT(fitToWindow())); aboutAct = new QAction(tr("&About"), this); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); aboutQtAct = new QAction(tr("About &Qt"), this); connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); crop = new QAction(tr("Crop"),this); crop->setEnabled(false); connect(crop,SIGNAL(triggered()),this,SLOT(saveSlot())); rotate_left_90 = new QAction(tr("Rotate left"),this); rotate_left_90->setEnabled(false); rotate_right_90 = new QAction(tr("rotate Right"),this); rotate_right_90->setEnabled(false); QSignalMapper *sm = new QSignalMapper(this); connect(rotate_left_90,SIGNAL(triggered()),sm,SLOT(map())); connect(rotate_right_90,SIGNAL(triggered()),sm,SLOT(map())); sm->setMapping(rotate_left_90,90); sm->setMapping(rotate_right_90,-90); connect (sm, SIGNAL(mapped(int)), this, SLOT(rotate_with_angle(int))) ; rotate_custom = new QAction(tr("Custom rotation"),this); rotate_custom->setEnabled(false); connect(rotate_custom,SIGNAL(triggered()),this,SLOT(rotate_custom_slot())); undo = new QAction(tr("Undo"),this); connect(undo,SIGNAL(triggered()),this,SLOT(undo_slot())); redo = new QAction(tr("Redo"),this); connect(redo,SIGNAL(triggered()),this,SLOT(redo_slot())); reset = new QAction(tr("Reset"),this); connect(reset,SIGNAL(triggered()),this,SLOT(reset_slot())); reset->setEnabled(false); QToolBar *tb = new QToolBar ; saveAs = new QAction(tr("Save As"),this); connect(saveAs,SIGNAL(triggered()),this,SLOT(saveAs_slot())); tb->addAction(openAct); tb->addAction(zoomInAct); tb->addAction(zoomOutAct); tb->addAction(crop); tb->addAction(rotate_left_90); tb->addAction(rotate_right_90); tb->addAction(undo); tb->addAction(redo); tb->addAction(reset); addToolBar(tb); }