Skip to content

Commit

Permalink
Revert "feat: fit by width"
Browse files Browse the repository at this point in the history
This reverts commit 038d04b.
  • Loading branch information
BLumia committed May 29, 2021
1 parent 3e51cd5 commit e92ccb0
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 36 deletions.
2 changes: 0 additions & 2 deletions app/actionmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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));
Expand Down
1 change: 0 additions & 1 deletion app/actionmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class ActionManager
QAction *actionZoomIn;
QAction *actionZoomOut;
QAction *actionHorizontalFlip;
QAction *actionFitByWidth;
QAction *actionCopyPixmap;
QAction *actionCopyFilePath;
QAction *actionPaste;
Expand Down
25 changes: 0 additions & 25 deletions app/graphicsview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())) {
Expand Down
1 change: 0 additions & 1 deletion app/graphicsview.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 0 additions & 6 deletions app/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion app/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit e92ccb0

Please sign in to comment.