MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); ui->zoomOut->setEnabled(false); ui->zoomIn->setEnabled(false); ui->cropButton->setEnabled(false); ui->rotateButton->setEnabled(false); ui->rotateButton_3->setEnabled(false); ui->undo->setEnabled(false); ui->redo->setEnabled(false); ui->reset->setEnabled(false); ui->actionSave->setEnabled(false); connect(ui->graphicsView,SIGNAL(areaSelected()) , this , SLOT(setEnable())); connect(ui->graphicsView,SIGNAL(enableRotateSignal()) , this , SLOT(enableRotateSlot())); new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_C), this, SLOT(on_cropButton_clicked())); new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Plus), this, SLOT(on_zoomIn_clicked())); new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Minus), this, SLOT(on_zoomOut_clicked())); new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z), this, SLOT(on_undo_clicked())); new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Y), this, SLOT(on_redo_clicked())); new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_R), this, SLOT(on_reset_clicked())); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); hwnd = (HWND)ui->paintArea->winId(); hdc = GetDC(hwnd); painter = new Paint; connect(ui->red, SIGNAL(rightClicked()), this, SLOT(onRedRightClicked())); connect(ui->red, SIGNAL(leftClicked()), this, SLOT(onRedLeftClicked())); connect(ui->orange, SIGNAL(rightClicked()), this, SLOT(onOrangeRightClicked())); connect(ui->orange, SIGNAL(leftClicked()), this, SLOT(onOrangeLeftClicked())); connect(ui->yellow, SIGNAL(rightClicked()), this, SLOT(onYellowRightClicked())); connect(ui->yellow, SIGNAL(leftClicked()), this, SLOT(onYellowLeftClicked())); connect(ui->purple, SIGNAL(rightClicked()), this, SLOT(onPurpleRightClicked())); connect(ui->purple, SIGNAL(leftClicked()), this, SLOT(onPurpleLeftClicked())); connect(ui->blue, SIGNAL(rightClicked()), this, SLOT(onBlueRightClicked())); connect(ui->blue, SIGNAL(leftClicked()), this, SLOT(onBlueLeftClicked())); connect(ui->green, SIGNAL(rightClicked()), this, SLOT(onGreenRightClicked())); connect(ui->green, SIGNAL(leftClicked()), this, SLOT(onGreenLeftClicked())); connect(ui->purpleLight, SIGNAL(rightClicked()), this, SLOT(onPurpleLightRightClicked())); connect(ui->purpleLight, SIGNAL(leftClicked()), this, SLOT(onPurpleLightLeftClicked())); connect(ui->blueLight, SIGNAL(rightClicked()), this, SLOT(onBlueLightRightClicked())); connect(ui->blueLight, SIGNAL(leftClicked()), this, SLOT(onBlueLightLeftClicked())); connect(ui->greenLight, SIGNAL(rightClicked()), this, SLOT(onGreenLightRightClicked())); connect(ui->greenLight, SIGNAL(leftClicked()), this, SLOT(onGreenLightLeftClicked())); connect(ui->zoom, SIGNAL(leftClicked()), this, SLOT(on_zoomOut_clicked())); connect(ui->zoom, SIGNAL(rightClicked()), this, SLOT(on_zoomIn_clicked())); connect(ui->paintArea, SIGNAL(leftPressed(int, int)), this, SLOT(mouseLeftPressed(int, int))); connect(ui->paintArea, SIGNAL(rightPressed(int, int)), this, SLOT(mouseRightPressed(int, int))); connect(ui->paintArea, SIGNAL(leftReleased(int, int)), this, SLOT(mouseLeftReleased(int, int))); connect(ui->paintArea, SIGNAL(rightReleased(int, int)), this, SLOT(mouseRightReleased(int, int))); connect(ui->paintArea, SIGNAL(moved(int, int)), this, SLOT(mouseMoved(int, int))); connect(ui->paintArea, SIGNAL(doubleClicked()), this, SLOT(mouseDoubleClicked())); }