##// END OF EJS Templates
Disabled anti-aliasing by default in declarative impl
Tero Ahola -
r1910:946c00a01ac4
parent child
Show More
@@ -29,6 +29,7 Q_DECL_EXPORT int main(int argc, char *argv[])
29
29
30 viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
30 viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
31 viewer->setSource(QUrl("qrc:/qml/qmlchart/loader.qml"));
31 viewer->setSource(QUrl("qrc:/qml/qmlchart/loader.qml"));
32 viewer->setRenderHint(QPainter::Antialiasing, true);
32 viewer->showExpanded();
33 viewer->showExpanded();
33
34
34 return app->exec();
35 return app->exec();
@@ -29,6 +29,7 Q_DECL_EXPORT int main(int argc, char *argv[])
29
29
30 viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
30 viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
31 viewer->setSource(QUrl("qrc:/qml/qmlcustomizations/loader.qml"));
31 viewer->setSource(QUrl("qrc:/qml/qmlcustomizations/loader.qml"));
32 viewer->setRenderHint(QPainter::Antialiasing, true);
32 viewer->showExpanded();
33 viewer->showExpanded();
33
34
34 return app->exec();
35 return app->exec();
@@ -41,6 +41,7 Q_DECL_EXPORT int main(int argc, char *argv[])
41
41
42 viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
42 viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
43 viewer->setSource(QUrl("qrc:/qml/qmlcustommodel/loader.qml"));
43 viewer->setSource(QUrl("qrc:/qml/qmlcustommodel/loader.qml"));
44 viewer->setRenderHint(QPainter::Antialiasing, true);
44 viewer->showExpanded();
45 viewer->showExpanded();
45
46
46 return app->exec();
47 return app->exec();
@@ -30,6 +30,7 Q_DECL_EXPORT int main(int argc, char *argv[])
30 QmlApplicationViewer viewer;
30 QmlApplicationViewer viewer;
31 viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
31 viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
32 viewer.setSource(QUrl("qrc:/qml/qmlf1legends/main.qml"));
32 viewer.setSource(QUrl("qrc:/qml/qmlf1legends/main.qml"));
33 viewer.setRenderHint(QPainter::Antialiasing, true);
33 viewer.showExpanded();
34 viewer.showExpanded();
34 return app->exec();
35 return app->exec();
35 }
36 }
@@ -21,14 +21,14
21 #include "datasource.h"
21 #include "datasource.h"
22 #include <QXYSeries>
22 #include <QXYSeries>
23 #include <QAreaSeries>
23 #include <QAreaSeries>
24 #include <QAbstractScrollArea>
24 #include <QDeclarativeView>
25 #include <QGLWidget>
25 #include <QGLWidget>
26 #include <QDebug>
26 #include <QDebug>
27 #include <cmath>
27 #include <cmath>
28
28
29 QTCOMMERCIALCHART_USE_NAMESPACE
29 QTCOMMERCIALCHART_USE_NAMESPACE
30
30
31 DataSource::DataSource(QAbstractScrollArea *appViewer, QObject *parent) :
31 DataSource::DataSource(QDeclarativeView *appViewer, QObject *parent) :
32 QObject(parent),
32 QObject(parent),
33 m_appViewer(appViewer),
33 m_appViewer(appViewer),
34 m_index(-1)
34 m_index(-1)
@@ -94,3 +94,8 void DataSource::setOpenGL(bool enabled)
94 else
94 else
95 m_appViewer->setViewport(0);
95 m_appViewer->setViewport(0);
96 }
96 }
97
98 void DataSource::setAntialiasing(bool enabled)
99 {
100 m_appViewer->setRenderHint(QPainter::Antialiasing, enabled);
101 }
@@ -24,7 +24,7
24 #include <QObject>
24 #include <QObject>
25 #include <QAbstractSeries>
25 #include <QAbstractSeries>
26
26
27 class QAbstractScrollArea;
27 class QDeclarativeView;
28
28
29 QTCOMMERCIALCHART_USE_NAMESPACE
29 QTCOMMERCIALCHART_USE_NAMESPACE
30
30
@@ -32,7 +32,7 class DataSource : public QObject
32 {
32 {
33 Q_OBJECT
33 Q_OBJECT
34 public:
34 public:
35 explicit DataSource(QAbstractScrollArea *appViewer, QObject *parent = 0);
35 explicit DataSource(QDeclarativeView *appViewer, QObject *parent = 0);
36
36
37 signals:
37 signals:
38
38
@@ -40,9 +40,10 public slots:
40 void generateData(int type, int rowCount, int colCount);
40 void generateData(int type, int rowCount, int colCount);
41 void update(QAbstractSeries *series);
41 void update(QAbstractSeries *series);
42 void setOpenGL(bool enabled);
42 void setOpenGL(bool enabled);
43 void setAntialiasing(bool enabled);
43
44
44 private:
45 private:
45 QAbstractScrollArea *m_appViewer;
46 QDeclarativeView *m_appViewer;
46 QList<QList<QPointF> > m_data;
47 QList<QList<QPointF> > m_data;
47 int m_index;
48 int m_index;
48 };
49 };
@@ -27,6 +27,7 Column {
27 signal seriesTypeChanged(string type)
27 signal seriesTypeChanged(string type)
28 signal refreshRateChanged(variant rate);
28 signal refreshRateChanged(variant rate);
29 signal signalSourceChanged(string source, int signalCount, int sampleCount);
29 signal signalSourceChanged(string source, int signalCount, int sampleCount);
30 signal antialiasingEnabled(bool enabled)
30
31
31 Text {
32 Text {
32 text: "Oscilloscope"
33 text: "Oscilloscope"
@@ -82,4 +83,11 Column {
82 currentSelection: 0
83 currentSelection: 0
83 onSelectionChanged: animationsEnabled(currentSelection == 1);
84 onSelectionChanged: animationsEnabled(currentSelection == 1);
84 }
85 }
86
87 MultiButton {
88 text: "Antialias: "
89 items: ["OFF", "ON"]
90 currentSelection: 0
91 onSelectionChanged: antialiasingEnabled(currentSelection == 1);
92 }
85 }
93 }
@@ -23,7 +23,7 import QtQuick 1.0
23 Rectangle {
23 Rectangle {
24 id: button
24 id: button
25 width: 120
25 width: 120
26 height: 35
26 height: 30
27 border.color: "gray"
27 border.color: "gray"
28 radius: 7
28 radius: 7
29 property string text: "Option: "
29 property string text: "Option: "
@@ -46,6 +46,7 Rectangle {
46 onAnimationsEnabled: scopeView.setAnimations(enabled);
46 onAnimationsEnabled: scopeView.setAnimations(enabled);
47 onSeriesTypeChanged: scopeView.changeSeriesType(type);
47 onSeriesTypeChanged: scopeView.changeSeriesType(type);
48 onRefreshRateChanged: scopeView.changeRefreshRate(rate);
48 onRefreshRateChanged: scopeView.changeRefreshRate(rate);
49 onAntialiasingEnabled: dataSource.setAntialiasing(enabled);
49 }
50 }
50
51
51 //![2]
52 //![2]
@@ -38,6 +38,7 Q_DECL_EXPORT int main(int argc, char *argv[])
38 }
38 }
39 viewer.rootContext()->setContextProperty("weatherAppKey", appKey);
39 viewer.rootContext()->setContextProperty("weatherAppKey", appKey);
40 viewer.setSource(QUrl("qrc:/qml/qmlweather/main.qml"));
40 viewer.setSource(QUrl("qrc:/qml/qmlweather/main.qml"));
41 viewer.setRenderHint(QPainter::Antialiasing, true);
41 viewer.showExpanded();
42 viewer.showExpanded();
42 return app->exec();
43 return app->exec();
43 }
44 }
@@ -29,6 +29,7 Q_DECL_EXPORT int main(int argc, char *argv[])
29
29
30 viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
30 viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
31 viewer->setSource(QUrl("qrc:/qml/qmlpiechart/main.qml"));
31 viewer->setSource(QUrl("qrc:/qml/qmlpiechart/main.qml"));
32 viewer->setRenderHint(QPainter::Antialiasing, true);
32 viewer->showExpanded();
33 viewer->showExpanded();
33
34
34 return app->exec();
35 return app->exec();
@@ -223,7 +223,6 DeclarativeChart::DeclarativeChart(QDeclarativeItem *parent)
223 m_chart(new QChart(this))
223 m_chart(new QChart(this))
224 {
224 {
225 setFlag(QGraphicsItem::ItemHasNoContents, false);
225 setFlag(QGraphicsItem::ItemHasNoContents, false);
226 // m_chart->axisX()->setNiceNumbersEnabled(false);
227 //TODO: check what should be really here margins or platArea ?!
226 //TODO: check what should be really here margins or platArea ?!
228 m_chartMargins = m_chart->minimumMargins();
227 m_chartMargins = m_chart->minimumMargins();
229 connect(m_chart, SIGNAL(marginsChanged(QRectF)), this, SLOT(handleMarginsChanged(QRectF)));
228 connect(m_chart, SIGNAL(marginsChanged(QRectF)), this, SLOT(handleMarginsChanged(QRectF)));
@@ -366,15 +365,6 void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &
366 QDeclarativeItem::geometryChanged(newGeometry, oldGeometry);
365 QDeclarativeItem::geometryChanged(newGeometry, oldGeometry);
367 }
366 }
368
367
369 void DeclarativeChart::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
370 {
371 Q_UNUSED(option)
372 Q_UNUSED(widget)
373
374 // TODO: optimized?
375 painter->setRenderHint(QPainter::Antialiasing, true);
376 }
377
378 void DeclarativeChart::setTheme(DeclarativeChart::Theme theme)
368 void DeclarativeChart::setTheme(DeclarativeChart::Theme theme)
379 {
369 {
380 QChart::ChartTheme chartTheme = (QChart::ChartTheme) theme;
370 QChart::ChartTheme chartTheme = (QChart::ChartTheme) theme;
@@ -90,7 +90,6 public: // From QDeclarativeItem/QGraphicsItem
90 void childEvent(QChildEvent *event);
90 void childEvent(QChildEvent *event);
91 void componentComplete();
91 void componentComplete();
92 void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
92 void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
93 void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
94
93
95 public:
94 public:
96 void setTheme(DeclarativeChart::Theme theme);
95 void setTheme(DeclarativeChart::Theme theme);
@@ -29,6 +29,7 Q_DECL_EXPORT int main(int argc, char *argv[])
29
29
30 viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
30 viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
31 viewer->setSource(QUrl("qrc:/qml/qmlchartproperties/loader.qml"));
31 viewer->setSource(QUrl("qrc:/qml/qmlchartproperties/loader.qml"));
32 viewer->setRenderHint(QPainter::Antialiasing, true);
32 viewer->showExpanded();
33 viewer->showExpanded();
33
34
34 return app->exec();
35 return app->exec();
General Comments 0
You need to be logged in to leave comments. Login now