diff options
author | Liang Qi <liang.qi@qt.io> | 2017-08-15 12:22:16 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-08-15 13:06:48 +0200 |
commit | 0168fe1f95d56850734447b118cdcf1847da1c51 (patch) | |
tree | 55763c374af875fc7228dc8d1f3771ef74c083cb /examples/charts/legendmarkers/mainwidget.cpp | |
parent | ac79bf382a9fabed940b8f9be20feeb58ac205aa (diff) | |
parent | 1f47b1a7ae58702dccc57a9ccbaa905441f4fecb (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
.qmake.conf
examples/charts/dynamicspline/chart.cpp
examples/charts/piechartdrilldown/main.cpp
Change-Id: I839e97bf377c7823f2f464c097656d58f279ed77
Diffstat (limited to 'examples/charts/legendmarkers/mainwidget.cpp')
-rw-r--r-- | examples/charts/legendmarkers/mainwidget.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/examples/charts/legendmarkers/mainwidget.cpp b/examples/charts/legendmarkers/mainwidget.cpp index 2cfe570e..a48a6384 100644 --- a/examples/charts/legendmarkers/mainwidget.cpp +++ b/examples/charts/legendmarkers/mainwidget.cpp @@ -88,9 +88,8 @@ void MainWidget::addSeries() series->append(data); m_chart->addSeries(series); - if (m_series.count() == 1) { + if (m_series.count() == 1) m_chart->createDefaultAxes(); - } } void MainWidget::removeSeries() @@ -108,10 +107,12 @@ void MainWidget::connectMarkers() { //![1] // Connect all markers to handler - foreach (QLegendMarker* marker, m_chart->legend()->markers()) { + const auto markers = m_chart->legend()->markers(); + for (QLegendMarker *marker : markers) { // Disconnect possible existing connection to avoid multiple connections - QObject::disconnect(marker, SIGNAL(clicked()), this, SLOT(handleMarkerClicked())); - QObject::connect(marker, SIGNAL(clicked()), this, SLOT(handleMarkerClicked())); + QObject::disconnect(marker, &QLegendMarker::clicked, + this, &MainWidget::handleMarkerClicked); + QObject::connect(marker, &QLegendMarker::clicked, this, &MainWidget::handleMarkerClicked); } //![1] } @@ -119,8 +120,10 @@ void MainWidget::connectMarkers() void MainWidget::disconnectMarkers() { //![2] - foreach (QLegendMarker* marker, m_chart->legend()->markers()) { - QObject::disconnect(marker, SIGNAL(clicked()), this, SLOT(handleMarkerClicked())); + const auto markers = m_chart->legend()->markers(); + for (QLegendMarker *marker : markers) { + QObject::disconnect(marker, &QLegendMarker::clicked, + this, &MainWidget::handleMarkerClicked); } //![2] } @@ -151,9 +154,8 @@ void MainWidget::handleMarkerClicked() // Dim the marker, if series is not visible qreal alpha = 1.0; - if (!marker->series()->isVisible()) { + if (!marker->series()->isVisible()) alpha = 0.5; - } QColor color; QBrush brush = marker->labelBrush(); |