##// END OF EJS Templates
Fix deprecation errors from Qt5
Jani Honkonen -
r2241:9223452f638c
parent child
Show More
@@ -31,21 +31,21 BrushTool::BrushTool(QString title, QWidget *parent)
31
31
32 m_colorButton = new QPushButton();
32 m_colorButton = new QPushButton();
33 m_styleCombo = new QComboBox();
33 m_styleCombo = new QComboBox();
34 m_styleCombo->addItem("Nobrush", Qt::NoBrush);
34 m_styleCombo->addItem("Nobrush", (int) Qt::NoBrush);
35 m_styleCombo->addItem("Solidpattern", Qt::SolidPattern);
35 m_styleCombo->addItem("Solidpattern", (int) Qt::SolidPattern);
36 m_styleCombo->addItem("Dense1pattern", Qt::Dense1Pattern);
36 m_styleCombo->addItem("Dense1pattern", (int) Qt::Dense1Pattern);
37 m_styleCombo->addItem("Dense2attern", Qt::Dense2Pattern);
37 m_styleCombo->addItem("Dense2attern", (int) Qt::Dense2Pattern);
38 m_styleCombo->addItem("Dense3Pattern", Qt::Dense3Pattern);
38 m_styleCombo->addItem("Dense3Pattern", (int) Qt::Dense3Pattern);
39 m_styleCombo->addItem("Dense4Pattern", Qt::Dense4Pattern);
39 m_styleCombo->addItem("Dense4Pattern", (int) Qt::Dense4Pattern);
40 m_styleCombo->addItem("Dense5Pattern", Qt::Dense5Pattern);
40 m_styleCombo->addItem("Dense5Pattern", (int) Qt::Dense5Pattern);
41 m_styleCombo->addItem("Dense6Pattern", Qt::Dense6Pattern);
41 m_styleCombo->addItem("Dense6Pattern", (int) Qt::Dense6Pattern);
42 m_styleCombo->addItem("Dense7Pattern", Qt::Dense7Pattern);
42 m_styleCombo->addItem("Dense7Pattern", (int) Qt::Dense7Pattern);
43 m_styleCombo->addItem("HorPattern", Qt::HorPattern);
43 m_styleCombo->addItem("HorPattern", (int) Qt::HorPattern);
44 m_styleCombo->addItem("VerPattern", Qt::VerPattern);
44 m_styleCombo->addItem("VerPattern", (int) Qt::VerPattern);
45 m_styleCombo->addItem("CrossPattern", Qt::CrossPattern);
45 m_styleCombo->addItem("CrossPattern", (int) Qt::CrossPattern);
46 m_styleCombo->addItem("BDiagPattern", Qt::BDiagPattern);
46 m_styleCombo->addItem("BDiagPattern", (int) Qt::BDiagPattern);
47 m_styleCombo->addItem("FDiagPattern", Qt::FDiagPattern);
47 m_styleCombo->addItem("FDiagPattern", (int) Qt::FDiagPattern);
48 m_styleCombo->addItem("DiagCrossPattern", Qt::DiagCrossPattern);
48 m_styleCombo->addItem("DiagCrossPattern", (int) Qt::DiagCrossPattern);
49
49
50 QFormLayout *layout = new QFormLayout();
50 QFormLayout *layout = new QFormLayout();
51 layout->addRow("Color", m_colorButton);
51 layout->addRow("Color", m_colorButton);
@@ -48,8 +48,13 TableWidget::TableWidget(QWidget *parent)
48 QTableView *tableView = new QTableView;
48 QTableView *tableView = new QTableView;
49 tableView->setModel(model);
49 tableView->setModel(model);
50 tableView->setMinimumWidth(300);
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 tableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
55 tableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
52 tableView->verticalHeader()->setResizeMode(QHeaderView::Stretch);
56 tableView->verticalHeader()->setResizeMode(QHeaderView::Stretch);
57 #endif
53 //! [2]
58 //! [2]
54
59
55 //! [3]
60 //! [3]
@@ -43,8 +43,13 TableWidget::TableWidget(QWidget *parent)
43 // create table view and add model to it
43 // create table view and add model to it
44 QTableView *tableView = new QTableView;
44 QTableView *tableView = new QTableView;
45 tableView->setModel(model);
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 tableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
50 tableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
47 tableView->verticalHeader()->setResizeMode(QHeaderView::Stretch);
51 tableView->verticalHeader()->setResizeMode(QHeaderView::Stretch);
52 #endif
48 //! [2]
53 //! [2]
49
54
50 //! [3]
55 //! [3]
@@ -50,7 +50,7 QVariant AbstractBarAnimation::interpolated(const QVariant &from, const QVariant
50
50
51 void AbstractBarAnimation::updateCurrentValue(const QVariant &value)
51 void AbstractBarAnimation::updateCurrentValue(const QVariant &value)
52 {
52 {
53 QVector<QRectF> layout = qVariantValue<QVector<QRectF> >(value);
53 QVector<QRectF> layout = qvariant_cast<QVector<QRectF> >(value);
54 m_item->setLayout(layout);
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 QVariant AxisAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const
114 QVariant AxisAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const
115 {
115 {
116 QVector<qreal> startVector = qVariantValue<QVector<qreal> >(start);
116 QVector<qreal> startVector = qvariant_cast<QVector<qreal> >(start);
117 QVector<qreal> endVecotr = qVariantValue<QVector<qreal> >(end);
117 QVector<qreal> endVecotr = qvariant_cast<QVector<qreal> >(end);
118 QVector<qreal> result;
118 QVector<qreal> result;
119
119
120 Q_ASSERT(startVector.count() == endVecotr.count()) ;
120 Q_ASSERT(startVector.count() == endVecotr.count()) ;
@@ -130,7 +130,7 QVariant AxisAnimation::interpolated(const QVariant &start, const QVariant &end,
130 void AxisAnimation::updateCurrentValue(const QVariant &value)
130 void AxisAnimation::updateCurrentValue(const QVariant &value)
131 {
131 {
132 if (state() != QAbstractAnimation::Stopped) { //workaround
132 if (state() != QAbstractAnimation::Stopped) { //workaround
133 QVector<qreal> vector = qVariantValue<QVector<qreal> >(value);
133 QVector<qreal> vector = qvariant_cast<QVector<qreal> >(value);
134 Q_ASSERT(vector.count() != 0);
134 Q_ASSERT(vector.count() != 0);
135 m_axis->setLayout(vector);
135 m_axis->setLayout(vector);
136 m_axis->updateGeometry();
136 m_axis->updateGeometry();
@@ -38,8 +38,8 BarAnimation::~BarAnimation()
38
38
39 QVariant BarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const
39 QVariant BarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const
40 {
40 {
41 QVector<QRectF> startVector = qVariantValue<QVector<QRectF> >(from);
41 QVector<QRectF> startVector = qvariant_cast<QVector<QRectF> >(from);
42 QVector<QRectF> endVector = qVariantValue<QVector<QRectF> >(to);
42 QVector<QRectF> endVector = qvariant_cast<QVector<QRectF> >(to);
43 QVector<QRectF> result;
43 QVector<QRectF> result;
44
44
45 Q_ASSERT(startVector.count() == endVector.count());
45 Q_ASSERT(startVector.count() == endVector.count());
@@ -39,8 +39,8 HorizontalBarAnimation::~HorizontalBarAnimation()
39
39
40 QVariant HorizontalBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const
40 QVariant HorizontalBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const
41 {
41 {
42 QVector<QRectF> startVector = qVariantValue<QVector<QRectF> >(from);
42 QVector<QRectF> startVector = qvariant_cast<QVector<QRectF> >(from);
43 QVector<QRectF> endVector = qVariantValue<QVector<QRectF> >(to);
43 QVector<QRectF> endVector = qvariant_cast<QVector<QRectF> >(to);
44 QVector<QRectF> result;
44 QVector<QRectF> result;
45
45
46 Q_ASSERT(startVector.count() == endVector.count());
46 Q_ASSERT(startVector.count() == endVector.count());
@@ -39,8 +39,8 HorizontalPercentBarAnimation::~HorizontalPercentBarAnimation()
39
39
40 QVariant HorizontalPercentBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const
40 QVariant HorizontalPercentBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const
41 {
41 {
42 QVector<QRectF> startVector = qVariantValue<QVector<QRectF> >(from);
42 QVector<QRectF> startVector = qvariant_cast<QVector<QRectF> >(from);
43 QVector<QRectF> endVector = qVariantValue<QVector<QRectF> >(to);
43 QVector<QRectF> endVector = qvariant_cast<QVector<QRectF> >(to);
44 QVector<QRectF> result;
44 QVector<QRectF> result;
45
45
46 Q_ASSERT(startVector.count() == endVector.count());
46 Q_ASSERT(startVector.count() == endVector.count());
@@ -39,8 +39,8 HorizontalStackedBarAnimation::~HorizontalStackedBarAnimation()
39
39
40 QVariant HorizontalStackedBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const
40 QVariant HorizontalStackedBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const
41 {
41 {
42 QVector<QRectF> startVector = qVariantValue<QVector<QRectF> >(from);
42 QVector<QRectF> startVector = qvariant_cast<QVector<QRectF> >(from);
43 QVector<QRectF> endVector = qVariantValue<QVector<QRectF> >(to);
43 QVector<QRectF> endVector = qvariant_cast<QVector<QRectF> >(to);
44 QVector<QRectF> result;
44 QVector<QRectF> result;
45
45
46 Q_ASSERT(startVector.count() == endVector.count());
46 Q_ASSERT(startVector.count() == endVector.count());
@@ -39,8 +39,8 PercentBarAnimation::~PercentBarAnimation()
39
39
40 QVariant PercentBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const
40 QVariant PercentBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const
41 {
41 {
42 QVector<QRectF> startVector = qVariantValue<QVector<QRectF> >(from);
42 QVector<QRectF> startVector = qvariant_cast<QVector<QRectF> >(from);
43 QVector<QRectF> endVector = qVariantValue<QVector<QRectF> >(to);
43 QVector<QRectF> endVector = qvariant_cast<QVector<QRectF> >(to);
44 QVector<QRectF> result;
44 QVector<QRectF> result;
45
45
46 Q_ASSERT(startVector.count() == endVector.count());
46 Q_ASSERT(startVector.count() == endVector.count());
@@ -99,8 +99,8 PieSliceData PieSliceAnimation::currentSliceValue()
99
99
100 QVariant PieSliceAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const
100 QVariant PieSliceAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const
101 {
101 {
102 PieSliceData startValue = qVariantValue<PieSliceData>(start);
102 PieSliceData startValue = qvariant_cast<PieSliceData>(start);
103 PieSliceData endValue = qVariantValue<PieSliceData>(end);
103 PieSliceData endValue = qvariant_cast<PieSliceData>(end);
104
104
105 PieSliceData result;
105 PieSliceData result;
106 result = endValue;
106 result = endValue;
@@ -118,7 +118,7 QVariant PieSliceAnimation::interpolated(const QVariant &start, const QVariant &
118 void PieSliceAnimation::updateCurrentValue(const QVariant &value)
118 void PieSliceAnimation::updateCurrentValue(const QVariant &value)
119 {
119 {
120 if (state() != QAbstractAnimation::Stopped) { //workaround
120 if (state() != QAbstractAnimation::Stopped) { //workaround
121 m_currentValue = qVariantValue<PieSliceData>(value);
121 m_currentValue = qvariant_cast<PieSliceData>(value);
122 m_sliceItem->setLayout(m_currentValue);
122 m_sliceItem->setLayout(m_currentValue);
123 }
123 }
124 }
124 }
@@ -120,8 +120,8 void SplineAnimation::setup(QVector<QPointF> &oldPoints, QVector<QPointF> &newPo
120 QVariant SplineAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const
120 QVariant SplineAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const
121 {
121 {
122
122
123 SplineVector startPair = qVariantValue< SplineVector >(start);
123 SplineVector startPair = qvariant_cast< SplineVector >(start);
124 SplineVector endPair = qVariantValue< SplineVector >(end);
124 SplineVector endPair = qvariant_cast< SplineVector >(end);
125 SplineVector result;
125 SplineVector result;
126
126
127 switch (animationType()) {
127 switch (animationType()) {
@@ -170,7 +170,7 QVariant SplineAnimation::interpolated(const QVariant &start, const QVariant &en
170 void SplineAnimation::updateCurrentValue(const QVariant &value)
170 void SplineAnimation::updateCurrentValue(const QVariant &value)
171 {
171 {
172 if (state() != QAbstractAnimation::Stopped && m_valid) { //workaround
172 if (state() != QAbstractAnimation::Stopped && m_valid) { //workaround
173 QPair<QVector<QPointF >, QVector<QPointF > > pair = qVariantValue< QPair< QVector<QPointF>, QVector<QPointF> > >(value);
173 QPair<QVector<QPointF >, QVector<QPointF > > pair = qvariant_cast< QPair< QVector<QPointF>, QVector<QPointF> > >(value);
174 m_item->setGeometryPoints(pair.first);
174 m_item->setGeometryPoints(pair.first);
175 m_item->setControlGeometryPoints(pair.second);
175 m_item->setControlGeometryPoints(pair.second);
176 m_item->updateGeometry();
176 m_item->updateGeometry();
@@ -38,8 +38,8 StackedBarAnimation::~StackedBarAnimation()
38
38
39 QVariant StackedBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const
39 QVariant StackedBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const
40 {
40 {
41 QVector<QRectF> startVector = qVariantValue<QVector<QRectF> >(from);
41 QVector<QRectF> startVector = qvariant_cast<QVector<QRectF> >(from);
42 QVector<QRectF> endVector = qVariantValue<QVector<QRectF> >(to);
42 QVector<QRectF> endVector = qvariant_cast<QVector<QRectF> >(to);
43 QVector<QRectF> result;
43 QVector<QRectF> result;
44
44
45 Q_ASSERT(startVector.count() == endVector.count());
45 Q_ASSERT(startVector.count() == endVector.count());
@@ -88,8 +88,8 void XYAnimation::setup(const QVector<QPointF> &oldPoints, const QVector<QPointF
88
88
89 QVariant XYAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const
89 QVariant XYAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const
90 {
90 {
91 QVector<QPointF> startVector = qVariantValue<QVector<QPointF> >(start);
91 QVector<QPointF> startVector = qvariant_cast<QVector<QPointF> >(start);
92 QVector<QPointF> endVector = qVariantValue<QVector<QPointF> >(end);
92 QVector<QPointF> endVector = qvariant_cast<QVector<QPointF> >(end);
93 QVector<QPointF> result;
93 QVector<QPointF> result;
94
94
95 switch (m_type) {
95 switch (m_type) {
@@ -125,7 +125,7 void XYAnimation::updateCurrentValue(const QVariant &value)
125 {
125 {
126 if (state() != QAbstractAnimation::Stopped) { //workaround
126 if (state() != QAbstractAnimation::Stopped) { //workaround
127
127
128 QVector<QPointF> vector = qVariantValue<QVector<QPointF> >(value);
128 QVector<QPointF> vector = qvariant_cast<QVector<QPointF> >(value);
129 m_item->setGeometryPoints(vector);
129 m_item->setGeometryPoints(vector);
130 m_item->updateGeometry();
130 m_item->updateGeometry();
131 m_item->setDirty(true);
131 m_item->setDirty(true);
@@ -78,10 +78,10 void ChartAxis::setLayout(QVector<qreal> &layout)
78
78
79 void ChartAxis::createItems(int count)
79 void ChartAxis::createItems(int count)
80 {
80 {
81 if (m_arrow->children().size() == 0)
81 if (m_arrow->childItems().size() == 0)
82 m_arrow->addToGroup(new AxisItem(this, presenter()->rootItem()));
82 m_arrow->addToGroup(new AxisItem(this, presenter()->rootItem()));
83
83
84 if (m_intervalAxis && m_grid->children().size() == 0) {
84 if (m_intervalAxis && m_grid->childItems().size() == 0) {
85 for (int i = 0 ; i < 2 ; i ++)
85 for (int i = 0 ; i < 2 ; i ++)
86 m_grid->addToGroup(new QGraphicsLineItem(presenter()->rootItem()));
86 m_grid->addToGroup(new QGraphicsLineItem(presenter()->rootItem()));
87 }
87 }
@@ -440,7 +440,7 QStringList ChartAxis::createValueLabels(int ticks) const
440 labels << QString::number(value, 'f', n);
440 labels << QString::number(value, 'f', n);
441 }
441 }
442 } else {
442 } else {
443 QByteArray array = format.toAscii();
443 QByteArray array = format.toLatin1();
444 for (int i = 0; i < ticks; i++) {
444 for (int i = 0; i < ticks; i++) {
445 qreal value = m_min + (i * (m_max - m_min) / (ticks - 1));
445 qreal value = m_min + (i * (m_max - m_min) / (ticks - 1));
446 labels << QString().sprintf(array, value);
446 labels << QString().sprintf(array, value);
@@ -43,7 +43,7 LegendMarkerItem::LegendMarkerItem(QLegendMarkerPrivate *marker, QGraphicsObject
43 m_pressPos(0, 0)
43 m_pressPos(0, 0)
44 {
44 {
45 m_rectItem->setRect(m_markerRect);
45 m_rectItem->setRect(m_markerRect);
46 setAcceptsHoverEvents(true);
46 setAcceptHoverEvents(true);
47 }
47 }
48
48
49 LegendMarkerItem::~LegendMarkerItem()
49 LegendMarkerItem::~LegendMarkerItem()
@@ -24,6 +24,17
24 #include <QtTest/QtTest>
24 #include <QtTest/QtTest>
25 #include <QPushButton>
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 #define TRY_COMPARE(actual, expected) { \
38 #define TRY_COMPARE(actual, expected) { \
28 do { \
39 do { \
29 const int timeout(1000); \
40 const int timeout(1000); \
@@ -22,6 +22,7
22 #include <qbarset.h>
22 #include <qbarset.h>
23 #include <qbarseries.h>
23 #include <qbarseries.h>
24 #include <qchartview.h>
24 #include <qchartview.h>
25 #include "tst_definitions.h"
25
26
26 QTCOMMERCIALCHART_USE_NAMESPACE
27 QTCOMMERCIALCHART_USE_NAMESPACE
27
28
@@ -31,6 +31,7
31 #include <qstackedbarseries.h>
31 #include <qstackedbarseries.h>
32 #include <qvalueaxis.h>
32 #include <qvalueaxis.h>
33 #include <qbarcategoryaxis.h>
33 #include <qbarcategoryaxis.h>
34 #include "tst_definitions.h"
34
35
35 QTCOMMERCIALCHART_USE_NAMESPACE
36 QTCOMMERCIALCHART_USE_NAMESPACE
36
37
General Comments 0
You need to be logged in to leave comments. Login now