void GraphicsView::dropEvent(QDropEvent* event) { QGraphicsView::dropEvent(event); if(event->mimeData()->hasUrls()) { QList<QUrl> urls = event->mimeData()->urls(); if(urls.size() == 1) { emit singleImageDropped(urls.at(0)); } } }
//connects gui buttons with Slots in this class void MainWindow::connectSignalSlots() { //connect signals/slots //load/save/open export folder connect(ui->pushButton_load, SIGNAL(clicked()), this, SLOT(loadUserFilePath())); connect(ui->pushButton_save, SIGNAL(clicked()), this, SLOT(saveUserFilePath())); connect(ui->pushButton_openExportFolder, SIGNAL(clicked()), this, SLOT(openExportFolder())); //zoom connect(ui->pushButton_zoomIn, SIGNAL(clicked()), this, SLOT(zoomIn())); connect(ui->pushButton_zoomOut, SIGNAL(clicked()), this, SLOT(zoomOut())); connect(ui->pushButton_resetZoom, SIGNAL(clicked()), this, SLOT(resetZoom())); connect(ui->pushButton_fitInView, SIGNAL(clicked()), this, SLOT(fitInView())); //calculate connect(ui->pushButton_calcNormal, SIGNAL(clicked()), this, SLOT(calcNormalAndPreview())); connect(ui->pushButton_calcSpec, SIGNAL(clicked()), this, SLOT(calcSpecAndPreview())); connect(ui->pushButton_calcDisplace, SIGNAL(clicked()), this, SLOT(calcDisplaceAndPreview())); connect(ui->pushButton_calcSsao, SIGNAL(clicked()), this, SLOT(calcSsaoAndPreview())); //switch between tabs connect(ui->tabWidget, SIGNAL(tabBarClicked(int)), this, SLOT(preview(int))); //display channel intensity connect(ui->checkBox_displayChannelIntensity, SIGNAL(clicked(bool)), this, SLOT(preview())); connect(ui->checkBox_displayChannelIntensity, SIGNAL(clicked(bool)), ui->radioButton_displayRed, SLOT(setEnabled(bool))); connect(ui->checkBox_displayChannelIntensity, SIGNAL(clicked(bool)), ui->radioButton_displayGreen, SLOT(setEnabled(bool))); connect(ui->checkBox_displayChannelIntensity, SIGNAL(clicked(bool)), ui->radioButton_displayBlue, SLOT(setEnabled(bool))); connect(ui->checkBox_displayChannelIntensity, SIGNAL(clicked(bool)), ui->radioButton_displayAlpha, SLOT(setEnabled(bool))); connect(ui->radioButton_displayRed, SIGNAL(clicked()), this, SLOT(displayChannelIntensity())); connect(ui->radioButton_displayGreen, SIGNAL(clicked()), this, SLOT(displayChannelIntensity())); connect(ui->radioButton_displayBlue, SIGNAL(clicked()), this, SLOT(displayChannelIntensity())); connect(ui->radioButton_displayAlpha, SIGNAL(clicked()), this, SLOT(displayChannelIntensity())); connect(ui->checkBox_displayChannelIntensity, SIGNAL(clicked()), this, SLOT(displayChannelIntensity())); //autoupdate after changed values // spec autoupdate connect(ui->doubleSpinBox_spec_redMul, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_spec_greenMul, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_spec_blueMul, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_spec_alphaMul, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_spec_scale, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); connect(ui->comboBox_mode_spec, SIGNAL(currentIndexChanged(int)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_spec_contrast, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); // normal autoupdate connect(ui->checkBox_useRed_normal, SIGNAL(clicked()), this, SLOT(autoUpdate())); connect(ui->checkBox_useGreen_normal, SIGNAL(clicked()), this, SLOT(autoUpdate())); connect(ui->checkBox_useBlue_normal, SIGNAL(clicked()), this, SLOT(autoUpdate())); connect(ui->checkBox_useAlpha_normal, SIGNAL(clicked()), this, SLOT(autoUpdate())); connect(ui->comboBox_mode_normal, SIGNAL(currentIndexChanged(int)), this, SLOT(autoUpdate())); connect(ui->comboBox_method, SIGNAL(currentIndexChanged(int)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_strength, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); connect(ui->checkBox_tileable, SIGNAL(clicked()), this, SLOT(autoUpdate())); connect(ui->checkBox_invertHeight, SIGNAL(clicked()), this, SLOT(autoUpdate())); connect(ui->spinBox_normalmapSize, SIGNAL(valueChanged(int)), this, SLOT(autoUpdate())); connect(ui->checkBox_keepLargeDetail, SIGNAL(clicked()), this, SLOT(autoUpdate())); connect(ui->spinBox_largeDetailScale, SIGNAL(valueChanged(int)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_largeDetailHeight, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); // displcacement autoupdate connect(ui->doubleSpinBox_displace_redMul, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_displace_greenMul, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_displace_blueMul, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_displace_scale, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); connect(ui->comboBox_mode_displace, SIGNAL(currentIndexChanged(int)), this, SLOT(autoUpdate())); connect(ui->doubleSpinBox_displace_contrast, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); // ssao autoupdate connect(ui->doubleSpinBox_ssao_size, SIGNAL(valueChanged(double)), this, SLOT(autoUpdate())); //graphicsview drag and drop connect(ui->graphicsView, SIGNAL(singleImageDropped(QUrl)), this, SLOT(loadSingleDropped(QUrl))); connect(ui->graphicsView, SIGNAL(multipleImagesDropped(QList<QUrl>)), this, SLOT(loadMultipleDropped(QList<QUrl>))); //graphicsview rightclick/middleclick/zoom connect(ui->graphicsView, SIGNAL(rightClick()), this, SLOT(resetZoom())); connect(ui->graphicsView, SIGNAL(middleClick()), this, SLOT(fitInView())); connect(ui->graphicsView, SIGNAL(zoomIn()), this, SLOT(zoomIn())); connect(ui->graphicsView, SIGNAL(zoomOut()), this, SLOT(zoomOut())); //queue (item widget) connect(ui->pushButton_removeImagesFromQueue, SIGNAL(clicked()), this, SLOT(removeImagesFromQueue())); connect(ui->pushButton_processQueue, SIGNAL(clicked()), this, SLOT(processQueue())); connect(ui->pushButton_stopProcessingQueue, SIGNAL(clicked()), this, SLOT(stopProcessingQueue())); connect(ui->pushButton_changeOutputPath_Queue, SIGNAL(clicked()), this, SLOT(changeOutputPathQueueDialog())); connect(ui->lineEdit_outputPath, SIGNAL(editingFinished()), this, SLOT(editOutputPathQueue())); connect(ui->listWidget_queue, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(queueItemDoubleClicked(QListWidgetItem*))); //queue drag and drop connect(ui->listWidget_queue, SIGNAL(singleImageDropped(QUrl)), this, SLOT(loadSingleDropped(QUrl))); connect(ui->listWidget_queue, SIGNAL(multipleImagesDropped(QList<QUrl>)), this, SLOT(loadMultipleDropped(QList<QUrl>))); //normalmap size preview text connect(ui->spinBox_normalmapSize, SIGNAL(valueChanged(int)), this, SLOT(normalmapSizeChanged())); //"About" button connect(ui->pushButton_about, SIGNAL(clicked()), this, SLOT(showAboutDialog())); }