qbarseries.h
127 lines
| 3.8 KiB
| text/x-c
|
CLexer
Jani Honkonen
|
r794 | /**************************************************************************** | ||
** | ||||
** Copyright (C) 2012 Digia Plc | ||||
** All rights reserved. | ||||
** For any questions to Digia, please use contact form at http://qt.digia.com | ||||
** | ||||
** This file is part of the Qt Commercial Charts Add-on. | ||||
** | ||||
** $QT_BEGIN_LICENSE$ | ||||
** Licensees holding valid Qt Commercial licenses may use this file in | ||||
** accordance with the Qt Commercial License Agreement provided with the | ||||
** Software or, alternatively, in accordance with the terms contained in | ||||
** a written agreement between you and Digia. | ||||
** | ||||
** If you have questions regarding the use of this file, please use | ||||
** contact form at http://qt.digia.com | ||||
** $QT_END_LICENSE$ | ||||
** | ||||
****************************************************************************/ | ||||
sauimone
|
r338 | #ifndef BARSERIES_H | ||
#define BARSERIES_H | ||||
sauimone
|
r56 | |||
Jani Honkonen
|
r697 | #include <qseries.h> | ||
sauimone
|
r377 | #include <QStringList> | ||
sauimone
|
r74 | |||
Marek Rosa
|
r877 | class QModelIndex; | ||
sauimone
|
r56 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||
Michal Klocek
|
r703 | typedef QStringList QBarCategories; | ||
Michal Klocek
|
r701 | |||
sauimone
|
r172 | class QBarSet; | ||
class BarChartModel; | ||||
sauimone
|
r412 | class BarCategory; | ||
sauimone
|
r934 | class QBarSeriesPrivate; | ||
sauimone
|
r172 | |||
sauimone
|
r56 | // Container for series | ||
Michal Klocek
|
r360 | class QTCOMMERCIALCHART_EXPORT QBarSeries : public QSeries | ||
sauimone
|
r56 | { | ||
sauimone
|
r71 | Q_OBJECT | ||
sauimone
|
r56 | public: | ||
Michal Klocek
|
r943 | QBarSeries(QBarCategories categories, QObject *parent = 0); | ||
sauimone
|
r56 | |||
Michal Klocek
|
r938 | QSeries::QSeriesType type() const; | ||
sauimone
|
r56 | |||
sauimone
|
r850 | void appendBarSet(QBarSet *set); // Takes ownership of set | ||
sauimone
|
r280 | void removeBarSet(QBarSet *set); // Releases ownership, doesn't delete set | ||
sauimone
|
r850 | void appendBarSets(QList<QBarSet* > sets); | ||
void removeBarSets(QList<QBarSet* > sets); | ||||
Marek Rosa
|
r662 | void insertBarSet(int i, QBarSet *set); | ||
void insertCategory(int i, QString category); | ||||
Marek Rosa
|
r663 | void removeCategory(int i); | ||
sauimone
|
r776 | int barsetCount() const; | ||
int categoryCount() const; | ||||
QList<QBarSet*> barSets() const; | ||||
Michal Klocek
|
r703 | QBarCategories categories() const; | ||
sauimone
|
r820 | void setLabelsVisible(bool visible = true); | ||
sauimone
|
r813 | |||
Tero Ahola
|
r737 | bool setModel(QAbstractItemModel *model); | ||
sauimone
|
r934 | void setModelMapping(int categories, int bottomBoundary, int topBoundary, Qt::Orientation orientation = Qt::Vertical); | ||
Marek Rosa
|
r527 | |||
sauimone
|
r288 | public: | ||
sauimone
|
r173 | // TODO: Functions below this are not part of api and will be moved | ||
sauimone
|
r296 | // to private implementation, when we start using it | ||
// TODO: TO PIMPL ---> | ||||
sauimone
|
r412 | QBarSet* barsetAt(int index); | ||
QString categoryName(int category); | ||||
sauimone
|
r172 | qreal min(); | ||
qreal max(); | ||||
qreal valueAt(int set, int category); | ||||
sauimone
|
r288 | qreal percentageAt(int set, int category); | ||
qreal categorySum(int category); | ||||
sauimone
|
r850 | qreal absoluteCategorySum(int category); | ||
sauimone
|
r172 | qreal maxCategorySum(); | ||
Marek Rosa
|
r877 | BarChartModel& modelInternal(); | ||
sauimone
|
r296 | // <--- TO PIMPL | ||
sauimone
|
r172 | |||
Michal Klocek
|
r943 | protected: | ||
explicit QBarSeries(QBarSeriesPrivate &d,QObject *parent = 0); | ||||
sauimone
|
r775 | Q_SIGNALS: | ||
sauimone
|
r812 | void clicked(QBarSet *barset, QString category, Qt::MouseButtons button); // Up to user of api, what to do with these signals | ||
Michal Klocek
|
r855 | void selected(); | ||
Marek Rosa
|
r655 | // | ||
void updatedBars(); | ||||
sauimone
|
r850 | void restructuredBars(); | ||
Marek Rosa
|
r655 | |||
sauimone
|
r288 | // TODO: internal signals, these to private implementation. | ||
sauimone
|
r296 | // TODO: TO PIMPL ---> | ||
sauimone
|
r934 | // void showToolTip(QPoint pos, QString tip); | ||
sauimone
|
r296 | // <--- TO PIMPL | ||
public Q_SLOTS: | ||||
Tero Ahola
|
r737 | void setToolTipEnabled(bool enabled = true); // enables tooltips | ||
sauimone
|
r171 | |||
sauimone
|
r425 | // TODO: TO PIMPL ---> | ||
sauimone
|
r812 | void barsetClicked(QString category, Qt::MouseButtons button); | ||
sauimone
|
r425 | // <--- TO PIMPL | ||
Marek Rosa
|
r630 | private Q_SLOTS: | ||
// slots for updating bars when data in model changes | ||||
void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight); | ||||
void modelDataAdded(QModelIndex parent, int start, int end); | ||||
void modelDataRemoved(QModelIndex parent, int start, int end); | ||||
void barsetChanged(); | ||||
sauimone
|
r281 | protected: | ||
sauimone
|
r934 | Q_DECLARE_PRIVATE(QBarSeries) | ||
/* | ||||
sauimone
|
r766 | BarChartModel *m_internalModel; // TODO: this may change... current "2 models" situation doesn't look good. | ||
Marek Rosa
|
r527 | |||
Marek Rosa
|
r877 | // QAbstractItemModel* m_model; | ||
Marek Rosa
|
r527 | int m_mapCategories; | ||
int m_mapBarBottom; | ||||
int m_mapBarTop; | ||||
Marek Rosa
|
r734 | int m_mapFirst; | ||
int m_mapCount; | ||||
Marek Rosa
|
r630 | Qt::Orientation m_mapOrientation; | ||
sauimone
|
r934 | */ | ||
sauimone
|
r56 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
sauimone
|
r338 | #endif // BARSERIES_H | ||