##// END OF EJS Templates
Some fixes for Qt5, vs2010 build and qml
Jani Honkonen -
r2277:3866e510c514
parent child
Show More
@@ -248,13 +248,12 DeclarativeChart::DeclarativeChart(QDeclarativeItem *parent)
248 connect(m_margins, SIGNAL(bottomChanged(int,int,int,int)), this, SLOT(changeMinimumMargins(int,int,int,int)));
248 connect(m_margins, SIGNAL(bottomChanged(int,int,int,int)), this, SLOT(changeMinimumMargins(int,int,int,int)));
249 connect(m_margins, SIGNAL(leftChanged(int,int,int,int)), this, SLOT(changeMinimumMargins(int,int,int,int)));
249 connect(m_margins, SIGNAL(leftChanged(int,int,int,int)), this, SLOT(changeMinimumMargins(int,int,int,int)));
250 connect(m_margins, SIGNAL(rightChanged(int,int,int,int)), this, SLOT(changeMinimumMargins(int,int,int,int)));
250 connect(m_margins, SIGNAL(rightChanged(int,int,int,int)), this, SLOT(changeMinimumMargins(int,int,int,int)));
251 connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesAdded(QAbstractSeries*,AbstractDomain*)), this, SLOT(handleSeriesAdded(QAbstractSeries*,AbstractDomain*)));
251 connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), this, SLOT(handleSeriesAdded(QAbstractSeries*)));
252 connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), this, SIGNAL(seriesRemoved(QAbstractSeries*)));
252 connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), this, SIGNAL(seriesRemoved(QAbstractSeries*)));
253 }
253 }
254
254
255 void DeclarativeChart::handleSeriesAdded(QAbstractSeries *series, AbstractDomain *domain)
255 void DeclarativeChart::handleSeriesAdded(QAbstractSeries *series)
256 {
256 {
257 Q_UNUSED(domain)
258 emit seriesAdded(series);
257 emit seriesAdded(series);
259 }
258 }
260
259
@@ -157,7 +157,7 public Q_SLOTS:
157 void changeMinimumMargins(int top, int bottom, int left, int right);
157 void changeMinimumMargins(int top, int bottom, int left, int right);
158 void handleAxisXSet(QAbstractAxis *axis);
158 void handleAxisXSet(QAbstractAxis *axis);
159 void handleAxisYSet(QAbstractAxis *axis);
159 void handleAxisYSet(QAbstractAxis *axis);
160 void handleSeriesAdded(QAbstractSeries *series, AbstractDomain *domain);
160 void handleSeriesAdded(QAbstractSeries *series);
161
161
162 private:
162 private:
163 // Extending QChart with DeclarativeChart is not possible because QObject does not support
163 // Extending QChart with DeclarativeChart is not possible because QObject does not support
@@ -101,16 +101,16 void ChartAxis::setLayout(QVector<qreal> &layout)
101
101
102 void ChartAxis::createItems(int count)
102 void ChartAxis::createItems(int count)
103 {
103 {
104 if (m_arrow->children().size() == 0){
104 if (m_arrow->childItems().size() == 0){
105 QGraphicsLineItem* arrow = new ArrowItem(this, this);
105 QGraphicsLineItem* arrow = new ArrowItem(this, this);
106 arrow->setPen(m_axis->linePen());
106 arrow->setPen(m_axis->linePen());
107 m_arrow->addToGroup(arrow);
107 m_arrow->addToGroup(arrow);
108 }
108 }
109
109
110 if (m_intervalAxis && m_grid->children().size() == 0) {
110 if (m_intervalAxis && m_grid->childItems().size() == 0) {
111 for (int i = 0 ; i < 2 ; i ++){
111 for (int i = 0 ; i < 2 ; i ++){
112 QGraphicsLineItem* item = new QGraphicsLineItem(this);
112 QGraphicsLineItem* item = new QGraphicsLineItem(this);
113 item->setPen(m_axis->gridLinePen());
113 item->setPen(m_axis->gridLinePen());
114 m_grid->addToGroup(item);
114 m_grid->addToGroup(item);
115 }
115 }
116 }
116 }
@@ -118,20 +118,20 void ChartAxis::createItems(int count)
118 for (int i = 0; i < count; ++i) {
118 for (int i = 0; i < count; ++i) {
119 QGraphicsLineItem* arrow = new QGraphicsLineItem(this);
119 QGraphicsLineItem* arrow = new QGraphicsLineItem(this);
120 arrow->setPen(m_axis->linePen());
120 arrow->setPen(m_axis->linePen());
121 QGraphicsLineItem* grid = new QGraphicsLineItem(this);
121 QGraphicsLineItem* grid = new QGraphicsLineItem(this);
122 grid->setPen(m_axis->gridLinePen());
122 grid->setPen(m_axis->gridLinePen());
123 QGraphicsSimpleTextItem* label = new QGraphicsSimpleTextItem(this);
123 QGraphicsSimpleTextItem* label = new QGraphicsSimpleTextItem(this);
124 label->setFont(m_axis->labelsFont());
124 label->setFont(m_axis->labelsFont());
125 label->setPen(m_axis->labelsPen());
125 label->setPen(m_axis->labelsPen());
126 label->setBrush(m_axis->labelsBrush());
126 label->setBrush(m_axis->labelsBrush());
127 m_arrow->addToGroup(arrow);
127 m_arrow->addToGroup(arrow);
128 m_grid->addToGroup(grid);
128 m_grid->addToGroup(grid);
129 m_labels->addToGroup(label);
129 m_labels->addToGroup(label);
130
130
131 if ((m_grid->childItems().size()) % 2 && m_grid->childItems().size() > 2){
131 if ((m_grid->childItems().size()) % 2 && m_grid->childItems().size() > 2){
132 QGraphicsRectItem* shades = new QGraphicsRectItem(this);
132 QGraphicsRectItem* shades = new QGraphicsRectItem(this);
133 shades->setPen(m_axis->shadesPen());
133 shades->setPen(m_axis->shadesPen());
134 shades->setBrush(m_axis->shadesBrush());
134 shades->setBrush(m_axis->shadesBrush());
135 m_shades->addToGroup(shades);
135 m_shades->addToGroup(shades);
136 }
136 }
137 }
137 }
@@ -217,32 +217,32 void ChartAxis::setGeometry(const QRectF &axis, const QRectF &grid)
217
217
218 qreal ChartAxis::min() const
218 qreal ChartAxis::min() const
219 {
219 {
220 return m_axis->d_ptr->min();
220 return m_axis->d_ptr->min();
221 }
221 }
222
222
223 qreal ChartAxis::max() const
223 qreal ChartAxis::max() const
224 {
224 {
225 return m_axis->d_ptr->max();
225 return m_axis->d_ptr->max();
226 }
226 }
227
227
228 QFont ChartAxis::font() const
228 QFont ChartAxis::font() const
229 {
229 {
230 return m_axis->labelsFont();
230 return m_axis->labelsFont();
231 }
231 }
232
232
233 QFont ChartAxis::titleFont() const
233 QFont ChartAxis::titleFont() const
234 {
234 {
235 return m_axis->titleFont();
235 return m_axis->titleFont();
236 }
236 }
237
237
238 QString ChartAxis::titleText() const
238 QString ChartAxis::titleText() const
239 {
239 {
240 return m_axis->titleText();
240 return m_axis->titleText();
241 }
241 }
242
242
243 void ChartAxis::axisSelected()
243 void ChartAxis::axisSelected()
244 {
244 {
245 emit clicked();
245 emit clicked();
246 }
246 }
247
247
248 Qt::Orientation ChartAxis::orientation() const
248 Qt::Orientation ChartAxis::orientation() const
@@ -311,10 +311,10 void ChartAxis::handleLabelsBrushChanged(const QBrush &brush)
311
311
312 void ChartAxis::handleLabelsFontChanged(const QFont &font)
312 void ChartAxis::handleLabelsFontChanged(const QFont &font)
313 {
313 {
314 foreach (QGraphicsItem *item , m_labels->childItems())
314 foreach (QGraphicsItem *item , m_labels->childItems())
315 static_cast<QGraphicsSimpleTextItem *>(item)->setFont(font);
315 static_cast<QGraphicsSimpleTextItem *>(item)->setFont(font);
316 QGraphicsLayoutItem::updateGeometry();
316 QGraphicsLayoutItem::updateGeometry();
317 presenter()->layout()->invalidate();
317 presenter()->layout()->invalidate();
318 }
318 }
319
319
320 void ChartAxis::handleShadesBrushChanged(const QBrush &brush)
320 void ChartAxis::handleShadesBrushChanged(const QBrush &brush)
@@ -343,9 +343,9 void ChartAxis::handleGridPenChanged(const QPen &pen)
343
343
344 void ChartAxis::handleTitleTextChanged(const QString &title)
344 void ChartAxis::handleTitleTextChanged(const QString &title)
345 {
345 {
346 Q_UNUSED(title)
346 Q_UNUSED(title)
347 QGraphicsLayoutItem::updateGeometry();
347 QGraphicsLayoutItem::updateGeometry();
348 presenter()->layout()->invalidate();
348 presenter()->layout()->invalidate();
349 }
349 }
350
350
351
351
@@ -370,29 +370,29 void ChartAxis::handleTitleFontChanged(const QFont &font)
370
370
371 void ChartAxis::handleVisibleChanged(bool visible)
371 void ChartAxis::handleVisibleChanged(bool visible)
372 {
372 {
373 setVisible(visible);
373 setVisible(visible);
374 }
374 }
375
375
376 void ChartAxis::handleRangeChanged(qreal min, qreal max)
376 void ChartAxis::handleRangeChanged(qreal min, qreal max)
377 {
377 {
378 Q_UNUSED(min);
378 Q_UNUSED(min);
379 Q_UNUSED(max);
379 Q_UNUSED(max);
380
380
381 if (!isEmpty()) {
381 if (!isEmpty()) {
382
382
383 QVector<qreal> layout = calculateLayout();
383 QVector<qreal> layout = calculateLayout();
384 updateLayout(layout);
384 updateLayout(layout);
385 QSizeF before = effectiveSizeHint(Qt::PreferredSize);
385 QSizeF before = effectiveSizeHint(Qt::PreferredSize);
386 QSizeF after = sizeHint(Qt::PreferredSize);
386 QSizeF after = sizeHint(Qt::PreferredSize);
387
387
388 if (before != after) {
388 if (before != after) {
389 QGraphicsLayoutItem::updateGeometry();
389 QGraphicsLayoutItem::updateGeometry();
390 //we don't want to call invalidate on layout, since it will change minimum size of component,
390 //we don't want to call invalidate on layout, since it will change minimum size of component,
391 //which we would like to avoid since it causes nasty flips when scrolling or zooming,
391 //which we would like to avoid since it causes nasty flips when scrolling or zooming,
392 //instead recalculate layout and use plotArea for extra space.
392 //instead recalculate layout and use plotArea for extra space.
393 presenter()->layout()->setGeometry(presenter()->layout()->geometry());
393 presenter()->layout()->setGeometry(presenter()->layout()->geometry());
394 }
394 }
395 }
395 }
396
396
397 }
397 }
398
398
@@ -463,7 +463,7 QStringList ChartAxis::createLogValueLabels(qreal min, qreal max, qreal base, in
463 labels << QString::number(value, 'f', n);
463 labels << QString::number(value, 'f', n);
464 }
464 }
465 } else {
465 } else {
466 QByteArray array = format.toAscii();
466 QByteArray array = format.toLatin1();
467 for (int i = firstTick; i < ticks + firstTick; i++) {
467 for (int i = firstTick; i < ticks + firstTick; i++) {
468 qreal value = qPow(base, i);
468 qreal value = qPow(base, i);
469 labels << QString().sprintf(array, value);
469 labels << QString().sprintf(array, value);
@@ -889,8 +889,8 QAbstractAxis* QPieSeriesPrivate::createDefaultAxis(Qt::Orientation orientation)
889
889
890 void QPieSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
890 void QPieSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
891 {
891 {
892 Q_Q(QPieSeries);
892 //Q_Q(QPieSeries);
893 const QList<QColor>& colors = theme->seriesColors();
893 //const QList<QColor>& colors = theme->seriesColors();
894 const QList<QGradient>& gradients = theme->seriesGradients();
894 const QList<QGradient>& gradients = theme->seriesGradients();
895
895
896 for (int i(0); i < m_slices.count(); i++) {
896 for (int i(0); i < m_slices.count(); i++) {
@@ -33,7 +33,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
33 class QAbstractSeries;
33 class QAbstractSeries;
34 class QAbstractAxis;
34 class QAbstractAxis;
35 class QLegend;
35 class QLegend;
36 struct QChartPrivate;
36 class QChartPrivate;
37
37
38 class QTCOMMERCIALCHART_EXPORT QChart : public QGraphicsWidget
38 class QTCOMMERCIALCHART_EXPORT QChart : public QGraphicsWidget
39 {
39 {
@@ -77,10 +77,10 public:
77 GetGValue(colorGradientActiveCaptionRight),
77 GetGValue(colorGradientActiveCaptionRight),
78 GetBValue(colorGradientActiveCaptionRight));
78 GetBValue(colorGradientActiveCaptionRight));
79 g.setColorAt(1.0, end);
79 g.setColorAt(1.0, end);
80 m_seriesColors.append(colorAt(g, 0.5));
80 m_seriesColors.append(ChartThemeManager::colorAt(g, 0.5));
81
81
82 // Generate gradients from the base colors
82 // Generate gradients from the base colors
83 generateSeriesGradients();
83 ChartThemeManager::generateSeriesGradients(m_seriesColors);
84
84
85 // Background fill color from COLOR_WINDOW
85 // Background fill color from COLOR_WINDOW
86 QLinearGradient backgroundGradient;
86 QLinearGradient backgroundGradient;
General Comments 0
You need to be logged in to leave comments. Login now