diff options
author | Titta Heikkala <titta.heikkala@digia.com> | 2013-08-19 09:22:45 +0300 |
---|---|---|
committer | Titta Heikkala <titta.heikkala@digia.com> | 2013-08-19 10:58:59 +0300 |
commit | 1aa9b23ddd5da2633164b973b037e8c71a2c515f (patch) | |
tree | 33e29d43983689566562d44a3b49783bf667f9c3 /src | |
parent | d8e784e0dd829c1e5b9c95a6afd8545ca050f1d2 (diff) |
Add hovered signal with index for bar charts
Added hovered signal for bar charts including the hovered bar inside the
set. The hovered bar is identified by the index.
Documentation and tests are updated accordingly.
Task-number: QTRD-2161
Change-Id: I96c9d86975441274a697dec794b22e906fb44243
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/barchart/abstractbarchartitem.cpp | 2 | ||||
-rw-r--r-- | src/barchart/bar.cpp | 3 | ||||
-rw-r--r-- | src/barchart/bar_p.h | 1 | ||||
-rw-r--r-- | src/barchart/qabstractbarseries.cpp | 12 | ||||
-rw-r--r-- | src/barchart/qabstractbarseries.h | 1 | ||||
-rw-r--r-- | src/barchart/qbarset.cpp | 8 | ||||
-rw-r--r-- | src/barchart/qbarset.h | 1 |
7 files changed, 27 insertions, 1 deletions
diff --git a/src/barchart/abstractbarchartitem.cpp b/src/barchart/abstractbarchartitem.cpp index 34d97965..6bd4b681 100644 --- a/src/barchart/abstractbarchartitem.cpp +++ b/src/barchart/abstractbarchartitem.cpp @@ -160,8 +160,10 @@ void AbstractBarChartItem::handleDataStructureChanged() m_bars.append(bar); connect(bar, SIGNAL(clicked(int,QBarSet*)), m_series, SIGNAL(clicked(int,QBarSet*))); connect(bar, SIGNAL(hovered(bool,QBarSet*)), m_series, SIGNAL(hovered(bool,QBarSet*))); + connect(bar, SIGNAL(hovered(bool, int, QBarSet*)), m_series, SIGNAL(hovered(bool, int, QBarSet*))); connect(bar, SIGNAL(clicked(int,QBarSet*)), set, SIGNAL(clicked(int))); connect(bar, SIGNAL(hovered(bool,QBarSet*)), set, SIGNAL(hovered(bool))); + connect(bar, SIGNAL(hovered(bool, int, QBarSet*)), set, SIGNAL(hovered(bool, int))); // m_layout.append(QRectF(0, 0, 1, 1)); // Labels diff --git a/src/barchart/bar.cpp b/src/barchart/bar.cpp index a3f50b63..db15241a 100644 --- a/src/barchart/bar.cpp +++ b/src/barchart/bar.cpp @@ -38,6 +38,7 @@ Bar::~Bar() // End hover event, if bar is deleted during it if (m_hovering) { emit hovered(false, m_barset); + emit hovered(false, m_index, m_barset); } } @@ -53,6 +54,7 @@ void Bar::hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_UNUSED(event) m_hovering = true; emit hovered(true, m_barset); + emit hovered(true, m_index, m_barset); } @@ -61,6 +63,7 @@ void Bar::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_UNUSED(event) m_hovering = false; emit hovered(false, m_barset); + emit hovered(false, m_index, m_barset); } #include "moc_bar_p.cpp" diff --git a/src/barchart/bar_p.h b/src/barchart/bar_p.h index 521ffa3e..b074aa4e 100644 --- a/src/barchart/bar_p.h +++ b/src/barchart/bar_p.h @@ -53,6 +53,7 @@ public: Q_SIGNALS: void clicked(int index, QBarSet *barset); void hovered(bool status, QBarSet *barset); + void hovered(bool status, int index, QBarSet *barset); private: int m_index; diff --git a/src/barchart/qabstractbarseries.cpp b/src/barchart/qabstractbarseries.cpp index 1fef2603..c9723ad6 100644 --- a/src/barchart/qabstractbarseries.cpp +++ b/src/barchart/qabstractbarseries.cpp @@ -142,12 +142,22 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE Parameter \a barset is the pointer of barset, where hover happened. Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series. */ + +/*! + \fn void QAbstractBarSeries::hovered(bool status, int index, QBarSet* barset) + + The signal is emitted if mouse is hovered on top of series. + Parameter \a barset is the pointer of barset, where hover happened. + Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series. + Hovered bar inside the set is indexed by \a index. +*/ /*! - \qmlsignal AbstractBarSeries::onHovered(bool status, BarSet barset) + \qmlsignal AbstractBarSeries::onHovered(bool status, int index, BarSet barset) The signal is emitted if mouse is hovered on top of series. Parameter \a barset is the pointer of barset, where hover happened. Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series. + Hovered bar inside the set is indexed by \a index. */ /*! diff --git a/src/barchart/qabstractbarseries.h b/src/barchart/qabstractbarseries.h index 68a74b99..5c6fc245 100644 --- a/src/barchart/qabstractbarseries.h +++ b/src/barchart/qabstractbarseries.h @@ -61,6 +61,7 @@ protected: Q_SIGNALS: void clicked(int index, QBarSet *barset); void hovered(bool status, QBarSet *barset); + void hovered(bool status, int index, QBarSet *barset); void countChanged(); void labelsVisibleChanged(); diff --git a/src/barchart/qbarset.cpp b/src/barchart/qbarset.cpp index 1bbc1334..7d208e5f 100644 --- a/src/barchart/qbarset.cpp +++ b/src/barchart/qbarset.cpp @@ -130,6 +130,14 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE Parameter \a status is true, if mouse entered on top of bar set, false if mouse left from top of bar set. */ +/*! + \fn void QBarSet::hovered(bool status, int index) + + The signal is emitted if mouse is hovered on top of bar set. + Parameter \a status is true, if mouse entered on top of bar set, false if mouse left from top of bar set. + Hovered bar inside the set is indexed by \a index. +*/ + /*! \fn void QBarSet::labelChanged() diff --git a/src/barchart/qbarset.h b/src/barchart/qbarset.h index 5013f073..bfcfe6e5 100644 --- a/src/barchart/qbarset.h +++ b/src/barchart/qbarset.h @@ -85,6 +85,7 @@ public: Q_SIGNALS: void clicked(int index); void hovered(bool status); + void hovered(bool status, int index); void penChanged(); void brushChanged(); void labelChanged(); |