From 74f7679156ae5d3165266c9919ffafb894cbe567 2012-04-11 12:15:31 From: Tero Ahola Date: 2012-04-11 12:15:31 Subject: [PATCH] Default to true in boolean setters --- diff --git a/demos/chartthemes/themewidget.cpp b/demos/chartthemes/themewidget.cpp index 4fcbcff..6bdeda8 100644 --- a/demos/chartthemes/themewidget.cpp +++ b/demos/chartthemes/themewidget.cpp @@ -177,8 +177,8 @@ QComboBox* ThemeWidget::createLegendBox() const QChart* ThemeWidget::createAreaChart() const { QChart *chart = new QChart(); - chart->axisX()->setNiceNumbers(true); - chart->axisY()->setNiceNumbers(true); + chart->axisX()->setNiceNumbersEnabled(true); + chart->axisY()->setNiceNumbersEnabled(true); chart->setTitle("Area chart"); // The lower series initialized to zero values @@ -207,8 +207,8 @@ QChart* ThemeWidget::createAreaChart() const QChart* ThemeWidget::createBarChart(int valueCount) const { QChart* chart = new QChart(); - chart->axisX()->setNiceNumbers(true); - chart->axisY()->setNiceNumbers(true); + chart->axisX()->setNiceNumbersEnabled(true); + chart->axisY()->setNiceNumbersEnabled(true); chart->setTitle("Bar chart"); QBarCategories categories; @@ -230,8 +230,8 @@ QChart* ThemeWidget::createBarChart(int valueCount) const QChart* ThemeWidget::createLineChart() const { QChart* chart = new QChart(); - chart->axisX()->setNiceNumbers(true); - chart->axisY()->setNiceNumbers(true); + chart->axisX()->setNiceNumbersEnabled(true); + chart->axisY()->setNiceNumbersEnabled(true); chart->setTitle("Line chart"); QString name("Series "); @@ -276,8 +276,8 @@ QChart* ThemeWidget::createPieChart() const QChart* ThemeWidget::createSplineChart() const { // spine chart QChart* chart = new QChart(); - chart->axisX()->setNiceNumbers(true); - chart->axisY()->setNiceNumbers(true); + chart->axisX()->setNiceNumbersEnabled(true); + chart->axisY()->setNiceNumbersEnabled(true); chart->setTitle("Spline chart"); QString name("Series "); int nameIndex = 0; @@ -295,8 +295,8 @@ QChart* ThemeWidget::createSplineChart() const QChart* ThemeWidget::createScatterChart() const { // scatter chart QChart* chart = new QChart(); - chart->axisX()->setNiceNumbers(true); - chart->axisY()->setNiceNumbers(true); + chart->axisX()->setNiceNumbersEnabled(true); + chart->axisY()->setNiceNumbersEnabled(true); chart->setTitle("Scatter chart"); QString name("Series "); int nameIndex = 0; diff --git a/examples/barchart/main.cpp b/examples/barchart/main.cpp index f9d07cd..f4e2624 100644 --- a/examples/barchart/main.cpp +++ b/examples/barchart/main.cpp @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) //![5] chart->legend()->setVisible(true); chart->legend()->setAlignment(QLegend::AlignmentBottom); - chart->axisY()->setNiceNumbers(true); + chart->axisY()->setNiceNumbersEnabled(true); //![5] //![6] diff --git a/examples/presenterchart/main.cpp b/examples/presenterchart/main.cpp index b4357b6..fb2e763 100644 --- a/examples/presenterchart/main.cpp +++ b/examples/presenterchart/main.cpp @@ -27,8 +27,8 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); QMainWindow window; QChart* chart = new QChart(); - chart->axisX()->setNiceNumbers(true); - chart->axisY()->setNiceNumbers(true); + chart->axisX()->setNiceNumbersEnabled(true); + chart->axisY()->setNiceNumbersEnabled(true); ChartView chartView(chart,&window); chartView.setRenderHint(QPainter::Antialiasing); chart->setAnimationOptions(QChart::AllAnimations); diff --git a/examples/stackedbarchart/main.cpp b/examples/stackedbarchart/main.cpp index 76c2c57..987f2f9 100644 --- a/examples/stackedbarchart/main.cpp +++ b/examples/stackedbarchart/main.cpp @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) //![5] chart->legend()->setVisible(true); chart->legend()->setAlignment(QLegend::AlignmentBottom); - chart->axisY()->setNiceNumbers(true); + chart->axisY()->setNiceNumbersEnabled(true); //![5] //![6] diff --git a/examples/stackedbarchartdrilldown/drilldownchart.cpp b/examples/stackedbarchartdrilldown/drilldownchart.cpp index 7dc03c3..1a7aba5 100644 --- a/examples/stackedbarchartdrilldown/drilldownchart.cpp +++ b/examples/stackedbarchartdrilldown/drilldownchart.cpp @@ -36,7 +36,7 @@ void DrilldownChart::changeSeries(QSeries* series) m_currentSeries = series; addSeries(series); setTitle(series->name()); - axisY()->setNiceNumbers(true); + axisY()->setNiceNumbersEnabled(true); } void DrilldownChart::handleClicked(QBarSet *barset, QString category, Qt::MouseButtons button) diff --git a/examples/stackedbarchartdrilldown/main.cpp b/examples/stackedbarchartdrilldown/main.cpp index aa24117..4423ca2 100644 --- a/examples/stackedbarchartdrilldown/main.cpp +++ b/examples/stackedbarchartdrilldown/main.cpp @@ -101,7 +101,7 @@ int main(int argc, char *argv[]) //! [7] drilldownChart->axisX()->setGridLineVisible(false); - drilldownChart->axisY()->setNiceNumbers(true); + drilldownChart->axisY()->setNiceNumbersEnabled(true); drilldownChart->legend()->setVisible(true); drilldownChart->legend()->setAlignment(QLegend::AlignmentBottom); //! [7] diff --git a/src/areachart/qareaseries.h b/src/areachart/qareaseries.h index 8502c6e..f2cc6cd 100644 --- a/src/areachart/qareaseries.h +++ b/src/areachart/qareaseries.h @@ -49,7 +49,7 @@ public: void setBrush(const QBrush &brush); QBrush brush() const; - void setPointsVisible(bool visible); + void setPointsVisible(bool visible = true); bool pointsVisible() const; bool setModel(QAbstractItemModel* model); diff --git a/src/axis/qchartaxis.cpp b/src/axis/qchartaxis.cpp index 4326b87..803b13c 100644 --- a/src/axis/qchartaxis.cpp +++ b/src/axis/qchartaxis.cpp @@ -147,11 +147,6 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! - \fn bool QChartAxis::niceNumbers() const - \brief Returns whether nice numbers are enabled or not. -*/ - -/*! \fn QChartAxisCategories* QChartAxis::categories() \brief Returns pointer to the list of categories which correspond to the values on the axis. */ @@ -482,7 +477,7 @@ void QChartAxis::hide() /*! Sets the nice numbers state to \a enable */ -void QChartAxis::setNiceNumbers(bool enable) +void QChartAxis::setNiceNumbersEnabled(bool enable) { if (d_ptr->m_niceNumbers != enable){ d_ptr->m_niceNumbers = enable; @@ -490,7 +485,10 @@ void QChartAxis::setNiceNumbers(bool enable) } } -bool QChartAxis::niceNumbers() const +/*! + Returns whether nice numbers are enabled or not. +*/ +bool QChartAxis::niceNumbersEnabled() const { return d_ptr->m_niceNumbers; } diff --git a/src/axis/qchartaxis.h b/src/axis/qchartaxis.h index 43618ba..0b02295 100644 --- a/src/axis/qchartaxis.h +++ b/src/axis/qchartaxis.h @@ -40,19 +40,19 @@ public: //axis handling bool isAxisVisible() const; - void setAxisVisible(bool visible); + void setAxisVisible(bool visible = true); void setAxisPen(const QPen &pen); QPen axisPen() const; //grid handling bool isGridLineVisible() const; - void setGridLineVisible(bool visible); + void setGridLineVisible(bool visible = true); void setGridLinePen(const QPen &pen); QPen gridLinePen() const; //labels handling bool labelsVisible() const; - void setLabelsVisible(bool visible); + void setLabelsVisible(bool visible = true); void setLabelsPen(const QPen &pen); QPen labelsPen() const; void setLabelsBrush(const QBrush &brush); @@ -64,7 +64,7 @@ public: //shades handling bool shadesVisible() const; - void setShadesVisible(bool visible); + void setShadesVisible(bool visible = true); void setShadesPen(const QPen &pen); QPen shadesPen() const; void setShadesBrush(const QBrush &brush); @@ -83,8 +83,8 @@ public: void setTicksCount(int count); int ticksCount() const; - void setNiceNumbers(bool enable); - bool niceNumbers() const; + void setNiceNumbersEnabled(bool enable = true); + bool niceNumbersEnabled() const; QChartAxisCategories* categories(); diff --git a/src/qchart.h b/src/qchart.h index 9473226..c966dec 100644 --- a/src/qchart.h +++ b/src/qchart.h @@ -82,7 +82,7 @@ public: void setBackgroundPen(const QPen &pen); QPen backgroundPen() const; - void setBackgroundVisible(bool visible); + void setBackgroundVisible(bool visible = true); bool isBackgroundVisible() const; void setAnimationOptions(AnimationOptions options); diff --git a/src/xychart/qxyseries.h b/src/xychart/qxyseries.h index 4af3545..18e57b5 100644 --- a/src/xychart/qxyseries.h +++ b/src/xychart/qxyseries.h @@ -64,7 +64,7 @@ public: void setBrush(const QBrush &brush); QBrush brush() const; - void setPointsVisible(bool visible); + void setPointsVisible(bool visible = true); bool pointsVisible() const; bool setModel(QAbstractItemModel *model);