29 #include <QtCore/qglobal.h>
32 #ifdef QCUSTOMPLOT_USE_OPENGL
33 # if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
34 # define QCP_OPENGL_PBUFFER
36 # define QCP_OPENGL_FBO
38 # if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)
39 # define QCP_OPENGL_OFFSCREENSURFACE
43 #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
44 # define QCP_DEVICEPIXELRATIO_SUPPORTED
45 # if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
46 # define QCP_DEVICEPIXELRATIO_FLOAT
50 #include <QtCore/QObject>
51 #include <QtCore/QPointer>
52 #include <QtCore/QSharedPointer>
53 #include <QtCore/QTimer>
54 #include <QtGui/QPainter>
55 #include <QtGui/QPaintEvent>
56 #include <QtGui/QMouseEvent>
57 #include <QtGui/QWheelEvent>
58 #include <QtGui/QPixmap>
59 #include <QtCore/QVector>
60 #include <QtCore/QString>
61 #include <QtCore/QDateTime>
62 #include <QtCore/QMultiMap>
63 #include <QtCore/QFlags>
64 #include <QtCore/QDebug>
65 #include <QtCore/QStack>
66 #include <QtCore/QCache>
67 #include <QtCore/QMargins>
72 # include <QtGui/QOpenGLContext>
73 # include <QtGui/QOpenGLFramebufferObject>
74 # ifdef QCP_OPENGL_OFFSCREENSURFACE
75 # include <QtGui/QOffscreenSurface>
77 # include <QtGui/QWindow>
80 #ifdef QCP_OPENGL_PBUFFER
81 # include <QtOpenGL/QGLPixelBuffer>
83 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
84 # include <qnumeric.h>
85 # include <QtGui/QWidget>
86 # include <QtGui/QPrinter>
87 # include <QtGui/QPrintEngine>
90 # include <QtWidgets/QWidget>
91 # include <QtPrintSupport/QtPrintSupport>
118 #define QCUSTOMPLOT_VERSION_STR "2.0.1"
119 #define QCUSTOMPLOT_VERSION 0x020001
122 #if defined(QT_STATIC_BUILD)
123 # define QCP_LIB_DECL
124 #elif defined(QCUSTOMPLOT_COMPILE_LIBRARY)
125 # define QCP_LIB_DECL Q_DECL_EXPORT
126 #elif defined(QCUSTOMPLOT_USE_LIBRARY)
127 # define QCP_LIB_DECL Q_DECL_IMPORT
129 # define QCP_LIB_DECL
133 #ifndef Q_DECL_OVERRIDE
134 # define Q_DECL_OVERRIDE
154 Q_FLAGS(AntialiasedElements)
156 Q_FLAGS(PlottingHints)
158 Q_FLAGS(Interactions)
311 return qIsNaN(value) || qIsInf(value);
336 case QCP::msTop: margins.setTop(value);
break;
338 case QCP::msAll: margins = QMargins(value, value, value, value);
break;
367 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::AntialiasedElements)
368 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::PlottingHints)
369 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::MarginSides)
370 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::Interactions)
396 double x()
const {
return mX; }
397 double y()
const {
return mY; }
398 double &
rx() {
return mX; }
399 double &
ry() {
return mY; }
406 double length()
const {
return qSqrt(mX*mX+mY*mY); }
408 QPoint
toPoint()
const {
return QPoint(mX, mY); }
409 QPointF
toPointF()
const {
return QPointF(mX, mY); }
411 bool isNull()
const {
return qIsNull(mX) && qIsNull(mY); }
417 double distanceSquaredToLine(
const QLineF &line)
const;
451 d.nospace() <<
"QCPVector2D(" << vec.
x() <<
", " << vec.
y() <<
")";
472 ,pmNonCosmetic = 0x04
475 Q_FLAGS(PainterModes)
476 Q_DECLARE_FLAGS(PainterModes, PainterMode)
482 bool antialiasing()
const {
return testRenderHint(QPainter::Antialiasing); }
483 PainterModes
modes()
const {
return mModes; }
486 void setAntialiasing(
bool enabled);
487 void setMode(PainterMode mode,
bool enabled=
true);
488 void setModes(PainterModes modes);
491 bool begin(QPaintDevice *device);
492 void setPen(
const QPen &pen);
493 void setPen(
const QColor &color);
494 void setPen(Qt::PenStyle penStyle);
495 void drawLine(
const QLineF &line);
501 void makeNonCosmetic();
511 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPainter::PainterModes)
527 QSize
size()
const {
return mSize; }
532 void setSize(
const QSize &
size);
533 void setInvalidated(
bool invalidated=
true);
534 void setDevicePixelRatio(
double ratio);
539 virtual void draw(
QCPPainter *painter)
const = 0;
540 virtual void clear(
const QColor &color) = 0;
551 virtual void reallocateBuffer() = 0;
575 #ifdef QCP_OPENGL_PBUFFER
579 explicit QCPPaintBufferGlPbuffer(
const QSize &
size,
double devicePixelRatio,
int multisamples);
580 virtual ~QCPPaintBufferGlPbuffer();
589 QGLPixelBuffer *mGlPBuffer;
595 #endif // QCP_OPENGL_PBUFFER
598 #ifdef QCP_OPENGL_FBO
602 explicit QCPPaintBufferGlFbo(
const QSize &
size,
double devicePixelRatio, QWeakPointer<QOpenGLContext> glContext, QWeakPointer<QOpenGLPaintDevice> glPaintDevice);
603 virtual ~QCPPaintBufferGlFbo();
613 QWeakPointer<QOpenGLContext> mGlContext;
614 QWeakPointer<QOpenGLPaintDevice> mGlPaintDevice;
615 QOpenGLFramebufferObject *mGlFrameBuffer;
620 #endif // QCP_OPENGL_FBO
632 Q_PROPERTY(
QCustomPlot* parentPlot READ parentPlot)
633 Q_PROPERTY(QString name READ name)
634 Q_PROPERTY(
int index READ index)
635 Q_PROPERTY(QList<QCPLayerable*> children READ children)
636 Q_PROPERTY(
bool visible READ visible WRITE setVisible)
637 Q_PROPERTY(
LayerMode mode READ mode WRITE setMode)
658 QString
name()
const {
return mName; }
659 int index()
const {
return mIndex; }
660 QList<QCPLayerable*>
children()
const {
return mChildren; }
665 void setVisible(
bool visible);
666 void setMode(LayerMode mode);
685 void drawToPaintBuffer();
701 Q_PROPERTY(
bool visible READ visible WRITE setVisible)
702 Q_PROPERTY(
QCustomPlot* parentPlot READ parentPlot)
703 Q_PROPERTY(
QCPLayerable* parentLayerable READ parentLayerable)
704 Q_PROPERTY(
QCPLayer* layer READ layer WRITE setLayer NOTIFY layerChanged)
705 Q_PROPERTY(
bool antialiased READ antialiased WRITE setAntialiased)
719 void setVisible(
bool on);
720 Q_SLOT
bool setLayer(
QCPLayer *layer);
721 bool setLayer(
const QString &layerName);
722 void setAntialiased(
bool enabled);
725 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
728 bool realVisibility()
const;
731 void layerChanged(
QCPLayer *newLayer);
742 virtual void parentPlotInitialized(
QCustomPlot *parentPlot);
744 virtual QRect clipRect()
const;
745 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const = 0;
748 virtual void selectEvent(QMouseEvent *event,
bool additive,
const QVariant &details,
bool *selectionStateChanged);
749 virtual void deselectEvent(
bool *selectionStateChanged);
751 virtual void mousePressEvent(QMouseEvent *event,
const QVariant &details);
752 virtual void mouseMoveEvent(QMouseEvent *event,
const QPointF &startPos);
753 virtual void mouseReleaseEvent(QMouseEvent *event,
const QPointF &startPos);
754 virtual void mouseDoubleClickEvent(QMouseEvent *event,
const QVariant &details);
755 virtual void wheelEvent(QWheelEvent *event);
758 void initializeParentPlot(
QCustomPlot *parentPlot);
760 bool moveToLayer(
QCPLayer *layer,
bool prepend);
783 QCPRange(
double lower,
double upper);
799 double size()
const {
return upper-lower; }
800 double center()
const {
return (upper+lower)*0.5; }
801 void normalize() {
if (lower > upper) qSwap(lower, upper); }
802 void expand(
const QCPRange &otherRange);
803 void expand(
double includeCoord);
805 QCPRange expanded(
double includeCoord)
const;
806 QCPRange bounded(
double lowerBound,
double upperBound)
const;
807 QCPRange sanitizedForLogScale()
const;
808 QCPRange sanitizedForLinScale()
const;
809 bool contains(
double value)
const {
return value >= lower && value <= upper; }
811 static bool validRange(
double lower,
double upper);
812 static bool validRange(
const QCPRange &range);
825 d.nospace() <<
"QCPRange(" << range.
lower <<
", " << range.
upper <<
")";
905 int begin()
const {
return mBegin; }
906 int end()
const {
return mEnd; }
907 int size()
const {
return mEnd-mBegin; }
915 bool isValid()
const {
return (mEnd >= mBegin) && (mBegin >= 0); }
916 bool isEmpty()
const {
return length() == 0; }
955 int dataPointCount()
const;
957 QList<QCPDataRange>
dataRanges()
const {
return mDataRanges; }
961 void addDataRange(
const QCPDataRange &dataRange,
bool simplify=
true);
963 bool isEmpty()
const {
return mDataRanges.isEmpty(); }
1070 d.nospace() <<
"QCPDataRange(" << dataRange.
begin() <<
", " << dataRange.
end() <<
")";
1080 d.nospace() <<
"QCPDataSelection(";
1107 QRect
rect()
const {
return mRect; }
1109 QPen
pen()
const {
return mPen; }
1114 void setPen(
const QPen &pen);
1115 void setBrush(
const QBrush &brush);
1118 Q_SLOT
void cancel();
1121 void started(QMouseEvent *event);
1122 void changed(
const QRect &rect, QMouseEvent *event);
1123 void canceled(
const QRect &rect, QInputEvent *event);
1124 void accepted(
const QRect &rect, QMouseEvent *event);
1135 virtual void startSelection(QMouseEvent *event);
1136 virtual void moveSelection(QMouseEvent *event);
1137 virtual void endSelection(QMouseEvent *event);
1138 virtual void keyPressEvent(QKeyEvent *event);
1162 bool isEmpty()
const;
1168 QHash<QCP::MarginSide, QList<QCPLayoutElement*> >
mChildren;
1188 Q_PROPERTY(
QCPLayout* layout READ layout)
1189 Q_PROPERTY(QRect rect READ rect)
1190 Q_PROPERTY(QRect outerRect READ outerRect WRITE setOuterRect)
1191 Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
1192 Q_PROPERTY(QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins)
1193 Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize)
1194 Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize)
1195 Q_PROPERTY(
SizeConstraintRect sizeConstraintRect READ sizeConstraintRect WRITE setSizeConstraintRect)
1206 Q_ENUMS(UpdatePhase)
1219 Q_ENUMS(SizeConstraintRect)
1226 QRect
rect()
const {
return mRect; }
1235 QHash<QCP::MarginSide, QCPMarginGroup*>
marginGroups()
const {
return mMarginGroups; }
1238 void setOuterRect(
const QRect &rect);
1239 void setMargins(
const QMargins &margins);
1240 void setMinimumMargins(
const QMargins &margins);
1241 void setAutoMargins(QCP::MarginSides sides);
1242 void setMinimumSize(
const QSize &
size);
1243 void setMinimumSize(
int width,
int height);
1244 void setMaximumSize(
const QSize &
size);
1245 void setMaximumSize(
int width,
int height);
1246 void setSizeConstraintRect(SizeConstraintRect constraintRect);
1247 void setMarginGroup(QCP::MarginSides sides,
QCPMarginGroup *group);
1250 virtual void update(UpdatePhase phase);
1251 virtual QSize minimumOuterSizeHint()
const;
1252 virtual QSize maximumOuterSizeHint()
const;
1253 virtual QList<QCPLayoutElement*> elements(
bool recursive)
const;
1256 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const
Q_DECL_OVERRIDE;
1261 QSize mMinimumSize, mMaximumSize;
1263 QRect mRect, mOuterRect;
1264 QMargins mMargins, mMinimumMargins;
1265 QCP::MarginSides mAutoMargins;
1270 virtual
void layoutChanged();
1295 virtual QList<QCPLayoutElement*> elements(
bool recursive)
const Q_DECL_OVERRIDE;
1298 virtual int elementCount()
const = 0;
1302 virtual void simplify();
1305 bool removeAt(
int index);
1311 virtual void updateLayout();
1314 void sizeConstraintsChanged()
const;
1317 QVector<int> getSectionSizes(QVector<int> maxSizes, QVector<int> minSizes, QVector<double> stretchFactors,
int totalSize)
const;
1331 Q_PROPERTY(
int rowCount READ rowCount)
1332 Q_PROPERTY(
int columnCount READ columnCount)
1333 Q_PROPERTY(QList<double> columnStretchFactors READ columnStretchFactors WRITE setColumnStretchFactors)
1334 Q_PROPERTY(QList<double> rowStretchFactors READ rowStretchFactors WRITE setRowStretchFactors)
1335 Q_PROPERTY(
int columnSpacing READ columnSpacing WRITE setColumnSpacing)
1336 Q_PROPERTY(
int rowSpacing READ rowSpacing WRITE setRowSpacing)
1337 Q_PROPERTY(
FillOrder fillOrder READ fillOrder WRITE setFillOrder)
1338 Q_PROPERTY(
int wrap READ wrap WRITE setWrap)
1359 int columnCount()
const {
return mElements.size() > 0 ? mElements.first().size() : 0; }
1368 void setColumnStretchFactor(
int column,
double factor);
1369 void setColumnStretchFactors(
const QList<double> &factors);
1370 void setRowStretchFactor(
int row,
double factor);
1371 void setRowStretchFactors(
const QList<double> &factors);
1372 void setColumnSpacing(
int pixels);
1373 void setRowSpacing(
int pixels);
1374 void setWrap(
int count);
1375 void setFillOrder(FillOrder order,
bool rearrange=
true);
1383 virtual QList<QCPLayoutElement*> elements(
bool recursive)
const Q_DECL_OVERRIDE;
1392 bool hasElement(
int row,
int column);
1393 void expandTo(
int newRowCount,
int newColumnCount);
1394 void insertRow(
int newIndex);
1395 void insertColumn(
int newIndex);
1396 int rowColToIndex(
int row,
int column) const;
1397 void indexToRowCol(
int index,
int &
row,
int &column) const;
1402 QList<
double> mColumnStretchFactors;
1403 QList<
double> mRowStretchFactors;
1404 int mColumnSpacing, mRowSpacing;
1409 void getMinimumRowColSizes(QVector<
int> *minColWidths, QVector<
int> *minRowHeights) const;
1410 void getMaximumRowColSizes(QVector<
int> *maxColWidths, QVector<
int> *maxRowHeights) const;
1428 Q_ENUMS(InsetPlacement)
1434 InsetPlacement insetPlacement(
int index)
const;
1435 Qt::Alignment insetAlignment(
int index)
const;
1436 QRectF insetRect(
int index)
const;
1439 void setInsetPlacement(
int index, InsetPlacement placement);
1440 void setInsetAlignment(
int index, Qt::Alignment alignment);
1441 void setInsetRect(
int index,
const QRectF &rect);
1450 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const
Q_DECL_OVERRIDE;
1460 QList<Qt::Alignment> mInsetAlignment;
1461 QList<QRectF> mInsetRect;
1500 Q_ENUMS(EndingStyle)
1503 QCPLineEnding(EndingStyle style,
double width=8,
double length=10,
bool inverted=
false);
1512 void setStyle(EndingStyle style);
1513 void setWidth(
double width);
1514 void setLength(
double length);
1515 void setInverted(
bool inverted);
1518 double boundingDistance()
const;
1519 double realLength()
const;
1552 Q_ENUMS(TickStepStrategy)
1563 void setTickStepStrategy(TickStepStrategy strategy);
1564 void setTickCount(
int count);
1565 void setTickOrigin(
double origin);
1568 virtual void generate(
const QCPRange &range,
const QLocale &locale, QChar formatChar,
int precision, QVector<double> &ticks, QVector<double> *subTicks, QVector<QString> *tickLabels);
1577 virtual double getTickStep(
const QCPRange &range);
1578 virtual int getSubTickCount(
double tickStep);
1579 virtual QString getTickLabel(
double tick,
const QLocale &locale, QChar formatChar,
int precision);
1580 virtual QVector<double> createTickVector(
double tickStep,
const QCPRange &range);
1581 virtual QVector<double> createSubTickVector(
int subTickCount,
const QVector<double> &ticks);
1582 virtual QVector<QString> createLabelVector(
const QVector<double> &ticks,
const QLocale &locale, QChar formatChar,
int precision);
1585 void trimTicks(
const QCPRange &range, QVector<double> &ticks,
bool keepOneOutlier)
const;
1586 double pickClosest(
double target,
const QVector<double> &candidates)
const;
1587 double getMantissa(
double input,
double *magnitude=0)
const;
1588 double cleanMantissa(
double input)
const;
1595 Q_DECLARE_METATYPE(QSharedPointer<QCPAxisTicker>)
1613 void setDateTimeFormat(
const QString &format);
1614 void setDateTimeSpec(Qt::TimeSpec spec);
1615 void setTickOrigin(
double origin);
1616 void setTickOrigin(
const QDateTime &origin);
1619 static QDateTime keyToDateTime(
double key);
1620 static double dateTimeToKey(
const QDateTime dateTime);
1621 static double dateTimeToKey(
const QDate date);
1634 virtual QString getTickLabel(
double tick,
const QLocale &locale, QChar formatChar,
int precision)
Q_DECL_OVERRIDE;
1668 void setTimeFormat(
const QString &format);
1669 void setFieldWidth(TimeUnit unit,
int width);
1683 virtual QString getTickLabel(
double tick,
const QLocale &locale, QChar formatChar,
int precision)
Q_DECL_OVERRIDE;
1686 void replaceUnit(QString &
text,
TimeUnit unit,
int value)
const;
1710 Q_ENUMS(ScaleStrategy)
1719 void setTickStep(
double step);
1720 void setScaleStrategy(ScaleStrategy strategy);
1744 QMap<double, QString> &
ticks() {
return mTicks; }
1748 void setTicks(
const QMap<double, QString> &ticks);
1749 void setTicks(
const QVector<double> &positions,
const QVector<QString> &labels);
1750 void setSubTickCount(
int subTicks);
1754 void addTick(
double position,
const QString &label);
1755 void addTicks(
const QMap<double, QString> &ticks);
1756 void addTicks(
const QVector<double> &positions,
const QVector<QString> &labels);
1766 virtual QString getTickLabel(
double tick,
const QLocale &locale, QChar formatChar,
int precision)
Q_DECL_OVERRIDE;
1789 Q_ENUMS(FractionStyle)
1800 void setPiSymbol(QString symbol);
1801 void setPiValue(
double pi);
1802 void setPeriodicity(
int multiplesOfPi);
1803 void setFractionStyle(FractionStyle style);
1818 virtual QString getTickLabel(
double tick,
const QLocale &locale, QChar formatChar,
int precision)
Q_DECL_OVERRIDE;
1821 void simplifyFraction(
int &numerator,
int &denominator)
const;
1822 QString fractionToString(
int numerator,
int denominator)
const;
1823 QString unicodeFraction(
int numerator,
int denominator)
const;
1824 QString unicodeSuperscript(
int number)
const;
1825 QString unicodeSubscript(
int number)
const;
1845 void setLogBase(
double base);
1846 void setSubTickCount(
int subTicks);
1872 Q_PROPERTY(
bool subGridVisible READ subGridVisible WRITE setSubGridVisible)
1873 Q_PROPERTY(
bool antialiasedSubGrid READ antialiasedSubGrid WRITE setAntialiasedSubGrid)
1874 Q_PROPERTY(
bool antialiasedZeroLine READ antialiasedZeroLine WRITE setAntialiasedZeroLine)
1875 Q_PROPERTY(QPen pen READ pen WRITE setPen)
1876 Q_PROPERTY(QPen subGridPen READ subGridPen WRITE setSubGridPen)
1877 Q_PROPERTY(QPen zeroLinePen READ zeroLinePen WRITE setZeroLinePen)
1886 QPen
pen()
const {
return mPen; }
1891 void setSubGridVisible(
bool visible);
1892 void setAntialiasedSubGrid(
bool enabled);
1893 void setAntialiasedZeroLine(
bool enabled);
1894 void setPen(
const QPen &pen);
1895 void setSubGridPen(
const QPen &pen);
1896 void setZeroLinePen(
const QPen &pen);
1912 void drawGridLines(
QCPPainter *painter)
const;
1913 void drawSubGridLines(
QCPPainter *painter)
const;
1923 Q_PROPERTY(
AxisType axisType READ axisType)
1925 Q_PROPERTY(
ScaleType scaleType READ scaleType WRITE setScaleType NOTIFY scaleTypeChanged)
1926 Q_PROPERTY(
QCPRange range READ range WRITE setRange NOTIFY rangeChanged)
1927 Q_PROPERTY(
bool rangeReversed READ rangeReversed WRITE setRangeReversed)
1928 Q_PROPERTY(QSharedPointer<QCPAxisTicker> ticker READ ticker WRITE setTicker)
1929 Q_PROPERTY(
bool ticks READ ticks WRITE setTicks)
1930 Q_PROPERTY(
bool tickLabels READ tickLabels WRITE setTickLabels)
1931 Q_PROPERTY(
int tickLabelPadding READ tickLabelPadding WRITE setTickLabelPadding)
1932 Q_PROPERTY(QFont tickLabelFont READ tickLabelFont WRITE setTickLabelFont)
1933 Q_PROPERTY(QColor tickLabelColor READ tickLabelColor WRITE setTickLabelColor)
1934 Q_PROPERTY(
double tickLabelRotation READ tickLabelRotation WRITE setTickLabelRotation)
1935 Q_PROPERTY(
LabelSide tickLabelSide READ tickLabelSide WRITE setTickLabelSide)
1936 Q_PROPERTY(QString numberFormat READ numberFormat WRITE setNumberFormat)
1937 Q_PROPERTY(
int numberPrecision READ numberPrecision WRITE setNumberPrecision)
1938 Q_PROPERTY(QVector<double> tickVector READ tickVector)
1939 Q_PROPERTY(QVector<QString> tickVectorLabels READ tickVectorLabels)
1940 Q_PROPERTY(
int tickLengthIn READ tickLengthIn WRITE setTickLengthIn)
1941 Q_PROPERTY(
int tickLengthOut READ tickLengthOut WRITE setTickLengthOut)
1942 Q_PROPERTY(
bool subTicks READ subTicks WRITE setSubTicks)
1943 Q_PROPERTY(
int subTickLengthIn READ subTickLengthIn WRITE setSubTickLengthIn)
1944 Q_PROPERTY(
int subTickLengthOut READ subTickLengthOut WRITE setSubTickLengthOut)
1945 Q_PROPERTY(QPen basePen READ basePen WRITE setBasePen)
1946 Q_PROPERTY(QPen tickPen READ tickPen WRITE setTickPen)
1947 Q_PROPERTY(QPen subTickPen READ subTickPen WRITE setSubTickPen)
1948 Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont)
1949 Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor)
1950 Q_PROPERTY(QString label READ label WRITE setLabel)
1951 Q_PROPERTY(
int labelPadding READ labelPadding WRITE setLabelPadding)
1952 Q_PROPERTY(
int padding READ padding WRITE setPadding)
1953 Q_PROPERTY(
int offset READ offset WRITE setOffset)
1954 Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectionChanged)
1955 Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectableChanged)
1956 Q_PROPERTY(QFont selectedTickLabelFont READ selectedTickLabelFont WRITE setSelectedTickLabelFont)
1957 Q_PROPERTY(QFont selectedLabelFont READ selectedLabelFont WRITE setSelectedLabelFont)
1958 Q_PROPERTY(QColor selectedTickLabelColor READ selectedTickLabelColor WRITE setSelectedTickLabelColor)
1959 Q_PROPERTY(QColor selectedLabelColor READ selectedLabelColor WRITE setSelectedLabelColor)
1960 Q_PROPERTY(QPen selectedBasePen READ selectedBasePen WRITE setSelectedBasePen)
1961 Q_PROPERTY(QPen selectedTickPen READ selectedTickPen WRITE setSelectedTickPen)
1962 Q_PROPERTY(QPen selectedSubTickPen READ selectedSubTickPen WRITE setSelectedSubTickPen)
1963 Q_PROPERTY(
QCPLineEnding lowerEnding READ lowerEnding WRITE setLowerEnding)
1964 Q_PROPERTY(
QCPLineEnding upperEnding READ upperEnding WRITE setUpperEnding)
1965 Q_PROPERTY(
QCPGrid* grid READ grid)
1979 Q_DECLARE_FLAGS(AxisTypes, AxisType)
2003 ,spTickLabels = 0x002
2004 ,spAxisLabel = 0x004
2006 Q_ENUMS(SelectablePart)
2007 Q_FLAGS(SelectableParts)
2008 Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
2019 QSharedPointer<QCPAxisTicker>
ticker()
const {
return mTicker; }
2022 int tickLabelPadding()
const;
2025 double tickLabelRotation()
const;
2026 LabelSide tickLabelSide()
const;
2027 QString numberFormat()
const;
2031 int tickLengthIn()
const;
2032 int tickLengthOut()
const;
2034 int subTickLengthIn()
const;
2035 int subTickLengthOut()
const;
2041 QString
label()
const {
return mLabel; }
2042 int labelPadding()
const;
2060 Q_SLOT
void setRange(
const QCPRange &range);
2061 void setRange(
double lower,
double upper);
2062 void setRange(
double position,
double size, Qt::AlignmentFlag alignment);
2063 void setRangeLower(
double lower);
2064 void setRangeUpper(
double upper);
2065 void setRangeReversed(
bool reversed);
2066 void setTicker(QSharedPointer<QCPAxisTicker> ticker);
2067 void setTicks(
bool show);
2068 void setTickLabels(
bool show);
2069 void setTickLabelPadding(
int padding);
2070 void setTickLabelFont(
const QFont &font);
2071 void setTickLabelColor(
const QColor &color);
2072 void setTickLabelRotation(
double degrees);
2073 void setTickLabelSide(LabelSide side);
2074 void setNumberFormat(
const QString &formatCode);
2075 void setNumberPrecision(
int precision);
2076 void setTickLength(
int inside,
int outside=0);
2077 void setTickLengthIn(
int inside);
2078 void setTickLengthOut(
int outside);
2079 void setSubTicks(
bool show);
2080 void setSubTickLength(
int inside,
int outside=0);
2081 void setSubTickLengthIn(
int inside);
2082 void setSubTickLengthOut(
int outside);
2083 void setBasePen(
const QPen &pen);
2084 void setTickPen(
const QPen &pen);
2085 void setSubTickPen(
const QPen &pen);
2086 void setLabelFont(
const QFont &font);
2087 void setLabelColor(
const QColor &color);
2088 void setLabel(
const QString &str);
2089 void setLabelPadding(
int padding);
2090 void setPadding(
int padding);
2091 void setOffset(
int offset);
2092 void setSelectedTickLabelFont(
const QFont &font);
2093 void setSelectedLabelFont(
const QFont &font);
2094 void setSelectedTickLabelColor(
const QColor &color);
2095 void setSelectedLabelColor(
const QColor &color);
2096 void setSelectedBasePen(
const QPen &pen);
2097 void setSelectedTickPen(
const QPen &pen);
2098 void setSelectedSubTickPen(
const QPen &pen);
2099 Q_SLOT
void setSelectableParts(
const QCPAxis::SelectableParts &selectableParts);
2100 Q_SLOT
void setSelectedParts(
const QCPAxis::SelectableParts &selectedParts);
2105 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const
Q_DECL_OVERRIDE;
2108 Qt::Orientation orientation()
const {
return mOrientation; }
2110 void moveRange(
double diff);
2111 void scaleRange(
double factor);
2112 void scaleRange(
double factor,
double center);
2113 void setScaleRatio(
const QCPAxis *otherAxis,
double ratio=1.0);
2114 void rescale(
bool onlyVisiblePlottables=
false);
2115 double pixelToCoord(
double value)
const;
2116 double coordToPixel(
double value)
const;
2117 SelectablePart getPartAt(
const QPointF &pos)
const;
2118 QList<QCPAbstractPlottable*> plottables()
const;
2119 QList<QCPGraph*> graphs()
const;
2120 QList<QCPAbstractItem*> items()
const;
2124 static AxisType opposite(AxisType type);
2127 void rangeChanged(
const QCPRange &newRange);
2130 void selectionChanged(
const QCPAxis::SelectableParts &parts);
2131 void selectableChanged(
const QCPAxis::SelectableParts &parts);
2184 virtual int calculateMargin();
2191 virtual
void selectEvent(QMouseEvent *event,
bool additive, const QVariant &details,
bool *selectionStateChanged)
Q_DECL_OVERRIDE;
2192 virtual
void deselectEvent(
bool *selectionStateChanged)
Q_DECL_OVERRIDE;
2194 virtual
void mousePressEvent(QMouseEvent *event, const QVariant &details)
Q_DECL_OVERRIDE;
2195 virtual
void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos)
Q_DECL_OVERRIDE;
2196 virtual
void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos)
Q_DECL_OVERRIDE;
2200 void setupTickVectors();
2201 QPen getBasePen() const;
2202 QPen getTickPen() const;
2203 QPen getSubTickPen() const;
2204 QFont getTickLabelFont() const;
2205 QFont getLabelFont() const;
2206 QColor getTickLabelColor() const;
2207 QColor getLabelColor() const;
2216 Q_DECLARE_OPERATORS_FOR_FLAGS(
QCPAxis::SelectableParts)
2217 Q_DECLARE_OPERATORS_FOR_FLAGS(
QCPAxis::AxisTypes)
2231 virtual int size()
const;
2273 QRect baseBounds, expBounds, suffixBounds,
totalBounds, rotatedTotalBounds;
2281 virtual QByteArray generateLabelParameterHash()
const;
2283 virtual void placeTickLabel(
QCPPainter *painter,
double position,
int distanceToAxis,
const QString &
text, QSize *tickLabelsSize);
2285 virtual TickLabelData getTickLabelData(
const QFont &font,
const QString &
text)
const;
2286 virtual QPointF getTickLabelDrawOffset(
const TickLabelData &labelData)
const;
2287 virtual void getMaxTickLabelSize(
const QFont &font,
const QString &
text, QSize *tickLabelsSize)
const;
2315 Q_ENUMS(ScatterProperty)
2316 Q_FLAGS(ScatterProperties)
2317 Q_DECLARE_FLAGS(ScatterProperties, ScatterProperty)
2345 Q_ENUMS(ScatterShape)
2350 QCPScatterStyle(ScatterShape shape,
const QColor &color,
const QColor &fill,
double size);
2353 QCPScatterStyle(
const QPainterPath &customPath,
const QPen &pen,
const QBrush &brush=Qt::NoBrush,
double size=6);
2356 double size()
const {
return mSize; }
2358 QPen
pen()
const {
return mPen; }
2364 void setFromOther(
const QCPScatterStyle &other, ScatterProperties properties);
2365 void setSize(
double size);
2366 void setShape(ScatterShape shape);
2367 void setPen(
const QPen &pen);
2368 void setBrush(
const QBrush &brush);
2369 void setPixmap(
const QPixmap &pixmap);
2370 void setCustomPath(
const QPainterPath &customPath);
2373 bool isNone()
const {
return mShape == ssNone; }
2376 void applyTo(
QCPPainter *painter,
const QPen &defaultPen)
const;
2377 void drawShape(
QCPPainter *painter,
const QPointF &pos)
const;
2378 void drawShape(
QCPPainter *painter,
double x,
double y)
const;
2393 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPScatterStyle::ScatterProperties)
2408 template <
class DataType>
2411 template <
class DataType>
2421 int size()
const {
return mData.size()-mPreallocSize; }
2426 void setAutoSqueeze(
bool enabled);
2430 void set(
const QVector<DataType> &data,
bool alreadySorted=
false);
2432 void add(
const QVector<DataType> &data,
bool alreadySorted=
false);
2433 void add(
const DataType &data);
2434 void removeBefore(
double sortKey);
2435 void removeAfter(
double sortKey);
2436 void remove(
double sortKeyFrom,
double sortKeyTo);
2437 void remove(
double sortKey);
2440 void squeeze(
bool preAllocation=
true,
bool postAllocation=
true);
2446 const_iterator findBegin(
double sortKey,
bool expandedRange=
true)
const;
2447 const_iterator findEnd(
double sortKey,
bool expandedRange=
true)
const;
2452 void limitIteratorsToDataRange(const_iterator &begin, const_iterator &end,
const QCPDataRange &dataRange)
const;
2464 void preallocateGrow(
int minimumPreallocSize);
2465 void performAutoSqueeze();
2606 template <
class DataType>
2610 mPreallocIteration(0)
2622 template <
class DataType>
2625 if (mAutoSqueeze != enabled)
2627 mAutoSqueeze = enabled;
2629 performAutoSqueeze();
2639 template <
class DataType>
2655 template <
class DataType>
2660 mPreallocIteration = 0;
2671 template <
class DataType>
2677 const int n = data.
size();
2678 const int oldSize =
size();
2680 if (oldSize > 0 && !qcpLessThanSortKey<DataType>(*constBegin(), *(data.
constEnd()-1)))
2682 if (mPreallocSize <
n)
2688 mData.resize(mData.size()+
n);
2690 if (oldSize > 0 && !qcpLessThanSortKey<DataType>(*(constEnd()-
n-1), *(constEnd()-
n)))
2691 std::inplace_merge(begin(), end()-
n, end(), qcpLessThanSortKey<DataType>);
2703 template <
class DataType>
2710 set(data, alreadySorted);
2714 const int n = data.size();
2715 const int oldSize =
size();
2717 if (alreadySorted && oldSize > 0 && !qcpLessThanSortKey<DataType>(*constBegin(), *(data.constEnd()-1)))
2719 if (mPreallocSize <
n)
2722 std::copy(data.constBegin(), data.constEnd(), begin());
2725 mData.resize(mData.size()+
n);
2726 std::copy(data.constBegin(), data.constEnd(), end()-
n);
2728 std::sort(end()-
n, end(), qcpLessThanSortKey<DataType>);
2729 if (oldSize > 0 && !qcpLessThanSortKey<DataType>(*(constEnd()-
n-1), *(constEnd()-
n)))
2730 std::inplace_merge(begin(), end()-
n, end(), qcpLessThanSortKey<DataType>);
2740 template <
class DataType>
2743 if (isEmpty() || !qcpLessThanSortKey<DataType>(data, *(constEnd()-1)))
2746 }
else if (qcpLessThanSortKey<DataType>(data, *constBegin()))
2748 if (mPreallocSize < 1)
2755 mData.insert(insertionPoint, data);
2764 template <
class DataType>
2769 mPreallocSize += itEnd-it;
2771 performAutoSqueeze();
2779 template <
class DataType>
2784 mData.erase(it, itEnd);
2786 performAutoSqueeze();
2796 template <
class DataType>
2799 if (sortKeyFrom >= sortKeyTo || isEmpty())
2804 mData.erase(it, itEnd);
2806 performAutoSqueeze();
2818 template <
class DataType>
2821 QCPDataContainer::iterator it = std::lower_bound(begin(), end(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
2822 if (it != end() && it->sortKey() == sortKey)
2830 performAutoSqueeze();
2838 template <
class DataType>
2842 mPreallocIteration = 0;
2857 template <
class DataType>
2860 std::sort(begin(), end(), qcpLessThanSortKey<DataType>);
2873 template <
class DataType>
2878 if (mPreallocSize > 0)
2880 std::copy(begin(), end(), mData.begin());
2881 mData.resize(
size());
2884 mPreallocIteration = 0;
2905 template <
class DataType>
2912 if (expandedRange && it != constBegin())
2932 template <
class DataType>
2939 if (expandedRange && it != constEnd())
2959 template <
class DataType>
2968 bool haveLower =
false;
2969 bool haveUpper =
false;
2976 if (DataType::sortKeyIsMainKey())
2980 if (!qIsNaN(it->mainValue()))
2982 range.
lower = it->mainKey();
2989 while (it != constBegin())
2992 if (!qIsNaN(it->mainValue()))
2994 range.
upper = it->mainKey();
3003 if (!qIsNaN(it->mainValue()))
3005 current = it->mainKey();
3006 if (current < range.
lower || !haveLower)
3008 range.
lower = current;
3011 if (current > range.
upper || !haveUpper)
3013 range.
upper = current;
3024 if (!qIsNaN(it->mainValue()))
3026 current = it->mainKey();
3027 if ((current < range.
lower || !haveLower) && current < 0)
3029 range.
lower = current;
3032 if ((current > range.
upper || !haveUpper) && current < 0)
3034 range.
upper = current;
3044 if (!qIsNaN(it->mainValue()))
3046 current = it->mainKey();
3047 if ((current < range.
lower || !haveLower) && current > 0)
3049 range.
lower = current;
3052 if ((current > range.
upper || !haveUpper) && current > 0)
3054 range.
upper = current;
3062 foundRange = haveLower && haveUpper;
3082 template <
class DataType>
3091 const bool restrictKeyRange = inKeyRange !=
QCPRange();
3092 bool haveLower =
false;
3093 bool haveUpper =
false;
3097 if (DataType::sortKeyIsMainKey() && restrictKeyRange)
3099 itBegin = findBegin(inKeyRange.
lower);
3100 itEnd = findEnd(inKeyRange.
upper);
3106 if (restrictKeyRange && (it->mainKey() < inKeyRange.
lower || it->mainKey() > inKeyRange.
upper))
3108 current = it->valueRange();
3109 if ((current.
lower < range.
lower || !haveLower) && !qIsNaN(current.
lower))
3114 if ((current.
upper > range.
upper || !haveUpper) && !qIsNaN(current.
upper))
3124 if (restrictKeyRange && (it->mainKey() < inKeyRange.
lower || it->mainKey() > inKeyRange.
upper))
3126 current = it->valueRange();
3127 if ((current.
lower < range.
lower || !haveLower) && current.
lower < 0 && !qIsNaN(current.
lower))
3132 if ((current.
upper > range.
upper || !haveUpper) && current.
upper < 0 && !qIsNaN(current.
upper))
3142 if (restrictKeyRange && (it->mainKey() < inKeyRange.
lower || it->mainKey() > inKeyRange.
upper))
3144 current = it->valueRange();
3145 if ((current.
lower < range.
lower || !haveLower) && current.
lower > 0 && !qIsNaN(current.
lower))
3150 if ((current.
upper > range.
upper || !haveUpper) && current.
upper > 0 && !qIsNaN(current.
upper))
3158 foundRange = haveLower && haveUpper;
3170 template <
class DataType>
3173 QCPDataRange iteratorRange(begin-constBegin(), end-constBegin());
3174 iteratorRange = iteratorRange.
bounded(dataRange.
bounded(this->dataRange()));
3175 begin = constBegin()+iteratorRange.
begin();
3176 end = constBegin()+iteratorRange.
end();
3188 template <
class DataType>
3191 if (minimumPreallocSize <= mPreallocSize)
3194 int newPreallocSize = minimumPreallocSize;
3195 newPreallocSize += (1u<<qBound(4, mPreallocIteration+4, 15)) - 12;
3196 ++mPreallocIteration;
3198 int sizeDifference = newPreallocSize-mPreallocSize;
3199 mData.resize(mData.size()+sizeDifference);
3200 std::copy_backward(mData.begin()+mPreallocSize, mData.end()-sizeDifference, mData.end());
3201 mPreallocSize = newPreallocSize;
3218 template <
class DataType>
3221 const int totalAlloc = mData.capacity();
3222 const int postAllocSize = totalAlloc-mData.size();
3223 const int usedSize =
size();
3224 bool shrinkPostAllocation =
false;
3225 bool shrinkPreAllocation =
false;
3226 if (totalAlloc > 650000)
3228 shrinkPostAllocation = postAllocSize > usedSize*1.5;
3229 shrinkPreAllocation = mPreallocSize*10 > usedSize;
3230 }
else if (totalAlloc > 1000)
3232 shrinkPostAllocation = postAllocSize > usedSize*5;
3233 shrinkPreAllocation = mPreallocSize > usedSize*1.5;
3236 if (shrinkPreAllocation || shrinkPostAllocation)
3237 squeeze(shrinkPreAllocation, shrinkPostAllocation);
3256 QPen
pen()
const {
return mPen; }
3262 void setPen(
const QPen &pen);
3263 void setBrush(
const QBrush &brush);
3265 void setUsedScatterProperties(
const QCPScatterStyle::ScatterProperties &properties);
3299 Q_PROPERTY(QString name READ name WRITE setName)
3300 Q_PROPERTY(
bool antialiasedFill READ antialiasedFill WRITE setAntialiasedFill)
3301 Q_PROPERTY(
bool antialiasedScatters READ antialiasedScatters WRITE setAntialiasedScatters)
3302 Q_PROPERTY(QPen pen READ pen WRITE setPen)
3303 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
3304 Q_PROPERTY(
QCPAxis* keyAxis READ keyAxis WRITE setKeyAxis)
3305 Q_PROPERTY(
QCPAxis* valueAxis READ valueAxis WRITE setValueAxis)
3306 Q_PROPERTY(
QCP::SelectionType selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
3307 Q_PROPERTY(
QCPDataSelection selection READ selection WRITE setSelection NOTIFY selectionChanged)
3308 Q_PROPERTY(
QCPSelectionDecorator* selectionDecorator READ selectionDecorator WRITE setSelectionDecorator)
3315 QString
name()
const {
return mName; }
3318 QPen
pen()
const {
return mPen; }
3323 bool selected()
const {
return !mSelection.isEmpty(); }
3328 void setName(
const QString &name);
3329 void setAntialiasedFill(
bool enabled);
3330 void setAntialiasedScatters(
bool enabled);
3331 void setPen(
const QPen &pen);
3332 void setBrush(
const QBrush &brush);
3333 void setKeyAxis(
QCPAxis *axis);
3334 void setValueAxis(
QCPAxis *axis);
3340 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const
Q_DECL_OVERRIDE = 0;
3346 void coordsToPixels(
double key,
double value,
double &
x,
double &
y)
const;
3347 const QPointF coordsToPixels(
double key,
double value)
const;
3348 void pixelsToCoords(
double x,
double y,
double &key,
double &value)
const;
3349 void pixelsToCoords(
const QPointF &pixelPos,
double &key,
double &value)
const;
3350 void rescaleAxes(
bool onlyEnlarge=
false)
const;
3351 void rescaleKeyAxis(
bool onlyEnlarge=
false)
const;
3352 void rescaleValueAxis(
bool onlyEnlarge=
false,
bool inKeyRange=
false)
const;
3355 bool removeFromLegend(
QCPLegend *legend)
const;
3356 bool removeFromLegend()
const;
3359 void selectionChanged(
bool selected);
3380 virtual
void selectEvent(QMouseEvent *event,
bool additive, const QVariant &details,
bool *selectionStateChanged)
Q_DECL_OVERRIDE;
3381 virtual
void deselectEvent(
bool *selectionStateChanged)
Q_DECL_OVERRIDE;
3384 virtual
void drawLegendIcon(
QCPPainter *painter, const QRectF &rect) const = 0;
3387 void applyFillAntialiasingHint(
QCPPainter *painter) const;
3388 void applyScattersAntialiasingHint(
QCPPainter *painter) const;
3413 QString
name()
const {
return mName; }
3414 virtual QPointF pixelPosition()
const;
3462 Q_ENUMS(PositionType)
3474 double key()
const {
return mKey; }
3476 QPointF
coords()
const {
return QPointF(mKey, mValue); }
3483 void setType(PositionType type);
3484 void setTypeX(PositionType type);
3485 void setTypeY(PositionType type);
3486 bool setParentAnchor(
QCPItemAnchor *parentAnchor,
bool keepPixelPosition=false);
3487 bool setParentAnchorX(
QCPItemAnchor *parentAnchor,
bool keepPixelPosition=false);
3488 bool setParentAnchorY(
QCPItemAnchor *parentAnchor,
bool keepPixelPosition=false);
3489 void setCoords(
double key,
double value);
3490 void setCoords(const QPointF &coords);
3493 void setPixelPosition(const QPointF &pixelPosition);
3500 double mKey, mValue;
3517 Q_PROPERTY(
bool clipToAxisRect READ clipToAxisRect WRITE setClipToAxisRect)
3518 Q_PROPERTY(
QCPAxisRect* clipAxisRect READ clipAxisRect WRITE setClipAxisRect)
3519 Q_PROPERTY(
bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
3520 Q_PROPERTY(
bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
3533 void setClipToAxisRect(
bool clip);
3535 Q_SLOT
void setSelectable(
bool selectable);
3536 Q_SLOT
void setSelected(
bool selected);
3539 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const
Q_DECL_OVERRIDE = 0;
3543 QList<QCPItemAnchor*>
anchors()
const {
return mAnchors; }
3546 bool hasAnchor(
const QString &name)
const;
3549 void selectionChanged(
bool selected);
3550 void selectableChanged(
bool selectable);
3566 virtual
void selectEvent(QMouseEvent *event,
bool additive, const QVariant &details,
bool *selectionStateChanged)
Q_DECL_OVERRIDE;
3567 virtual
void deselectEvent(
bool *selectionStateChanged)
Q_DECL_OVERRIDE;
3570 virtual QPointF anchorPixelPosition(
int anchorId) const;
3573 double rectDistance(const QRectF &rect, const QPointF &pos,
bool filledRect) const;
3575 QCPItemAnchor *createAnchor(const QString &name,
int anchorId);
3594 Q_PROPERTY(QRect viewport READ viewport WRITE setViewport)
3595 Q_PROPERTY(QPixmap background READ background WRITE setBackground)
3596 Q_PROPERTY(
bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
3597 Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
3599 Q_PROPERTY(
bool autoAddPlottableToLegend READ autoAddPlottableToLegend WRITE setAutoAddPlottableToLegend)
3600 Q_PROPERTY(
int selectionTolerance READ selectionTolerance WRITE setSelectionTolerance)
3601 Q_PROPERTY(
bool noAntialiasingOnDrag READ noAntialiasingOnDrag WRITE setNoAntialiasingOnDrag)
3602 Q_PROPERTY(Qt::KeyboardModifier multiSelectModifier READ multiSelectModifier WRITE setMultiSelectModifier)
3603 Q_PROPERTY(
bool openGl READ openGl WRITE setOpenGl)
3614 Q_ENUMS(LayerInsertMode)
3626 Q_ENUMS(RefreshPriority)
3651 void setViewport(
const QRect &rect);
3652 void setBufferDevicePixelRatio(
double ratio);
3653 void setBackground(
const QPixmap &pm);
3654 void setBackground(
const QPixmap &pm,
bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
3655 void setBackground(
const QBrush &brush);
3656 void setBackgroundScaled(
bool scaled);
3657 void setBackgroundScaledMode(Qt::AspectRatioMode mode);
3658 void setAntialiasedElements(
const QCP::AntialiasedElements &antialiasedElements);
3660 void setNotAntialiasedElements(
const QCP::AntialiasedElements ¬AntialiasedElements);
3662 void setAutoAddPlottableToLegend(
bool on);
3663 void setInteractions(
const QCP::Interactions &interactions);
3664 void setInteraction(
const QCP::Interaction &interaction,
bool enabled=
true);
3665 void setSelectionTolerance(
int pixels);
3666 void setNoAntialiasingOnDrag(
bool enabled);
3667 void setPlottingHints(
const QCP::PlottingHints &hints);
3669 void setMultiSelectModifier(Qt::KeyboardModifier modifier);
3672 void setOpenGl(
bool enabled,
int multisampling=16);
3679 bool removePlottable(
int index);
3680 int clearPlottables();
3681 int plottableCount()
const;
3682 QList<QCPAbstractPlottable*> selectedPlottables()
const;
3691 bool removeGraph(
int index);
3693 int graphCount()
const;
3694 QList<QCPGraph*> selectedGraphs()
const;
3700 bool removeItem(
int index);
3702 int itemCount()
const;
3703 QList<QCPAbstractItem*> selectedItems()
const;
3704 QCPAbstractItem *itemAt(
const QPointF &pos,
bool onlySelectable=
false)
const;
3708 QCPLayer *layer(
const QString &name)
const;
3711 bool setCurrentLayer(
const QString &name);
3712 bool setCurrentLayer(
QCPLayer *layer);
3713 int layerCount()
const;
3714 bool addLayer(
const QString &name,
QCPLayer *otherLayer=0, LayerInsertMode insertMode=limAbove);
3716 bool moveLayer(
QCPLayer *layer,
QCPLayer *otherLayer, LayerInsertMode insertMode=limAbove);
3719 int axisRectCount()
const;
3721 QList<QCPAxisRect*> axisRects()
const;
3723 QCPAxisRect* axisRectAt(
const QPointF &pos)
const;
3724 Q_SLOT
void rescaleAxes(
bool onlyVisiblePlottables=
false);
3726 QList<QCPAxis*> selectedAxes()
const;
3727 QList<QCPLegend*> selectedLegends()
const;
3728 Q_SLOT
void deselectAll();
3730 bool savePdf(
const QString &fileName,
int width=0,
int height=0,
QCP::ExportPen exportPen=
QCP::epAllowCosmetic,
const QString &pdfCreator=QString(),
const QString &pdfTitle=QString());
3734 bool saveRastered(
const QString &fileName,
int width,
int height,
double scale,
const char *format,
int quality=-1,
int resolution=96,
QCP::ResolutionUnit resolutionUnit=
QCP::ruDotsPerInch);
3735 QPixmap toPixmap(
int width=0,
int height=0,
double scale=1.0);
3736 void toPainter(
QCPPainter *painter,
int width=0,
int height=0);
3743 void mouseDoubleClick(QMouseEvent *event);
3744 void mousePress(QMouseEvent *event);
3745 void mouseMove(QMouseEvent *event);
3746 void mouseRelease(QMouseEvent *event);
3747 void mouseWheel(QWheelEvent *event);
3758 void selectionChangedByUser();
3759 void beforeReplot();
3801 #ifdef QCP_OPENGL_FBO
3802 QSharedPointer<QOpenGLContext> mGlContext;
3803 QSharedPointer<QSurface> mGlSurface;
3804 QSharedPointer<QOpenGLPaintDevice> mGlPaintDevice;
3812 virtual
void mouseDoubleClickEvent(QMouseEvent *event)
Q_DECL_OVERRIDE;
3820 virtual
void updateLayout();
3821 virtual
void axisRemoved(
QCPAxis *axis);
3822 virtual
void legendRemoved(
QCPLegend *legend);
3823 Q_SLOT virtual
void processRectSelection(QRect rect, QMouseEvent *event);
3824 Q_SLOT virtual
void processRectZoom(QRect rect, QMouseEvent *event);
3825 Q_SLOT virtual
void processPointSelection(QMouseEvent *event);
3829 bool registerGraph(
QCPGraph *graph);
3831 void updateLayerIndices() const;
3832 QCPLayerable *layerableAt(const QPointF &pos,
bool onlySelectable, QVariant *selectionDetails=0) const;
3833 QList<
QCPLayerable*> layerableListAt(const QPointF &pos,
bool onlySelectable, QList<QVariant> *selectionDetails=0) const;
3835 void setupPaintBuffers();
3837 bool hasInvalidatedPaintBuffers();
3863 virtual int dataCount()
const = 0;
3864 virtual double dataMainKey(
int index)
const = 0;
3865 virtual double dataSortKey(
int index)
const = 0;
3866 virtual double dataMainValue(
int index)
const = 0;
3867 virtual QCPRange dataValueRange(
int index)
const = 0;
3868 virtual QPointF dataPixelPosition(
int index)
const = 0;
3869 virtual bool sortKeyIsMainKey()
const = 0;
3870 virtual QCPDataSelection selectTestRect(
const QRectF &rect,
bool onlySelectable)
const = 0;
3871 virtual int findBegin(
double sortKey,
bool expandedRange=
true)
const = 0;
3872 virtual int findEnd(
double sortKey,
bool expandedRange=
true)
const = 0;
3875 template <
class DataType>
3893 virtual int findBegin(
double sortKey,
bool expandedRange=
true)
const Q_DECL_OVERRIDE;
3894 virtual int findEnd(
double sortKey,
bool expandedRange=
true)
const Q_DECL_OVERRIDE;
3897 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const Q_DECL_OVERRIDE;
3905 void getDataSegments(QList<QCPDataRange> &selectedSegments, QList<QCPDataRange> &unselectedSegments)
const;
3906 void drawPolyline(
QCPPainter *painter,
const QVector<QPointF> &lineData)
const;
4103 template <
class DataType>
4110 template <
class DataType>
4118 template <
class DataType>
4121 return mDataContainer->size();
4127 template <
class DataType>
4130 if (index >= 0 && index < mDataContainer->
size())
4132 return (mDataContainer->constBegin()+index)->mainKey();
4135 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
4143 template <
class DataType>
4146 if (index >= 0 && index < mDataContainer->
size())
4148 return (mDataContainer->constBegin()+index)->sortKey();
4151 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
4159 template <
class DataType>
4162 if (index >= 0 && index < mDataContainer->
size())
4164 return (mDataContainer->constBegin()+index)->mainValue();
4167 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
4175 template <
class DataType>
4178 if (index >= 0 && index < mDataContainer->
size())
4180 return (mDataContainer->constBegin()+index)->valueRange();
4183 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
4191 template <
class DataType>
4194 if (index >= 0 && index < mDataContainer->
size())
4197 return coordsToPixels(it->mainKey(), it->mainValue());
4200 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
4208 template <
class DataType>
4211 return DataType::sortKeyIsMainKey();
4221 template <
class DataType>
4225 if ((onlySelectable && mSelectable ==
QCP::stNone) || mDataContainer->isEmpty())
4227 if (!mKeyAxis || !mValueAxis)
4231 double key1, value1, key2, value2;
4232 pixelsToCoords(rect.topLeft(), key1, value1);
4233 pixelsToCoords(rect.bottomRight(), key2, value2);
4235 QCPRange valueRange(value1, value2);
4238 if (DataType::sortKeyIsMainKey())
4246 int currentSegmentBegin = -1;
4249 if (currentSegmentBegin == -1)
4251 if (valueRange.
contains(it->mainValue()) && keyRange.
contains(it->mainKey()))
4252 currentSegmentBegin = it-mDataContainer->constBegin();
4253 }
else if (!valueRange.
contains(it->mainValue()) || !keyRange.
contains(it->mainKey()))
4256 currentSegmentBegin = -1;
4260 if (currentSegmentBegin != -1)
4270 template <
class DataType>
4273 return mDataContainer->findBegin(sortKey, expandedRange)-mDataContainer->constBegin();
4279 template <
class DataType>
4282 return mDataContainer->findEnd(sortKey, expandedRange)-mDataContainer->constBegin();
4295 template <
class DataType>
4298 if ((onlySelectable && mSelectable ==
QCP::stNone) || mDataContainer->isEmpty())
4300 if (!mKeyAxis || !mValueAxis)
4305 int minDistIndex = mDataContainer->size();
4309 if (DataType::sortKeyIsMainKey())
4312 double posKeyMin, posKeyMax, dummy;
4315 if (posKeyMin > posKeyMax)
4316 qSwap(posKeyMin, posKeyMax);
4317 begin = mDataContainer->
findBegin(posKeyMin,
true);
4318 end = mDataContainer->
findEnd(posKeyMax,
true);
4322 QCPRange keyRange(mKeyAxis->range());
4323 QCPRange valueRange(mValueAxis->range());
4326 const double mainKey = it->mainKey();
4327 const double mainValue = it->mainValue();
4331 if (currentDistSqr < minDistSqr)
4333 minDistSqr = currentDistSqr;
4334 minDistIndex = it-mDataContainer->constBegin();
4338 if (minDistIndex != mDataContainer->size())
4343 details->setValue(selectionResult);
4344 return qSqrt(minDistSqr);
4357 template <
class DataType>
4360 selectedSegments.clear();
4361 unselectedSegments.clear();
4387 template <
class DataType>
4392 painter->pen().style() == Qt::SolidLine &&
4397 bool lastIsNan =
false;
4398 const int lineDataSize = lineData.size();
4399 while (i < lineDataSize && (qIsNaN(lineData.at(i).y()) || qIsNaN(lineData.at(i).x())))
4402 while (i < lineDataSize)
4404 if (!qIsNaN(lineData.at(i).y()) && !qIsNaN(lineData.at(i).x()))
4407 painter->
drawLine(lineData.at(i-1), lineData.at(i));
4416 int segmentStart = 0;
4418 const int lineDataSize = lineData.size();
4419 while (i < lineDataSize)
4421 if (qIsNaN(lineData.at(i).y()) || qIsNaN(lineData.at(i).x()) || qIsInf(lineData.at(i).y()))
4423 painter->drawPolyline(lineData.constData()+segmentStart, i-segmentStart);
4429 painter->drawPolyline(lineData.constData()+segmentStart, lineDataSize-segmentStart);
4453 Q_ENUMS(ColorInterpolation)
4472 Q_ENUMS(GradientPreset)
4486 void setLevelCount(
int n);
4487 void setColorStops(
const QMap<double, QColor> &colorStops);
4488 void setColorStopAt(
double position,
const QColor &color);
4489 void setColorInterpolation(ColorInterpolation interpolation);
4490 void setPeriodic(
bool enabled);
4493 void colorize(
const double *data,
const QCPRange &range, QRgb *scanLine,
int n,
int dataIndexFactor=1,
bool logarithmic=
false);
4494 void colorize(
const double *data,
const unsigned char *
alpha,
const QCPRange &range, QRgb *scanLine,
int n,
int dataIndexFactor=1,
bool logarithmic=
false);
4495 QRgb color(
double position,
const QCPRange &range,
bool logarithmic=
false);
4496 void loadPreset(GradientPreset preset);
4497 void clearColorStops();
4512 bool stopsUseAlpha()
const;
4513 void updateColorBuffer();
4541 Q_ENUMS(BracketStyle)
4556 void setBracketPen(
const QPen &pen);
4557 void setBracketBrush(
const QBrush &brush);
4558 void setBracketWidth(
int width);
4559 void setBracketHeight(
int height);
4560 void setBracketStyle(BracketStyle style);
4561 void setTangentToData(
bool enabled);
4562 void setTangentAverage(
int pointCount);
4565 virtual void drawBracket(
QCPPainter *painter,
int direction)
const;
4597 Q_PROPERTY(QPixmap background READ background WRITE setBackground)
4598 Q_PROPERTY(
bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
4599 Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
4600 Q_PROPERTY(Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag)
4601 Q_PROPERTY(Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom)
4614 QCPAxis *rangeDragAxis(Qt::Orientation orientation);
4615 QCPAxis *rangeZoomAxis(Qt::Orientation orientation);
4616 QList<QCPAxis*> rangeDragAxes(Qt::Orientation orientation);
4617 QList<QCPAxis*> rangeZoomAxes(Qt::Orientation orientation);
4618 double rangeZoomFactor(Qt::Orientation orientation);
4621 void setBackground(
const QPixmap &pm);
4622 void setBackground(
const QPixmap &pm,
bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
4623 void setBackground(
const QBrush &brush);
4624 void setBackgroundScaled(
bool scaled);
4625 void setBackgroundScaledMode(Qt::AspectRatioMode mode);
4626 void setRangeDrag(Qt::Orientations orientations);
4627 void setRangeZoom(Qt::Orientations orientations);
4629 void setRangeDragAxes(QList<QCPAxis*> axes);
4630 void setRangeDragAxes(QList<QCPAxis*> horizontal, QList<QCPAxis*> vertical);
4632 void setRangeZoomAxes(QList<QCPAxis*> axes);
4633 void setRangeZoomAxes(QList<QCPAxis*> horizontal, QList<QCPAxis*> vertical);
4634 void setRangeZoomFactor(
double horizontalFactor,
double verticalFactor);
4635 void setRangeZoomFactor(
double factor);
4640 QList<QCPAxis*> axes(QCPAxis::AxisTypes types)
const;
4641 QList<QCPAxis*> axes()
const;
4643 QList<QCPAxis*> addAxes(QCPAxis::AxisTypes types);
4644 bool removeAxis(
QCPAxis *axis);
4647 void zoom(
const QRectF &pixelRect);
4648 void zoom(
const QRectF &pixelRect,
const QList<QCPAxis*> &affectedAxes);
4649 void setupFullAxesBox(
bool connectRanges=
false);
4650 QList<QCPAbstractPlottable*> plottables()
const;
4651 QList<QCPGraph*> graphs()
const;
4652 QList<QCPAbstractItem*> items()
const;
4655 int left()
const {
return mRect.left(); }
4656 int right()
const {
return mRect.right(); }
4657 int top()
const {
return mRect.top(); }
4658 int bottom()
const {
return mRect.bottom(); }
4659 int width()
const {
return mRect.width(); }
4660 int height()
const {
return mRect.height(); }
4661 QSize
size()
const {
return mRect.size(); }
4662 QPoint
topLeft()
const {
return mRect.topLeft(); }
4666 QPoint
center()
const {
return mRect.center(); }
4670 virtual QList<QCPLayoutElement*> elements(
bool recursive)
const Q_DECL_OVERRIDE;
4689 QHash<QCPAxis::AxisType, QList<QCPAxis*> >
mAxes;
4697 virtual
void mousePressEvent(QMouseEvent *event, const QVariant &details)
Q_DECL_OVERRIDE;
4698 virtual
void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos)
Q_DECL_OVERRIDE;
4699 virtual
void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos)
Q_DECL_OVERRIDE;
4704 void updateAxesOffset(
QCPAxis::AxisType type);
4723 Q_PROPERTY(
QCPLegend* parentLegend READ parentLegend)
4724 Q_PROPERTY(QFont font READ font WRITE setFont)
4725 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
4726 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
4727 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
4728 Q_PROPERTY(
bool selectable READ selectable WRITE setSelectable NOTIFY selectionChanged)
4729 Q_PROPERTY(
bool selected READ selected WRITE setSelected NOTIFY selectableChanged)
4736 QFont
font()
const {
return mFont; }
4744 void setFont(
const QFont &font);
4745 void setTextColor(
const QColor &color);
4746 void setSelectedFont(
const QFont &font);
4747 void setSelectedTextColor(
const QColor &color);
4748 Q_SLOT
void setSelectable(
bool selectable);
4749 Q_SLOT
void setSelected(
bool selected);
4752 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const
Q_DECL_OVERRIDE;
4755 void selectionChanged(
bool selected);
4756 void selectableChanged(
bool selectable);
4763 QFont mSelectedFont;
4764 QColor mSelectedTextColor;
4765 bool mSelectable, mSelected;
4773 virtual
void selectEvent(QMouseEvent *event,
bool additive, const QVariant &details,
bool *selectionStateChanged)
Q_DECL_OVERRIDE;
4774 virtual
void deselectEvent(
bool *selectionStateChanged)
Q_DECL_OVERRIDE;
4801 QPen getIconBorderPen() const;
4802 QColor getTextColor() const;
4803 QFont getFont() const;
4811 Q_PROPERTY(QPen borderPen READ borderPen WRITE setBorderPen)
4812 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
4813 Q_PROPERTY(QFont font READ font WRITE setFont)
4814 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
4815 Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
4816 Q_PROPERTY(
int iconTextPadding READ iconTextPadding WRITE setIconTextPadding)
4817 Q_PROPERTY(QPen iconBorderPen READ iconBorderPen WRITE setIconBorderPen)
4818 Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectionChanged)
4819 Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectableChanged)
4820 Q_PROPERTY(QPen selectedBorderPen READ selectedBorderPen WRITE setSelectedBorderPen)
4821 Q_PROPERTY(QPen selectedIconBorderPen READ selectedIconBorderPen WRITE setSelectedIconBorderPen)
4822 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
4823 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
4824 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
4833 ,spLegendBox = 0x001
4836 Q_ENUMS(SelectablePart)
4837 Q_FLAGS(SelectableParts)
4838 Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
4846 QFont
font()
const {
return mFont; }
4852 SelectableParts selectedParts()
const;
4860 void setBorderPen(
const QPen &pen);
4861 void setBrush(
const QBrush &brush);
4862 void setFont(
const QFont &font);
4863 void setTextColor(
const QColor &color);
4864 void setIconSize(
const QSize &
size);
4865 void setIconSize(
int width,
int height);
4866 void setIconTextPadding(
int padding);
4867 void setIconBorderPen(
const QPen &pen);
4868 Q_SLOT
void setSelectableParts(
const SelectableParts &selectableParts);
4869 Q_SLOT
void setSelectedParts(
const SelectableParts &selectedParts);
4870 void setSelectedBorderPen(
const QPen &pen);
4871 void setSelectedIconBorderPen(
const QPen &pen);
4872 void setSelectedBrush(
const QBrush &brush);
4873 void setSelectedFont(
const QFont &font);
4874 void setSelectedTextColor(
const QColor &color);
4877 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const
Q_DECL_OVERRIDE;
4882 int itemCount() const;
4886 bool removeItem(
int index);
4892 void selectionChanged(
QCPLegend::SelectableParts parts);
4893 void selectableChanged(
QCPLegend::SelectableParts parts);
4897 QPen mBorderPen, mIconBorderPen;
4902 int mIconTextPadding;
4903 SelectableParts mSelectedParts, mSelectableParts;
4904 QPen mSelectedBorderPen, mSelectedIconBorderPen;
4905 QBrush mSelectedBrush;
4906 QFont mSelectedFont;
4907 QColor mSelectedTextColor;
4915 virtual
void selectEvent(QMouseEvent *event,
bool additive, const QVariant &details,
bool *selectionStateChanged)
Q_DECL_OVERRIDE;
4916 virtual
void deselectEvent(
bool *selectionStateChanged)
Q_DECL_OVERRIDE;
4919 QPen getBorderPen() const;
4920 QBrush getBrush() const;
4928 Q_DECLARE_OPERATORS_FOR_FLAGS(
QCPLegend::SelectableParts)
4941 Q_PROPERTY(QString
text READ
text WRITE setText)
4942 Q_PROPERTY(QFont font READ font WRITE setFont)
4943 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
4944 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
4945 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
4946 Q_PROPERTY(
bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
4947 Q_PROPERTY(
bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
4957 QString
text()
const {
return mText; }
4959 QFont
font()
const {
return mFont; }
4967 void setText(
const QString &
text);
4968 void setTextFlags(
int flags);
4969 void setFont(
const QFont &font);
4970 void setTextColor(
const QColor &color);
4971 void setSelectedFont(
const QFont &font);
4972 void setSelectedTextColor(
const QColor &color);
4973 Q_SLOT
void setSelectable(
bool selectable);
4974 Q_SLOT
void setSelected(
bool selected);
4977 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const
Q_DECL_OVERRIDE;
4978 virtual
void mousePressEvent(QMouseEvent *event, const QVariant &details)
Q_DECL_OVERRIDE;
4979 virtual
void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos)
Q_DECL_OVERRIDE;
4980 virtual
void mouseDoubleClickEvent(QMouseEvent *event, const QVariant &details)
Q_DECL_OVERRIDE;
4983 void selectionChanged(
bool selected);
4984 void selectableChanged(
bool selectable);
4985 void clicked(QMouseEvent *event);
4986 void doubleClicked(QMouseEvent *event);
4994 QFont mSelectedFont;
4995 QColor mSelectedTextColor;
4996 QRect mTextBoundingRect;
4997 bool mSelectable, mSelected;
5005 virtual
void selectEvent(QMouseEvent *event,
bool additive, const QVariant &details,
bool *selectionStateChanged)
Q_DECL_OVERRIDE;
5006 virtual
void deselectEvent(
bool *selectionStateChanged)
Q_DECL_OVERRIDE;
5009 QFont mainFont() const;
5010 QColor mainTextColor() const;
5042 void updateGradientImage();
5043 Q_SLOT
void axisSelectionChanged(QCPAxis::SelectableParts selectedParts);
5044 Q_SLOT
void axisSelectableChanged(QCPAxis::SelectableParts selectableParts);
5054 Q_PROPERTY(
QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged)
5055 Q_PROPERTY(
QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged)
5056 Q_PROPERTY(
QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged)
5057 Q_PROPERTY(QString label READ label WRITE setLabel)
5058 Q_PROPERTY(
int barWidth READ barWidth WRITE setBarWidth)
5059 Q_PROPERTY(
bool rangeDrag READ rangeDrag WRITE setRangeDrag)
5060 Q_PROPERTY(
bool rangeZoom READ rangeZoom WRITE setRangeZoom)
5072 QString label()
const;
5074 bool rangeDrag()
const;
5075 bool rangeZoom()
const;
5079 Q_SLOT
void setDataRange(
const QCPRange &dataRange);
5082 void setLabel(
const QString &str);
5083 void setBarWidth(
int width);
5084 void setRangeDrag(
bool enabled);
5085 void setRangeZoom(
bool enabled);
5088 QList<QCPColorMap*> colorMaps()
const;
5089 void rescaleDataRange(
bool onlyVisibleMaps);
5095 void dataRangeChanged(
const QCPRange &newRange);
5167 Q_PROPERTY(
LineStyle lineStyle READ lineStyle WRITE setLineStyle)
5168 Q_PROPERTY(
QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
5169 Q_PROPERTY(
int scatterSkip READ scatterSkip WRITE setScatterSkip)
5170 Q_PROPERTY(
QCPGraph* channelFillGraph READ channelFillGraph WRITE setChannelFillGraph)
5171 Q_PROPERTY(
bool adaptiveSampling READ adaptiveSampling WRITE setAdaptiveSampling)
5201 void setData(QSharedPointer<QCPGraphDataContainer> data);
5202 void setData(
const QVector<double> &keys,
const QVector<double> &values,
bool alreadySorted=
false);
5203 void setLineStyle(LineStyle ls);
5205 void setScatterSkip(
int skip);
5206 void setChannelFillGraph(
QCPGraph *targetGraph);
5207 void setAdaptiveSampling(
bool enabled);
5210 void addData(
const QVector<double> &keys,
const QVector<double> &values,
bool alreadySorted=
false);
5211 void addData(
double key,
double value);
5224 bool mAdaptiveSampling;
5231 virtual
void drawFill(
QCPPainter *painter, QVector<QPointF> *lines) const;
5232 virtual
void drawScatterPlot(
QCPPainter *painter, const QVector<QPointF> &scatters, const
QCPScatterStyle &style) const;
5233 virtual
void drawLinePlot(
QCPPainter *painter, const QVector<QPointF> &lines) const;
5234 virtual
void drawImpulsePlot(
QCPPainter *painter, const QVector<QPointF> &lines) const;
5241 void getLines(QVector<QPointF> *lines, const
QCPDataRange &dataRange) const;
5242 void getScatters(QVector<QPointF> *scatters, const
QCPDataRange &dataRange) const;
5243 QVector<QPointF> dataToLines(const QVector<
QCPGraphData> &data) const;
5244 QVector<QPointF> dataToStepLeftLines(const QVector<
QCPGraphData> &data) const;
5245 QVector<QPointF> dataToStepRightLines(const QVector<
QCPGraphData> &data) const;
5246 QVector<QPointF> dataToStepCenterLines(const QVector<
QCPGraphData> &data) const;
5247 QVector<QPointF> dataToImpulseLines(const QVector<
QCPGraphData> &data) const;
5248 QVector<
QCPDataRange> getNonNanSegments(const QVector<QPointF> *lineData, Qt::Orientation keyOrientation) const;
5250 bool segmentsIntersect(
double aLower,
double aUpper,
double bLower,
double bUpper,
int &bPrecedence) const;
5251 QPointF getFillBasePoint(QPointF matchingDataPoint) const;
5252 const QPolygonF getFillPolygon(const QVector<QPointF> *lineData,
QCPDataRange segment) const;
5253 const QPolygonF getChannelFillPolygon(const QVector<QPointF> *lineData,
QCPDataRange thisSegment, const QVector<QPointF> *otherData,
QCPDataRange otherSegment) const;
5254 int findIndexBelowX(const QVector<QPointF> *data,
double x) const;
5255 int findIndexAboveX(const QVector<QPointF> *data,
double x) const;
5256 int findIndexBelowY(const QVector<QPointF> *data,
double y) const;
5257 int findIndexAboveY(const QVector<QPointF> *data,
double y) const;
5258 double pointDistance(const QPointF &pixelPoint,
QCPGraphDataContainer::const_iterator &closestData) const;
5307 Q_PROPERTY(
QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
5308 Q_PROPERTY(
int scatterSkip READ scatterSkip WRITE setScatterSkip)
5309 Q_PROPERTY(
LineStyle lineStyle READ lineStyle WRITE setLineStyle)
5332 void setData(QSharedPointer<QCPCurveDataContainer> data);
5333 void setData(
const QVector<double> &t,
const QVector<double> &keys,
const QVector<double> &values,
bool alreadySorted=
false);
5334 void setData(
const QVector<double> &keys,
const QVector<double> &values);
5336 void setScatterSkip(
int skip);
5337 void setLineStyle(LineStyle style);
5340 void addData(
const QVector<double> &t,
const QVector<double> &keys,
const QVector<double> &values,
bool alreadySorted=
false);
5341 void addData(
const QVector<double> &keys,
const QVector<double> &values);
5342 void addData(
double t,
double key,
double value);
5343 void addData(
double key,
double value);
5361 virtual
void drawCurveLine(
QCPPainter *painter, const QVector<QPointF> &lines) const;
5365 void getCurveLines(QVector<QPointF> *lines, const
QCPDataRange &dataRange,
double penWidth) const;
5366 void getScatters(QVector<QPointF> *scatters, const
QCPDataRange &dataRange,
double scatterWidth) const;
5367 int getRegion(
double key,
double value,
double keyMin,
double valueMax,
double keyMax,
double valueMin) const;
5368 QPointF getOptimizedPoint(
int prevRegion,
double prevKey,
double prevValue,
double key,
double value,
double keyMin,
double valueMax,
double keyMax,
double valueMin) const;
5369 QVector<QPointF> getOptimizedCornerPoints(
int prevRegion,
int currentRegion,
double prevKey,
double prevValue,
double key,
double value,
double keyMin,
double valueMax,
double keyMax,
double valueMin) const;
5370 bool mayTraverse(
int prevRegion,
int currentRegion) const;
5371 bool getTraverse(
double prevKey,
double prevValue,
double key,
double value,
double keyMin,
double valueMax,
double keyMax,
double valueMin, QPointF &crossA, QPointF &crossB) const;
5372 void getTraverseCornerPoints(
int prevRegion,
int currentRegion,
double keyMin,
double valueMax,
double keyMax,
double valueMin, QVector<QPointF> &beforeTraverse, QVector<QPointF> &afterTraverse) const;
5373 double pointDistance(const QPointF &pixelPoint,
QCPCurveDataContainer::const_iterator &closestData) const;
5390 Q_PROPERTY(
SpacingType spacingType READ spacingType WRITE setSpacingType)
5391 Q_PROPERTY(
double spacing READ spacing WRITE setSpacing)
5404 Q_ENUMS(SpacingType)
5414 void setSpacingType(SpacingType spacingType);
5415 void setSpacing(
double spacing);
5418 QList<QCPBars*>
bars()
const {
return mBars; }
5419 QCPBars* bars(
int index)
const;
5420 int size()
const {
return mBars.size(); }
5425 void insert(
int i,
QCPBars *bars);
5436 void registerBars(
QCPBars *bars);
5437 void unregisterBars(
QCPBars *bars);
5440 double keyPixelOffset(
const QCPBars *bars,
double keyCoord);
5441 double getPixelSpacing(
const QCPBars *bars,
double keyCoord);
5486 Q_PROPERTY(
double width READ width WRITE setWidth)
5487 Q_PROPERTY(
WidthType widthType READ widthType WRITE setWidthType)
5488 Q_PROPERTY(
QCPBarsGroup* barsGroup READ barsGroup WRITE setBarsGroup)
5489 Q_PROPERTY(
double baseValue READ baseValue WRITE setBaseValue)
5490 Q_PROPERTY(
double stackingGap READ stackingGap WRITE setStackingGap)
5491 Q_PROPERTY(
QCPBars* barBelow READ barBelow)
5492 Q_PROPERTY(
QCPBars* barAbove READ barAbove)
5521 void setData(QSharedPointer<QCPBarsDataContainer> data);
5522 void setData(
const QVector<double> &keys,
const QVector<double> &values,
bool alreadySorted=
false);
5523 void setWidth(
double width);
5524 void setWidthType(WidthType widthType);
5526 void setBaseValue(
double baseValue);
5527 void setStackingGap(
double pixels);
5530 void addData(
const QVector<double> &keys,
const QVector<double> &values,
bool alreadySorted=
false);
5531 void addData(
double key,
double value);
5532 void moveBelow(
QCPBars *bars);
5533 void moveAbove(
QCPBars *bars);
5548 double mStackingGap;
5557 QRectF getBarRect(
double key,
double value) const;
5558 void getPixelWidth(
double key,
double &lower,
double &upper) const;
5559 double getStackedBaseValue(
double key,
bool positive) const;
5578 QCPStatisticalBoxData(
double key,
double minimum,
double lowerQuartile,
double median,
double upperQuartile,
double maximum,
const QVector<double>& outliers=QVector<double>());
5590 for (QVector<double>::const_iterator it = outliers.constBegin(); it != outliers.constEnd(); ++it)
5617 Q_PROPERTY(
double width READ width WRITE setWidth)
5618 Q_PROPERTY(
double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
5619 Q_PROPERTY(QPen whiskerPen READ whiskerPen WRITE setWhiskerPen)
5620 Q_PROPERTY(QPen whiskerBarPen READ whiskerBarPen WRITE setWhiskerBarPen)
5621 Q_PROPERTY(
bool whiskerAntialiased READ whiskerAntialiased WRITE setWhiskerAntialiased)
5622 Q_PROPERTY(QPen medianPen READ medianPen WRITE setMedianPen)
5623 Q_PROPERTY(
QCPScatterStyle outlierStyle READ outlierStyle WRITE setOutlierStyle)
5639 void setData(QSharedPointer<QCPStatisticalBoxDataContainer> data);
5640 void setData(
const QVector<double> &keys,
const QVector<double> &minimum,
const QVector<double> &lowerQuartile,
const QVector<double> &median,
const QVector<double> &upperQuartile,
const QVector<double> &maximum,
bool alreadySorted=
false);
5641 void setWidth(
double width);
5642 void setWhiskerWidth(
double width);
5643 void setWhiskerPen(
const QPen &pen);
5644 void setWhiskerBarPen(
const QPen &pen);
5645 void setWhiskerAntialiased(
bool enabled);
5646 void setMedianPen(
const QPen &pen);
5650 void addData(
const QVector<double> &keys,
const QVector<double> &minimum,
const QVector<double> &lowerQuartile,
const QVector<double> &median,
const QVector<double> &upperQuartile,
const QVector<double> &maximum,
bool alreadySorted=
false);
5651 void addData(
double key,
double minimum,
double lowerQuartile,
double median,
double upperQuartile,
double maximum,
const QVector<double> &outliers=QVector<double>());
5662 double mWhiskerWidth;
5663 QPen mWhiskerPen, mWhiskerBarPen;
5664 bool mWhiskerAntialiased;
5705 double data(
double key,
double value);
5706 double cell(
int keyIndex,
int valueIndex);
5707 unsigned char alpha(
int keyIndex,
int valueIndex);
5710 void setSize(
int keySize,
int valueSize);
5711 void setKeySize(
int keySize);
5712 void setValueSize(
int valueSize);
5714 void setKeyRange(
const QCPRange &keyRange);
5715 void setValueRange(
const QCPRange &valueRange);
5716 void setData(
double key,
double value,
double z);
5717 void setCell(
int keyIndex,
int valueIndex,
double z);
5718 void setAlpha(
int keyIndex,
int valueIndex,
unsigned char alpha);
5721 void recalculateDataBounds();
5724 void fill(
double z);
5725 void fillAlpha(
unsigned char alpha);
5727 void coordToCell(
double key,
double value,
int *keyIndex,
int *valueIndex)
const;
5728 void cellToCoord(
int keyIndex,
int valueIndex,
double *key,
double *value)
const;
5742 bool createAlpha(
bool initializeOpaque=
true);
5752 Q_PROPERTY(
QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged)
5753 Q_PROPERTY(
QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged)
5754 Q_PROPERTY(
QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged)
5755 Q_PROPERTY(
bool interpolate READ interpolate WRITE setInterpolate)
5756 Q_PROPERTY(
bool tightBoundary READ tightBoundary WRITE setTightBoundary)
5757 Q_PROPERTY(
QCPColorScale* colorScale READ colorScale WRITE setColorScale)
5774 Q_SLOT
void setDataRange(
const QCPRange &dataRange);
5777 void setInterpolate(
bool enabled);
5778 void setTightBoundary(
bool enabled);
5782 void rescaleDataRange(
bool recalculateDataBounds=
false);
5783 Q_SLOT
void updateLegendIcon(Qt::TransformationMode transformMode=Qt::SmoothTransformation,
const QSize &thumbSize=QSize(32, 18));
5791 void dataRangeChanged(const
QCPRange &newRange);
5792 void dataScaleTypeChanged(
QCPAxis::ScaleType scaleType);
5802 bool mTightBoundary;
5806 QImage mMapImage, mUndersampledMapImage;
5807 QPixmap mLegendIcon;
5808 bool mMapImageInvalidated;
5811 virtual
void updateMapImage();
5831 QCPFinancialData(
double key,
double open,
double high,
double low,
double close);
5842 double key,
open, high, low, close;
5862 Q_PROPERTY(
ChartStyle chartStyle READ chartStyle WRITE setChartStyle)
5863 Q_PROPERTY(
double width READ width WRITE setWidth)
5864 Q_PROPERTY(
WidthType widthType READ widthType WRITE setWidthType)
5865 Q_PROPERTY(
bool twoColored READ twoColored WRITE setTwoColored)
5866 Q_PROPERTY(QBrush brushPositive READ brushPositive WRITE setBrushPositive)
5867 Q_PROPERTY(QBrush brushNegative READ brushNegative WRITE setBrushNegative)
5868 Q_PROPERTY(QPen penPositive READ penPositive WRITE setPenPositive)
5869 Q_PROPERTY(QPen penNegative READ penNegative WRITE setPenNegative)
5909 void setData(QSharedPointer<QCPFinancialDataContainer> data);
5910 void setData(
const QVector<double> &keys,
const QVector<double> &open,
const QVector<double> &high,
const QVector<double> &low,
const QVector<double> &close,
bool alreadySorted=
false);
5911 void setChartStyle(ChartStyle style);
5912 void setWidth(
double width);
5913 void setWidthType(WidthType widthType);
5914 void setTwoColored(
bool twoColored);
5915 void setBrushPositive(
const QBrush &brush);
5916 void setBrushNegative(
const QBrush &brush);
5917 void setPenPositive(
const QPen &pen);
5918 void setPenNegative(
const QPen &pen);
5921 void addData(
const QVector<double> &keys,
const QVector<double> &open,
const QVector<double> &high,
const QVector<double> &low,
const QVector<double> &close,
bool alreadySorted=
false);
5922 void addData(
double key,
double open,
double high,
double low,
double close);
5931 static
QCPFinancialDataContainer timeSeriesToOhlc(const QVector<
double> &time, const QVector<
double> &value,
double timeBinSize,
double timeBinOffset = 0);
5939 QBrush mBrushPositive, mBrushNegative;
5940 QPen mPenPositive, mPenNegative;
5949 double getPixelWidth(
double key,
double keyPixel) const;
5999 Q_PROPERTY(QSharedPointer<QCPErrorBarsDataContainer> data READ data WRITE setData)
6001 Q_PROPERTY(
ErrorType errorType READ errorType WRITE setErrorType)
6002 Q_PROPERTY(
double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
6003 Q_PROPERTY(
double symbolGap READ symbolGap WRITE setSymbolGap)
6021 QSharedPointer<QCPErrorBarsDataContainer>
data()
const {
return mDataContainer; }
6028 void setData(QSharedPointer<QCPErrorBarsDataContainer> data);
6029 void setData(
const QVector<double> &error);
6030 void setData(
const QVector<double> &errorMinus,
const QVector<double> &errorPlus);
6032 void setErrorType(ErrorType type);
6033 void setWhiskerWidth(
double pixels);
6034 void setSymbolGap(
double pixels);
6037 void addData(
const QVector<double> &error);
6038 void addData(
const QVector<double> &errorMinus,
const QVector<double> &errorPlus);
6039 void addData(
double error);
6040 void addData(
double errorMinus,
double errorPlus);
6051 virtual
int findBegin(
double sortKey,
bool expandedRange=true) const
Q_DECL_OVERRIDE;
6052 virtual
int findEnd(
double sortKey,
bool expandedRange=true) const
Q_DECL_OVERRIDE;
6055 virtual
double selectTest(const QPointF &pos,
bool onlySelectable, QVariant *details=0) const
Q_DECL_OVERRIDE;
6073 void getErrorBarLines(
QCPErrorBarsDataContainer::const_iterator it, QVector<QLineF> &backbones, QVector<QLineF> &whiskers) const;
6078 bool errorBarVisible(
int index) const;
6079 bool rectIntersectsLine(const QRectF &pixelRect, const QLineF &line) const;
6095 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6096 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6107 void setPen(
const QPen &pen);
6108 void setSelectedPen(
const QPen &pen);
6118 QPen mPen, mSelectedPen;
6124 QLineF getRectClippedStraightLine(const
QCPVector2D &point1, const
QCPVector2D &vec, const QRect &rect) const;
6125 QPen mainPen() const;
6138 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6139 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6154 void setPen(
const QPen &pen);
6155 void setSelectedPen(
const QPen &pen);
6167 QPen mPen, mSelectedPen;
6175 QPen mainPen() const;
6188 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6189 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6204 void setPen(
const QPen &pen);
6205 void setSelectedPen(
const QPen &pen);
6219 QPen mPen, mSelectedPen;
6226 QPen mainPen() const;
6239 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6240 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6241 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
6242 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6255 void setPen(
const QPen &pen);
6256 void setSelectedPen(
const QPen &pen);
6257 void setBrush(
const QBrush &brush);
6258 void setSelectedBrush(
const QBrush &brush);
6273 enum
AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
6281 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
6284 QPen mainPen()
const;
6285 QBrush mainBrush()
const;
6298 Q_PROPERTY(QColor color READ color WRITE setColor)
6299 Q_PROPERTY(QColor selectedColor READ selectedColor WRITE setSelectedColor)
6300 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6301 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6302 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
6303 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6304 Q_PROPERTY(QFont font READ font WRITE setFont)
6305 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
6306 Q_PROPERTY(QString
text READ
text WRITE setText)
6307 Q_PROPERTY(Qt::Alignment positionAlignment READ positionAlignment WRITE setPositionAlignment)
6308 Q_PROPERTY(Qt::Alignment textAlignment READ textAlignment WRITE setTextAlignment)
6309 Q_PROPERTY(
double rotation READ rotation WRITE setRotation)
6310 Q_PROPERTY(QMargins padding READ padding WRITE setPadding)
6319 QPen
pen()
const {
return mPen; }
6323 QFont
font()
const {
return mFont; }
6325 QString
text()
const {
return mText; }
6332 void setColor(
const QColor &color);
6333 void setSelectedColor(
const QColor &color);
6334 void setPen(
const QPen &pen);
6335 void setSelectedPen(
const QPen &pen);
6336 void setBrush(
const QBrush &brush);
6337 void setSelectedBrush(
const QBrush &brush);
6338 void setFont(
const QFont &font);
6339 void setSelectedFont(
const QFont &font);
6340 void setText(
const QString &
text);
6341 void setPositionAlignment(Qt::Alignment alignment);
6342 void setTextAlignment(Qt::Alignment alignment);
6343 void setRotation(
double degrees);
6344 void setPadding(
const QMargins &padding);
6360 enum
AnchorIndex {aiTopLeft, aiTop, aiTopRight, aiRight, aiBottomRight, aiBottom, aiBottomLeft, aiLeft};
6378 QPointF getTextDrawPoint(
const QPointF &pos,
const QRectF &rect, Qt::Alignment positionAlignment)
const;
6379 QFont mainFont()
const;
6380 QColor mainColor()
const;
6381 QPen mainPen()
const;
6382 QBrush mainBrush()
const;
6395 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6396 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6397 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
6398 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6405 QPen
pen()
const {
return mPen; }
6411 void setPen(
const QPen &pen);
6412 void setSelectedPen(
const QPen &pen);
6413 void setBrush(
const QBrush &brush);
6414 void setSelectedBrush(
const QBrush &brush);
6432 enum
AnchorIndex {aiTopLeftRim, aiTop, aiTopRightRim, aiRight, aiBottomRightRim, aiBottom, aiBottomLeftRim, aiLeft, aiCenter};
6443 QPen mainPen()
const;
6444 QBrush mainBrush()
const;
6457 Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap)
6458 Q_PROPERTY(
bool scaled READ scaled WRITE setScaled)
6459 Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode)
6460 Q_PROPERTY(Qt::TransformationMode transformationMode READ transformationMode)
6461 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6462 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6473 QPen
pen()
const {
return mPen; }
6477 void setPixmap(
const QPixmap &pixmap);
6478 void setScaled(
bool scaled, Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio, Qt::TransformationMode transformationMode=Qt::SmoothTransformation);
6479 void setPen(
const QPen &pen);
6480 void setSelectedPen(
const QPen &pen);
6495 enum
AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
6511 void updateScaledPixmap(QRect finalRect=QRect(),
bool flipHorz=
false,
bool flipVert=
false);
6512 QRect getFinalRect(
bool *flippedHorz=0,
bool *flippedVert=0)
const;
6513 QPen mainPen()
const;
6526 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6527 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6528 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
6529 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6530 Q_PROPERTY(
double size READ
size WRITE setSize)
6531 Q_PROPERTY(
TracerStyle style READ style WRITE setStyle)
6532 Q_PROPERTY(
QCPGraph* graph READ graph WRITE setGraph)
6533 Q_PROPERTY(
double graphKey READ graphKey WRITE setGraphKey)
6534 Q_PROPERTY(
bool interpolating READ interpolating WRITE setInterpolating)
6548 Q_ENUMS(TracerStyle)
6554 QPen
pen()
const {
return mPen; }
6558 double size()
const {
return mSize; }
6565 void setPen(
const QPen &pen);
6566 void setSelectedPen(
const QPen &pen);
6567 void setBrush(
const QBrush &brush);
6568 void setSelectedBrush(
const QBrush &brush);
6569 void setSize(
double size);
6570 void setStyle(TracerStyle style);
6572 void setGraphKey(
double key);
6573 void setInterpolating(
bool enabled);
6579 void updatePosition();
6585 QPen mPen, mSelectedPen;
6586 QBrush mBrush, mSelectedBrush;
6591 bool mInterpolating;
6597 QPen mainPen() const;
6598 QBrush mainBrush() const;
6612 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6613 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6614 Q_PROPERTY(
double length READ length WRITE setLength)
6615 Q_PROPERTY(
BracketStyle style READ style WRITE setStyle)
6629 Q_ENUMS(BracketStyle)
6635 QPen
pen()
const {
return mPen; }
6641 void setPen(
const QPen &pen);
6642 void setSelectedPen(
const QPen &pen);
6643 void setLength(
double length);
6644 void setStyle(BracketStyle style);
6665 QPen mainPen()
const;
6672 #endif // QCUSTOMPLOT_H