diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-03-11 10:00:33 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-03-11 17:06:54 +0000 |
commit | 99303e92ae9cf461f99b8eff8b37b42f758118b6 (patch) | |
tree | 7dd56787ed2e9ed711b599913bcb66e91e14b631 /examples/svg/svgviewer/svgview.h | |
parent | 86b82a0eea6c26fba34a9d2049935a18a088f3e7 (diff) |
Polish the SVG viewer example.
- Use Qt 5 connection syntax, demonstrating lambdas.
- Use QCommandLineParser.
- Improve error handling.
- Use Mime API of QFileDialog, point to pictures location initially.
- Prevent the application from shrinking when loading small images.
- Minor polishing, status messages on loading, About Qt dialog.
Change-Id: I76f14001c9ab12cbfaaacc2ca4828b404e4b13b2
Reviewed-by: aavit <eirik.aavitsland@theqtcompany.com>
Diffstat (limited to 'examples/svg/svgviewer/svgview.h')
-rw-r--r-- | examples/svg/svgviewer/svgview.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/examples/svg/svgviewer/svgview.h b/examples/svg/svgviewer/svgview.h index b6d1b01..41c0ca5 100644 --- a/examples/svg/svgviewer/svgview.h +++ b/examples/svg/svgviewer/svgview.h @@ -46,7 +46,6 @@ QT_BEGIN_NAMESPACE class QWheelEvent; class QPaintEvent; -class QFile; QT_END_NAMESPACE class SvgView : public QGraphicsView @@ -56,11 +55,13 @@ class SvgView : public QGraphicsView public: enum RendererType { Native, OpenGL, Image }; - SvgView(QWidget *parent = 0); + explicit SvgView(QWidget *parent = nullptr); - void openFile(const QFile &file); + bool openFile(const QString &fileName); void setRenderer(RendererType type = Native); - void drawBackground(QPainter *p, const QRectF &rect); + void drawBackground(QPainter *p, const QRectF &rect) override; + + QSize svgSize() const; public slots: void setHighQualityAntialiasing(bool highQualityAntialiasing); @@ -68,8 +69,8 @@ public slots: void setViewOutline(bool enable); protected: - void wheelEvent(QWheelEvent *event); - void paintEvent(QPaintEvent *event); + void wheelEvent(QWheelEvent *event) override; + void paintEvent(QPaintEvent *event) override; private: RendererType m_renderer; |