void ImageWorkShop::initImageWorkShop(){ //imagewidget = new ImageWidget(ui.centralWidget); loadImage = false; connect(ui.actionOpen, SIGNAL(triggered()), this, SLOT(slotOpenFile())); connect(ui.actionSave_as, SIGNAL(triggered()), this, SLOT(slotSaveFile())); connect(ui.actionImage_last_saved, SIGNAL(triggered()), this, SLOT(slotCompare())); connect(ui.actionStageSave, SIGNAL(triggered()), this, SLOT(slotStageSave())); connect(ui.actionStageBack, SIGNAL(triggered()), this, SLOT(slotStageBack())); connect(ui.horizontalSliderVignette, SIGNAL(actionTriggered(int)), this, SLOT(slotVignetteFactor())); connect(ui.pushButtonMedian, SIGNAL(clicked()), this, SLOT(slotMedian())); connect(ui.horizontalSliderGauss, SIGNAL(actionTriggered(int)), this, SLOT(slotGauss())); connect(ui.horizontalSliderBalance, SIGNAL(actionTriggered(int)), this, SLOT(slotWhiteBalance())); connect(ui.horizontalSliderSaturation, SIGNAL(actionTriggered(int)), this, SLOT(slotSaturation())); connect(ui.pushButtonSharp, SIGNAL(clicked()), this, SLOT(slotSharp())); connect(ui.pushButtonLiquify, SIGNAL(clicked()), this, SLOT(slotLiquify())); connect(ui.pushButtonLiquifyRadius, SIGNAL(clicked()), this, SLOT(slotLiquifySetRadius())); connect(ui.comboBox_Lomo, SIGNAL(currentIndexChanged(int)), this, SLOT(slotLomo())); connect(ui.horizontalSliderLomoR, SIGNAL(actionTriggered(int)), this, SLOT(slotLomoR())); connect(ui.horizontalSliderLomoG, SIGNAL(actionTriggered(int)), this, SLOT(slotLomoG())); connect(ui.horizontalSliderLomoB, SIGNAL(actionTriggered(int)), this, SLOT(slotLomoB())); connect(ui.pushButton_Exfoliating, SIGNAL(clicked()), this, SLOT(slotExfoliating())); connect(ui.horizontalSliderWhitenSkin, SIGNAL(actionTriggered(int)), this, SLOT(slotWhitenSkin())); connect(ui.horizontalSliderWhitenSkinMask, SIGNAL(actionTriggered(int)), this, SLOT(slotDrawSkinMaskRadius())); connect(ui.horizontalSliderThreshold, SIGNAL(actionTriggered(int)), this, SLOT(slotWhitenThreshold())); connect(ui.pushButton_Source, SIGNAL(clicked()), this, SLOT(slotColorMapSource())); connect(ui.pushButton_Target, SIGNAL(clicked()), this, SLOT(slotColorMapTarget())); connect(ui.pushButton_Result, SIGNAL(clicked()), this, SLOT(slotColorMapResult())); connect(ui.pushButton_ResultGrayToRGB, SIGNAL(clicked()), this, SLOT(slotColorMapGrayToRGB())); connect(ui.horizontalSliderBrushRadiusImageCopy, SIGNAL(actionTriggered(int)), this, SLOT(slotImageCopyRadius())); connect(ui.pushButtonMovePatch, SIGNAL(clicked()), this, SLOT(slotImageCopyMovePatch())); connect(ui.horizontalSliderBrushRadiusImageInpaintHole, SIGNAL(actionTriggered(int)), this, SLOT(slotImageInpaintRadius())); connect(ui.pushButtonImageInpaintHoleResult, SIGNAL(clicked()), this, SLOT(slotImageInpaintResult())); connect(ui.horizontalSliderBrushRadiusImageInpaintHoleRestrict, SIGNAL(actionTriggered(int)), this, SLOT(slotImageInpaintRestrictRadius())); connect(ui.pushButtonImageInpaintHoleRestrictResult, SIGNAL(clicked()), this, SLOT(slotImageInpaintRestrictResult())); connect(ui.pushButtonImageInpaintHoleRestrictResultOut, SIGNAL(clicked()), this, SLOT(slotImageInpaintRestrictResultOut())); connect(ui.pushButtonErodeRadius, SIGNAL(clicked()), this, SLOT(slotRrodeRadius())); connect(ui.comboBox_ifGpu, SIGNAL(currentIndexChanged(int)), this, SLOT(slotPatchMatchIfGpu())); connect(ui.pushButton_ClearRestrict, SIGNAL(clicked()), this, SLOT(slotClearRestrict())); connect(ui.pushButton_ClearRegion, SIGNAL(clicked()), this, SLOT(slotClearRegion())); }
void MainWindow::createActions() { // file open action fileOpenAction = new QAction(QIcon(":/images/open.png"),tr("Open"),this); // 打开文件 fileOpenAction->setShortcut(tr("Ctrl+O")); fileOpenAction->setStatusTip(tr("open a file")); connect(fileOpenAction,SIGNAL(triggered()),this,SLOT(slotOpenFile())); // file new action fileNewAction = new QAction(QIcon(":/images/new.png"),tr("New"),this); // 新建文件 fileNewAction->setShortcut(tr("Ctrl+N")); fileNewAction->setStatusTip(tr("new file")); connect(fileNewAction,SIGNAL(triggered()),this,SLOT(slotNewFile())); // save file action fileSaveAction = new QAction(QPixmap(":/images/save.png"),tr("Save"),this); // 保存文件 fileSaveAction->setShortcut(tr("Ctrl+S")); fileSaveAction->setStatusTip(tr("save file")); connect(fileSaveAction,SIGNAL(activated()),this,SLOT(slotSaveFile())); // exit action exitAction = new QAction(tr("Exit"), this); // 退出 exitAction->setShortcut(tr("Ctrl+Q")); exitAction->setStatusTip(tr("exit")); connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); cutAction = new QAction(QIcon(":/images/cut.png"), tr("Cut"), this); // 剪切 cutAction->setShortcut(tr("Ctrl+X")); cutAction->setStatusTip(tr("cut to clipboard")); connect(cutAction, SIGNAL(triggered()), text, SLOT(cut())); copyAction = new QAction(QIcon(":/images/copy.png"), tr("Copy"), this); // 复制 copyAction->setShortcut(tr("Ctrl+C")); copyAction->setStatusTip(tr("copy to clipboard")); connect(copyAction, SIGNAL(triggered()), text, SLOT(copy())); pasteAction = new QAction(QIcon(":/images/paste.png"), tr("Paste"), this); // 粘贴 pasteAction->setShortcut(tr("Ctrl+V")); pasteAction->setStatusTip(tr("paste clipboard to selection")); connect(pasteAction, SIGNAL(triggered()), text, SLOT(paste())); aboutAction = new QAction(tr("About"), this); // 关于 connect(aboutAction, SIGNAL(triggered()), this, SLOT(slotAbout())); }
void TrWidget::closeEvent(QCloseEvent *evt) { Q_UNUSED(evt); qDebug() << "TrWidget::closeEvent"; if(m_isForceQuit || m_isSaved) return; int ret; ret = QMessageBox::warning(this, "File changed", "<p>This file has been changed." "<p>Do you want to save it?", QMessageBox::Yes, QMessageBox::No); if(ret == QMessageBox::Yes) { qDebug() << "QMessageBox::Yes"; slotSaveFile(true); }else{ qDebug() << "QMessageBox::No"; } }
void MainWindow::createActions() { //通过图片路径来实现添加Qt资源文件目的 fileOpenAction = new QAction(QIcon("C:/qt/Mwindow/open.png"),tr("Open"),this); fileOpenAction->setShortcut(tr("Ctrl+O")); fileOpenAction->setStatusTip(tr("Open a file")); connect(fileOpenAction,SIGNAL(triggered()),this,SLOT(slotOpenFile())); fileNewAction = new QAction(QIcon("C:/qt/Mwindow/new.png"),tr("New"),this); fileNewAction->setShortcut(tr("Ctrl+N")); fileNewAction->setStatusTip(tr("new file")); connect(fileNewAction,SIGNAL(triggered()),this,SLOT(slotNewFile())); fileSaveAction = new QAction(QIcon("C:/qt/Mwindow/save.png"),tr("Save"),this); fileSaveAction->setShortcut(tr("Ctrl+S")); fileNewAction->setStatusTip(tr("save file")); connect(fileNewAction,SIGNAL(triggered()),this,SLOT(slotSaveFile())); exitAction = new QAction(tr("Exit"),this); exitAction->setShortcut(tr("Ctrl+Q")); exitAction->setStatusTip(tr("exit")); connect(exitAction,SIGNAL(triggered()),this,SLOT(close())); cutAction = new QAction(QIcon("C:/qt/Mwindow/cut.png"),tr("Cut"),this); cutAction->setShortcut(tr("Ctrl+X")); cutAction->setStatusTip(tr("cut to clipboard")); connect(cutAction,SIGNAL(triggered()),text,SLOT(cut())); copyAction = new QAction(QIcon("C:/qt/Mwindow/copy.png"),tr("Copy"),this); copyAction->setShortcut(tr("Ctrl+C")); copyAction->setStatusTip(tr("copy to clipboard")); connect(copyAction,SIGNAL(triggered()),this,SLOT(copy())); pasteAction = new QAction(QIcon("C:/qt/Mwindow/paste.png"),tr("paste"),this); pasteAction->setShortcut(tr("Ctrl+V")); pasteAction->setStatusTip(tr("paste clipboard to selection")); connect(pasteAction,SIGNAL(triggered()),this,SLOT(paste())); aboutAction = new QAction(tr("About"),this); connect(aboutAction,SIGNAL(triggered()),this,SLOT(slotAbout())); }
void MainWindow::createMenu() { QMenu *fileMenu = menuBar()->addMenu(tr("File")); QAction *openAct = new QAction(tr("Open"),this); connect(openAct,SIGNAL(triggered()),this,SLOT(slotOpenFile())); fileMenu->addAction(openAct); QAction *saveAct = new QAction(tr("Save"),this); connect(saveAct,SIGNAL(triggered()),this,SLOT(slotSaveFile())); fileMenu->addAction(saveAct); QMenu *editMenu = menuBar()->addMenu(tr("Edit")); QAction *insertAct = new QAction(tr("Insert"),this); connect(insertAct,SIGNAL(triggered()),this,SLOT(slotInsertRows())); editMenu->addAction(insertAct); QAction *removeAct = new QAction(tr("Remove"),this); connect(removeAct,SIGNAL(triggered()),this,SLOT(slotRemoveRows())); editMenu->addAction(removeAct); }
/** * @param set - указатель на объект, отвечающий за настройки приложения. * @param mon - указатель на объект монитора. * @param parent - указатель на объект предка. */ MonitorWindow::MonitorWindow(SettingsObj * set, Monitor * mon, QWidget *parent): QDialog(parent) { setupUi(this); setWindowFlags(windowFlags() | Qt::WindowMinMaxButtonsHint); set_obj = set; monitor = mon; monitor_model = (QStandardItemModel *) monitor->getModel(false); connect(&future_watch, SIGNAL(finished()), SLOT(slotPrintOK())); printer_pdf.setOutputFormat(QPrinter::PdfFormat); monitor_view->setModel(monitor->getModel(true)); monitor_view->hideColumn(Monitor::DevNumAttr); monitor_view->hideColumn(Monitor::TagIdAttr); monitor_view->hideColumn(Monitor::TransCodeAttr); monitor_view->verticalHeader()->hide(); monitor_view->setEditTriggers(QAbstractItemView::NoEditTriggers); monitor_view->resizeColumnsToContents(); connect(&timer, SIGNAL(timeout()), SLOT(slotUpdateTrans())); connect(resetFilterBtn, SIGNAL(clicked()), SLOT(slotResetFilter())); connect(mw_tabs, SIGNAL(currentChanged(int)), SLOT(slotTabChanged())); connect(tag_check, SIGNAL(clicked()), SLOT(slotTagInform())); connect(save_file_button, SIGNAL(clicked()), SLOT(slotSaveFile())); connect(clear_button, SIGNAL(clicked()), SLOT(slotClearMonitor())); connect(monitor, SIGNAL(signalResizeMonitorView()), SLOT(slotResizeMonitorView())); timer.start(REQ_PERIOD); slotResetFilter(); setFilter(); }
void MainWindow::initMenu() { //file _fileMenu = menuBar()->addMenu(QWidget::tr("文件(&F)")); QAction* actionNewFile = new QAction(QIcon(":/images/new.png"), QWidget::tr("新建(&New)"), this); actionNewFile->setShortcut(QWidget::tr("Ctrl+N")); actionNewFile->setToolTip(QWidget::tr("新建场景文件")); connect(actionNewFile, SIGNAL(triggered()), this, SLOT(slotNewFile())); _fileMenu->addAction(actionNewFile); QAction* actionOpenFile = new QAction(QIcon(":/images/open.png"), QWidget::tr("打开(&Open)"), this); actionOpenFile->setShortcut(QWidget::tr("Ctrl+O")); actionOpenFile->setToolTip(QWidget::tr("打开一个场景文件")); connect(actionOpenFile, SIGNAL(triggered()), this, SLOT(slotOpenFile())); _fileMenu->addAction(actionOpenFile); QAction* actionSaveFile = new QAction(QIcon(":/images/save.png"), QWidget::tr("保存(&Save)"), this); actionSaveFile->setShortcut(QWidget::tr("Ctrl+S")); actionSaveFile->setToolTip(QWidget::tr("保存场景文件")); actionSaveFile->setEnabled(false); connect(actionSaveFile, SIGNAL(triggered()), this, SLOT(slotSaveFile())); _fileMenu->addAction(actionSaveFile); QAction* actionSaveAsFile = new QAction(QIcon(":/images/save.png"), QWidget::tr("另存(SaveAs)"), this); actionSaveAsFile->setToolTip(QWidget::tr("另存场景文件")); actionSaveAsFile->setEnabled(false); connect(actionSaveAsFile, SIGNAL(triggered()), this, SLOT(slotSaveAsFile())); _fileMenu->addAction(actionSaveAsFile); QAction* actionExit = new QAction(QIcon(":/images/close.png"), QWidget::tr("退出(&X)"), this); actionExit->setToolTip(QWidget::tr("退出场景编辑器")); connect(actionExit, SIGNAL(triggered()), this, SLOT(slotExit())); _fileMenu->addAction(actionExit); //edit _editMenu = menuBar()->addMenu(QWidget::tr("编辑(&E)")); QAction* actionUndo = new QAction(QIcon(":/images/undo.png"), QWidget::tr("撤销"), this); actionUndo->setShortcut(QWidget::tr("Ctrl+Z")); actionUndo->setToolTip(QWidget::tr("撤销Ctrl+Z")); actionUndo->setEnabled(false); connect(actionUndo, SIGNAL(triggered()), this, SLOT(slotUndo())); _editMenu->addAction(actionUndo); QAction* actionRedo = new QAction(QIcon(":/images/redo.png"), QWidget::tr("重做"), this); actionRedo->setShortcut(QWidget::tr("Ctrl+Y")); actionRedo->setToolTip(QWidget::tr("重做Ctrl+Y")); actionRedo->setEnabled(false); connect(actionRedo, SIGNAL(triggered()), this, SLOT(slotRedo())); _editMenu->addAction(actionRedo); QAction* actionCopy = new QAction(QIcon(":/images/copy.png"), QWidget::tr("复制"), this); actionCopy->setShortcut(QWidget::tr("Ctrl+C")); actionCopy->setToolTip(QWidget::tr("复制Ctrl+C")); actionCopy->setEnabled(false); connect(actionCopy, SIGNAL(triggered()), this, SLOT(slotCopy())); _editMenu->addAction(actionCopy); QAction* actionRotateFast = new QAction(QIcon(":/images/rotate.png"), QWidget::tr("快速旋转"), this); actionRotateFast->setShortcut(QKeySequence(Qt::Key_F3)); actionRotateFast->setToolTip(QWidget::tr("快速旋转F3")); actionRotateFast->setEnabled(false); connect(actionRotateFast, SIGNAL(triggered()), this, SLOT(slotRotateFast())); _editMenu->addAction(actionRotateFast); QAction* actionAlign = new QAction(QIcon(":/images/align.png"), QWidget::tr("对齐"), this); actionAlign->setShortcut(QWidget::tr("Ctrl+L")); actionAlign->setToolTip(QWidget::tr("对齐Ctrl+L")); actionAlign->setEnabled(false); connect(actionAlign, SIGNAL(triggered()), this, SLOT(slotAlign())); _editMenu->addAction(actionAlign); QAction* actionDelete = new QAction(QIcon(":/images/delete.png"), QWidget::tr("删除"), this); actionDelete->setShortcut(QKeySequence(QKeySequence::Delete)); actionDelete->setToolTip(QWidget::tr("删除Delete")); actionDelete->setEnabled(false); connect(actionDelete, SIGNAL(triggered()), this, SLOT(slotDelete())); _editMenu->addAction(actionDelete); //windowsMenu _windowsMenu = menuBar()->addMenu(QWidget::tr("窗口(&W)")); QAction* actionObjectsTreeDockWidget = new QAction(QIcon(":/images/default.png"), QWidget::tr("场景树(&ObjTree)"), this); actionObjectsTreeDockWidget->setShortcut(QKeySequence("h")); actionObjectsTreeDockWidget->setToolTip(QWidget::tr("打开或隐藏对象树窗口")); actionObjectsTreeDockWidget->setEnabled(false); connect(actionObjectsTreeDockWidget, SIGNAL(triggered()), this, SLOT(slotObjectTreeWidgetActive())); _windowsMenu->addAction(actionObjectsTreeDockWidget); QAction* actionPropertyDockWidget = new QAction(QIcon(":/images/default.png"), QWidget::tr("属性窗"), this); actionPropertyDockWidget->setToolTip(QWidget::tr("打开或隐藏属性窗口")); actionPropertyDockWidget->setEnabled(false); connect(actionPropertyDockWidget, SIGNAL(triggered()), this, SLOT(slotPropertyDockWidgetActive())); _windowsMenu->addAction(actionPropertyDockWidget); QAction* actionBuiltinResourcesDockWidget = new QAction(QIcon(":/images/default.png"), QWidget::tr("内置资源列表"), this); actionBuiltinResourcesDockWidget->setToolTip(QWidget::tr("打开或隐藏内置资源列表窗口")); actionBuiltinResourcesDockWidget->setEnabled(false); connect(actionBuiltinResourcesDockWidget, SIGNAL(triggered()), this, SLOT(slotBuiltinResourcesDockWidgetActive())); _windowsMenu->addAction(actionBuiltinResourcesDockWidget); QAction* actionvdsResourcesDockWidget = new QAction(QIcon(":/images/default.png"), QWidget::tr("资源列表"), this); actionvdsResourcesDockWidget->setToolTip(QWidget::tr("打开或隐藏资源列表窗口")); actionvdsResourcesDockWidget->setEnabled(false); connect(actionvdsResourcesDockWidget, SIGNAL(triggered()), this, SLOT(slotvdsResourcesDockWidgetActive())); _windowsMenu->addAction(actionvdsResourcesDockWidget); QAction* actionCSharpAssemblyDockWidget = new QAction(QIcon(":/images/default.png"), QWidget::tr("脚本列表"), this); actionCSharpAssemblyDockWidget->setToolTip(QWidget::tr("打开或隐藏脚本列表窗口")); actionCSharpAssemblyDockWidget->setEnabled(false); connect(actionCSharpAssemblyDockWidget, SIGNAL(triggered()), this, SLOT(slotCSharpAssemblyDockWidgetActive())); _windowsMenu->addAction(actionCSharpAssemblyDockWidget); //tool _toolMenu = menuBar()->addMenu(QWidget::tr("工具(&T)")); QAction* actionAnimationMerge = new QAction(QIcon(":/images/default.png"), QWidget::tr("动画合并(&AnimationMerge)"), this); actionAnimationMerge->setToolTip(QWidget::tr("完成骨骼动画合并")); actionAnimationMerge->setEnabled(false); connect(actionAnimationMerge, SIGNAL(triggered()), this, SLOT(slotAnimationMerge())); _toolMenu->addAction(actionAnimationMerge); QAction* particleEdit = new QAction(QIcon(":/images/default.png"), QWidget::tr("粒子编辑(&Particle)"), this); particleEdit->setToolTip(QWidget::tr("编辑粒子效果")); particleEdit->setEnabled(false); connect(particleEdit, SIGNAL(triggered()), this, SLOT(slotParticleEdit())); _toolMenu->addAction(particleEdit); QAction* actionPlantBrushDockWidget = new QAction(QIcon(":/images/default.png"), QWidget::tr("植被编辑"), this); actionPlantBrushDockWidget->setToolTip(QWidget::tr("打开或隐藏植被编辑窗口")); actionPlantBrushDockWidget->setEnabled(false); connect(actionPlantBrushDockWidget, SIGNAL(triggered()), this, SLOT(slotPlantBrushDockWidgetActive())); _toolMenu->addAction(actionPlantBrushDockWidget); QAction* actionViewPointEdit = new QAction(QIcon(":/images/default.png"), QWidget::tr("视点编辑(&ViewPoint)"), this); actionViewPointEdit->setToolTip(QWidget::tr("定义视点")); actionViewPointEdit->setEnabled(false); connect(actionViewPointEdit, SIGNAL(triggered()), this, SLOT(slotViewPointEdit())); _toolMenu->addAction(actionViewPointEdit); QAction* actionPhysicalEdit = new QAction(QIcon(":/images/default.png"), QWidget::tr("物理编辑"), this); actionPhysicalEdit->setToolTip(QWidget::tr("定义碰撞体或碰撞面")); actionPhysicalEdit->setEnabled(false); connect(actionPhysicalEdit, SIGNAL(triggered()), this, SLOT(slotPhysicalEditDockWidgetActive())); _toolMenu->addAction(actionPhysicalEdit); QAction* actionRiverEdit = new QAction(QIcon(":/images/default.png"), QWidget::tr("河流编辑"), this); actionRiverEdit->setToolTip(QWidget::tr("定义河流效果")); actionRiverEdit->setEnabled(false); connect(actionRiverEdit, SIGNAL(triggered()), this, SLOT(slotRiverEditDockWidgetActive())); _toolMenu->addAction(actionRiverEdit); QAction* modelConvert = new QAction(QIcon(":/images/default.png"), QWidget::tr("模型转换(&ConvertModel)"), this); modelConvert->setToolTip(QWidget::tr("转换模型到其他平台")); modelConvert->setEnabled(true); connect(modelConvert, SIGNAL(triggered()), this, SLOT(slotConvertModel())); _toolMenu->addAction(modelConvert); QAction* compressDir = new QAction(QIcon(":/images/default.png"), QWidget::tr("压缩文件夹"), this); compressDir->setToolTip(QWidget::tr("压缩文件夹,可以设定文件名编码")); compressDir->setEnabled(true); connect(compressDir, SIGNAL(triggered()), this, SLOT(slotCompressDir())); _toolMenu->addAction(compressDir); //animation _animationMenu = menuBar()->addMenu(QWidget::tr("动画(&A)")); ///////////////////////////////////////////////////////////////////should move to PlotAnimation later QAction* actionViewPointAnimationEdit = new QAction(QIcon(":/images/default.png"), QWidget::tr("视点动画编辑"), this); actionViewPointAnimationEdit->setToolTip(QWidget::tr("编辑视点动画")); actionViewPointAnimationEdit->setEnabled(false); connect(actionViewPointAnimationEdit, SIGNAL(triggered()), this, SLOT(slotViewPointAnimationEdit())); _animationMenu->addAction(actionViewPointAnimationEdit); QAction* actionPlotAnimationEdit = new QAction(QIcon(":/images/default.png"), QWidget::tr("剧情编辑"), this); actionPlotAnimationEdit->setToolTip(QWidget::tr("编辑一段剧情")); actionPlotAnimationEdit->setEnabled(false); connect(actionPlotAnimationEdit, SIGNAL(triggered()), this, SLOT(slotPlotAnimationEdit())); _animationMenu->addAction(actionPlotAnimationEdit); }