diff --git a/app/actionmanager.cpp b/app/actionmanager.cpp index c876a613..f914f776 100644 --- a/app/actionmanager.cpp +++ b/app/actionmanager.cpp @@ -24,7 +24,6 @@ void ActionManager::setupAction(MainWindow *mainWindow) CREATE_NEW_ACTION(mainWindow, actionZoomIn); CREATE_NEW_ACTION(mainWindow, actionZoomOut); CREATE_NEW_ACTION(mainWindow, actionHorizontalFlip); - CREATE_NEW_ACTION(mainWindow, actionFitByWidth); CREATE_NEW_ACTION(mainWindow, actionCopyPixmap); CREATE_NEW_ACTION(mainWindow, actionCopyFilePath); CREATE_NEW_ACTION(mainWindow, actionPaste); @@ -48,7 +47,6 @@ void ActionManager::retranslateUi(MainWindow *mainWindow) actionZoomIn->setText(QCoreApplication::translate("MainWindow", "Zoom in", nullptr)); actionZoomOut->setText(QCoreApplication::translate("MainWindow", "Zoom out", nullptr)); actionHorizontalFlip->setText(QCoreApplication::translate("MainWindow", "Flip &Horizontally", nullptr)); - actionFitByWidth->setText("Fit by width"); // TODO: what should it called? actionCopyPixmap->setText(QCoreApplication::translate("MainWindow", "Copy P&ixmap", nullptr)); actionCopyFilePath->setText(QCoreApplication::translate("MainWindow", "Copy &File Path", nullptr)); actionPaste->setText(QCoreApplication::translate("MainWindow", "&Paste", nullptr)); diff --git a/app/actionmanager.h b/app/actionmanager.h index 50e7978c..cb316946 100644 --- a/app/actionmanager.h +++ b/app/actionmanager.h @@ -19,7 +19,6 @@ class ActionManager QAction *actionZoomIn; QAction *actionZoomOut; QAction *actionHorizontalFlip; - QAction *actionFitByWidth; QAction *actionCopyPixmap; QAction *actionCopyFilePath; QAction *actionPaste; diff --git a/app/graphicsview.cpp b/app/graphicsview.cpp index 3bce1711..b59a1962 100644 --- a/app/graphicsview.cpp +++ b/app/graphicsview.cpp @@ -171,31 +171,6 @@ void GraphicsView::fitInView(const QRectF &rect, Qt::AspectRatioMode aspectRadio applyTransformationModeByScaleFactor(); } -void GraphicsView::fitByOrientation(Qt::Orientation ori, bool scaleDownOnly) -{ - resetScale(); - - QRectF viewRect = this->viewport()->rect().adjusted(2, 2, -2, -2); - QRectF imageRect = transform().mapRect(sceneRect()); - - qreal ratio; - - if (ori == Qt::Horizontal) { - ratio = viewRect.width() / imageRect.width(); - } else { - ratio = viewRect.height() / imageRect.height(); - } - - if (scaleDownOnly && ratio > 1) ratio = 1; - - scale(ratio, ratio); - centerOn(imageRect.top(), 0); - m_enableFitInView = false; - - applyTransformationModeByScaleFactor(); - emit navigatorViewRequired(!isThingSmallerThanWindowWith(transform()), transform()); -} - void GraphicsView::checkAndDoFitInView(bool markItOnAnyway) { if (!isThingSmallerThanWindowWith(transform())) { diff --git a/app/graphicsview.h b/app/graphicsview.h index b741c4f6..ab324dec 100644 --- a/app/graphicsview.h +++ b/app/graphicsview.h @@ -30,7 +30,6 @@ class GraphicsView : public QGraphicsView void flipView(bool horizontal = true); void resetScale(); void fitInView(const QRectF &rect, Qt::AspectRatioMode aspectRadioMode = Qt::IgnoreAspectRatio); - void fitByOrientation(Qt::Orientation ori = Qt::Horizontal, bool scaleDownOnly = false); void checkAndDoFitInView(bool markItOnAnyway = true); diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp index 009b76b7..825d0878 100644 --- a/app/mainwindow.cpp +++ b/app/mainwindow.cpp @@ -421,7 +421,6 @@ void MainWindow::contextMenuEvent(QContextMenuEvent *event) menu->addSeparator(); menu->addAction(m_am->actionHorizontalFlip); - menu->addAction(m_am->actionFitByWidth); menu->addSeparator(); menu->addAction(stayOnTopMode); @@ -562,11 +561,6 @@ void MainWindow::on_actionHorizontalFlip_triggered() m_graphicsView->flipView(); } -void MainWindow::on_actionFitByWidth_triggered() -{ - m_graphicsView->fitByOrientation(); -} - void MainWindow::on_actionCopyPixmap_triggered() { QClipboard *cb = QApplication::clipboard(); diff --git a/app/mainwindow.h b/app/mainwindow.h index 4ab6c659..0eb2a8d4 100644 --- a/app/mainwindow.h +++ b/app/mainwindow.h @@ -66,7 +66,6 @@ private slots: void on_actionZoomIn_triggered(); void on_actionZoomOut_triggered(); void on_actionHorizontalFlip_triggered(); - void on_actionFitByWidth_triggered(); void on_actionCopyPixmap_triggered(); void on_actionCopyFilePath_triggered(); void on_actionPaste_triggered();