From 9b4c1980ee189fb67eb948deba2d7f88d14f89eb 2012-02-22 15:08:42 From: sauimone Date: 2012-02-22 15:08:42 Subject: [PATCH] barcharts: added legend to model. added signals for hover events (for tooltip). updated examples --- diff --git a/example/barchart/custombarset.cpp b/example/barchart/custombarset.cpp index b65b708..ef978d4 100644 --- a/example/barchart/custombarset.cpp +++ b/example/barchart/custombarset.cpp @@ -1,7 +1,7 @@ #include "custombarset.h" -CustomBarSet::CustomBarSet(QObject *parent) : - QBarSet(parent) +CustomBarSet::CustomBarSet(QString name, QObject *parent) : + QBarSet(name, parent) { // Using signal to signal connection here. connect(this,SIGNAL(clicked()),this,SIGNAL(toggleFloatingValues())); diff --git a/example/barchart/custombarset.h b/example/barchart/custombarset.h index 5b21ecf..ea8e897 100644 --- a/example/barchart/custombarset.h +++ b/example/barchart/custombarset.h @@ -9,7 +9,7 @@ class CustomBarSet : public QBarSet { Q_OBJECT public: - explicit CustomBarSet(QObject *parent = 0); + explicit CustomBarSet(QString name, QObject *parent = 0); signals: diff --git a/example/barchart/main.cpp b/example/barchart/main.cpp index 0697619..8a8b861 100644 --- a/example/barchart/main.cpp +++ b/example/barchart/main.cpp @@ -20,11 +20,11 @@ int main(int argc, char *argv[]) QBarChartSeries* series= new QBarChartSeries(category); // We use custom set, which connects some signals. Could use QBarSet here if we don't need signals - CustomBarSet *set0 = new CustomBarSet; - CustomBarSet *set1 = new CustomBarSet; - CustomBarSet *set2 = new CustomBarSet; - CustomBarSet *set3 = new CustomBarSet; - CustomBarSet *set4 = new CustomBarSet; + CustomBarSet *set0 = new CustomBarSet("Bub"); + CustomBarSet *set1 = new CustomBarSet("Bob"); + CustomBarSet *set2 = new CustomBarSet("Guybrush"); + CustomBarSet *set3 = new CustomBarSet("Larry"); + CustomBarSet *set4 = new CustomBarSet("Zak"); // Create some test data to chart *set0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12; diff --git a/example/percentbarchart/custombarset.cpp b/example/percentbarchart/custombarset.cpp index b65b708..ef978d4 100644 --- a/example/percentbarchart/custombarset.cpp +++ b/example/percentbarchart/custombarset.cpp @@ -1,7 +1,7 @@ #include "custombarset.h" -CustomBarSet::CustomBarSet(QObject *parent) : - QBarSet(parent) +CustomBarSet::CustomBarSet(QString name, QObject *parent) : + QBarSet(name, parent) { // Using signal to signal connection here. connect(this,SIGNAL(clicked()),this,SIGNAL(toggleFloatingValues())); diff --git a/example/percentbarchart/custombarset.h b/example/percentbarchart/custombarset.h index 5b21ecf..ea8e897 100644 --- a/example/percentbarchart/custombarset.h +++ b/example/percentbarchart/custombarset.h @@ -9,7 +9,7 @@ class CustomBarSet : public QBarSet { Q_OBJECT public: - explicit CustomBarSet(QObject *parent = 0); + explicit CustomBarSet(QString name, QObject *parent = 0); signals: diff --git a/example/percentbarchart/main.cpp b/example/percentbarchart/main.cpp index f0e8da2..8399201 100644 --- a/example/percentbarchart/main.cpp +++ b/example/percentbarchart/main.cpp @@ -5,7 +5,6 @@ #include #include -//#include #include "custombarset.h" QTCOMMERCIALCHART_USE_NAMESPACE @@ -21,11 +20,11 @@ int main(int argc, char *argv[]) QPercentBarChartSeries* series = new QPercentBarChartSeries(category); // We use custom set, which connects some signals. Could use QBarSet here if we don't need signals - CustomBarSet *set0 = new CustomBarSet; - CustomBarSet *set1 = new CustomBarSet; - CustomBarSet *set2 = new CustomBarSet; - CustomBarSet *set3 = new CustomBarSet; - CustomBarSet *set4 = new CustomBarSet; + CustomBarSet *set0 = new CustomBarSet("Bub"); + CustomBarSet *set1 = new CustomBarSet("Bob"); + CustomBarSet *set2 = new CustomBarSet("Guybrush"); + CustomBarSet *set3 = new CustomBarSet("Larry"); + CustomBarSet *set4 = new CustomBarSet("Zak"); // Create some test data to chart *set0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12; diff --git a/example/stackedbarchart/custombarset.cpp b/example/stackedbarchart/custombarset.cpp index b65b708..ef978d4 100644 --- a/example/stackedbarchart/custombarset.cpp +++ b/example/stackedbarchart/custombarset.cpp @@ -1,7 +1,7 @@ #include "custombarset.h" -CustomBarSet::CustomBarSet(QObject *parent) : - QBarSet(parent) +CustomBarSet::CustomBarSet(QString name, QObject *parent) : + QBarSet(name, parent) { // Using signal to signal connection here. connect(this,SIGNAL(clicked()),this,SIGNAL(toggleFloatingValues())); diff --git a/example/stackedbarchart/custombarset.h b/example/stackedbarchart/custombarset.h index 5b21ecf..ea8e897 100644 --- a/example/stackedbarchart/custombarset.h +++ b/example/stackedbarchart/custombarset.h @@ -9,7 +9,7 @@ class CustomBarSet : public QBarSet { Q_OBJECT public: - explicit CustomBarSet(QObject *parent = 0); + explicit CustomBarSet(QString name, QObject *parent = 0); signals: diff --git a/example/stackedbarchart/main.cpp b/example/stackedbarchart/main.cpp index b5db2d9..677d789 100644 --- a/example/stackedbarchart/main.cpp +++ b/example/stackedbarchart/main.cpp @@ -20,11 +20,11 @@ int main(int argc, char *argv[]) QStackedBarChartSeries* series = new QStackedBarChartSeries(category); // We use custom set, which connects some signals. Could use QBarSet here if we don't need signals - CustomBarSet *set0 = new CustomBarSet; - CustomBarSet *set1 = new CustomBarSet; - CustomBarSet *set2 = new CustomBarSet; - CustomBarSet *set3 = new CustomBarSet; - CustomBarSet *set4 = new CustomBarSet; + CustomBarSet *set0 = new CustomBarSet("Bub"); + CustomBarSet *set1 = new CustomBarSet("Bob"); + CustomBarSet *set2 = new CustomBarSet("Guybrush"); + CustomBarSet *set3 = new CustomBarSet("Larry"); + CustomBarSet *set4 = new CustomBarSet("Zak"); // Create some test data to chart *set0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12; diff --git a/src/barchart/bar.cpp b/src/barchart/bar.cpp index aa9c629..e8fc57b 100644 --- a/src/barchart/bar.cpp +++ b/src/barchart/bar.cpp @@ -8,6 +8,7 @@ Bar::Bar(QGraphicsItem *parent) : QGraphicsObject(parent) { setAcceptedMouseButtons(Qt::LeftButton); + setAcceptHoverEvents(true); } void Bar::setSize(const QSizeF& size) @@ -23,11 +24,6 @@ void Bar::resize( qreal w, qreal h ) mHeight = h; } -void Bar::setColor( QColor col ) -{ - mColor = col; -} - void Bar::setPos(qreal x, qreal y) { mXpos = x; @@ -72,14 +68,14 @@ void Bar::mousePressEvent(QGraphicsSceneMouseEvent* /*event*/) emit clicked(); } -void Bar::hoverEnterEvent(QGraphicsSceneHoverEvent* /*event*/) +void Bar::hoverEnterEvent(QGraphicsSceneHoverEvent* event) { - emit hoverEntered(); + emit hoverEntered(event); } -void Bar::hoverLeaveEvent(QGraphicsSceneHoverEvent* /*event*/) +void Bar::hoverLeaveEvent(QGraphicsSceneHoverEvent* event) { - emit hoverLeaved(); + emit hoverLeaved(event); } #include "moc_bar_p.cpp" diff --git a/src/barchart/bar_p.h b/src/barchart/bar_p.h index 842a5a7..c335d80 100644 --- a/src/barchart/bar_p.h +++ b/src/barchart/bar_p.h @@ -8,7 +8,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE -// Single bar item of chart +// Single visual bar item of chart class Bar : public QGraphicsObject { Q_OBJECT @@ -19,11 +19,10 @@ public: // from ChartItem void setSize(const QSizeF &size); // Layout Stuff - void resize(qreal w, qreal h); // Size of bar. + void resize(qreal w, qreal h); void setPos(qreal x, qreal y); void setPen(QPen pen); void setBrush(QBrush brush); - void setColor( QColor col); // deprecated public: // From QGraphicsItem @@ -35,8 +34,8 @@ public: Q_SIGNALS: void clicked(); - void hoverEntered(); - void hoverLeaved(); + void hoverEntered(QGraphicsSceneHoverEvent *event); + void hoverLeaved(QGraphicsSceneHoverEvent *event); private: diff --git a/src/barchart/barchartmodel.cpp b/src/barchart/barchartmodel.cpp index 463dc47..eea1e47 100644 --- a/src/barchart/barchartmodel.cpp +++ b/src/barchart/barchartmodel.cpp @@ -56,6 +56,16 @@ QBarSet* BarChartModel::setAt(int index) return mDataModel.at(index); } +QList BarChartModel::legend() +{ + QList legend; + + for (int i=0; iname()); + } + return legend; +} + int BarChartModel::countSets() { return mDataModel.count(); diff --git a/src/barchart/barchartmodel_p.h b/src/barchart/barchartmodel_p.h index 40b821d..4c33392 100644 --- a/src/barchart/barchartmodel_p.h +++ b/src/barchart/barchartmodel_p.h @@ -24,6 +24,7 @@ public: void removeBarSet(QBarSet *set); QBarSet* nextSet(bool getFirst); QBarSet *setAt(int index); + QList legend(); int countSets(); // Number of sets in model int countCategories(); // Number of categories diff --git a/src/barchart/barpresenterbase.cpp b/src/barchart/barpresenterbase.cpp index d719868..7b6fda4 100644 --- a/src/barchart/barpresenterbase.cpp +++ b/src/barchart/barpresenterbase.cpp @@ -70,8 +70,9 @@ void BarPresenterBase::dataChanged() childItems().append(bar); mBars.append(bar); connect(bar,SIGNAL(clicked()),set,SLOT(barClicked())); - connect(bar,SIGNAL(hoverEntered()),set,SLOT(barHoverEntered())); - connect(bar,SIGNAL(hoverLeaved()),set,SLOT(barHoverLeaved())); + // TODO: should the event be passed to set or not? + //connect(bar,SIGNAL(hoverEntered(QGraphicsSceneHoverEvent* event)),set,SLOT(barHoverEntered(QGraphicsSceneHoverEvent* event))); + //connect(bar,SIGNAL(hoverLeaved(QGraphicsSceneHoverEvent* event)),set,SLOT(barHoverLeaved(QGraphicsSceneHoverEvent *event))); } } @@ -133,6 +134,17 @@ void BarPresenterBase::handleGeometryChanged(const QRectF& rect) setPos(rect.topLeft()); } + +void BarPresenterBase::barHoverEntered(QGraphicsSceneHoverEvent *event) +{ + //TODO: show tooltip (name of series, where bar belongs...) +} + +void BarPresenterBase::barHoverLeaved(QGraphicsSceneHoverEvent *event) +{ + //TODO: hide tooltip (name of series, where bar belongs...) +} + #include "moc_barpresenterbase.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/barchart/barpresenterbase.h b/src/barchart/barpresenterbase.h index 01c9ace..cb1d902 100644 --- a/src/barchart/barpresenterbase.h +++ b/src/barchart/barpresenterbase.h @@ -46,6 +46,9 @@ protected slots: void handleDomainChanged(const Domain& domain); void handleGeometryChanged(const QRectF& size); + void barHoverEntered(QGraphicsSceneHoverEvent *event); // Internal. + void barHoverLeaved(QGraphicsSceneHoverEvent *event); + protected: // TODO: consider these. diff --git a/src/barchart/barvalue.cpp b/src/barchart/barvalue.cpp index 3673227..27e1fcb 100644 --- a/src/barchart/barvalue.cpp +++ b/src/barchart/barvalue.cpp @@ -43,10 +43,12 @@ void BarValue::setPos(qreal x, qreal y) mYpos = y; } +/* bool BarValue::belongsToSet(QBarSet *set) { return (&mBarSet == set); } +*/ void BarValue::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { diff --git a/src/barchart/barvalue_p.h b/src/barchart/barvalue_p.h index e705c14..c5ec4a5 100644 --- a/src/barchart/barvalue_p.h +++ b/src/barchart/barvalue_p.h @@ -27,7 +27,8 @@ public: void resize(qreal w, qreal h); void setPos(qreal x, qreal y); - bool belongsToSet(QBarSet *set); + // Propably not needed. +// bool belongsToSet(QBarSet *set); // From QGraphicsItem void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); diff --git a/src/barchart/percentbarpresenter.cpp b/src/barchart/percentbarpresenter.cpp index 81afb6e..4aae2c4 100644 --- a/src/barchart/percentbarpresenter.cpp +++ b/src/barchart/percentbarpresenter.cpp @@ -84,11 +84,14 @@ void PercentBarPresenter::layoutChanged() BarValue* value = mFloatingValues.at(itemIndex); // TODO: remove hard coding, apply layout + value->resize(100,50); value->setPos(xPos, yPos-barHeight/2); value->setPen(QPen(QColor(255,255,255,255))); if (mModel.valueAt(set,category) != 0) { - QString vString(QString::number(mModel.percentageAt(set,category) * 100)); + int p = mModel.percentageAt(set,category) * 100; + QString vString(QString::number(p)); + vString.truncate(3); vString.append("%"); value->setValueString(vString); } else { diff --git a/src/barchart/qbarchartseries.cpp b/src/barchart/qbarchartseries.cpp index 1506e63..0dab9b6 100644 --- a/src/barchart/qbarchartseries.cpp +++ b/src/barchart/qbarchartseries.cpp @@ -15,11 +15,15 @@ QBarChartSeries::QBarChartSeries(QBarCategory *category, QObject *parent) void QBarChartSeries::addBarSet(QBarSet *set) { +// connect(this,SIGNAL(floatingValuesEnabled(bool)),set,SLOT(enableFloatingValues(bool))); +// connect(this,SIGNAL(hoverNamesEnabled(bool)),set,SLOT(enableHoverNames(bool))); mModel->addBarSet(set); } void QBarChartSeries::removeBarSet(QBarSet *set) { +// disconnect(set,SLOT(enableFloatingValues(bool))); +// disconnect(set,SLOT(enableHoverNames(bool))); mModel->removeBarSet(set); } @@ -33,6 +37,21 @@ QBarSet* QBarChartSeries::nextSet(bool getFirst) return mModel->nextSet(getFirst); } +QList QBarChartSeries::legend() +{ + return mModel->legend(); +} + +void QBarChartSeries::enableFloatingValues(bool enabled) +{ + emit floatingValuesEnabled(enabled); +} + +void QBarChartSeries::enableHoverNames(bool enabled) +{ + emit hoverNamesEnabled(enabled); +} + int QBarChartSeries::countCategories() { return mModel->countCategories(); diff --git a/src/barchart/qbarchartseries.h b/src/barchart/qbarchartseries.h index 5959a13..eb9c28f 100644 --- a/src/barchart/qbarchartseries.h +++ b/src/barchart/qbarchartseries.h @@ -12,6 +12,7 @@ class QBarSet; class BarChartModel; // Container for series +// TODO: derive Stacked and percent bar charts from this? class QTCOMMERCIALCHART_EXPORT QBarChartSeries : public QChartSeries { Q_OBJECT @@ -20,13 +21,16 @@ public: virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeBar; } - void addBarSet(QBarSet *set); // Takes ownership of set - void removeBarSet(QBarSet *set); // Removes set, releases ownership. + void addBarSet(QBarSet *set); // Takes ownership of set + void removeBarSet(QBarSet *set); // Releases ownership, doesn't delete set int countSets(); QBarSet* nextSet(bool getFirst=false); // Returns first set, if called with true - //TODO: - //QList legend(); // Returns legend of series (ie. names of all sets in series) + QList legend(); // Returns legend of series (ie. names of all sets in series) + + // Disabled by default. Call these to change behavior. + void enableFloatingValues(bool enabled=true); + void enableHoverNames(bool enabled=true); // TODO: Functions below this are not part of api and will be moved // to private implementation, when we start using it (not part of api) @@ -41,10 +45,16 @@ public: signals: void changed(int index); -public Q_SLOTS: + // TODO: these to private implementation. + void floatingValuesEnabled(bool enabled); + void hoverNamesEnabled(bool enabled); + + +//public Q_SLOTS: private: BarChartModel* mModel; + }; QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/barchart/qbarset.cpp b/src/barchart/qbarset.cpp index fa72ab1..a819d15 100644 --- a/src/barchart/qbarset.cpp +++ b/src/barchart/qbarset.cpp @@ -3,10 +3,12 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE -QBarSet::QBarSet(QObject *parent) +QBarSet::QBarSet(QString name, QObject *parent) : QObject(parent) + ,mName(name) + ,mHoverNamesEnabled(true) // TODO: these 2 as false by default, when implementation is ready + ,mFloatingValuesEnabled(true) { - mFloatingValuesVisible = false; } void QBarSet::setName(QString name) @@ -59,9 +61,16 @@ const QBrush& QBarSet::brush() const return mBrush; } -bool QBarSet::isFloatingValuesVisible() +void QBarSet::enableFloatingValues(bool enabled) { - return mFloatingValuesVisible; + qDebug() << "QBarSet::enableFloatingValues" << enabled; + mFloatingValuesEnabled = enabled; +} + +void QBarSet::enableHoverNames(bool enabled) +{ + qDebug() << "QBarSet::enableHoverNames" << enabled; + mHoverNamesEnabled = enabled; } void QBarSet::barClicked() @@ -75,13 +84,17 @@ void QBarSet::barClicked() void QBarSet::barHoverEntered() { qDebug() << "QBarset::barHoverEntered" << this; - emit hoverEnter(); + if (mHoverNamesEnabled) { + emit hoverEnter(); + } } void QBarSet::barHoverLeaved() { qDebug() << "QBarset::barHoverLeaved" << this; - emit hoverLeave(); + if (mHoverNamesEnabled) { + emit hoverLeave(); + } } #include "moc_qbarset.cpp" diff --git a/src/barchart/qbarset.h b/src/barchart/qbarset.h index e84c13a..e090d13 100644 --- a/src/barchart/qbarset.h +++ b/src/barchart/qbarset.h @@ -11,7 +11,7 @@ class QTCOMMERCIALCHART_EXPORT QBarSet : public QObject { Q_OBJECT public: - QBarSet(QObject *parent = 0); + QBarSet(QString name, QObject *parent = 0); void setName(QString name); QString name(); @@ -19,7 +19,7 @@ public: int count(); // count of values in set qreal valueAt(int index); // for modifying individual values - void setValue(int index, qreal value); // + void setValue(int index, qreal value); // setter for individual value void setPen(const QPen& pen); const QPen& pen() const; @@ -27,15 +27,18 @@ public: void setBrush(const QBrush& brush); const QBrush& brush() const; - bool isFloatingValuesVisible(); - Q_SIGNALS: - void clicked(); + void clicked(); // Clicked and hover signals exposed to user void hoverEnter(); void hoverLeave(); - void toggleFloatingValues(); + void toggleFloatingValues(); // Private signal, TODO: move to private impl public Q_SLOTS: + void enableFloatingValues(bool enabled); // enables floating values on top of bars + void enableHoverNames(bool enabled); // enableHoverEvents would be better name? + + // TODO: these slots belong to private implementation. + // These are for single bars to notify set about internal events void barClicked(); void barHoverEntered(); void barHoverLeaved(); @@ -47,7 +50,9 @@ private: QPen mPen; QBrush mBrush; - bool mFloatingValuesVisible; + // TODO: to pimpl + bool mFloatingValuesEnabled; + bool mHoverNamesEnabled; }; QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/barchart/qpercentbarchartseries.cpp b/src/barchart/qpercentbarchartseries.cpp index 271197b..7361a49 100644 --- a/src/barchart/qpercentbarchartseries.cpp +++ b/src/barchart/qpercentbarchartseries.cpp @@ -15,11 +15,15 @@ QPercentBarChartSeries::QPercentBarChartSeries(QBarCategory *category, QObject * void QPercentBarChartSeries::addBarSet(QBarSet *set) { + connect(this,SIGNAL(floatingValuesEnabled(bool)),set,SLOT(enableFloatingValues(bool))); + connect(this,SIGNAL(hoverNamesEnabled(bool)),set,SLOT(enableHoverNames(bool))); mModel->addBarSet(set); } void QPercentBarChartSeries::removeBarSet(QBarSet *set) { + disconnect(set,SLOT(enableFloatingValues(bool))); + disconnect(set,SLOT(enableHoverNames(bool))); mModel->removeBarSet(set); } @@ -33,6 +37,11 @@ QBarSet* QPercentBarChartSeries::nextSet(bool getFirst) return mModel->nextSet(getFirst); } +QList QPercentBarChartSeries::legend() +{ + return mModel->legend(); +} + int QPercentBarChartSeries::countCategories() { return mModel->countCategories(); diff --git a/src/barchart/qpercentbarchartseries.h b/src/barchart/qpercentbarchartseries.h index 4a99888..69f750a 100644 --- a/src/barchart/qpercentbarchartseries.h +++ b/src/barchart/qpercentbarchartseries.h @@ -21,12 +21,15 @@ public: virtual QChartSeriesType type() const { return QChartSeries::SeriesTypePercentBar; } void addBarSet(QBarSet *set); // Takes ownership - void removeBarSet(QBarSet *set); // Also deletes the set, if set is owned. + void removeBarSet(QBarSet *set); // Releases ownership, doesn't delete set int countSets(); QBarSet* nextSet(bool first=false); // Returns first set, if called with true - //TODO: - //QList legend(); // Returns legend of series (ie. names of all sets in series) + QList legend(); // Returns legend of series (ie. names of all sets in series) + + // Disabled by default. Call these to change behavior. + void enableFloatingValues(bool enabled=true); + void enableHoverNames(bool enabled=true); // TODO: Functions below this are not part of api and will be moved // to private implementation, when we start using it (not part of api) diff --git a/src/barchart/qstackedbarchartseries.cpp b/src/barchart/qstackedbarchartseries.cpp index 219b69d..ecab997 100644 --- a/src/barchart/qstackedbarchartseries.cpp +++ b/src/barchart/qstackedbarchartseries.cpp @@ -15,11 +15,15 @@ QStackedBarChartSeries::QStackedBarChartSeries(QBarCategory *category, QObject * void QStackedBarChartSeries::addBarSet(QBarSet *set) { + connect(this,SIGNAL(floatingValuesEnabled(bool)),set,SLOT(enableFloatingValues(bool))); + connect(this,SIGNAL(hoverNamesEnabled(bool)),set,SLOT(enableHoverNames(bool))); mModel->addBarSet(set); } void QStackedBarChartSeries::removeBarSet(QBarSet *set) { + disconnect(set,SLOT(enableFloatingValues(bool))); + disconnect(set,SLOT(enableHoverNames(bool))); mModel->removeBarSet(set); } @@ -33,6 +37,11 @@ QBarSet* QStackedBarChartSeries::nextSet(bool getFirst) return mModel->nextSet(getFirst); } +QList QStackedBarChartSeries::legend() +{ + return mModel->legend(); +} + int QStackedBarChartSeries::countCategories() { return mModel->countCategories(); diff --git a/src/barchart/qstackedbarchartseries.h b/src/barchart/qstackedbarchartseries.h index df7c905..d73a258 100644 --- a/src/barchart/qstackedbarchartseries.h +++ b/src/barchart/qstackedbarchartseries.h @@ -22,11 +22,15 @@ public: // Set handling void addBarSet(QBarSet *set); // Takes ownership - void removeBarSet(QBarSet *set); // Also deletes the set, if set is owned. + void removeBarSet(QBarSet *set); // Releases ownership, doesn't delete set int countSets(); QBarSet* nextSet(bool first=false); // Returns first set, if called with true - //QList legend(); // Returns legend of series (ie. names of all sets in series) + QList legend(); // Returns legend of series (ie. names of all sets in series) + + // Disabled by default. Call these to change behavior. + void enableFloatingValues(bool enabled=true); + void enableHoverNames(bool enabled=true); // TODO: Functions below this are not part of api and will be moved // to private implementation, when we start using it (not part of api)