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