diff options
author | Clifford Wolf <clifford@clifford.at> | 2013-03-27 18:48:38 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2013-03-27 18:48:38 +0100 |
commit | 98fcb5daa361c9de56ce75d9416d4eeffd01cc85 (patch) | |
tree | 6b9976722b3f8313fc9cdfaef5c08e76c56e1c3b /libs/svgviewer | |
parent | 92cf7ae2f73278fbcbb0bf443c0e245ce4e868b7 (diff) | |
download | yosys-98fcb5daa361c9de56ce75d9416d4eeffd01cc85.tar.gz yosys-98fcb5daa361c9de56ce75d9416d4eeffd01cc85.tar.bz2 yosys-98fcb5daa361c9de56ce75d9416d4eeffd01cc85.zip |
Keep viewport transform stable on reload in yosys-svgviewer
Diffstat (limited to 'libs/svgviewer')
-rw-r--r-- | libs/svgviewer/mainwindow.cpp | 10 | ||||
-rw-r--r-- | libs/svgviewer/mainwindow.h | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/libs/svgviewer/mainwindow.cpp b/libs/svgviewer/mainwindow.cpp index 31dd63e5c..9c4aa23f8 100644 --- a/libs/svgviewer/mainwindow.cpp +++ b/libs/svgviewer/mainwindow.cpp @@ -112,7 +112,7 @@ MainWindow::MainWindow() setWindowTitle(tr("SVG Viewer")); } -void MainWindow::openFile(const QString &path) +void MainWindow::openFile(const QString &path, bool reload) { QString fileName; if (path.isNull()) @@ -148,6 +148,7 @@ void MainWindow::openFile(const QString &path) // just keep the file open so this process is found using 'fuser' m_filehandle = fopen(fileName.toAscii(), "r"); + QTransform oldTransform = m_view->transform(); m_view->openFile(file); if (!fileName.startsWith(":/")) { @@ -158,13 +159,16 @@ void MainWindow::openFile(const QString &path) m_outlineAction->setEnabled(true); m_backgroundAction->setEnabled(true); - // resize(m_view->sizeHint() + QSize(80, 80 + menuBar()->height())); + if (reload) + m_view->setTransform(oldTransform); + else + resize(m_view->sizeHint() + QSize(80, 80 + menuBar()->height())); } } void MainWindow::reloadFile() { - openFile(m_currentPath); + openFile(m_currentPath, true); } void MainWindow::setRenderer(QAction *action) diff --git a/libs/svgviewer/mainwindow.h b/libs/svgviewer/mainwindow.h index bfbfd803b..5b549e92a 100644 --- a/libs/svgviewer/mainwindow.h +++ b/libs/svgviewer/mainwindow.h @@ -63,7 +63,7 @@ public: MainWindow(); public slots: - void openFile(const QString &path = QString()); + void openFile(const QString &path = QString(), bool reload = false); void setRenderer(QAction *action); void reloadFile(); |