##// END OF EJS Templates
Workaround for version check flag
Jani Honkonen -
r3:c3678819f924
parent child
Show More
@@ -1,27 +1,27
1 1 #include "declarativechart.h"
2 2 #include <QPainter>
3 3
4 #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
4 #ifndef QTQUICK2
5 5 DeclarativeChart::DeclarativeChart(QDeclarativeItem *parent)
6 6 : QDeclarativeItem(parent)
7 7 {
8 8 // need to disable this flag to draw inside a QDeclarativeItem
9 9 setFlag(QGraphicsItem::ItemHasNoContents, false);
10 10 }
11 11 #else
12 12 DeclarativeChart::DeclarativeChart(QQuickItem *parent)
13 13 : QQuickPaintedItem(parent)
14 14 {
15 15
16 16 }
17 17 #endif
18 18
19 #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
19 #ifndef QTQUICK2
20 20 void DeclarativeChart::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
21 21 #else
22 22 void DeclarativeChart::paint(QPainter *painter)
23 23 #endif
24 24 {
25 25 drawChart(painter, boundingRect());
26 26 }
27 27
@@ -1,37 +1,37
1 1 #ifndef DECLARATIVECHART_H
2 2 #define DECLARATIVECHART_H
3 3
4 4 #include <QtCore/QtGlobal>
5 #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
5 #ifndef QTQUICK2
6 6 #include <QDeclarativeItem>
7 7 #else
8 8 #include <QtQuick/QQuickPaintedItem>
9 9 #endif
10 10 #include <QColor>
11 11 #include "../src/chart.h"
12 12
13 #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
13 #ifndef QTQUICK2
14 14 class DeclarativeChart : public QDeclarativeItem, public Chart
15 15 #else
16 16 class DeclarativeChart : public QQuickPaintedItem, public Chart
17 17 #endif
18 18 {
19 19 Q_OBJECT
20 20 Q_PROPERTY(QColor color READ color WRITE setColor)
21 21
22 22 public:
23 #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
23 #ifndef QTQUICK2
24 24 DeclarativeChart(QDeclarativeItem *parent = 0);
25 25 #else
26 26 DeclarativeChart(QQuickItem *parent = 0);
27 27 #endif
28 28
29 #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
29 #ifndef QTQUICK2
30 30 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
31 31 #else
32 32 void paint(QPainter *painter);
33 33 #endif
34 34 };
35 35
36 36
37 37 #endif // DECLARATIVECHART_H
@@ -1,26 +1,30
1 1 TEMPLATE = lib
2 2 TARGET = qmlchartplugin
3 3
4 4 CONFIG += qt plugin
5 5 QT += declarative
6 6
7 contains($$QT_MAJOR_VERSION, 5) {
8 DEFINES += QTQUICK2
9 }
10
7 11 OBJECTS_DIR = tmp
8 12 MOC_DIR = tmp
9 13
10 14 SOURCES += \
11 15 plugin.cpp \
12 16 declarativechart.cpp
13 17 HEADERS += \
14 18 declarativechart.h
15 19 include(../src/chart.pri)
16 20
17 21 TARGETPATH = com/digia/charts
18 22
19 23 #DESTDIR = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
20 24 target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
21 25
22 26 qmldir.files += $$PWD/qmldir
23 27 qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
24 28
25 29 INSTALLS += target qmldir
26 30
General Comments 0
You need to be logged in to leave comments. Login now