##// END OF EJS Templates
Bugfix: axis visibily issues...
Michal Klocek -
r2297:bf59b22cf3e9
parent child
Show More
@@ -82,6 +82,7 void ChartAxis::connectSlots()
82 82 QObject::connect(m_axis,SIGNAL(titleFontChanged(const QFont&)),this,SLOT(handleTitleFontChanged(const QFont&)));
83 83 QObject::connect(m_axis,SIGNAL(titlePenChanged(const QPen&)),this,SLOT(handleTitlePenChanged(const QPen&)));
84 84 QObject::connect(m_axis,SIGNAL(titleBrushChanged(const QBrush&)),this,SLOT(handleTitleBrushChanged(const QBrush&)));
85 QObject::connect(m_axis,SIGNAL(titleVisibleChanged(bool)),this,SLOT(handleTitleVisibleChanged(bool)));
85 86 QObject::connect(m_axis->d_ptr.data(),SIGNAL(rangeChanged(qreal,qreal)),this,SLOT(handleRangeChanged(qreal,qreal)));
86 87 }
87 88
@@ -289,6 +290,12 void ChartAxis::handleShadesVisibleChanged(bool visible)
289 290 m_shades->setVisible(visible);
290 291 }
291 292
293 void ChartAxis::handleTitleVisibleChanged(bool visible)
294 {
295 m_title->setVisible(visible);
296 presenter()->layout()->invalidate();
297 }
298
292 299 void ChartAxis::handleLabelsAngleChanged(int angle)
293 300 {
294 301 foreach (QGraphicsItem *item, m_labels->childItems())
@@ -371,6 +378,21 void ChartAxis::handleTitleFontChanged(const QFont &font)
371 378 void ChartAxis::handleVisibleChanged(bool visible)
372 379 {
373 380 setVisible(visible);
381 if(!visible) {
382 m_grid->setVisible(visible);
383 m_arrow->setVisible(visible);
384 m_shades->setVisible(visible);
385 m_labels->setVisible(visible);
386 m_title->setVisible(visible);
387 }else {
388 m_grid->setVisible(m_axis->isGridLineVisible());
389 m_arrow->setVisible(m_axis->isLineVisible());
390 m_shades->setVisible(m_axis->shadesVisible());
391 m_labels->setVisible(m_axis->labelsVisible());
392 m_title->setVisible(m_axis->isTitleVisible());
393 }
394
395 presenter()->layout()->invalidate();
374 396 }
375 397
376 398 void ChartAxis::handleRangeChanged(qreal min, qreal max)
@@ -129,6 +129,7 public Q_SLOTS:
129 129 void handleTitleBrushChanged(const QBrush &brush);
130 130 void handleTitleFontChanged(const QFont &font);
131 131 void handleTitleTextChanged(const QString &title);
132 void handleTitleVisibleChanged(bool visible);
132 133 void handleRangeChanged(qreal min , qreal max);
133 134
134 135 Q_SIGNALS:
@@ -189,7 +189,7 QSizeF HorizontalAxis::sizeHint(Qt::SizeHint which, const QSizeF &constraint) co
189 189 QFontMetrics fn(titleFont());
190 190 QSizeF sh;
191 191
192 if (titleText().isNull())
192 if (titleText().isNull() || !titleItem()->isVisible())
193 193 return sh;
194 194
195 195 switch (which) {
@@ -499,11 +499,11 void QAbstractAxis::setTitleVisible(bool visible)
499 499 {
500 500 if (d_ptr->m_titleVisible != visible) {
501 501 d_ptr->m_titleVisible = visible;
502 emit labelsVisibleChanged(visible);
502 emit titleVisibleChanged(visible);
503 503 }
504 504 }
505 505
506 bool QAbstractAxis::titleVisible() const
506 bool QAbstractAxis::isTitleVisible() const
507 507 {
508 508 return d_ptr->m_titleVisible;
509 509 }
@@ -64,8 +64,8 class QTCOMMERCIALCHART_EXPORT QAbstractAxis : public QObject
64 64 Q_PROPERTY(QString titleText READ titleText WRITE setTitleText NOTIFY titleTextChanged)
65 65 Q_PROPERTY(QPen titlePen READ titlePen WRITE setTitlePen NOTIFY titlePenChanged)
66 66 Q_PROPERTY(QBrush titleBrush READ titleBrush WRITE setTitleBrush NOTIFY titleBrushChanged)
67 Q_PROPERTY(bool titleVisible READ titleVisible WRITE setTitleVisible)
68 Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont)
67 Q_PROPERTY(bool titleVisible READ isTitleVisible WRITE setTitleVisible NOTIFY titleVisibleChanged)
68 Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont NOTIFY titleFontChanged)
69 69 //orientation
70 70 Q_PROPERTY(Qt::Orientation orinetation READ orientation)
71 71 //aligment
@@ -127,7 +127,7 public:
127 127 QColor labelsColor() const;
128 128
129 129 //title handling
130 bool titleVisible() const;
130 bool isTitleVisible() const;
131 131 void setTitleVisible(bool visible = true);
132 132 void setTitlePen(const QPen &pen);
133 133 QPen titlePen() const;
@@ -191,7 +191,7 QSizeF VerticalAxis::sizeHint(Qt::SizeHint which, const QSizeF &constraint) cons
191 191 QFontMetrics fn(titleFont());
192 192 QSizeF sh;
193 193
194 if (titleText().isNull())
194 if (titleText().isNull() || !titleItem()->isVisible())
195 195 return sh;
196 196
197 197 switch (which) {
General Comments 0
You need to be logged in to leave comments. Login now