summaryrefslogtreecommitdiff
path: root/examples/svg/svgviewer/svgview.h
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-04-08 23:43:42 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2016-04-08 23:43:42 +0200
commitca030597815daad554450384e8fa87d3d256bbaf (patch)
treea9f22ddde8cbd5bb5b6f1a470ffdc76cff65f3a3 /examples/svg/svgviewer/svgview.h
parent965cdb2f87e5d22950a7cd5434e2d80a2fbe6cf9 (diff)
parent612c3041475550837dee7149b9f5e9e4f55c17a0 (diff)
downloadqtsvg-ca030597815daad554450384e8fa87d3d256bbaf.tar.gz
Merge remote-tracking branch 'origin/5.7' into dev
Change-Id: I8226348c242d0d5bf1f78adc376ecbe26215445e
Diffstat (limited to 'examples/svg/svgviewer/svgview.h')
-rw-r--r--examples/svg/svgviewer/svgview.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/examples/svg/svgviewer/svgview.h b/examples/svg/svgviewer/svgview.h
index b6d1b01..645fb49 100644
--- a/examples/svg/svgviewer/svgview.h
+++ b/examples/svg/svgviewer/svgview.h
@@ -44,9 +44,10 @@
#include <QGraphicsView>
QT_BEGIN_NAMESPACE
+class QGraphicsSvgItem;
+class QSvgRenderer;
class QWheelEvent;
class QPaintEvent;
-class QFile;
QT_END_NAMESPACE
class SvgView : public QGraphicsView
@@ -56,11 +57,14 @@ 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;
+ QSvgRenderer *renderer() const;
public slots:
void setHighQualityAntialiasing(bool highQualityAntialiasing);
@@ -68,13 +72,13 @@ 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;
- QGraphicsItem *m_svgItem;
+ QGraphicsSvgItem *m_svgItem;
QGraphicsRectItem *m_backgroundItem;
QGraphicsRectItem *m_outlineItem;