@@ -31,21 +31,21 BrushTool::BrushTool(QString title, QWidget *parent) | |||
|
31 | 31 | |
|
32 | 32 | m_colorButton = new QPushButton(); |
|
33 | 33 | m_styleCombo = new QComboBox(); |
|
34 | m_styleCombo->addItem("Nobrush", Qt::NoBrush); | |
|
35 | m_styleCombo->addItem("Solidpattern", Qt::SolidPattern); | |
|
36 | m_styleCombo->addItem("Dense1pattern", Qt::Dense1Pattern); | |
|
37 | m_styleCombo->addItem("Dense2attern", Qt::Dense2Pattern); | |
|
38 | m_styleCombo->addItem("Dense3Pattern", Qt::Dense3Pattern); | |
|
39 | m_styleCombo->addItem("Dense4Pattern", Qt::Dense4Pattern); | |
|
40 | m_styleCombo->addItem("Dense5Pattern", Qt::Dense5Pattern); | |
|
41 | m_styleCombo->addItem("Dense6Pattern", Qt::Dense6Pattern); | |
|
42 | m_styleCombo->addItem("Dense7Pattern", Qt::Dense7Pattern); | |
|
43 | m_styleCombo->addItem("HorPattern", Qt::HorPattern); | |
|
44 | m_styleCombo->addItem("VerPattern", Qt::VerPattern); | |
|
45 | m_styleCombo->addItem("CrossPattern", Qt::CrossPattern); | |
|
46 | m_styleCombo->addItem("BDiagPattern", Qt::BDiagPattern); | |
|
47 | m_styleCombo->addItem("FDiagPattern", Qt::FDiagPattern); | |
|
48 | m_styleCombo->addItem("DiagCrossPattern", Qt::DiagCrossPattern); | |
|
34 | m_styleCombo->addItem("Nobrush", (int) Qt::NoBrush); | |
|
35 | m_styleCombo->addItem("Solidpattern", (int) Qt::SolidPattern); | |
|
36 | m_styleCombo->addItem("Dense1pattern", (int) Qt::Dense1Pattern); | |
|
37 | m_styleCombo->addItem("Dense2attern", (int) Qt::Dense2Pattern); | |
|
38 | m_styleCombo->addItem("Dense3Pattern", (int) Qt::Dense3Pattern); | |
|
39 | m_styleCombo->addItem("Dense4Pattern", (int) Qt::Dense4Pattern); | |
|
40 | m_styleCombo->addItem("Dense5Pattern", (int) Qt::Dense5Pattern); | |
|
41 | m_styleCombo->addItem("Dense6Pattern", (int) Qt::Dense6Pattern); | |
|
42 | m_styleCombo->addItem("Dense7Pattern", (int) Qt::Dense7Pattern); | |
|
43 | m_styleCombo->addItem("HorPattern", (int) Qt::HorPattern); | |
|
44 | m_styleCombo->addItem("VerPattern", (int) Qt::VerPattern); | |
|
45 | m_styleCombo->addItem("CrossPattern", (int) Qt::CrossPattern); | |
|
46 | m_styleCombo->addItem("BDiagPattern", (int) Qt::BDiagPattern); | |
|
47 | m_styleCombo->addItem("FDiagPattern", (int) Qt::FDiagPattern); | |
|
48 | m_styleCombo->addItem("DiagCrossPattern", (int) Qt::DiagCrossPattern); | |
|
49 | 49 | |
|
50 | 50 | QFormLayout *layout = new QFormLayout(); |
|
51 | 51 | layout->addRow("Color", m_colorButton); |
@@ -48,8 +48,13 TableWidget::TableWidget(QWidget *parent) | |||
|
48 | 48 | QTableView *tableView = new QTableView; |
|
49 | 49 | tableView->setModel(model); |
|
50 | 50 | tableView->setMinimumWidth(300); |
|
51 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | |
|
52 | tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); | |
|
53 | tableView->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch); | |
|
54 | #else | |
|
51 | 55 | tableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch); |
|
52 | 56 | tableView->verticalHeader()->setResizeMode(QHeaderView::Stretch); |
|
57 | #endif | |
|
53 | 58 | //! [2] |
|
54 | 59 | |
|
55 | 60 | //! [3] |
@@ -43,8 +43,13 TableWidget::TableWidget(QWidget *parent) | |||
|
43 | 43 | // create table view and add model to it |
|
44 | 44 | QTableView *tableView = new QTableView; |
|
45 | 45 | tableView->setModel(model); |
|
46 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | |
|
47 | tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); | |
|
48 | tableView->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch); | |
|
49 | #else | |
|
46 | 50 | tableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch); |
|
47 | 51 | tableView->verticalHeader()->setResizeMode(QHeaderView::Stretch); |
|
52 | #endif | |
|
48 | 53 | //! [2] |
|
49 | 54 | |
|
50 | 55 | //! [3] |
@@ -50,7 +50,7 QVariant AbstractBarAnimation::interpolated(const QVariant &from, const QVariant | |||
|
50 | 50 | |
|
51 | 51 | void AbstractBarAnimation::updateCurrentValue(const QVariant &value) |
|
52 | 52 | { |
|
53 |
QVector<QRectF> layout = q |
|
|
53 | QVector<QRectF> layout = qvariant_cast<QVector<QRectF> >(value); | |
|
54 | 54 | m_item->setLayout(layout); |
|
55 | 55 | } |
|
56 | 56 |
@@ -113,8 +113,8 void AxisAnimation::setValues(QVector<qreal> &oldLayout, QVector<qreal> &newLayo | |||
|
113 | 113 | |
|
114 | 114 | QVariant AxisAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const |
|
115 | 115 | { |
|
116 |
QVector<qreal> startVector = q |
|
|
117 |
QVector<qreal> endVecotr = q |
|
|
116 | QVector<qreal> startVector = qvariant_cast<QVector<qreal> >(start); | |
|
117 | QVector<qreal> endVecotr = qvariant_cast<QVector<qreal> >(end); | |
|
118 | 118 | QVector<qreal> result; |
|
119 | 119 | |
|
120 | 120 | Q_ASSERT(startVector.count() == endVecotr.count()) ; |
@@ -130,7 +130,7 QVariant AxisAnimation::interpolated(const QVariant &start, const QVariant &end, | |||
|
130 | 130 | void AxisAnimation::updateCurrentValue(const QVariant &value) |
|
131 | 131 | { |
|
132 | 132 | if (state() != QAbstractAnimation::Stopped) { //workaround |
|
133 |
QVector<qreal> vector = q |
|
|
133 | QVector<qreal> vector = qvariant_cast<QVector<qreal> >(value); | |
|
134 | 134 | Q_ASSERT(vector.count() != 0); |
|
135 | 135 | m_axis->setLayout(vector); |
|
136 | 136 | m_axis->updateGeometry(); |
@@ -38,8 +38,8 BarAnimation::~BarAnimation() | |||
|
38 | 38 | |
|
39 | 39 | QVariant BarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const |
|
40 | 40 | { |
|
41 |
QVector<QRectF> startVector = q |
|
|
42 |
QVector<QRectF> endVector = q |
|
|
41 | QVector<QRectF> startVector = qvariant_cast<QVector<QRectF> >(from); | |
|
42 | QVector<QRectF> endVector = qvariant_cast<QVector<QRectF> >(to); | |
|
43 | 43 | QVector<QRectF> result; |
|
44 | 44 | |
|
45 | 45 | Q_ASSERT(startVector.count() == endVector.count()); |
@@ -39,8 +39,8 HorizontalBarAnimation::~HorizontalBarAnimation() | |||
|
39 | 39 | |
|
40 | 40 | QVariant HorizontalBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const |
|
41 | 41 | { |
|
42 |
QVector<QRectF> startVector = q |
|
|
43 |
QVector<QRectF> endVector = q |
|
|
42 | QVector<QRectF> startVector = qvariant_cast<QVector<QRectF> >(from); | |
|
43 | QVector<QRectF> endVector = qvariant_cast<QVector<QRectF> >(to); | |
|
44 | 44 | QVector<QRectF> result; |
|
45 | 45 | |
|
46 | 46 | Q_ASSERT(startVector.count() == endVector.count()); |
@@ -39,8 +39,8 HorizontalPercentBarAnimation::~HorizontalPercentBarAnimation() | |||
|
39 | 39 | |
|
40 | 40 | QVariant HorizontalPercentBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const |
|
41 | 41 | { |
|
42 |
QVector<QRectF> startVector = q |
|
|
43 |
QVector<QRectF> endVector = q |
|
|
42 | QVector<QRectF> startVector = qvariant_cast<QVector<QRectF> >(from); | |
|
43 | QVector<QRectF> endVector = qvariant_cast<QVector<QRectF> >(to); | |
|
44 | 44 | QVector<QRectF> result; |
|
45 | 45 | |
|
46 | 46 | Q_ASSERT(startVector.count() == endVector.count()); |
@@ -39,8 +39,8 HorizontalStackedBarAnimation::~HorizontalStackedBarAnimation() | |||
|
39 | 39 | |
|
40 | 40 | QVariant HorizontalStackedBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const |
|
41 | 41 | { |
|
42 |
QVector<QRectF> startVector = q |
|
|
43 |
QVector<QRectF> endVector = q |
|
|
42 | QVector<QRectF> startVector = qvariant_cast<QVector<QRectF> >(from); | |
|
43 | QVector<QRectF> endVector = qvariant_cast<QVector<QRectF> >(to); | |
|
44 | 44 | QVector<QRectF> result; |
|
45 | 45 | |
|
46 | 46 | Q_ASSERT(startVector.count() == endVector.count()); |
@@ -39,8 +39,8 PercentBarAnimation::~PercentBarAnimation() | |||
|
39 | 39 | |
|
40 | 40 | QVariant PercentBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const |
|
41 | 41 | { |
|
42 |
QVector<QRectF> startVector = q |
|
|
43 |
QVector<QRectF> endVector = q |
|
|
42 | QVector<QRectF> startVector = qvariant_cast<QVector<QRectF> >(from); | |
|
43 | QVector<QRectF> endVector = qvariant_cast<QVector<QRectF> >(to); | |
|
44 | 44 | QVector<QRectF> result; |
|
45 | 45 | |
|
46 | 46 | Q_ASSERT(startVector.count() == endVector.count()); |
@@ -99,8 +99,8 PieSliceData PieSliceAnimation::currentSliceValue() | |||
|
99 | 99 | |
|
100 | 100 | QVariant PieSliceAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const |
|
101 | 101 | { |
|
102 |
PieSliceData startValue = q |
|
|
103 |
PieSliceData endValue = q |
|
|
102 | PieSliceData startValue = qvariant_cast<PieSliceData>(start); | |
|
103 | PieSliceData endValue = qvariant_cast<PieSliceData>(end); | |
|
104 | 104 | |
|
105 | 105 | PieSliceData result; |
|
106 | 106 | result = endValue; |
@@ -118,7 +118,7 QVariant PieSliceAnimation::interpolated(const QVariant &start, const QVariant & | |||
|
118 | 118 | void PieSliceAnimation::updateCurrentValue(const QVariant &value) |
|
119 | 119 | { |
|
120 | 120 | if (state() != QAbstractAnimation::Stopped) { //workaround |
|
121 |
m_currentValue = q |
|
|
121 | m_currentValue = qvariant_cast<PieSliceData>(value); | |
|
122 | 122 | m_sliceItem->setLayout(m_currentValue); |
|
123 | 123 | } |
|
124 | 124 | } |
@@ -120,8 +120,8 void SplineAnimation::setup(QVector<QPointF> &oldPoints, QVector<QPointF> &newPo | |||
|
120 | 120 | QVariant SplineAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const |
|
121 | 121 | { |
|
122 | 122 | |
|
123 |
SplineVector startPair = q |
|
|
124 |
SplineVector endPair = q |
|
|
123 | SplineVector startPair = qvariant_cast< SplineVector >(start); | |
|
124 | SplineVector endPair = qvariant_cast< SplineVector >(end); | |
|
125 | 125 | SplineVector result; |
|
126 | 126 | |
|
127 | 127 | switch (animationType()) { |
@@ -170,7 +170,7 QVariant SplineAnimation::interpolated(const QVariant &start, const QVariant &en | |||
|
170 | 170 | void SplineAnimation::updateCurrentValue(const QVariant &value) |
|
171 | 171 | { |
|
172 | 172 | if (state() != QAbstractAnimation::Stopped && m_valid) { //workaround |
|
173 |
QPair<QVector<QPointF >, QVector<QPointF > > pair = q |
|
|
173 | QPair<QVector<QPointF >, QVector<QPointF > > pair = qvariant_cast< QPair< QVector<QPointF>, QVector<QPointF> > >(value); | |
|
174 | 174 | m_item->setGeometryPoints(pair.first); |
|
175 | 175 | m_item->setControlGeometryPoints(pair.second); |
|
176 | 176 | m_item->updateGeometry(); |
@@ -38,8 +38,8 StackedBarAnimation::~StackedBarAnimation() | |||
|
38 | 38 | |
|
39 | 39 | QVariant StackedBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const |
|
40 | 40 | { |
|
41 |
QVector<QRectF> startVector = q |
|
|
42 |
QVector<QRectF> endVector = q |
|
|
41 | QVector<QRectF> startVector = qvariant_cast<QVector<QRectF> >(from); | |
|
42 | QVector<QRectF> endVector = qvariant_cast<QVector<QRectF> >(to); | |
|
43 | 43 | QVector<QRectF> result; |
|
44 | 44 | |
|
45 | 45 | Q_ASSERT(startVector.count() == endVector.count()); |
@@ -88,8 +88,8 void XYAnimation::setup(const QVector<QPointF> &oldPoints, const QVector<QPointF | |||
|
88 | 88 | |
|
89 | 89 | QVariant XYAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const |
|
90 | 90 | { |
|
91 |
QVector<QPointF> startVector = q |
|
|
92 |
QVector<QPointF> endVector = q |
|
|
91 | QVector<QPointF> startVector = qvariant_cast<QVector<QPointF> >(start); | |
|
92 | QVector<QPointF> endVector = qvariant_cast<QVector<QPointF> >(end); | |
|
93 | 93 | QVector<QPointF> result; |
|
94 | 94 | |
|
95 | 95 | switch (m_type) { |
@@ -125,7 +125,7 void XYAnimation::updateCurrentValue(const QVariant &value) | |||
|
125 | 125 | { |
|
126 | 126 | if (state() != QAbstractAnimation::Stopped) { //workaround |
|
127 | 127 | |
|
128 |
QVector<QPointF> vector = q |
|
|
128 | QVector<QPointF> vector = qvariant_cast<QVector<QPointF> >(value); | |
|
129 | 129 | m_item->setGeometryPoints(vector); |
|
130 | 130 | m_item->updateGeometry(); |
|
131 | 131 | m_item->setDirty(true); |
@@ -78,10 +78,10 void ChartAxis::setLayout(QVector<qreal> &layout) | |||
|
78 | 78 | |
|
79 | 79 | void ChartAxis::createItems(int count) |
|
80 | 80 | { |
|
81 |
if (m_arrow->child |
|
|
81 | if (m_arrow->childItems().size() == 0) | |
|
82 | 82 | m_arrow->addToGroup(new AxisItem(this, presenter()->rootItem())); |
|
83 | 83 | |
|
84 |
if (m_intervalAxis && m_grid->child |
|
|
84 | if (m_intervalAxis && m_grid->childItems().size() == 0) { | |
|
85 | 85 | for (int i = 0 ; i < 2 ; i ++) |
|
86 | 86 | m_grid->addToGroup(new QGraphicsLineItem(presenter()->rootItem())); |
|
87 | 87 | } |
@@ -440,7 +440,7 QStringList ChartAxis::createValueLabels(int ticks) const | |||
|
440 | 440 | labels << QString::number(value, 'f', n); |
|
441 | 441 | } |
|
442 | 442 | } else { |
|
443 |
QByteArray array = format.to |
|
|
443 | QByteArray array = format.toLatin1(); | |
|
444 | 444 | for (int i = 0; i < ticks; i++) { |
|
445 | 445 | qreal value = m_min + (i * (m_max - m_min) / (ticks - 1)); |
|
446 | 446 | labels << QString().sprintf(array, value); |
@@ -43,7 +43,7 LegendMarkerItem::LegendMarkerItem(QLegendMarkerPrivate *marker, QGraphicsObject | |||
|
43 | 43 | m_pressPos(0, 0) |
|
44 | 44 | { |
|
45 | 45 | m_rectItem->setRect(m_markerRect); |
|
46 |
setAccept |
|
|
46 | setAcceptHoverEvents(true); | |
|
47 | 47 | } |
|
48 | 48 | |
|
49 | 49 | LegendMarkerItem::~LegendMarkerItem() |
@@ -24,6 +24,17 | |||
|
24 | 24 | #include <QtTest/QtTest> |
|
25 | 25 | #include <QPushButton> |
|
26 | 26 | |
|
27 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | |
|
28 | namespace QTest | |
|
29 | { | |
|
30 | // This was deprecated in Qt5. This is a small hack for the sake of compatibility. | |
|
31 | inline static bool qWaitForWindowShown(QWidget *window) | |
|
32 | { | |
|
33 | return QTest::qWaitForWindowExposed(window); | |
|
34 | } | |
|
35 | } | |
|
36 | #endif | |
|
37 | ||
|
27 | 38 | #define TRY_COMPARE(actual, expected) { \ |
|
28 | 39 | do { \ |
|
29 | 40 | const int timeout(1000); \ |
@@ -22,6 +22,7 | |||
|
22 | 22 | #include <qbarset.h> |
|
23 | 23 | #include <qbarseries.h> |
|
24 | 24 | #include <qchartview.h> |
|
25 | #include "tst_definitions.h" | |
|
25 | 26 | |
|
26 | 27 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
27 | 28 |
@@ -31,6 +31,7 | |||
|
31 | 31 | #include <qstackedbarseries.h> |
|
32 | 32 | #include <qvalueaxis.h> |
|
33 | 33 | #include <qbarcategoryaxis.h> |
|
34 | #include "tst_definitions.h" | |
|
34 | 35 | |
|
35 | 36 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
36 | 37 | |
@@ -466,10 +467,10 void tst_QChart::removeSeries() | |||
|
466 | 467 | |
|
467 | 468 | void tst_QChart::scroll_right_data() |
|
468 | 469 | { |
|
469 |
|
|
|
470 | QTest::addColumn<QAbstractSeries *>("series"); | |
|
470 | 471 | |
|
471 |
|
|
|
472 |
|
|
|
472 | QLineSeries* series0 = new QLineSeries(this); | |
|
473 | *series0 << QPointF(0, 0) << QPointF(100, 100); | |
|
473 | 474 | |
|
474 | 475 | QTest::newRow("lineSeries") << (QAbstractSeries*) series0; |
|
475 | 476 | |
@@ -490,77 +491,77 void tst_QChart::scroll_right() | |||
|
490 | 491 | { |
|
491 | 492 | case QAbstractAxis::AxisTypeValue:{ |
|
492 | 493 | QValueAxis* vaxis = qobject_cast<QValueAxis*>(axis); |
|
493 |
|
|
|
494 |
|
|
|
495 |
|
|
|
496 |
|
|
|
497 |
|
|
|
498 |
|
|
|
499 |
|
|
|
500 |
|
|
|
501 |
|
|
|
494 | QVERIFY(vaxis!=0); | |
|
495 | qreal min = vaxis->min(); | |
|
496 | qreal max = vaxis->max(); | |
|
497 | QVERIFY(max>min); | |
|
498 | m_chart->scroll(50, 0); | |
|
499 | QVERIFY(min<vaxis->min()); | |
|
500 | QVERIFY(max<vaxis->max()); | |
|
501 | break; | |
|
502 | } | |
|
502 | 503 | case QAbstractAxis::AxisTypeBarCategory:{ |
|
503 | 504 | QBarCategoryAxis* caxis = qobject_cast<QBarCategoryAxis*>(axis); |
|
504 |
|
|
|
505 |
|
|
|
506 |
|
|
|
507 |
|
|
|
508 |
|
|
|
509 |
|
|
|
510 |
|
|
|
511 |
|
|
|
512 |
|
|
|
513 |
|
|
|
514 |
|
|
|
505 | QVERIFY(caxis!=0); | |
|
506 | qreal min = caxis->min().toDouble(); | |
|
507 | qreal max = caxis->max().toDouble(); | |
|
508 | m_chart->scroll(50, 0); | |
|
509 | QVERIFY(min<caxis->min().toDouble()); | |
|
510 | QVERIFY(max<caxis->max().toDouble()); | |
|
511 | break; | |
|
512 | } | |
|
513 | default: | |
|
514 | qFatal("Unsupported type"); | |
|
515 | break; | |
|
515 | 516 | } |
|
516 | 517 | } |
|
517 | 518 | |
|
518 | 519 | void tst_QChart::scroll_left_data() |
|
519 | 520 | { |
|
520 |
|
|
|
521 | scroll_right_data(); | |
|
521 | 522 | } |
|
522 | 523 | |
|
523 | 524 | void tst_QChart::scroll_left() |
|
524 | 525 | { |
|
525 |
|
|
|
526 |
|
|
|
527 |
|
|
|
528 |
|
|
|
529 |
|
|
|
530 |
|
|
|
531 |
|
|
|
526 | QFETCH(QAbstractSeries *, series); | |
|
527 | m_chart->addSeries(series); | |
|
528 | m_chart->createDefaultAxes(); | |
|
529 | m_view->show(); | |
|
530 | QTest::qWaitForWindowShown(m_view); | |
|
531 | QAbstractAxis * axis = m_chart->axisX(); | |
|
532 | QVERIFY(axis!=0); | |
|
532 | 533 | |
|
533 |
|
|
|
534 |
|
|
|
534 | switch(axis->type()) | |
|
535 | { | |
|
535 | 536 | case QAbstractAxis::AxisTypeValue:{ |
|
536 | 537 | QValueAxis* vaxis = qobject_cast<QValueAxis*>(axis); |
|
537 |
|
|
|
538 |
|
|
|
539 |
|
|
|
540 |
|
|
|
541 |
|
|
|
542 |
|
|
|
543 | break; | |
|
544 | } | |
|
538 | QVERIFY(vaxis!=0); | |
|
539 | qreal min = vaxis->min(); | |
|
540 | qreal max = vaxis->max(); | |
|
541 | m_chart->scroll(-50, 0); | |
|
542 | QVERIFY(min>vaxis->min()); | |
|
543 | QVERIFY(max>vaxis->max()); | |
|
544 | break; | |
|
545 | } | |
|
545 | 546 | case QAbstractAxis::AxisTypeBarCategory:{ |
|
546 | 547 | QBarCategoryAxis* caxis = qobject_cast<QBarCategoryAxis*>(axis); |
|
547 |
|
|
|
548 |
|
|
|
549 |
|
|
|
550 |
|
|
|
551 |
|
|
|
552 |
|
|
|
553 | break; | |
|
554 | } | |
|
555 |
|
|
|
556 |
|
|
|
557 | break; | |
|
558 |
|
|
|
548 | QVERIFY(caxis!=0); | |
|
549 | qreal min = caxis->min().toDouble(); | |
|
550 | qreal max = caxis->max().toDouble(); | |
|
551 | m_chart->scroll(-50, 0); | |
|
552 | QVERIFY(min>caxis->min().toDouble()); | |
|
553 | QVERIFY(max>caxis->max().toDouble()); | |
|
554 | break; | |
|
555 | } | |
|
556 | default: | |
|
557 | qFatal("Unsupported type"); | |
|
558 | break; | |
|
559 | } | |
|
559 | 560 | } |
|
560 | 561 | |
|
561 | 562 | void tst_QChart::scroll_up_data() |
|
562 | 563 | { |
|
563 |
|
|
|
564 | scroll_right_data(); | |
|
564 | 565 | } |
|
565 | 566 | |
|
566 | 567 | void tst_QChart::scroll_up() |
@@ -577,71 +578,71 void tst_QChart::scroll_up() | |||
|
577 | 578 | { |
|
578 | 579 | case QAbstractAxis::AxisTypeValue:{ |
|
579 | 580 | QValueAxis* vaxis = qobject_cast<QValueAxis*>(axis); |
|
580 |
|
|
|
581 |
|
|
|
582 |
|
|
|
583 |
|
|
|
584 |
|
|
|
585 |
|
|
|
586 |
|
|
|
587 |
|
|
|
581 | QVERIFY(vaxis!=0); | |
|
582 | qreal min = vaxis->min(); | |
|
583 | qreal max = vaxis->max(); | |
|
584 | m_chart->scroll(0, 50); | |
|
585 | QVERIFY(min<vaxis->min()); | |
|
586 | QVERIFY(max<vaxis->max()); | |
|
587 | break; | |
|
588 | } | |
|
588 | 589 | case QAbstractAxis::AxisTypeBarCategory:{ |
|
589 | 590 | QBarCategoryAxis* caxis = qobject_cast<QBarCategoryAxis*>(axis); |
|
590 |
|
|
|
591 |
|
|
|
592 |
|
|
|
593 |
|
|
|
594 |
|
|
|
595 |
|
|
|
596 |
|
|
|
597 |
|
|
|
598 |
|
|
|
599 |
|
|
|
600 |
|
|
|
591 | QVERIFY(caxis!=0); | |
|
592 | qreal min = caxis->min().toDouble(); | |
|
593 | qreal max = caxis->max().toDouble(); | |
|
594 | m_chart->scroll(0, 50); | |
|
595 | QVERIFY(min<caxis->min().toDouble()); | |
|
596 | QVERIFY(max<caxis->max().toDouble()); | |
|
597 | break; | |
|
598 | } | |
|
599 | default: | |
|
600 | qFatal("Unsupported type"); | |
|
601 | break; | |
|
601 | 602 | } |
|
602 | 603 | } |
|
603 | 604 | |
|
604 | 605 | void tst_QChart::scroll_down_data() |
|
605 | 606 | { |
|
606 |
|
|
|
607 | scroll_right_data(); | |
|
607 | 608 | } |
|
608 | 609 | |
|
609 | 610 | void tst_QChart::scroll_down() |
|
610 | 611 | { |
|
611 |
|
|
|
612 |
|
|
|
613 |
|
|
|
614 |
|
|
|
615 |
|
|
|
616 |
|
|
|
617 |
|
|
|
612 | QFETCH(QAbstractSeries *, series); | |
|
613 | m_chart->addSeries(series); | |
|
614 | m_chart->createDefaultAxes(); | |
|
615 | m_view->show(); | |
|
616 | QTest::qWaitForWindowShown(m_view); | |
|
617 | QAbstractAxis * axis = m_chart->axisY(); | |
|
618 | QVERIFY(axis!=0); | |
|
618 | 619 | |
|
619 |
|
|
|
620 |
|
|
|
620 | switch(axis->type()) | |
|
621 | { | |
|
621 | 622 | case QAbstractAxis::AxisTypeValue:{ |
|
622 | 623 | QValueAxis* vaxis = qobject_cast<QValueAxis*>(axis); |
|
623 |
|
|
|
624 |
|
|
|
625 |
|
|
|
626 |
|
|
|
627 |
|
|
|
628 |
|
|
|
629 | break; | |
|
630 | } | |
|
624 | QVERIFY(vaxis!=0); | |
|
625 | qreal min = vaxis->min(); | |
|
626 | qreal max = vaxis->max(); | |
|
627 | m_chart->scroll(0, -50); | |
|
628 | QVERIFY(min>vaxis->min()); | |
|
629 | QVERIFY(max>vaxis->max()); | |
|
630 | break; | |
|
631 | } | |
|
631 | 632 | case QAbstractAxis::AxisTypeBarCategory:{ |
|
632 | 633 | QBarCategoryAxis* caxis = qobject_cast<QBarCategoryAxis*>(axis); |
|
633 |
|
|
|
634 |
|
|
|
635 |
|
|
|
636 |
|
|
|
637 |
|
|
|
638 |
|
|
|
639 | break; | |
|
640 | } | |
|
641 |
|
|
|
642 |
|
|
|
643 | break; | |
|
644 |
|
|
|
634 | QVERIFY(caxis!=0); | |
|
635 | qreal min = caxis->min().toDouble(); | |
|
636 | qreal max = caxis->max().toDouble(); | |
|
637 | m_chart->scroll(0, -50); | |
|
638 | QVERIFY(min>caxis->min().toDouble()); | |
|
639 | QVERIFY(max>caxis->max().toDouble()); | |
|
640 | break; | |
|
641 | } | |
|
642 | default: | |
|
643 | qFatal("Unsupported type"); | |
|
644 | break; | |
|
645 | } | |
|
645 | 646 | } |
|
646 | 647 | |
|
647 | 648 | void tst_QChart::theme_data() |
General Comments 0
You need to be logged in to leave comments.
Login now