From 143a58bccce1b8a4de9f80ce9402ac07c16471ce Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Thu, 28 Nov 2013 11:57:25 +0100 Subject: Added QGraphicsWebView to yosys-svgviewer --- libs/svgviewer/mainwindow.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'libs/svgviewer/mainwindow.cpp') diff --git a/libs/svgviewer/mainwindow.cpp b/libs/svgviewer/mainwindow.cpp index f8f72e5c4..70da140eb 100644 --- a/libs/svgviewer/mainwindow.cpp +++ b/libs/svgviewer/mainwindow.cpp @@ -41,6 +41,7 @@ #include "mainwindow.h" #include +#include #include #include "svgview.h" @@ -60,10 +61,18 @@ MainWindow::MainWindow() menuBar()->addMenu(fileMenu); QMenu *viewMenu = new QMenu(tr("&View"), this); + + m_interactiveAction = viewMenu->addAction(tr("&Interactive")); + m_interactiveAction->setEnabled(false); + m_interactiveAction->setCheckable(true); + m_interactiveAction->setChecked(false); + connect(m_interactiveAction, SIGNAL(toggled(bool)), m_view, SLOT(setViewInteractive(bool))); + m_backgroundAction = viewMenu->addAction(tr("&Background")); m_backgroundAction->setEnabled(false); m_backgroundAction->setCheckable(true); m_backgroundAction->setChecked(false); + m_backgroundAction->setVisible(false); connect(m_backgroundAction, SIGNAL(toggled(bool)), m_view, SLOT(setViewBackground(bool))); m_outlineAction = viewMenu->addAction(tr("&Outline")); @@ -136,6 +145,7 @@ void MainWindow::openFile(const QString &path, bool reload) QMessageBox::critical(this, tr("Open SVG File"), QString("Could not open file '%1'.").arg(fileName)); + m_interactiveAction->setEnabled(false); m_outlineAction->setEnabled(false); m_backgroundAction->setEnabled(false); return; @@ -157,6 +167,7 @@ void MainWindow::openFile(const QString &path, bool reload) connect(m_watcher, SIGNAL(fileChanged(const QString&)), this, SLOT(reloadFile())); } + m_interactiveAction->setEnabled(true); m_outlineAction->setEnabled(true); m_backgroundAction->setEnabled(true); @@ -169,6 +180,8 @@ void MainWindow::openFile(const QString &path, bool reload) void MainWindow::reloadFile() { + // give the writer ~100 ms to finish writing + usleep(100000); openFile(m_currentPath, true); } -- cgit v1.2.3