@@ -74,8 +74,8 int main(int argc, char *argv[]) | |||
|
74 | 74 | // Customize axis colors |
|
75 | 75 | QPen axisPen(QRgb(0xd18952)); |
|
76 | 76 | axisPen.setWidth(2); |
|
77 |
axisX->set |
|
|
78 |
axisY->set |
|
|
77 | axisX->setLinePen(axisPen); | |
|
78 | axisY->setLinePen(axisPen); | |
|
79 | 79 | |
|
80 | 80 | // Customize axis label colors |
|
81 | 81 | QBrush axisBrush(Qt::white); |
@@ -299,12 +299,12 void ChartAxis::handleAxisUpdated() | |||
|
299 | 299 | |
|
300 | 300 | bool visible = m_chartAxis->isVisible(); |
|
301 | 301 | |
|
302 |
setArrowVisibility(visible && m_chartAxis->is |
|
|
302 | setArrowVisibility(visible && m_chartAxis->isLineVisible()); | |
|
303 | 303 | setGridVisibility(visible && m_chartAxis->isGridLineVisible()); |
|
304 | 304 | setLabelsVisibility(visible && m_chartAxis->labelsVisible()); |
|
305 | 305 | setShadesVisibility(visible && m_chartAxis->shadesVisible()); |
|
306 | 306 | setLabelsAngle(m_chartAxis->labelsAngle()); |
|
307 |
setArrowPen(m_chartAxis-> |
|
|
307 | setArrowPen(m_chartAxis->linePen()); | |
|
308 | 308 | setLabelsPen(m_chartAxis->labelsPen()); |
|
309 | 309 | setLabelsBrush(m_chartAxis->labelsBrush()); |
|
310 | 310 | setLabelsFont(m_chartAxis->labelsFont()); |
@@ -278,7 +278,7 QAbstractAxis::~QAbstractAxis() | |||
|
278 | 278 | /*! |
|
279 | 279 | Sets \a pen used to draw axis line and ticks. |
|
280 | 280 | */ |
|
281 |
void QAbstractAxis::set |
|
|
281 | void QAbstractAxis::setLinePen(const QPen &pen) | |
|
282 | 282 | { |
|
283 | 283 | if (d_ptr->m_axisPen!=pen) { |
|
284 | 284 | d_ptr->m_axisPen = pen; |
@@ -289,22 +289,22 void QAbstractAxis::setAxisPen(const QPen &pen) | |||
|
289 | 289 | /*! |
|
290 | 290 | Returns pen used to draw axis and ticks. |
|
291 | 291 | */ |
|
292 |
QPen QAbstractAxis:: |
|
|
292 | QPen QAbstractAxis::linePen() const | |
|
293 | 293 | { |
|
294 | 294 | return d_ptr->m_axisPen; |
|
295 | 295 | } |
|
296 | 296 | |
|
297 |
void QAbstractAxis::set |
|
|
297 | void QAbstractAxis::setLinePenColor(QColor color) | |
|
298 | 298 | { |
|
299 | 299 | QPen p = d_ptr->m_axisPen; |
|
300 | 300 | if (p.color() != color) { |
|
301 | 301 | p.setColor(color); |
|
302 |
set |
|
|
302 | setLinePen(p); | |
|
303 | 303 | emit colorChanged(color); |
|
304 | 304 | } |
|
305 | 305 | } |
|
306 | 306 | |
|
307 |
QColor QAbstractAxis:: |
|
|
307 | QColor QAbstractAxis::linePenColor() const | |
|
308 | 308 | { |
|
309 | 309 | return d_ptr->m_axisPen.color(); |
|
310 | 310 | } |
@@ -312,16 +312,16 QColor QAbstractAxis::axisPenColor() const | |||
|
312 | 312 | /*! |
|
313 | 313 | Sets if axis and ticks are \a visible. |
|
314 | 314 | */ |
|
315 |
void QAbstractAxis::set |
|
|
315 | void QAbstractAxis::setLineVisible(bool visible) | |
|
316 | 316 | { |
|
317 | 317 | if (d_ptr->m_arrowVisible != visible) { |
|
318 | 318 | d_ptr->m_arrowVisible = visible; |
|
319 | 319 | d_ptr->emitUpdated(); |
|
320 |
emit |
|
|
320 | emit lineVisibleChanged(visible); | |
|
321 | 321 | } |
|
322 | 322 | } |
|
323 | 323 | |
|
324 |
bool QAbstractAxis::is |
|
|
324 | bool QAbstractAxis::isLineVisible() const | |
|
325 | 325 | { |
|
326 | 326 | return d_ptr->m_arrowVisible; |
|
327 | 327 | } |
@@ -34,8 +34,8 class QTCOMMERCIALCHART_EXPORT QAbstractAxis : public QObject | |||
|
34 | 34 | { |
|
35 | 35 | Q_OBJECT |
|
36 | 36 | Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) |
|
37 |
Q_PROPERTY(bool arrowVisible READ is |
|
|
38 |
Q_PROPERTY(QColor color READ |
|
|
37 | Q_PROPERTY(bool arrowVisible READ isLineVisible WRITE setLineVisible NOTIFY lineVisibleChanged) | |
|
38 | Q_PROPERTY(QColor color READ linePenColor WRITE setLinePenColor NOTIFY colorChanged) | |
|
39 | 39 | Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged) |
|
40 | 40 | Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle) |
|
41 | 41 | Q_PROPERTY(QFont labelsFont READ labelsFont WRITE setLabelsFont) |
@@ -71,12 +71,12 public: | |||
|
71 | 71 | |
|
72 | 72 | |
|
73 | 73 | //axis handling |
|
74 |
bool is |
|
|
75 |
void set |
|
|
76 |
void set |
|
|
77 |
QPen |
|
|
78 |
void set |
|
|
79 |
QColor |
|
|
74 | bool isLineVisible() const; | |
|
75 | void setLineVisible(bool visible = true); | |
|
76 | void setLinePen(const QPen &pen); | |
|
77 | QPen linePen() const; | |
|
78 | void setLinePenColor(QColor color); | |
|
79 | QColor linePenColor() const; | |
|
80 | 80 | |
|
81 | 81 | //grid handling |
|
82 | 82 | bool isGridLineVisible() const; |
@@ -122,7 +122,7 public: | |||
|
122 | 122 | |
|
123 | 123 | Q_SIGNALS: |
|
124 | 124 | void visibleChanged(bool visible); |
|
125 |
void |
|
|
125 | void lineVisibleChanged(bool visible); | |
|
126 | 126 | void labelsVisibleChanged(bool visible); |
|
127 | 127 | void gridVisibleChanged(bool visible); |
|
128 | 128 | void colorChanged(QColor color); |
@@ -266,7 +266,7 void ChartTheme::decorate(QAbstractAxis *axis) | |||
|
266 | 266 | |
|
267 | 267 | bool axisX = axis->orientation()== Qt::Horizontal; |
|
268 | 268 | |
|
269 |
if (axis->is |
|
|
269 | if (axis->isLineVisible()) { | |
|
270 | 270 | |
|
271 | 271 | if(m_force || brush == axis->labelsBrush()){ |
|
272 | 272 | axis->setLabelsBrush(m_labelBrush); |
@@ -294,8 +294,8 void ChartTheme::decorate(QAbstractAxis *axis) | |||
|
294 | 294 | } |
|
295 | 295 | } |
|
296 | 296 | |
|
297 |
if(m_force || pen == axis-> |
|
|
298 |
axis->set |
|
|
297 | if(m_force || pen == axis->linePen()){ | |
|
298 | axis->setLinePen(m_axisLinePen); | |
|
299 | 299 | } |
|
300 | 300 | |
|
301 | 301 | if(m_force || pen == axis->gridLinePen()){ |
@@ -49,10 +49,10 void tst_QAbstractAxis::cleanup() | |||
|
49 | 49 | |
|
50 | 50 | void tst_QAbstractAxis::qabstractaxis() |
|
51 | 51 | { |
|
52 |
QCOMPARE(m_axis-> |
|
|
52 | QCOMPARE(m_axis->linePen(), QPen()); | |
|
53 | 53 | //TODO QCOMPARE(m_axis->axisPenColor(), QColor()); |
|
54 | 54 | QCOMPARE(m_axis->gridLinePen(), QPen()); |
|
55 |
QCOMPARE(m_axis->is |
|
|
55 | QCOMPARE(m_axis->isLineVisible(), true); | |
|
56 | 56 | QCOMPARE(m_axis->isGridLineVisible(), true); |
|
57 | 57 | QCOMPARE(m_axis->isVisible(), false); |
|
58 | 58 | QCOMPARE(m_axis->labelsAngle(), 0); |
@@ -62,9 +62,9 void tst_QAbstractAxis::qabstractaxis() | |||
|
62 | 62 | QCOMPARE(m_axis->labelsPen(), QPen()); |
|
63 | 63 | QCOMPARE(m_axis->labelsVisible(), true); |
|
64 | 64 | QCOMPARE(m_axis->orientation(), Qt::Orientation(0)); |
|
65 |
m_axis->set |
|
|
66 |
m_axis->set |
|
|
67 |
m_axis->set |
|
|
65 | m_axis->setLineVisible(false); | |
|
66 | m_axis->setLinePen(QPen()); | |
|
67 | m_axis->setLinePenColor(QColor()); | |
|
68 | 68 | m_axis->setGridLinePen(QPen()); |
|
69 | 69 | m_axis->setGridLineVisible(false); |
|
70 | 70 | m_axis->setLabelsAngle(-1); |
@@ -114,8 +114,8 void tst_QAbstractAxis::axisPen() | |||
|
114 | 114 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
|
115 | 115 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
|
116 | 116 | |
|
117 |
m_axis->set |
|
|
118 |
QCOMPARE(m_axis-> |
|
|
117 | m_axis->setLinePen(axisPen); | |
|
118 | QCOMPARE(m_axis->linePen(), axisPen); | |
|
119 | 119 | |
|
120 | 120 | QCOMPARE(spy0.count(), 0); |
|
121 | 121 | QCOMPARE(spy1.count(), 0); |
@@ -197,7 +197,7 void tst_QAbstractAxis::arrowVisible() | |||
|
197 | 197 | { |
|
198 | 198 | QFETCH(bool, arrowVisible); |
|
199 | 199 | |
|
200 |
m_axis->set |
|
|
200 | m_axis->setLineVisible(!arrowVisible); | |
|
201 | 201 | |
|
202 | 202 | QSignalSpy spy0(m_axis, SIGNAL(arrowVisibleChanged(bool))); |
|
203 | 203 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
@@ -209,8 +209,8 void tst_QAbstractAxis::arrowVisible() | |||
|
209 | 209 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
|
210 | 210 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
|
211 | 211 | |
|
212 |
m_axis->set |
|
|
213 |
QCOMPARE(m_axis->is |
|
|
212 | m_axis->setLineVisible(arrowVisible); | |
|
213 | QCOMPARE(m_axis->isLineVisible(), arrowVisible); | |
|
214 | 214 | |
|
215 | 215 | QCOMPARE(spy0.count(), 1); |
|
216 | 216 | QCOMPARE(spy1.count(), 0); |
@@ -225,7 +225,7 void tst_QAbstractAxis::arrowVisible() | |||
|
225 | 225 | m_chart->setAxisX(m_axis, m_series); |
|
226 | 226 | m_view->show(); |
|
227 | 227 | QTest::qWaitForWindowShown(m_view); |
|
228 |
QCOMPARE(m_axis->is |
|
|
228 | QCOMPARE(m_axis->isLineVisible(), arrowVisible); | |
|
229 | 229 | } |
|
230 | 230 | |
|
231 | 231 | void tst_QAbstractAxis::gridLineVisible_data() |
General Comments 0
You need to be logged in to leave comments.
Login now