##// END OF EJS Templates
Add support for showing tooltips when the legend text is truncated...
Add support for showing tooltips when the legend text is truncated Change-Id: Ie0b90489eb51633a0294db12410f9056f740d086 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>

File last commit:

r2854:46147b040d06
r2864:47032ec192b3
Show More
chartpresenter_p.h
220 lines | 6.7 KiB | text/x-c | CLexer
/ src / charts / chartpresenter_p.h
Miikka Heikkinen
Updated license...
r2854 /****************************************************************************
Jani Honkonen
Add license headers
r794 **
Miikka Heikkinen
Updated license...
r2854 ** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
Jani Honkonen
Add license headers
r794 **
Miikka Heikkinen
Updated license...
r2854 ** This file is part of the Qt Charts module of the Qt Toolkit.
Jani Honkonen
Add license headers
r794 **
Miikka Heikkinen
Updated license...
r2854 ** $QT_BEGIN_LICENSE:GPL$
Titta Heikkala
Updated license headers...
r2845 ** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
Miikka Heikkinen
Updated license...
r2854 ** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) any later version
** approved by the KDE Free Qt Foundation. The licenses are as published by
** the Free Software Foundation and appearing in the file LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
Jani Honkonen
Add license headers
r794 **
Titta Heikkala
Updated license headers...
r2845 ** $QT_END_LICENSE$
**
Miikka Heikkinen
Updated license...
r2854 ****************************************************************************/
Jani Honkonen
Add license headers
r794
unknown
Added missing warning about private implementation
r1366 // W A R N I N G
// -------------
//
Titta Heikkala
Updated private header warning...
r2807 // This file is not part of the Qt Chart API. It exists purely as an
unknown
Added missing warning about private implementation
r1366 // implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
Michal Klocek
Fixes header guard style issues
r969 #ifndef CHARTPRESENTER_H
#define CHARTPRESENTER_H
Michal Klocek
Refactors qchart , adds line animation...
r131
Titta Heikkala
Fix include syntax...
r2714 #include <QtCharts/QChartGlobal>
#include <QtCharts/QChart> //because of QChart::ChartThemeId
Miikka Heikkinen
Accelerating lineseries with OpenGL...
r2820 #include <private/glwidget_p.h>
Titta Heikkala
Fix include syntax...
r2714 #include <QtCore/QRectF>
#include <QtCore/QMargins>
#include <QtCore/QLocale>
Miikka Heikkinen
Accelerating lineseries with OpenGL...
r2820 #include <QtCore/QPointer>
Miikka Heikkinen
Fix issues based on android testing...
r2826 #include <QtCore/QEasingCurve>
Michal Klocek
Refactors qchart , adds line animation...
r131
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_BEGIN_NAMESPACE
Michal Klocek
Refactors qchart , adds line animation...
r131
Michal Klocek
Refactors internals...
r2273 class ChartItem;
class AxisItem;
Tero Ahola
Renamed QSeries to QAbstractSeries
r988 class QAbstractSeries;
Michal Klocek
Refactors qchart , adds line animation...
r131 class ChartDataSet;
Marek Rosa
Domains added
r2275 class AbstractDomain;
Miikka Heikkinen
Add Polar chart support...
r2483 class ChartAxisElement;
Michal Klocek
Animation refactor...
r530 class ChartAnimator;
Michal Klocek
Changes QChartAxis -> QAxis
r1006 class ChartBackground;
Michal Klocek
Refactors layout...
r1965 class ChartTitle;
Michal Klocek
Refactors axis animation, line animations
r1241 class ChartAnimation;
Miikka Heikkinen
Add Polar chart support...
r2483 class AbstractChartLayout;
Michal Klocek
Refactors qchart , adds line animation...
r131
class ChartPresenter: public QObject
{
Q_OBJECT
public:
Tero Ahola
Fixed drawing issues in Scatter
r375 enum ZValues {
BackgroundZValue = -1,
Miikka Heikkinen
Add API to specify plot area background....
r2498 PlotAreaZValue,
ShadesZValue,
Tero Ahola
Fixed drawing issues in Scatter
r375 GridZValue,
Tero Ahola
Switched the z-order of axis to be below series...
r1790 AxisZValue,
Tero Ahola
All the series to use the same z-plane
r1260 SeriesZValue,
LineChartZValue = SeriesZValue,
Michal Klocek
Fixes mouse handling in base class of chartseries
r1747 SplineChartZValue = SeriesZValue,
Tero Ahola
All the series to use the same z-plane
r1260 BarSeriesZValue = SeriesZValue,
ScatterSeriesZValue = SeriesZValue,
PieSeriesZValue = SeriesZValue,
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 BoxPlotSeriesZValue = SeriesZValue,
Michal Klocek
Fixes mouse handling in base class of chartseries
r1747 LegendZValue,
TopMostZValue
Tero Ahola
Fixed drawing issues in Scatter
r375 };
Tero Ahola
All the series to use the same z-plane
r1260
enum State {
ShowState,
Michal Klocek
Refactors axis animation, line animations
r1241 ScrollUpState,
ScrollDownState,
ScrollLeftState,
ScrollRightState,
ZoomInState,
ZoomOutState
};
Michal Klocek
Adds ZOrder enum to presenter
r262
Miikka Heikkinen
Add Polar chart support...
r2483 ChartPresenter(QChart *chart, QChart::ChartType type);
Michal Klocek
Refactors qchart , adds line animation...
r131 virtual ~ChartPresenter();
Michal Klocek
Refactored for MVP...
r139
Michal Klocek
Refactors internals...
r2273
void setGeometry(QRectF rect);
QRectF geometry() const;
QGraphicsItem *rootItem(){ return m_chart; }
Jani Honkonen
src folder: another massive victory for coding style police
r2131 ChartBackground *backgroundElement();
Miikka Heikkinen
Add API to specify plot area background....
r2498 QAbstractGraphicsShapeItem *plotAreaElement();
Jani Honkonen
src folder: another massive victory for coding style police
r2131 ChartTitle *titleElement();
Miikka Heikkinen
Add Polar chart support...
r2483 QList<ChartAxisElement *> axisItems() const;
Michal Klocek
Refactors internals...
r2273 QList<ChartItem *> chartItems() const;
Jani Honkonen
src folder: another massive victory for coding style police
r2131 QLegend *legend();
Michal Klocek
Refactors layout managment...
r1534
Jani Honkonen
src folder: another massive victory for coding style police
r2131 void setBackgroundBrush(const QBrush &brush);
Michal Klocek
Refactors layout managment...
r1534 QBrush backgroundBrush() const;
Jani Honkonen
src folder: another massive victory for coding style police
r2131 void setBackgroundPen(const QPen &pen);
Michal Klocek
Refactors layout managment...
r1534 QPen backgroundPen() const;
Miikka Heikkinen
Added API to set chart background roundness...
r2549 void setBackgroundRoundness(qreal diameter);
qreal backgroundRoundness() const;
Miikka Heikkinen
Add API to specify plot area background....
r2498 void setPlotAreaBackgroundBrush(const QBrush &brush);
QBrush plotAreaBackgroundBrush() const;
void setPlotAreaBackgroundPen(const QPen &pen);
QPen plotAreaBackgroundPen() const;
Jani Honkonen
src folder: another massive victory for coding style police
r2131 void setTitle(const QString &title);
Michal Klocek
Refactors layout managment...
r1534 QString title() const;
Jani Honkonen
src folder: another massive victory for coding style police
r2131 void setTitleFont(const QFont &font);
Michal Klocek
Refactors layout managment...
r1534 QFont titleFont() const;
void setTitleBrush(const QBrush &brush);
QBrush titleBrush() const;
void setBackgroundVisible(bool visible);
bool isBackgroundVisible() const;
Miikka Heikkinen
Add API to specify plot area background....
r2498 void setPlotAreaBackgroundVisible(bool visible);
bool isPlotAreaBackgroundVisible() const;
Michal Klocek
Refactors layout managment...
r1534 void setBackgroundDropShadowEnabled(bool enabled);
bool isBackgroundDropShadowEnabled() const;
Miikka Heikkinen
Added QChart::localizeNumbers...
r2707 void setLocalizeNumbers(bool localize);
Miikka Heikkinen
Added QChart::locale property...
r2708 inline bool localizeNumbers() const { return m_localizeNumbers; }
void setLocale(const QLocale &locale);
inline const QLocale &locale() const { return m_locale; }
Miikka Heikkinen
Added QChart::localizeNumbers...
r2707
Michal Klocek
Refactors layout managment...
r1534 void setVisible(bool visible);
Michal Klocek
Refactors qchart , adds line animation...
r131
Michal Klocek
Adds animation settings handling
r298 void setAnimationOptions(QChart::AnimationOptions options);
QChart::AnimationOptions animationOptions() const;
Titta Heikkala
Added possibility to set duration and easing curve for chart animation...
r2804 void setAnimationDuration(int msecs);
int animationDuration() const { return m_animationDuration; }
void setAnimationEasingCurve(const QEasingCurve &curve);
QEasingCurve animationEasingCurve() const { return m_animationCurve; }
Michal Klocek
Adds animation settings handling
r298
Jani Honkonen
src folder: another massive victory for coding style police
r2131 void startAnimation(ChartAnimation *animation);
Michal Klocek
Refactors internals...
r2273
void setState(State state,QPointF point);
Michal Klocek
Refactors axis animation, line animations
r1241 State state() const { return m_state; }
QPointF statePoint() const { return m_statePoint; }
Miikka Heikkinen
Add Polar chart support...
r2483 AbstractChartLayout *layout();
QChart::ChartType chartType() const { return m_chart->chartType(); }
Miikka Heikkinen
Add API to specify plot area background....
r2498 QChart *chart() { return m_chart; }
Michal Klocek
Refactors layout managment...
r1534
Miikka Heikkinen
Added HTML support for various text items...
r2539 static QRectF textBoundingRect(const QFont &font, const QString &text, qreal angle = 0.0);
Titta Heikkala
Fix long labels visibility for QBarChart...
r2604 static QString truncatedText(const QFont &font, const QString &text, qreal angle,
qreal maxWidth, qreal maxHeight, QRectF &boundingRect);
Miikka Heikkinen
Fix text item margins...
r2592 inline static qreal textMargin() { return qreal(0.5); }
Miikka Heikkinen
Added QChart::localizeNumbers...
r2707
QString numberToString(double value, char f = 'g', int prec = 6);
Miikka Heikkinen
Additional fixes to label localization...
r2709 QString numberToString(int value);
Miikka Heikkinen
Added QChart::localizeNumbers...
r2707
Miikka Heikkinen
Accelerating lineseries with OpenGL...
r2820 void ensureGLWidget();
void glSetUseWidget(bool enable) { m_glUseWidget = enable; }
Michal Klocek
Refactors layout managment...
r1534 private:
void createBackgroundItem();
Miikka Heikkinen
Add API to specify plot area background....
r2498 void createPlotAreaBackgroundItem();
Michal Klocek
Refactors layout managment...
r1534 void createTitleItem();
Michal Klocek
Refactors qchart , adds line animation...
r131
sauimone
Q_SIGNALS and Q_SLOTS
r775 public Q_SLOTS:
Michal Klocek
Refactors internals...
r2273 void handleSeriesAdded(QAbstractSeries *series);
Jani Honkonen
src folder: another massive victory for coding style police
r2131 void handleSeriesRemoved(QAbstractSeries *series);
Michal Klocek
Refactors internals...
r2273 void handleAxisAdded(QAbstractAxis *axis);
Jani Honkonen
src folder: another massive victory for coding style police
r2131 void handleAxisRemoved(QAbstractAxis *axis);
Michal Klocek
Refactor domain model...
r439
Miikka Heikkinen
Fix build against 5.6...
r2793 Q_SIGNALS:
Miikka Heikkinen
Added plotAreaChanged signal to chart....
r2716 void plotAreaChanged(const QRectF &plotArea);
Michal Klocek
Refactors qchart , adds line animation...
r131 private:
Jani Honkonen
src folder: another massive victory for coding style police
r2131 QChart *m_chart;
Michal Klocek
Refactors internals...
r2273 QList<ChartItem *> m_chartItems;
Miikka Heikkinen
Add Polar chart support...
r2483 QList<ChartAxisElement *> m_axisItems;
Michal Klocek
Refactors internals...
r2273 QList<QAbstractSeries *> m_series;
QList<QAbstractAxis *> m_axes;
Michal Klocek
Adds animation settings handling
r298 QChart::AnimationOptions m_options;
Titta Heikkala
Added possibility to set duration and easing curve for chart animation...
r2804 int m_animationDuration;
QEasingCurve m_animationCurve;
Michal Klocek
Refactors axis animation, line animations
r1241 State m_state;
QPointF m_statePoint;
Miikka Heikkinen
Add Polar chart support...
r2483 AbstractChartLayout *m_layout;
Jani Honkonen
src folder: another massive victory for coding style police
r2131 ChartBackground *m_background;
Miikka Heikkinen
Add API to specify plot area background....
r2498 QAbstractGraphicsShapeItem *m_plotAreaBackground;
Jani Honkonen
src folder: another massive victory for coding style police
r2131 ChartTitle *m_title;
Michal Klocek
Refactors internals...
r2273 QRectF m_rect;
Miikka Heikkinen
Added QChart::localizeNumbers...
r2707 bool m_localizeNumbers;
QLocale m_locale;
Miikka Heikkinen
Accelerating lineseries with OpenGL...
r2820 #ifndef QT_NO_OPENGL
QPointer<GLWidget> m_glWidget;
#endif
bool m_glUseWidget;
Michal Klocek
Refactors qchart , adds line animation...
r131 };
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_END_NAMESPACE
Michal Klocek
Refactors qchart , adds line animation...
r131
Jani Honkonen
Fix Krazy issues
r1935 #endif /* CHARTPRESENTER_H */