From ca1a13ed9d2fc1311a6680564edd6fc464113d0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Poizl?= Date: Sat, 15 Jun 2024 17:45:30 +0200 Subject: [PATCH] Solve deprectation warnings --- mainwindow.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index c4ab181..0e51cdd 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -143,22 +143,22 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) connect(m_imageGL->imageWidget(), &ImageWidget::fileDropped, this, static_cast(&MainWindow::loadFile)); QMenu *fileMenu = new QMenu(tr("File"), this); - fileMenu->addAction(tr("Open"), this, SLOT(loadFile()), QKeySequence::Open); + fileMenu->addAction(tr("Open"), QKeySequence::Open, this, SLOT(loadFile())); fileMenu->addAction(tr("Open directory recursively"), this, &MainWindow::loadDir); - fileMenu->addAction(tr("Save as"), this, SLOT(saveAs()), QKeySequence::Save); + fileMenu->addAction(tr("Save as"), QKeySequence::Save, this, SLOT(saveAs())); fileMenu->addSeparator(); - fileMenu->addAction(tr("Copy marked files"), this, SLOT(copyMarked()), Qt::Key_F5); - fileMenu->addAction(tr("Move marked files"), this, SLOT(moveMarked()), Qt::Key_F6); - fileMenu->addAction(tr("Move marked files to trash"), this, &MainWindow::deleteMarked, QKeySequence::Delete); + fileMenu->addAction(tr("Copy marked files"), Qt::Key_F5, this, SLOT(copyMarked())); + fileMenu->addAction(tr("Move marked files"), Qt::Key_F6, this, SLOT(moveMarked())); + fileMenu->addAction(tr("Move marked files to trash"), QKeySequence::Delete, this, &MainWindow::deleteMarked); fileMenu->addSeparator(); fileMenu->addAction(tr("Index directory"), this, SLOT(indexDir())); fileMenu->addAction(tr("Reindex files"), this, SLOT(reindex())); fileMenu->addAction(tr("Export database to CSV"), this, &MainWindow::exportCSV); - fileMenu->addAction(tr("Batch processing"), [this](){ + fileMenu->addAction(tr("Batch processing"), Qt::Key_B | Qt::CTRL, [this](){ BatchProcessing *batchProcessing = new BatchProcessing(this); batchProcessing->exec(); delete batchProcessing; - }, Qt::Key_B | Qt::CTRL); + }); fileMenu->addSeparator(); QAction *liveModeAction = fileMenu->addAction(tr("Live mode"), this, SLOT(liveMode(bool))); liveModeAction->setCheckable(true); @@ -171,9 +171,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) menuBar()->addMenu(editMenu); QMenu *viewMenu = new QMenu(tr("View"), this); - viewMenu->addAction(tr("Zoom In"), m_imageGL, SLOT(zoomIn()), QKeySequence::ZoomIn); - viewMenu->addAction(tr("Zoom Out"), m_imageGL, SLOT(zoomOut()), QKeySequence::ZoomOut); - viewMenu->addAction(tr("Best Fit"), m_imageGL, SLOT(bestFit()), QKeySequence("Ctrl+1")); + viewMenu->addAction(tr("Zoom In"), QKeySequence::ZoomIn, m_imageGL, SLOT(zoomIn())); + viewMenu->addAction(tr("Zoom Out"), QKeySequence::ZoomOut, m_imageGL, SLOT(zoomOut())); + viewMenu->addAction(tr("Best Fit"), QKeySequence("Ctrl+1"), m_imageGL, SLOT(bestFit())); viewMenu->addAction(tr("100%"), m_imageGL, SLOT(oneToOne())); viewMenu->addSeparator(); QMenu *bayerMenu = viewMenu->addMenu(tr("Bayer mask")); @@ -195,28 +195,28 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) settings.setValue("mainwindow/bayermask", data); }); - QAction *thumbnailsAction = viewMenu->addAction(tr("Thumbnails"), [this](bool checked){ + QAction *thumbnailsAction = viewMenu->addAction(tr("Thumbnails"), Qt::Key_F2, [this](bool checked){ if(SettingsDialog::loadThumbsizes())m_ringList->clearThumbnails(); m_imageGL->imageWidget()->allocateThumbnails(m_ringList->imageNames()); m_imageGL->imageWidget()->showThumbnail(checked); if(checked)m_ringList->loadThumbnails(); else m_ringList->stopLoading(); - }, Qt::Key_F2); + }); thumbnailsAction->setCheckable(true); - QAction *slideshowAction = viewMenu->addAction(tr("Slideshow"), m_ringList, &ImageRingList::toggleSlideshow, Qt::Key_F3); + QAction *slideshowAction = viewMenu->addAction(tr("Slideshow"), Qt::Key_F3, m_ringList, &ImageRingList::toggleSlideshow); slideshowAction->setCheckable(true); menuBar()->addMenu(viewMenu); QMenu *selectMenu = new QMenu(tr("Select"), this); - selectMenu->addAction(tr("Mark"), this, SLOT(markImage()), Qt::Key_F7); - selectMenu->addAction(tr("Unmark"), this, SLOT(unmarkImage()), Qt::Key_F8); + selectMenu->addAction(tr("Mark"), Qt::Key_F7, this, SLOT(markImage())); + selectMenu->addAction(tr("Unmark"), Qt::Key_F8, this, SLOT(unmarkImage())); selectMenu->addSeparator(); - selectMenu->addAction(tr("Mark and next"), this, SLOT(markAndNext()), Qt::Key_M); - selectMenu->addAction(tr("Unmark and next"), this, SLOT(unmarkAndNext()), Qt::Key_X); + selectMenu->addAction(tr("Mark and next"), Qt::Key_M, this, SLOT(markAndNext())); + selectMenu->addAction(tr("Unmark and next"), Qt::Key_X, this, SLOT(unmarkAndNext())); selectMenu->addAction(tr("Show marked"), this, &MainWindow::showMarkFilesDialog); menuBar()->addMenu(selectMenu); - QMenu *analyzeMenu = new QMenu(tr("Analyze"), this); + /*QMenu *analyzeMenu = new QMenu(tr("Analyze"), this); QActionGroup *analyzeGroup = new QActionGroup(this); connect(analyzeGroup, &QActionGroup::triggered, [](QAction* action) { static QAction* lastAction = nullptr; @@ -239,7 +239,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) connect(peakAction, SIGNAL(toggled(bool)), this, SLOT(peakFinder(bool))); connect(starAction, SIGNAL(toggled(bool)), this, SLOT(starFinder(bool))); analyzeMenu->addActions({statsAction, peakAction, starAction}); - //menuBar()->addMenu(analyzeMenu); + menuBar()->addMenu(analyzeMenu);*/ QMenu *dockMenu = new QMenu(tr("Docks"), this); dockMenu->addAction(infoDock->toggleViewAction()); @@ -251,7 +251,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) menuBar()->addMenu(dockMenu); QMenu *helpMenu = menuBar()->addMenu(tr("Help")); - helpMenu->addAction(tr("Help"), [this]{ HelpDialog help(this); help.exec(); }, QKeySequence::HelpContents); + helpMenu->addAction(tr("Help"), QKeySequence::HelpContents, [this]{ HelpDialog help(this); help.exec(); }); helpMenu->addAction(tr("About Tenmon"), [this]{ About about(this); about.exec(); }); helpMenu->addAction(tr("About Qt"), [this](){ QMessageBox::aboutQt(this); });