From 858c8c89d553c334120114d775b0082c5e084c38 Mon Sep 17 00:00:00 2001 From: tianduanrui <2407223896@qq.com> Date: Wed, 22 Nov 2017 19:22:53 +0800 Subject: [PATCH] fix linux qt4 build --- QQt.pro | 10 +- README.md | 2 +- demo/VegeTablesPrice/mainwindow.cpp | 2 +- demo/VegeTablesPrice/mainwindow.h | 2 +- demo/cmdwidget/cmdwidget.pro | 35 +- .../qqthttpdownloadprotocol.cpp | 2 +- .../qqthttpdownload/qqthttpdownloadprotocol.h | 14 +- src/charts/qqtchart.h | 8 +- src/customplot/qcustomplot.h | 2365 +++++++++-------- src/network/qqtwebaccessmanager.cpp | 183 ++ src/network/qqtwebaccessmanager.h | 78 + src/network/qqtwebprotocolmanager.cpp | 183 -- src/network/qqtwebprotocolmanager.h | 80 - src/qqt_header.pri | 7 +- src/qqt_source.pri | 7 +- test/gumbo_query_test/main.cpp | 37 +- 16 files changed, 1512 insertions(+), 1503 deletions(-) create mode 100644 src/network/qqtwebaccessmanager.cpp create mode 100644 src/network/qqtwebaccessmanager.h delete mode 100644 src/network/qqtwebprotocolmanager.cpp delete mode 100644 src/network/qqtwebprotocolmanager.h diff --git a/QQt.pro b/QQt.pro index 194969ef..8d9dc599 100644 --- a/QQt.pro +++ b/QQt.pro @@ -1,8 +1,7 @@ TEMPLATE = subdirs CONFIG += ordered -SUBDIRS = src/qqt.pro \ - examples/qqthttpdownload +SUBDIRS = src/qqt.pro #----------------------------------------------------------------- #basic example @@ -20,10 +19,11 @@ SUBDIRS += examples/animationframe SUBDIRS += examples/exquisite SUBDIRS += examples/tabwidgetexamples SUBDIRS += examples/qrcodeexample -SUBDIRS += examples/qqtnetworkexample +greaterThan(QT_MAJOR_VERSION , 4):SUBDIRS += examples/qqtnetworkexample SUBDIRS += examples/QtBuildTool SUBDIRS += examples/QtSdkManager SUBDIRS += examples/QQtInstaller +greaterThan(QT_MAJOR_VERSION, 4):SUBDIRS += examples/qqthttpdownload #can't support ios SUBDIRS += examples/qqtprintsupportexample @@ -58,14 +58,12 @@ SUBDIRS += examples/soapQQtOnline #need webwork - WebSupport #----------------------------------------------------------------- SUBDIRS += examples/qqtftpclient -SUBDIRS += examples/qqthttpdownload #----------------------------------------------------------------- #some example project #maybe demo #----------------------------------------------------------------- - -SUBDIRS += demo/VegeTablesPrice +greaterThan(QT_MAJOR_VERSION , 4):SUBDIRS += demo/VegeTablesPrice SUBDIRS += demo/cmdwidget #----------------------------------------------------------------- diff --git a/README.md b/README.md index c5c3dcdd..76731ce7 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ - QQtSerialPort 兼容QSerialPort and QextSerialPort - QQtSocketTcpClient、QQtSocketTcpServer、QQtSocketUdpClient、QQtSocketUdpServer - QQtBluetoothSocket +QQtBluetoothManager - - QQtWebProtocolManager,支持http、ftp等主流协议,高并发传输。 + - QQtWebAccessManager,支持http、ftp等主流协议,高并发传输。 - QQtWebSocket接口 - 协议虚类(接口类) QQtProtocol QQtWebSocketProtocol - 报文虚类(接口类) QQtMessage diff --git a/demo/VegeTablesPrice/mainwindow.cpp b/demo/VegeTablesPrice/mainwindow.cpp index 604a71ca..c414f62b 100644 --- a/demo/VegeTablesPrice/mainwindow.cpp +++ b/demo/VegeTablesPrice/mainwindow.cpp @@ -14,7 +14,7 @@ MainWindow::MainWindow ( QWidget* parent ) : //ui->b0->setFixedHeight ( 50 ); //ui->b1->setFixedHeight ( 50 ); - m_client = new QQtWebProtocolManager ( this ); + m_client = new QQtWebAccessManager ( this ); connect ( m_client, SIGNAL ( replyFinished ( QNetworkReply* ) ), this, SLOT ( replyFinished ( QNetworkReply* ) ) ); diff --git a/demo/VegeTablesPrice/mainwindow.h b/demo/VegeTablesPrice/mainwindow.h index d4958686..6bd48b9e 100644 --- a/demo/VegeTablesPrice/mainwindow.h +++ b/demo/VegeTablesPrice/mainwindow.h @@ -36,7 +36,7 @@ private slots: private: Ui::MainWindow* ui; - QQtWebProtocolManager* m_client; + QQtWebAccessManager* m_client; QMap m_mapVege; QBarSet* m_barSet0; QBarSet* m_barSet1; diff --git a/demo/cmdwidget/cmdwidget.pro b/demo/cmdwidget/cmdwidget.pro index 83e84298..4bb7fb78 100644 --- a/demo/cmdwidget/cmdwidget.pro +++ b/demo/cmdwidget/cmdwidget.pro @@ -3,7 +3,24 @@ # Project created by QtCreator 2016-09-30T09:34:03 # #------------------------------------------------- -include(../qqtframe2/link_qqt_library.pri) +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = cmdwidget +TEMPLATE = app + + +SOURCES += main.cpp\ + cmdwidget.cpp \ + rlineedit.cpp + +HEADERS += cmdwidget.h \ + rlineedit.h + +FORMS += cmdwidget.ui + +include($$PWD/../../examples/qqtframe2/link_qqt_library.pri) ############ ##install @@ -31,19 +48,3 @@ equals(QKIT_PRIVATE, ANDROID) { message ($${TARGET} config $${CONFIG}) message ($${TARGET} define $${DEFINES}) -QT += core gui - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -TARGET = cmdwidget -TEMPLATE = app - - -SOURCES += main.cpp\ - cmdwidget.cpp \ - rlineedit.cpp - -HEADERS += cmdwidget.h \ - rlineedit.h - -FORMS += cmdwidget.ui diff --git a/examples/qqthttpdownload/qqthttpdownloadprotocol.cpp b/examples/qqthttpdownload/qqthttpdownloadprotocol.cpp index ba48233d..2c999e17 100644 --- a/examples/qqthttpdownload/qqthttpdownloadprotocol.cpp +++ b/examples/qqthttpdownload/qqthttpdownloadprotocol.cpp @@ -1,6 +1,6 @@ #include "qqthttpdownloadprotocol.h" -QQtHttpDownloadProtocol::QQtHttpDownloadProtocol ( QObject* parent ) : QQtWebSocketProtocol ( parent ) +QQtHttpDownloadProtocol::QQtHttpDownloadProtocol(QObject* parent) : QQtWebAccessManager(parent) { } diff --git a/examples/qqthttpdownload/qqthttpdownloadprotocol.h b/examples/qqthttpdownload/qqthttpdownloadprotocol.h index cdd8a562..7defa57b 100644 --- a/examples/qqthttpdownload/qqthttpdownloadprotocol.h +++ b/examples/qqthttpdownload/qqthttpdownloadprotocol.h @@ -1,25 +1,25 @@ #ifndef QQTHTTPDOWNLOADPROTOCOL_H #define QQTHTTPDOWNLOADPROTOCOL_H -#include -#include +#include -class QQtHttpDownloadWebWorkSession: public QQtWebWorkSession +class QQtHttpDownloadWebWorkSession: public QQtWebAccessSession { Q_OBJECT public: - explicit QQtHttpDownloadWebWorkSession ( QObject* parent = 0 ) : QQtWebWorkSession ( parent ) {} + explicit QQtHttpDownloadWebWorkSession(QObject* parent = 0) : QQtWebAccessSession(parent) {} virtual ~QQtHttpDownloadWebWorkSession() {} }; -class QQtHttpDownloadProtocol : public QQtWebSocketProtocol +class QQtHttpDownloadProtocol : public QQtWebAccessManager { Q_OBJECT public: - explicit QQtHttpDownloadProtocol ( QObject* parent = nullptr ); + explicit QQtHttpDownloadProtocol(QObject* parent = nullptr); virtual ~QQtHttpDownloadProtocol() {} - void sendRequstUrl ( QString& url ) { + void sendRequstUrl(QString& url) + { m_url = url; } diff --git a/src/charts/qqtchart.h b/src/charts/qqtchart.h index 11be9f65..8687395c 100644 --- a/src/charts/qqtchart.h +++ b/src/charts/qqtchart.h @@ -2,16 +2,18 @@ #define QQTCHART_H #include +#include +#include -class QQtChart : public QWidget +class QQTSHARED_EXPORT QQtChart : public QWidget { Q_OBJECT public: - explicit QQtChart(QWidget *parent = nullptr); + explicit QQtChart(QWidget* parent = nullptr); signals: public slots: }; -#endif // QQTCHART_H \ No newline at end of file +#endif // QQTCHART_H diff --git a/src/customplot/qcustomplot.h b/src/customplot/qcustomplot.h index ab5b662a..53cf8b9d 100644 --- a/src/customplot/qcustomplot.h +++ b/src/customplot/qcustomplot.h @@ -45,7 +45,11 @@ #include #include #include +#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0) #include +#else +#include +#endif #ifndef QT_NO_PRINTER #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) # include @@ -100,7 +104,8 @@ class QCPBars; /*! The QCP Namespace contains general enums and QFlags used throughout the QCustomPlot library */ -namespace QCP { +namespace QCP +{ /*! Defines the sides of a rectangular entity to which margins can be applied. @@ -113,7 +118,7 @@ enum MarginSide { msLeft = 0x01 ///< 0x01 left margin , msAll = 0xFF ///< 0xFF all margins , msNone = 0x00 ///< 0x00 no margin }; -Q_DECLARE_FLAGS ( MarginSides, MarginSide ) +Q_DECLARE_FLAGS(MarginSides, MarginSide) /*! Defines what objects of a plot can be forcibly drawn antialiased/not antialiased. If an object is @@ -138,7 +143,7 @@ enum AntialiasedElement { aeAxes = 0x0001 ///< 0x0001 Axis ba , aeAll = 0xFFFF ///< 0xFFFF All elements , aeNone = 0x0000 ///< 0x0000 No elements }; -Q_DECLARE_FLAGS ( AntialiasedElements, AntialiasedElement ) +Q_DECLARE_FLAGS(AntialiasedElements, AntialiasedElement) /*! Defines plotting hints that control various aspects of the quality and speed of plotting. @@ -147,12 +152,12 @@ Q_DECLARE_FLAGS ( AntialiasedElements, AntialiasedElement ) */ enum PlottingHint { phNone = 0x000 ///< 0x000 No hints are set , phFastPolylines = 0x001 ///< 0x001 Graph/Curve lines are drawn with a faster method. This reduces the quality - ///< especially of the line segment joins. (Only relevant for solid line pens.) + ///< especially of the line segment joins. (Only relevant for solid line pens.) , phForceRepaint = 0x002 ///< 0x002 causes an immediate repaint() instead of a soft update() when QCustomPlot::replot() is called with parameter \ref QCustomPlot::rpHint. ///< This is set by default to prevent the plot from freezing on fast consecutive replots (e.g. user drags ranges with mouse). , phCacheLabels = 0x004 ///< 0x004 axis (tick) labels will be cached as pixmaps, increasing replot performance. }; -Q_DECLARE_FLAGS ( PlottingHints, PlottingHint ) +Q_DECLARE_FLAGS(PlottingHints, PlottingHint) /*! Defines the mouse interactions possible with QCustomPlot. @@ -170,7 +175,7 @@ enum Interaction { iRangeDrag = 0x001 ///< 0x001 Axis ranges ar , iSelectItems = 0x040 ///< 0x040 Items are selectable (Rectangles, Arrows, Textitems, etc. see \ref QCPAbstractItem) , iSelectOther = 0x080 ///< 0x080 All other objects are selectable (e.g. your own derived layerables, the plot title,...) }; -Q_DECLARE_FLAGS ( Interactions, Interaction ) +Q_DECLARE_FLAGS(Interactions, Interaction) /*! \internal @@ -178,9 +183,9 @@ Q_DECLARE_FLAGS ( Interactions, Interaction ) is \e nan or \e +/-inf). This function is used to check data validity upon replots, when the compiler flag \c QCUSTOMPLOT_CHECK_DATA is set. */ -inline bool isInvalidData ( double value ) +inline bool isInvalidData(double value) { - return qIsNaN ( value ) || qIsInf ( value ); + return qIsNaN(value) || qIsInf(value); } /*! \internal @@ -188,9 +193,9 @@ inline bool isInvalidData ( double value ) Checks two arguments instead of one. */ -inline bool isInvalidData ( double value1, double value2 ) +inline bool isInvalidData(double value1, double value2) { - return isInvalidData ( value1 ) || isInvalidData ( value2 ); + return isInvalidData(value1) || isInvalidData(value2); } /*! \internal @@ -199,19 +204,19 @@ inline bool isInvalidData ( double value1, double value2 ) \see getMarginValue */ -inline void setMarginValue ( QMargins& margins, QCP::MarginSide side, int value ) +inline void setMarginValue(QMargins& margins, QCP::MarginSide side, int value) { - switch ( side ) + switch (side) { - case QCP::msLeft: margins.setLeft ( value ); break; + case QCP::msLeft: margins.setLeft(value); break; - case QCP::msRight: margins.setRight ( value ); break; + case QCP::msRight: margins.setRight(value); break; - case QCP::msTop: margins.setTop ( value ); break; + case QCP::msTop: margins.setTop(value); break; - case QCP::msBottom: margins.setBottom ( value ); break; + case QCP::msBottom: margins.setBottom(value); break; - case QCP::msAll: margins = QMargins ( value, value, value, value ); break; + case QCP::msAll: margins = QMargins(value, value, value, value); break; default: break; } @@ -224,9 +229,9 @@ inline void setMarginValue ( QMargins& margins, QCP::MarginSide side, int value \see setMarginValue */ -inline int getMarginValue ( const QMargins& margins, QCP::MarginSide side ) +inline int getMarginValue(const QMargins& margins, QCP::MarginSide side) { - switch ( side ) + switch (side) { case QCP::msLeft: return margins.left(); @@ -244,10 +249,10 @@ inline int getMarginValue ( const QMargins& margins, QCP::MarginSide side ) } // end of namespace QCP -Q_DECLARE_OPERATORS_FOR_FLAGS ( QCP::AntialiasedElements ) -Q_DECLARE_OPERATORS_FOR_FLAGS ( QCP::PlottingHints ) -Q_DECLARE_OPERATORS_FOR_FLAGS ( QCP::MarginSides ) -Q_DECLARE_OPERATORS_FOR_FLAGS ( QCP::Interactions ) +Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::AntialiasedElements) +Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::PlottingHints) +Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::MarginSides) +Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::Interactions) class QCP_LIB_DECL QCPScatterStyle @@ -261,7 +266,7 @@ public: \ref ssDot and \ref ssPixmap) can be controlled with the \ref setSize function. Scatters are drawn with the pen and brush specified with \ref setPen and \ref setBrush. */ - Q_ENUMS ( ScatterShape ) + Q_ENUMS(ScatterShape) enum ScatterShape { ssNone ///< no scatter symbols are drawn (e.g. in QCPGraph, data only represented with lines) , ssDot ///< \enumimage{ssDot.png} a single pixel (use \ref ssDisc or \ref ssCircle if you want a round shape with a certain radius) , ssCross ///< \enumimage{ssCross.png} a cross @@ -283,12 +288,12 @@ public: }; QCPScatterStyle(); - QCPScatterStyle ( ScatterShape shape, double size = 6 ); - QCPScatterStyle ( ScatterShape shape, const QColor& color, double size ); - QCPScatterStyle ( ScatterShape shape, const QColor& color, const QColor& fill, double size ); - QCPScatterStyle ( ScatterShape shape, const QPen& pen, const QBrush& brush, double size ); - QCPScatterStyle ( const QPixmap& pixmap ); - QCPScatterStyle ( const QPainterPath& customPath, const QPen& pen, const QBrush& brush = Qt::NoBrush, double size = 6 ); + QCPScatterStyle(ScatterShape shape, double size = 6); + QCPScatterStyle(ScatterShape shape, const QColor& color, double size); + QCPScatterStyle(ScatterShape shape, const QColor& color, const QColor& fill, double size); + QCPScatterStyle(ScatterShape shape, const QPen& pen, const QBrush& brush, double size); + QCPScatterStyle(const QPixmap& pixmap); + QCPScatterStyle(const QPainterPath& customPath, const QPen& pen, const QBrush& brush = Qt::NoBrush, double size = 6); // getters: double size() const { return mSize; } @@ -299,19 +304,19 @@ public: QPainterPath customPath() const { return mCustomPath; } // setters: - void setSize ( double size ); - void setShape ( ScatterShape shape ); - void setPen ( const QPen& pen ); - void setBrush ( const QBrush& brush ); - void setPixmap ( const QPixmap& pixmap ); - void setCustomPath ( const QPainterPath& customPath ); + void setSize(double size); + void setShape(ScatterShape shape); + void setPen(const QPen& pen); + void setBrush(const QBrush& brush); + void setPixmap(const QPixmap& pixmap); + void setCustomPath(const QPainterPath& customPath); // non-property methods: bool isNone() const { return mShape == ssNone; } bool isPenDefined() const { return mPenDefined; } - void applyTo ( QCPPainter* painter, const QPen& defaultPen ) const; - void drawShape ( QCPPainter* painter, QPointF pos ) const; - void drawShape ( QCPPainter* painter, double x, double y ) const; + void applyTo(QCPPainter* painter, const QPen& defaultPen) const; + void drawShape(QCPPainter* painter, QPointF pos) const; + void drawShape(QCPPainter* painter, double x, double y) const; protected: // property members: @@ -325,7 +330,7 @@ protected: // non-property members: bool mPenDefined; }; -Q_DECLARE_TYPEINFO ( QCPScatterStyle, Q_MOVABLE_TYPE ); +Q_DECLARE_TYPEINFO(QCPScatterStyle, Q_MOVABLE_TYPE); class QCP_LIB_DECL QCPPainter : public QPainter @@ -341,29 +346,29 @@ public: , pmNoCaching = 0x02 ///< 0x02 Mode for all sorts of exports (e.g. PNG, PDF,...). For example, this prevents using cached pixmap labels , pmNonCosmetic = 0x04 ///< 0x04 Turns pen widths 0 to 1, i.e. disables cosmetic pens. (A cosmetic pen is always drawn with width 1 pixel in the vector image/pdf viewer, independent of zoom.) }; - Q_FLAGS ( PainterMode PainterModes ) - Q_DECLARE_FLAGS ( PainterModes, PainterMode ) + Q_FLAGS(PainterMode PainterModes) + Q_DECLARE_FLAGS(PainterModes, PainterMode) QCPPainter(); - QCPPainter ( QPaintDevice* device ); + QCPPainter(QPaintDevice* device); ~QCPPainter(); // getters: - bool antialiasing() const { return testRenderHint ( QPainter::Antialiasing ); } + bool antialiasing() const { return testRenderHint(QPainter::Antialiasing); } PainterModes modes() const { return mModes; } // setters: - void setAntialiasing ( bool enabled ); - void setMode ( PainterMode mode, bool enabled = true ); - void setModes ( PainterModes modes ); + void setAntialiasing(bool enabled); + void setMode(PainterMode mode, bool enabled = true); + void setModes(PainterModes modes); // methods hiding non-virtual base class functions (QPainter bug workarounds): - bool begin ( QPaintDevice* device ); - void setPen ( const QPen& pen ); - void setPen ( const QColor& color ); - void setPen ( Qt::PenStyle penStyle ); - void drawLine ( const QLineF& line ); - void drawLine ( const QPointF& p1, const QPointF& p2 ) {drawLine ( QLineF ( p1, p2 ) );} + bool begin(QPaintDevice* device); + void setPen(const QPen& pen); + void setPen(const QColor& color); + void setPen(Qt::PenStyle penStyle); + void drawLine(const QLineF& line); + void drawLine(const QPointF& p1, const QPointF& p2) {drawLine(QLineF(p1, p2));} void save(); void restore(); @@ -378,21 +383,21 @@ protected: // non-property members: QStack mAntialiasingStack; }; -Q_DECLARE_OPERATORS_FOR_FLAGS ( QCPPainter::PainterModes ) +Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPainter::PainterModes) class QCP_LIB_DECL QCPLayer : public QObject { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( QCustomPlot* parentPlot READ parentPlot ) - Q_PROPERTY ( QString name READ name ) - Q_PROPERTY ( int index READ index ) - Q_PROPERTY ( QList children READ children ) - Q_PROPERTY ( bool visible READ visible WRITE setVisible ) + Q_PROPERTY(QCustomPlot* parentPlot READ parentPlot) + Q_PROPERTY(QString name READ name) + Q_PROPERTY(int index READ index) + Q_PROPERTY(QList children READ children) + Q_PROPERTY(bool visible READ visible WRITE setVisible) /// \endcond public: - QCPLayer ( QCustomPlot* parentPlot, const QString& layerName ); + QCPLayer(QCustomPlot* parentPlot, const QString& layerName); ~QCPLayer(); // getters: @@ -403,7 +408,7 @@ public: bool visible() const { return mVisible; } // setters: - void setVisible ( bool visible ); + void setVisible(bool visible); protected: // property members: @@ -414,11 +419,11 @@ protected: bool mVisible; // non-virtual methods: - void addChild ( QCPLayerable* layerable, bool prepend ); - void removeChild ( QCPLayerable* layerable ); + void addChild(QCPLayerable* layerable, bool prepend); + void removeChild(QCPLayerable* layerable); private: - Q_DISABLE_COPY ( QCPLayer ) + Q_DISABLE_COPY(QCPLayer) friend class QCustomPlot; friend class QCPLayerable; @@ -428,14 +433,14 @@ class QCP_LIB_DECL QCPLayerable : public QObject { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( bool visible READ visible WRITE setVisible ) - Q_PROPERTY ( QCustomPlot* parentPlot READ parentPlot ) - Q_PROPERTY ( QCPLayerable* parentLayerable READ parentLayerable ) - Q_PROPERTY ( QCPLayer* layer READ layer WRITE setLayer NOTIFY layerChanged ) - Q_PROPERTY ( bool antialiased READ antialiased WRITE setAntialiased ) + Q_PROPERTY(bool visible READ visible WRITE setVisible) + Q_PROPERTY(QCustomPlot* parentPlot READ parentPlot) + Q_PROPERTY(QCPLayerable* parentLayerable READ parentLayerable) + Q_PROPERTY(QCPLayer* layer READ layer WRITE setLayer NOTIFY layerChanged) + Q_PROPERTY(bool antialiased READ antialiased WRITE setAntialiased) /// \endcond public: - QCPLayerable ( QCustomPlot* plot, QString targetLayer = QString(), QCPLayerable* parentLayerable = 0 ); + QCPLayerable(QCustomPlot* plot, QString targetLayer = QString(), QCPLayerable* parentLayerable = 0); ~QCPLayerable(); // getters: @@ -446,19 +451,19 @@ public: bool antialiased() const { return mAntialiased; } // setters: - void setVisible ( bool on ); - Q_SLOT bool setLayer ( QCPLayer* layer ); - bool setLayer ( const QString& layerName ); - void setAntialiased ( bool enabled ); + void setVisible(bool on); + Q_SLOT bool setLayer(QCPLayer* layer); + bool setLayer(const QString& layerName); + void setAntialiased(bool enabled); // introduced virtual methods: - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; // non-property methods: bool realVisibility() const; signals: - void layerChanged ( QCPLayer* newLayer ); + void layerChanged(QCPLayer* newLayer); protected: // property members: @@ -469,24 +474,24 @@ protected: bool mAntialiased; // introduced virtual methods: - virtual void parentPlotInitialized ( QCustomPlot* parentPlot ); + virtual void parentPlotInitialized(QCustomPlot* parentPlot); virtual QCP::Interaction selectionCategory() const; virtual QRect clipRect() const; - virtual void applyDefaultAntialiasingHint ( QCPPainter* painter ) const = 0; - virtual void draw ( QCPPainter* painter ) = 0; + virtual void applyDefaultAntialiasingHint(QCPPainter* painter) const = 0; + virtual void draw(QCPPainter* painter) = 0; // events: - virtual void selectEvent ( QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged ); - virtual void deselectEvent ( bool* selectionStateChanged ); + virtual void selectEvent(QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged); + virtual void deselectEvent(bool* selectionStateChanged); // non-property methods: - void initializeParentPlot ( QCustomPlot* parentPlot ); - void setParentLayerable ( QCPLayerable* parentLayerable ); - bool moveToLayer ( QCPLayer* layer, bool prepend ); - void applyAntialiasingHint ( QCPPainter* painter, bool localAntialiased, - QCP::AntialiasedElement overrideElement ) const; + void initializeParentPlot(QCustomPlot* parentPlot); + void setParentLayerable(QCPLayerable* parentLayerable); + bool moveToLayer(QCPLayer* layer, bool prepend); + void applyAntialiasingHint(QCPPainter* painter, bool localAntialiased, + QCP::AntialiasedElement overrideElement) const; private: - Q_DISABLE_COPY ( QCPLayerable ) + Q_DISABLE_COPY(QCPLayerable) friend class QCustomPlot; friend class QCPAxisRect; @@ -499,38 +504,38 @@ public: double lower, upper; QCPRange(); - QCPRange ( double lower, double upper ); + QCPRange(double lower, double upper); - bool operator== ( const QCPRange& other ) const { return lower == other.lower && upper == other.upper; } - bool operator!= ( const QCPRange& other ) const { return ! ( *this == other ); } + bool operator== (const QCPRange& other) const { return lower == other.lower && upper == other.upper; } + bool operator!= (const QCPRange& other) const { return !(*this == other); } - QCPRange& operator+= ( const double& value ) { lower += value; upper += value; return *this; } - QCPRange& operator-= ( const double& value ) { lower -= value; upper -= value; return *this; } - QCPRange& operator*= ( const double& value ) { lower *= value; upper *= value; return *this; } - QCPRange& operator/= ( const double& value ) { lower /= value; upper /= value; return *this; } - friend inline const QCPRange operator+ ( const QCPRange&, double ); - friend inline const QCPRange operator+ ( double, const QCPRange& ); - friend inline const QCPRange operator- ( const QCPRange& range, double value ); - friend inline const QCPRange operator* ( const QCPRange& range, double value ); - friend inline const QCPRange operator* ( double value, const QCPRange& range ); - friend inline const QCPRange operator/ ( const QCPRange& range, double value ); + QCPRange& operator+= (const double& value) { lower += value; upper += value; return *this; } + QCPRange& operator-= (const double& value) { lower -= value; upper -= value; return *this; } + QCPRange& operator*= (const double& value) { lower *= value; upper *= value; return *this; } + QCPRange& operator/= (const double& value) { lower /= value; upper /= value; return *this; } + friend inline const QCPRange operator+ (const QCPRange&, double); + friend inline const QCPRange operator+ (double, const QCPRange&); + friend inline const QCPRange operator- (const QCPRange& range, double value); + friend inline const QCPRange operator* (const QCPRange& range, double value); + friend inline const QCPRange operator* (double value, const QCPRange& range); + friend inline const QCPRange operator/ (const QCPRange& range, double value); double size() const; double center() const; void normalize(); - void expand ( const QCPRange& otherRange ); - QCPRange expanded ( const QCPRange& otherRange ) const; + void expand(const QCPRange& otherRange); + QCPRange expanded(const QCPRange& otherRange) const; QCPRange sanitizedForLogScale() const; QCPRange sanitizedForLinScale() const; - bool contains ( double value ) const; + bool contains(double value) const; - static bool validRange ( double lower, double upper ); - static bool validRange ( const QCPRange& range ); + static bool validRange(double lower, double upper); + static bool validRange(const QCPRange& range); static const double minRange; //1e-280; static const double maxRange; //1e280; }; -Q_DECLARE_TYPEINFO ( QCPRange, Q_MOVABLE_TYPE ); +Q_DECLARE_TYPEINFO(QCPRange, Q_MOVABLE_TYPE); /* documentation of inline functions */ @@ -559,9 +564,9 @@ Q_DECLARE_TYPEINFO ( QCPRange, Q_MOVABLE_TYPE ); /*! Adds \a value to both boundaries of the range. */ -inline const QCPRange operator+ ( const QCPRange& range, double value ) +inline const QCPRange operator+ (const QCPRange& range, double value) { - QCPRange result ( range ); + QCPRange result(range); result += value; return result; } @@ -569,9 +574,9 @@ inline const QCPRange operator+ ( const QCPRange& range, double value ) /*! Adds \a value to both boundaries of the range. */ -inline const QCPRange operator+ ( double value, const QCPRange& range ) +inline const QCPRange operator+ (double value, const QCPRange& range) { - QCPRange result ( range ); + QCPRange result(range); result += value; return result; } @@ -579,9 +584,9 @@ inline const QCPRange operator+ ( double value, const QCPRange& range ) /*! Subtracts \a value from both boundaries of the range. */ -inline const QCPRange operator- ( const QCPRange& range, double value ) +inline const QCPRange operator- (const QCPRange& range, double value) { - QCPRange result ( range ); + QCPRange result(range); result -= value; return result; } @@ -589,9 +594,9 @@ inline const QCPRange operator- ( const QCPRange& range, double value ) /*! Multiplies both boundaries of the range by \a value. */ -inline const QCPRange operator* ( const QCPRange& range, double value ) +inline const QCPRange operator* (const QCPRange& range, double value) { - QCPRange result ( range ); + QCPRange result(range); result *= value; return result; } @@ -599,9 +604,9 @@ inline const QCPRange operator* ( const QCPRange& range, double value ) /*! Multiplies both boundaries of the range by \a value. */ -inline const QCPRange operator* ( double value, const QCPRange& range ) +inline const QCPRange operator* (double value, const QCPRange& range) { - QCPRange result ( range ); + QCPRange result(range); result *= value; return result; } @@ -609,9 +614,9 @@ inline const QCPRange operator* ( double value, const QCPRange& range ) /*! Divides both boundaries of the range by \a value. */ -inline const QCPRange operator/ ( const QCPRange& range, double value ) +inline const QCPRange operator/ (const QCPRange& range, double value) { - QCPRange result ( range ); + QCPRange result(range); result /= value; return result; } @@ -621,11 +626,11 @@ class QCP_LIB_DECL QCPMarginGroup : public QObject { Q_OBJECT public: - QCPMarginGroup ( QCustomPlot* parentPlot ); + QCPMarginGroup(QCustomPlot* parentPlot); ~QCPMarginGroup(); // non-virtual methods: - QList elements ( QCP::MarginSide side ) const { return mChildren.value ( side ); } + QList elements(QCP::MarginSide side) const { return mChildren.value(side); } bool isEmpty() const; void clear(); @@ -635,12 +640,12 @@ protected: QHash > mChildren; // non-virtual methods: - int commonMargin ( QCP::MarginSide side ) const; - void addChild ( QCP::MarginSide side, QCPLayoutElement* element ); - void removeChild ( QCP::MarginSide side, QCPLayoutElement* element ); + int commonMargin(QCP::MarginSide side) const; + void addChild(QCP::MarginSide side, QCPLayoutElement* element); + void removeChild(QCP::MarginSide side, QCPLayoutElement* element); private: - Q_DISABLE_COPY ( QCPMarginGroup ) + Q_DISABLE_COPY(QCPMarginGroup) friend class QCPLayoutElement; }; @@ -650,13 +655,13 @@ class QCP_LIB_DECL QCPLayoutElement : public QCPLayerable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( QCPLayout* layout READ layout ) - Q_PROPERTY ( QRect rect READ rect ) - Q_PROPERTY ( QRect outerRect READ outerRect WRITE setOuterRect ) - Q_PROPERTY ( QMargins margins READ margins WRITE setMargins ) - Q_PROPERTY ( QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins ) - Q_PROPERTY ( QSize minimumSize READ minimumSize WRITE setMinimumSize ) - Q_PROPERTY ( QSize maximumSize READ maximumSize WRITE setMaximumSize ) + Q_PROPERTY(QCPLayout* layout READ layout) + Q_PROPERTY(QRect rect READ rect) + Q_PROPERTY(QRect outerRect READ outerRect WRITE setOuterRect) + Q_PROPERTY(QMargins margins READ margins WRITE setMargins) + Q_PROPERTY(QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins) + Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize) + Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize) /// \endcond public: /*! @@ -667,9 +672,9 @@ public: , upMargins ///< Phase in which the margins are calculated and set , upLayout ///< Final phase in which the layout system places the rects of the elements }; - Q_ENUMS ( UpdatePhase ) + Q_ENUMS(UpdatePhase) - explicit QCPLayoutElement ( QCustomPlot* parentPlot = 0 ); + explicit QCPLayoutElement(QCustomPlot* parentPlot = 0); virtual ~QCPLayoutElement(); // getters: @@ -681,28 +686,28 @@ public: QCP::MarginSides autoMargins() const { return mAutoMargins; } QSize minimumSize() const { return mMinimumSize; } QSize maximumSize() const { return mMaximumSize; } - QCPMarginGroup* marginGroup ( QCP::MarginSide side ) const { return mMarginGroups.value ( side, ( QCPMarginGroup* ) 0 ); } + QCPMarginGroup* marginGroup(QCP::MarginSide side) const { return mMarginGroups.value(side, (QCPMarginGroup*) 0); } QHash marginGroups() const { return mMarginGroups; } // setters: - void setOuterRect ( const QRect& rect ); - void setMargins ( const QMargins& margins ); - void setMinimumMargins ( const QMargins& margins ); - void setAutoMargins ( QCP::MarginSides sides ); - void setMinimumSize ( const QSize& size ); - void setMinimumSize ( int width, int height ); - void setMaximumSize ( const QSize& size ); - void setMaximumSize ( int width, int height ); - void setMarginGroup ( QCP::MarginSides sides, QCPMarginGroup* group ); + void setOuterRect(const QRect& rect); + void setMargins(const QMargins& margins); + void setMinimumMargins(const QMargins& margins); + void setAutoMargins(QCP::MarginSides sides); + void setMinimumSize(const QSize& size); + void setMinimumSize(int width, int height); + void setMaximumSize(const QSize& size); + void setMaximumSize(int width, int height); + void setMarginGroup(QCP::MarginSides sides, QCPMarginGroup* group); // introduced virtual methods: - virtual void update ( UpdatePhase phase ); + virtual void update(UpdatePhase phase); virtual QSize minimumSizeHint() const; virtual QSize maximumSizeHint() const; - virtual QList elements ( bool recursive ) const; + virtual QList elements(bool recursive) const; // reimplemented virtual methods: - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; protected: // property members: @@ -714,21 +719,21 @@ protected: QHash mMarginGroups; // introduced virtual methods: - virtual int calculateAutoMargin ( QCP::MarginSide side ); + virtual int calculateAutoMargin(QCP::MarginSide side); // events: - virtual void mousePressEvent ( QMouseEvent* event ) {Q_UNUSED ( event ) } - virtual void mouseMoveEvent ( QMouseEvent* event ) {Q_UNUSED ( event ) } - virtual void mouseReleaseEvent ( QMouseEvent* event ) {Q_UNUSED ( event ) } - virtual void mouseDoubleClickEvent ( QMouseEvent* event ) {Q_UNUSED ( event ) } - virtual void wheelEvent ( QWheelEvent* event ) {Q_UNUSED ( event ) } + virtual void mousePressEvent(QMouseEvent* event) {Q_UNUSED(event) } + virtual void mouseMoveEvent(QMouseEvent* event) {Q_UNUSED(event) } + virtual void mouseReleaseEvent(QMouseEvent* event) {Q_UNUSED(event) } + virtual void mouseDoubleClickEvent(QMouseEvent* event) {Q_UNUSED(event) } + virtual void wheelEvent(QWheelEvent* event) {Q_UNUSED(event) } // reimplemented virtual methods: - virtual void applyDefaultAntialiasingHint ( QCPPainter* painter ) const { Q_UNUSED ( painter ) } - virtual void draw ( QCPPainter* painter ) { Q_UNUSED ( painter ) } - virtual void parentPlotInitialized ( QCustomPlot* parentPlot ); + virtual void applyDefaultAntialiasingHint(QCPPainter* painter) const { Q_UNUSED(painter) } + virtual void draw(QCPPainter* painter) { Q_UNUSED(painter) } + virtual void parentPlotInitialized(QCustomPlot* parentPlot); private: - Q_DISABLE_COPY ( QCPLayoutElement ) + Q_DISABLE_COPY(QCPLayoutElement) friend class QCustomPlot; friend class QCPLayout; @@ -743,19 +748,19 @@ public: explicit QCPLayout(); // reimplemented virtual methods: - virtual void update ( UpdatePhase phase ); - virtual QList elements ( bool recursive ) const; + virtual void update(UpdatePhase phase); + virtual QList elements(bool recursive) const; // introduced virtual methods: virtual int elementCount() const = 0; - virtual QCPLayoutElement* elementAt ( int index ) const = 0; - virtual QCPLayoutElement* takeAt ( int index ) = 0; - virtual bool take ( QCPLayoutElement* element ) = 0; + virtual QCPLayoutElement* elementAt(int index) const = 0; + virtual QCPLayoutElement* takeAt(int index) = 0; + virtual bool take(QCPLayoutElement* element) = 0; virtual void simplify(); // non-virtual methods: - bool removeAt ( int index ); - bool remove ( QCPLayoutElement* element ); + bool removeAt(int index); + bool remove(QCPLayoutElement* element); void clear(); protected: @@ -764,13 +769,13 @@ protected: // non-virtual methods: void sizeConstraintsChanged() const; - void adoptElement ( QCPLayoutElement* el ); - void releaseElement ( QCPLayoutElement* el ); - QVector getSectionSizes ( QVector maxSizes, QVector minSizes, QVector stretchFactors, - int totalSize ) const; + void adoptElement(QCPLayoutElement* el); + void releaseElement(QCPLayoutElement* el); + QVector getSectionSizes(QVector maxSizes, QVector minSizes, QVector stretchFactors, + int totalSize) const; private: - Q_DISABLE_COPY ( QCPLayout ) + Q_DISABLE_COPY(QCPLayout) friend class QCPLayoutElement; }; @@ -779,12 +784,12 @@ class QCP_LIB_DECL QCPLayoutGrid : public QCPLayout { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( int rowCount READ rowCount ) - Q_PROPERTY ( int columnCount READ columnCount ) - Q_PROPERTY ( QList columnStretchFactors READ columnStretchFactors WRITE setColumnStretchFactors ) - Q_PROPERTY ( QList rowStretchFactors READ rowStretchFactors WRITE setRowStretchFactors ) - Q_PROPERTY ( int columnSpacing READ columnSpacing WRITE setColumnSpacing ) - Q_PROPERTY ( int rowSpacing READ rowSpacing WRITE setRowSpacing ) + Q_PROPERTY(int rowCount READ rowCount) + Q_PROPERTY(int columnCount READ columnCount) + Q_PROPERTY(QList columnStretchFactors READ columnStretchFactors WRITE setColumnStretchFactors) + Q_PROPERTY(QList rowStretchFactors READ rowStretchFactors WRITE setRowStretchFactors) + Q_PROPERTY(int columnSpacing READ columnSpacing WRITE setColumnSpacing) + Q_PROPERTY(int rowSpacing READ rowSpacing WRITE setRowSpacing) /// \endcond public: explicit QCPLayoutGrid(); @@ -799,31 +804,31 @@ public: int rowSpacing() const { return mRowSpacing; } // setters: - void setColumnStretchFactor ( int column, double factor ); - void setColumnStretchFactors ( const QList& factors ); - void setRowStretchFactor ( int row, double factor ); - void setRowStretchFactors ( const QList& factors ); - void setColumnSpacing ( int pixels ); - void setRowSpacing ( int pixels ); + void setColumnStretchFactor(int column, double factor); + void setColumnStretchFactors(const QList& factors); + void setRowStretchFactor(int row, double factor); + void setRowStretchFactors(const QList& factors); + void setColumnSpacing(int pixels); + void setRowSpacing(int pixels); // reimplemented virtual methods: virtual void updateLayout(); virtual int elementCount() const; - virtual QCPLayoutElement* elementAt ( int index ) const; - virtual QCPLayoutElement* takeAt ( int index ); - virtual bool take ( QCPLayoutElement* element ); - virtual QList elements ( bool recursive ) const; + virtual QCPLayoutElement* elementAt(int index) const; + virtual QCPLayoutElement* takeAt(int index); + virtual bool take(QCPLayoutElement* element); + virtual QList elements(bool recursive) const; virtual void simplify(); virtual QSize minimumSizeHint() const; virtual QSize maximumSizeHint() const; // non-virtual methods: - QCPLayoutElement* element ( int row, int column ) const; - bool addElement ( int row, int column, QCPLayoutElement* element ); - bool hasElement ( int row, int column ); - void expandTo ( int newRowCount, int newColumnCount ); - void insertRow ( int newIndex ); - void insertColumn ( int newIndex ); + QCPLayoutElement* element(int row, int column) const; + bool addElement(int row, int column, QCPLayoutElement* element); + bool hasElement(int row, int column); + void expandTo(int newRowCount, int newColumnCount); + void insertRow(int newIndex); + void insertColumn(int newIndex); protected: // property members: @@ -833,11 +838,11 @@ protected: int mColumnSpacing, mRowSpacing; // non-virtual methods: - void getMinimumRowColSizes ( QVector* minColWidths, QVector* minRowHeights ) const; - void getMaximumRowColSizes ( QVector* maxColWidths, QVector* maxRowHeights ) const; + void getMinimumRowColSizes(QVector* minColWidths, QVector* minRowHeights) const; + void getMaximumRowColSizes(QVector* maxColWidths, QVector* maxRowHeights) const; private: - Q_DISABLE_COPY ( QCPLayoutGrid ) + Q_DISABLE_COPY(QCPLayoutGrid) }; @@ -856,27 +861,27 @@ public: virtual ~QCPLayoutInset(); // getters: - InsetPlacement insetPlacement ( int index ) const; - Qt::Alignment insetAlignment ( int index ) const; - QRectF insetRect ( int index ) const; + InsetPlacement insetPlacement(int index) const; + Qt::Alignment insetAlignment(int index) const; + QRectF insetRect(int index) const; // setters: - void setInsetPlacement ( int index, InsetPlacement placement ); - void setInsetAlignment ( int index, Qt::Alignment alignment ); - void setInsetRect ( int index, const QRectF& rect ); + void setInsetPlacement(int index, InsetPlacement placement); + void setInsetAlignment(int index, Qt::Alignment alignment); + void setInsetRect(int index, const QRectF& rect); // reimplemented virtual methods: virtual void updateLayout(); virtual int elementCount() const; - virtual QCPLayoutElement* elementAt ( int index ) const; - virtual QCPLayoutElement* takeAt ( int index ); - virtual bool take ( QCPLayoutElement* element ); + virtual QCPLayoutElement* elementAt(int index) const; + virtual QCPLayoutElement* takeAt(int index); + virtual bool take(QCPLayoutElement* element); virtual void simplify() {} - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; // non-virtual methods: - void addElement ( QCPLayoutElement* element, Qt::Alignment alignment ); - void addElement ( QCPLayoutElement* element, const QRectF& rect ); + void addElement(QCPLayoutElement* element, Qt::Alignment alignment); + void addElement(QCPLayoutElement* element, const QRectF& rect); protected: // property members: @@ -886,7 +891,7 @@ protected: QList mInsetRect; private: - Q_DISABLE_COPY ( QCPLayoutInset ) + Q_DISABLE_COPY(QCPLayoutInset) }; @@ -905,7 +910,7 @@ public: \see QCPItemLine::setHead, QCPItemLine::setTail, QCPItemCurve::setHead, QCPItemCurve::setTail, QCPAxis::setLowerEnding, QCPAxis::setUpperEnding */ - Q_ENUMS ( EndingStyle ) + Q_ENUMS(EndingStyle) enum EndingStyle { esNone ///< No ending decoration , esFlatArrow ///< A filled arrow head with a straight/flat back (a triangle) , esSpikeArrow ///< A filled arrow head with an indented back @@ -919,7 +924,7 @@ public: }; QCPLineEnding(); - QCPLineEnding ( EndingStyle style, double width = 8, double length = 10, bool inverted = false ); + QCPLineEnding(EndingStyle style, double width = 8, double length = 10, bool inverted = false); // getters: EndingStyle style() const { return mStyle; } @@ -928,16 +933,16 @@ public: bool inverted() const { return mInverted; } // setters: - void setStyle ( EndingStyle style ); - void setWidth ( double width ); - void setLength ( double length ); - void setInverted ( bool inverted ); + void setStyle(EndingStyle style); + void setWidth(double width); + void setLength(double length); + void setInverted(bool inverted); // non-property methods: double boundingDistance() const; double realLength() const; - void draw ( QCPPainter* painter, const QVector2D& pos, const QVector2D& dir ) const; - void draw ( QCPPainter* painter, const QVector2D& pos, double angle ) const; + void draw(QCPPainter* painter, const QVector2D& pos, const QVector2D& dir) const; + void draw(QCPPainter* painter, const QVector2D& pos, double angle) const; protected: // property members: @@ -945,22 +950,22 @@ protected: double mWidth, mLength; bool mInverted; }; -Q_DECLARE_TYPEINFO ( QCPLineEnding, Q_MOVABLE_TYPE ); +Q_DECLARE_TYPEINFO(QCPLineEnding, Q_MOVABLE_TYPE); class QCP_LIB_DECL QCPGrid : public QCPLayerable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( bool subGridVisible READ subGridVisible WRITE setSubGridVisible ) - Q_PROPERTY ( bool antialiasedSubGrid READ antialiasedSubGrid WRITE setAntialiasedSubGrid ) - Q_PROPERTY ( bool antialiasedZeroLine READ antialiasedZeroLine WRITE setAntialiasedZeroLine ) - Q_PROPERTY ( QPen pen READ pen WRITE setPen ) - Q_PROPERTY ( QPen subGridPen READ subGridPen WRITE setSubGridPen ) - Q_PROPERTY ( QPen zeroLinePen READ zeroLinePen WRITE setZeroLinePen ) + Q_PROPERTY(bool subGridVisible READ subGridVisible WRITE setSubGridVisible) + Q_PROPERTY(bool antialiasedSubGrid READ antialiasedSubGrid WRITE setAntialiasedSubGrid) + Q_PROPERTY(bool antialiasedZeroLine READ antialiasedZeroLine WRITE setAntialiasedZeroLine) + Q_PROPERTY(QPen pen READ pen WRITE setPen) + Q_PROPERTY(QPen subGridPen READ subGridPen WRITE setSubGridPen) + Q_PROPERTY(QPen zeroLinePen READ zeroLinePen WRITE setZeroLinePen) /// \endcond public: - QCPGrid ( QCPAxis* parentAxis ); + QCPGrid(QCPAxis* parentAxis); // getters: bool subGridVisible() const { return mSubGridVisible; } @@ -971,12 +976,12 @@ public: QPen zeroLinePen() const { return mZeroLinePen; } // setters: - void setSubGridVisible ( bool visible ); - void setAntialiasedSubGrid ( bool enabled ); - void setAntialiasedZeroLine ( bool enabled ); - void setPen ( const QPen& pen ); - void setSubGridPen ( const QPen& pen ); - void setZeroLinePen ( const QPen& pen ); + void setSubGridVisible(bool visible); + void setAntialiasedSubGrid(bool enabled); + void setAntialiasedZeroLine(bool enabled); + void setPen(const QPen& pen); + void setSubGridPen(const QPen& pen); + void setZeroLinePen(const QPen& pen); protected: // property members: @@ -987,12 +992,12 @@ protected: QCPAxis* mParentAxis; // reimplemented virtual methods: - virtual void applyDefaultAntialiasingHint ( QCPPainter* painter ) const; - virtual void draw ( QCPPainter* painter ); + virtual void applyDefaultAntialiasingHint(QCPPainter* painter) const; + virtual void draw(QCPPainter* painter); // non-virtual methods: - void drawGridLines ( QCPPainter* painter ) const; - void drawSubGridLines ( QCPPainter* painter ) const; + void drawGridLines(QCPPainter* painter) const; + void drawSubGridLines(QCPPainter* painter) const; friend class QCPAxis; }; @@ -1002,58 +1007,58 @@ class QCP_LIB_DECL QCPAxis : public QCPLayerable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( AxisType axisType READ axisType ) - Q_PROPERTY ( QCPAxisRect* axisRect READ axisRect ) - Q_PROPERTY ( ScaleType scaleType READ scaleType WRITE setScaleType NOTIFY scaleTypeChanged ) - Q_PROPERTY ( double scaleLogBase READ scaleLogBase WRITE setScaleLogBase ) - Q_PROPERTY ( QCPRange range READ range WRITE setRange NOTIFY rangeChanged ) - Q_PROPERTY ( bool rangeReversed READ rangeReversed WRITE setRangeReversed ) - Q_PROPERTY ( bool autoTicks READ autoTicks WRITE setAutoTicks ) - Q_PROPERTY ( int autoTickCount READ autoTickCount WRITE setAutoTickCount ) - Q_PROPERTY ( bool autoTickLabels READ autoTickLabels WRITE setAutoTickLabels ) - Q_PROPERTY ( bool autoTickStep READ autoTickStep WRITE setAutoTickStep ) - Q_PROPERTY ( bool autoSubTicks READ autoSubTicks WRITE setAutoSubTicks ) - Q_PROPERTY ( bool ticks READ ticks WRITE setTicks ) - Q_PROPERTY ( bool tickLabels READ tickLabels WRITE setTickLabels ) - Q_PROPERTY ( int tickLabelPadding READ tickLabelPadding WRITE setTickLabelPadding ) - Q_PROPERTY ( LabelType tickLabelType READ tickLabelType WRITE setTickLabelType ) - Q_PROPERTY ( QFont tickLabelFont READ tickLabelFont WRITE setTickLabelFont ) - Q_PROPERTY ( QColor tickLabelColor READ tickLabelColor WRITE setTickLabelColor ) - Q_PROPERTY ( double tickLabelRotation READ tickLabelRotation WRITE setTickLabelRotation ) - Q_PROPERTY ( LabelSide tickLabelSide READ tickLabelSide WRITE setTickLabelSide ) - Q_PROPERTY ( QString dateTimeFormat READ dateTimeFormat WRITE setDateTimeFormat ) - Q_PROPERTY ( Qt::TimeSpec dateTimeSpec READ dateTimeSpec WRITE setDateTimeSpec ) - Q_PROPERTY ( QString numberFormat READ numberFormat WRITE setNumberFormat ) - Q_PROPERTY ( int numberPrecision READ numberPrecision WRITE setNumberPrecision ) - Q_PROPERTY ( double tickStep READ tickStep WRITE setTickStep ) - Q_PROPERTY ( QVector tickVector READ tickVector WRITE setTickVector ) - Q_PROPERTY ( QVector tickVectorLabels READ tickVectorLabels WRITE setTickVectorLabels ) - Q_PROPERTY ( int tickLengthIn READ tickLengthIn WRITE setTickLengthIn ) - Q_PROPERTY ( int tickLengthOut READ tickLengthOut WRITE setTickLengthOut ) - Q_PROPERTY ( int subTickCount READ subTickCount WRITE setSubTickCount ) - Q_PROPERTY ( int subTickLengthIn READ subTickLengthIn WRITE setSubTickLengthIn ) - Q_PROPERTY ( int subTickLengthOut READ subTickLengthOut WRITE setSubTickLengthOut ) - Q_PROPERTY ( QPen basePen READ basePen WRITE setBasePen ) - Q_PROPERTY ( QPen tickPen READ tickPen WRITE setTickPen ) - Q_PROPERTY ( QPen subTickPen READ subTickPen WRITE setSubTickPen ) - Q_PROPERTY ( QFont labelFont READ labelFont WRITE setLabelFont ) - Q_PROPERTY ( QColor labelColor READ labelColor WRITE setLabelColor ) - Q_PROPERTY ( QString label READ label WRITE setLabel ) - Q_PROPERTY ( int labelPadding READ labelPadding WRITE setLabelPadding ) - Q_PROPERTY ( int padding READ padding WRITE setPadding ) - Q_PROPERTY ( int offset READ offset WRITE setOffset ) - Q_PROPERTY ( SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectionChanged ) - Q_PROPERTY ( SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectableChanged ) - Q_PROPERTY ( QFont selectedTickLabelFont READ selectedTickLabelFont WRITE setSelectedTickLabelFont ) - Q_PROPERTY ( QFont selectedLabelFont READ selectedLabelFont WRITE setSelectedLabelFont ) - Q_PROPERTY ( QColor selectedTickLabelColor READ selectedTickLabelColor WRITE setSelectedTickLabelColor ) - Q_PROPERTY ( QColor selectedLabelColor READ selectedLabelColor WRITE setSelectedLabelColor ) - Q_PROPERTY ( QPen selectedBasePen READ selectedBasePen WRITE setSelectedBasePen ) - Q_PROPERTY ( QPen selectedTickPen READ selectedTickPen WRITE setSelectedTickPen ) - Q_PROPERTY ( QPen selectedSubTickPen READ selectedSubTickPen WRITE setSelectedSubTickPen ) - Q_PROPERTY ( QCPLineEnding lowerEnding READ lowerEnding WRITE setLowerEnding ) - Q_PROPERTY ( QCPLineEnding upperEnding READ upperEnding WRITE setUpperEnding ) - Q_PROPERTY ( QCPGrid* grid READ grid ) + Q_PROPERTY(AxisType axisType READ axisType) + Q_PROPERTY(QCPAxisRect* axisRect READ axisRect) + Q_PROPERTY(ScaleType scaleType READ scaleType WRITE setScaleType NOTIFY scaleTypeChanged) + Q_PROPERTY(double scaleLogBase READ scaleLogBase WRITE setScaleLogBase) + Q_PROPERTY(QCPRange range READ range WRITE setRange NOTIFY rangeChanged) + Q_PROPERTY(bool rangeReversed READ rangeReversed WRITE setRangeReversed) + Q_PROPERTY(bool autoTicks READ autoTicks WRITE setAutoTicks) + Q_PROPERTY(int autoTickCount READ autoTickCount WRITE setAutoTickCount) + Q_PROPERTY(bool autoTickLabels READ autoTickLabels WRITE setAutoTickLabels) + Q_PROPERTY(bool autoTickStep READ autoTickStep WRITE setAutoTickStep) + Q_PROPERTY(bool autoSubTicks READ autoSubTicks WRITE setAutoSubTicks) + Q_PROPERTY(bool ticks READ ticks WRITE setTicks) + Q_PROPERTY(bool tickLabels READ tickLabels WRITE setTickLabels) + Q_PROPERTY(int tickLabelPadding READ tickLabelPadding WRITE setTickLabelPadding) + Q_PROPERTY(LabelType tickLabelType READ tickLabelType WRITE setTickLabelType) + Q_PROPERTY(QFont tickLabelFont READ tickLabelFont WRITE setTickLabelFont) + Q_PROPERTY(QColor tickLabelColor READ tickLabelColor WRITE setTickLabelColor) + Q_PROPERTY(double tickLabelRotation READ tickLabelRotation WRITE setTickLabelRotation) + Q_PROPERTY(LabelSide tickLabelSide READ tickLabelSide WRITE setTickLabelSide) + Q_PROPERTY(QString dateTimeFormat READ dateTimeFormat WRITE setDateTimeFormat) + Q_PROPERTY(Qt::TimeSpec dateTimeSpec READ dateTimeSpec WRITE setDateTimeSpec) + Q_PROPERTY(QString numberFormat READ numberFormat WRITE setNumberFormat) + Q_PROPERTY(int numberPrecision READ numberPrecision WRITE setNumberPrecision) + Q_PROPERTY(double tickStep READ tickStep WRITE setTickStep) + Q_PROPERTY(QVector tickVector READ tickVector WRITE setTickVector) + Q_PROPERTY(QVector tickVectorLabels READ tickVectorLabels WRITE setTickVectorLabels) + Q_PROPERTY(int tickLengthIn READ tickLengthIn WRITE setTickLengthIn) + Q_PROPERTY(int tickLengthOut READ tickLengthOut WRITE setTickLengthOut) + Q_PROPERTY(int subTickCount READ subTickCount WRITE setSubTickCount) + Q_PROPERTY(int subTickLengthIn READ subTickLengthIn WRITE setSubTickLengthIn) + Q_PROPERTY(int subTickLengthOut READ subTickLengthOut WRITE setSubTickLengthOut) + Q_PROPERTY(QPen basePen READ basePen WRITE setBasePen) + Q_PROPERTY(QPen tickPen READ tickPen WRITE setTickPen) + Q_PROPERTY(QPen subTickPen READ subTickPen WRITE setSubTickPen) + Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont) + Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor) + Q_PROPERTY(QString label READ label WRITE setLabel) + Q_PROPERTY(int labelPadding READ labelPadding WRITE setLabelPadding) + Q_PROPERTY(int padding READ padding WRITE setPadding) + Q_PROPERTY(int offset READ offset WRITE setOffset) + Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectionChanged) + Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectableChanged) + Q_PROPERTY(QFont selectedTickLabelFont READ selectedTickLabelFont WRITE setSelectedTickLabelFont) + Q_PROPERTY(QFont selectedLabelFont READ selectedLabelFont WRITE setSelectedLabelFont) + Q_PROPERTY(QColor selectedTickLabelColor READ selectedTickLabelColor WRITE setSelectedTickLabelColor) + Q_PROPERTY(QColor selectedLabelColor READ selectedLabelColor WRITE setSelectedLabelColor) + Q_PROPERTY(QPen selectedBasePen READ selectedBasePen WRITE setSelectedBasePen) + Q_PROPERTY(QPen selectedTickPen READ selectedTickPen WRITE setSelectedTickPen) + Q_PROPERTY(QPen selectedSubTickPen READ selectedSubTickPen WRITE setSelectedSubTickPen) + Q_PROPERTY(QCPLineEnding lowerEnding READ lowerEnding WRITE setLowerEnding) + Q_PROPERTY(QCPLineEnding upperEnding READ upperEnding WRITE setUpperEnding) + Q_PROPERTY(QCPGrid* grid READ grid) /// \endcond public: /*! @@ -1065,8 +1070,8 @@ public: , atTop = 0x04 ///< 0x04 Axis is horizontal and on the top side of the axis rect , atBottom = 0x08 ///< 0x08 Axis is horizontal and on the bottom side of the axis rect }; - Q_FLAGS ( AxisType AxisTypes ) - Q_DECLARE_FLAGS ( AxisTypes, AxisType ) + Q_FLAGS(AxisType AxisTypes) + Q_DECLARE_FLAGS(AxisTypes, AxisType) /*! When automatic tick label generation is enabled (\ref setAutoTickLabels), defines how the coordinate of the tick is interpreted, i.e. translated into a string. @@ -1076,7 +1081,7 @@ public: enum LabelType { ltNumber ///< Tick coordinate is regarded as normal number and will be displayed as such. (see \ref setNumberFormat) , ltDateTime ///< Tick coordinate is regarded as a date/time (seconds since 1970-01-01T00:00:00 UTC) and will be displayed and formatted as such. (for details, see \ref setDateTimeFormat) }; - Q_ENUMS ( LabelType ) + Q_ENUMS(LabelType) /*! Defines on which side of the axis the tick labels (numbers) shall appear. @@ -1085,7 +1090,7 @@ public: enum LabelSide { lsInside ///< Tick labels will be displayed inside the axis rect and clipped to the inner axis rect , lsOutside ///< Tick labels will be displayed outside the axis rect }; - Q_ENUMS ( LabelSide ) + Q_ENUMS(LabelSide) /*! Defines the scale of an axis. \see setScaleType @@ -1093,7 +1098,7 @@ public: enum ScaleType { stLinear ///< Linear scaling , stLogarithmic ///< Logarithmic scaling with correspondingly transformed plots and (major) tick marks at every base power (see \ref setScaleLogBase). }; - Q_ENUMS ( ScaleType ) + Q_ENUMS(ScaleType) /*! Defines the selectable parts of an axis. \see setSelectableParts, setSelectedParts @@ -1103,10 +1108,10 @@ public: , spTickLabels = 0x002 ///< Tick labels (numbers) of this axis (as a whole, not individually) , spAxisLabel = 0x004 ///< The axis label }; - Q_FLAGS ( SelectablePart SelectableParts ) - Q_DECLARE_FLAGS ( SelectableParts, SelectablePart ) + Q_FLAGS(SelectablePart SelectableParts) + Q_DECLARE_FLAGS(SelectableParts, SelectablePart) - explicit QCPAxis ( QCPAxisRect* parent, AxisType type ); + explicit QCPAxis(QCPAxisRect* parent, AxisType type); virtual ~QCPAxis(); // getters: @@ -1164,89 +1169,89 @@ public: QCPGrid* grid() const { return mGrid; } // setters: - Q_SLOT void setScaleType ( QCPAxis::ScaleType type ); - void setScaleLogBase ( double base ); - Q_SLOT void setRange ( const QCPRange& range ); - void setRange ( double lower, double upper ); - void setRange ( double position, double size, Qt::AlignmentFlag alignment ); - void setRangeLower ( double lower ); - void setRangeUpper ( double upper ); - void setRangeReversed ( bool reversed ); - void setAutoTicks ( bool on ); - void setAutoTickCount ( int approximateCount ); - void setAutoTickLabels ( bool on ); - void setAutoTickStep ( bool on ); - void setAutoSubTicks ( bool on ); - void setTicks ( bool show ); - void setTickLabels ( bool show ); - void setTickLabelPadding ( int padding ); - void setTickLabelType ( LabelType type ); - void setTickLabelFont ( const QFont& font ); - void setTickLabelColor ( const QColor& color ); - void setTickLabelRotation ( double degrees ); - void setTickLabelSide ( LabelSide side ); - void setDateTimeFormat ( const QString& format ); - void setDateTimeSpec ( const Qt::TimeSpec& timeSpec ); - void setNumberFormat ( const QString& formatCode ); - void setNumberPrecision ( int precision ); - void setTickStep ( double step ); - void setTickVector ( const QVector& vec ); - void setTickVectorLabels ( const QVector& vec ); - void setTickLength ( int inside, int outside = 0 ); - void setTickLengthIn ( int inside ); - void setTickLengthOut ( int outside ); - void setSubTickCount ( int count ); - void setSubTickLength ( int inside, int outside = 0 ); - void setSubTickLengthIn ( int inside ); - void setSubTickLengthOut ( int outside ); - void setBasePen ( const QPen& pen ); - void setTickPen ( const QPen& pen ); - void setSubTickPen ( const QPen& pen ); - void setLabelFont ( const QFont& font ); - void setLabelColor ( const QColor& color ); - void setLabel ( const QString& str ); - void setLabelPadding ( int padding ); - void setPadding ( int padding ); - void setOffset ( int offset ); - void setSelectedTickLabelFont ( const QFont& font ); - void setSelectedLabelFont ( const QFont& font ); - void setSelectedTickLabelColor ( const QColor& color ); - void setSelectedLabelColor ( const QColor& color ); - void setSelectedBasePen ( const QPen& pen ); - void setSelectedTickPen ( const QPen& pen ); - void setSelectedSubTickPen ( const QPen& pen ); - Q_SLOT void setSelectableParts ( const QCPAxis::SelectableParts& selectableParts ); - Q_SLOT void setSelectedParts ( const QCPAxis::SelectableParts& selectedParts ); - void setLowerEnding ( const QCPLineEnding& ending ); - void setUpperEnding ( const QCPLineEnding& ending ); + Q_SLOT void setScaleType(QCPAxis::ScaleType type); + void setScaleLogBase(double base); + Q_SLOT void setRange(const QCPRange& range); + void setRange(double lower, double upper); + void setRange(double position, double size, Qt::AlignmentFlag alignment); + void setRangeLower(double lower); + void setRangeUpper(double upper); + void setRangeReversed(bool reversed); + void setAutoTicks(bool on); + void setAutoTickCount(int approximateCount); + void setAutoTickLabels(bool on); + void setAutoTickStep(bool on); + void setAutoSubTicks(bool on); + void setTicks(bool show); + void setTickLabels(bool show); + void setTickLabelPadding(int padding); + void setTickLabelType(LabelType type); + void setTickLabelFont(const QFont& font); + void setTickLabelColor(const QColor& color); + void setTickLabelRotation(double degrees); + void setTickLabelSide(LabelSide side); + void setDateTimeFormat(const QString& format); + void setDateTimeSpec(const Qt::TimeSpec& timeSpec); + void setNumberFormat(const QString& formatCode); + void setNumberPrecision(int precision); + void setTickStep(double step); + void setTickVector(const QVector& vec); + void setTickVectorLabels(const QVector& vec); + void setTickLength(int inside, int outside = 0); + void setTickLengthIn(int inside); + void setTickLengthOut(int outside); + void setSubTickCount(int count); + void setSubTickLength(int inside, int outside = 0); + void setSubTickLengthIn(int inside); + void setSubTickLengthOut(int outside); + void setBasePen(const QPen& pen); + void setTickPen(const QPen& pen); + void setSubTickPen(const QPen& pen); + void setLabelFont(const QFont& font); + void setLabelColor(const QColor& color); + void setLabel(const QString& str); + void setLabelPadding(int padding); + void setPadding(int padding); + void setOffset(int offset); + void setSelectedTickLabelFont(const QFont& font); + void setSelectedLabelFont(const QFont& font); + void setSelectedTickLabelColor(const QColor& color); + void setSelectedLabelColor(const QColor& color); + void setSelectedBasePen(const QPen& pen); + void setSelectedTickPen(const QPen& pen); + void setSelectedSubTickPen(const QPen& pen); + Q_SLOT void setSelectableParts(const QCPAxis::SelectableParts& selectableParts); + Q_SLOT void setSelectedParts(const QCPAxis::SelectableParts& selectedParts); + void setLowerEnding(const QCPLineEnding& ending); + void setUpperEnding(const QCPLineEnding& ending); // reimplemented virtual methods: - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; // non-property methods: Qt::Orientation orientation() const { return mOrientation; } - void moveRange ( double diff ); - void scaleRange ( double factor, double center ); - void setScaleRatio ( const QCPAxis* otherAxis, double ratio = 1.0 ); - void rescale ( bool onlyVisiblePlottables = false ); - double pixelToCoord ( double value ) const; - double coordToPixel ( double value ) const; - SelectablePart getPartAt ( const QPointF& pos ) const; + void moveRange(double diff); + void scaleRange(double factor, double center); + void setScaleRatio(const QCPAxis* otherAxis, double ratio = 1.0); + void rescale(bool onlyVisiblePlottables = false); + double pixelToCoord(double value) const; + double coordToPixel(double value) const; + SelectablePart getPartAt(const QPointF& pos) const; QList plottables() const; QList graphs() const; QList items() const; - static AxisType marginSideToAxisType ( QCP::MarginSide side ); - static Qt::Orientation orientation ( AxisType type ) { return type == atBottom || type == atTop ? Qt::Horizontal : Qt::Vertical; } - static AxisType opposite ( AxisType type ); + static AxisType marginSideToAxisType(QCP::MarginSide side); + static Qt::Orientation orientation(AxisType type) { return type == atBottom || type == atTop ? Qt::Horizontal : Qt::Vertical; } + static AxisType opposite(AxisType type); signals: void ticksRequest(); - void rangeChanged ( const QCPRange& newRange ); - void rangeChanged ( const QCPRange& newRange, const QCPRange& oldRange ); - void scaleTypeChanged ( QCPAxis::ScaleType scaleType ); - void selectionChanged ( const QCPAxis::SelectableParts& parts ); - void selectableChanged ( const QCPAxis::SelectableParts& parts ); + void rangeChanged(const QCPRange& newRange); + void rangeChanged(const QCPRange& newRange, const QCPRange& oldRange); + void scaleTypeChanged(QCPAxis::ScaleType scaleType); + void selectionChanged(const QCPAxis::SelectableParts& parts); + void selectableChanged(const QCPAxis::SelectableParts& parts); protected: // property members: @@ -1304,21 +1309,21 @@ protected: // introduced virtual methods: virtual void setupTickVectors(); virtual void generateAutoTicks(); - virtual int calculateAutoSubTickCount ( double tickStep ) const; + virtual int calculateAutoSubTickCount(double tickStep) const; virtual int calculateMargin(); // reimplemented virtual methods: - virtual void applyDefaultAntialiasingHint ( QCPPainter* painter ) const; - virtual void draw ( QCPPainter* painter ); + virtual void applyDefaultAntialiasingHint(QCPPainter* painter) const; + virtual void draw(QCPPainter* painter); virtual QCP::Interaction selectionCategory() const; // events: - virtual void selectEvent ( QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged ); - virtual void deselectEvent ( bool* selectionStateChanged ); + virtual void selectEvent(QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged); + virtual void deselectEvent(bool* selectionStateChanged); // non-virtual methods: - void visibleTickBounds ( int& lowIndex, int& highIndex ) const; - double baseLog ( double value ) const; - double basePow ( double value ) const; + void visibleTickBounds(int& lowIndex, int& highIndex) const; + double baseLog(double value) const; + double basePow(double value) const; QPen getBasePen() const; QPen getTickPen() const; QPen getSubTickPen() const; @@ -1328,24 +1333,24 @@ protected: QColor getLabelColor() const; private: - Q_DISABLE_COPY ( QCPAxis ) + Q_DISABLE_COPY(QCPAxis) friend class QCustomPlot; friend class QCPGrid; friend class QCPAxisRect; }; -Q_DECLARE_OPERATORS_FOR_FLAGS ( QCPAxis::SelectableParts ) -Q_DECLARE_OPERATORS_FOR_FLAGS ( QCPAxis::AxisTypes ) -Q_DECLARE_METATYPE ( QCPAxis::SelectablePart ) +Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::SelectableParts) +Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::AxisTypes) +Q_DECLARE_METATYPE(QCPAxis::SelectablePart) class QCPAxisPainterPrivate { public: - explicit QCPAxisPainterPrivate ( QCustomPlot* parentPlot ); + explicit QCPAxisPainterPrivate(QCustomPlot* parentPlot); virtual ~QCPAxisPainterPrivate(); - virtual void draw ( QCPPainter* painter ); + virtual void draw(QCPPainter* painter); virtual int size() const; void clearCache(); @@ -1398,12 +1403,12 @@ protected: virtual QByteArray generateLabelParameterHash() const; - virtual void placeTickLabel ( QCPPainter* painter, double position, int distanceToAxis, const QString& text, - QSize* tickLabelsSize ); - virtual void drawTickLabel ( QCPPainter* painter, double x, double y, const TickLabelData& labelData ) const; - virtual TickLabelData getTickLabelData ( const QFont& font, const QString& text ) const; - virtual QPointF getTickLabelDrawOffset ( const TickLabelData& labelData ) const; - virtual void getMaxTickLabelSize ( const QFont& font, const QString& text, QSize* tickLabelsSize ) const; + virtual void placeTickLabel(QCPPainter* painter, double position, int distanceToAxis, const QString& text, + QSize* tickLabelsSize); + virtual void drawTickLabel(QCPPainter* painter, double x, double y, const TickLabelData& labelData) const; + virtual TickLabelData getTickLabelData(const QFont& font, const QString& text) const; + virtual QPointF getTickLabelDrawOffset(const TickLabelData& labelData) const; + virtual void getMaxTickLabelSize(const QFont& font, const QString& text, QSize* tickLabelsSize) const; }; @@ -1411,21 +1416,21 @@ class QCP_LIB_DECL QCPAbstractPlottable : public QCPLayerable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( QString name READ name WRITE setName ) - Q_PROPERTY ( bool antialiasedFill READ antialiasedFill WRITE setAntialiasedFill ) - Q_PROPERTY ( bool antialiasedScatters READ antialiasedScatters WRITE setAntialiasedScatters ) - Q_PROPERTY ( bool antialiasedErrorBars READ antialiasedErrorBars WRITE setAntialiasedErrorBars ) - Q_PROPERTY ( QPen pen READ pen WRITE setPen ) - Q_PROPERTY ( QPen selectedPen READ selectedPen WRITE setSelectedPen ) - Q_PROPERTY ( QBrush brush READ brush WRITE setBrush ) - Q_PROPERTY ( QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush ) - Q_PROPERTY ( QCPAxis* keyAxis READ keyAxis WRITE setKeyAxis ) - Q_PROPERTY ( QCPAxis* valueAxis READ valueAxis WRITE setValueAxis ) - Q_PROPERTY ( bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged ) - Q_PROPERTY ( bool selected READ selected WRITE setSelected NOTIFY selectionChanged ) + Q_PROPERTY(QString name READ name WRITE setName) + Q_PROPERTY(bool antialiasedFill READ antialiasedFill WRITE setAntialiasedFill) + Q_PROPERTY(bool antialiasedScatters READ antialiasedScatters WRITE setAntialiasedScatters) + Q_PROPERTY(bool antialiasedErrorBars READ antialiasedErrorBars WRITE setAntialiasedErrorBars) + Q_PROPERTY(QPen pen READ pen WRITE setPen) + Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) + Q_PROPERTY(QBrush brush READ brush WRITE setBrush) + Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush) + Q_PROPERTY(QCPAxis* keyAxis READ keyAxis WRITE setKeyAxis) + Q_PROPERTY(QCPAxis* valueAxis READ valueAxis WRITE setValueAxis) + Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged) + Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectionChanged) /// \endcond public: - QCPAbstractPlottable ( QCPAxis* keyAxis, QCPAxis* valueAxis ); + QCPAbstractPlottable(QCPAxis* keyAxis, QCPAxis* valueAxis); // getters: QString name() const { return mName; } @@ -1442,33 +1447,33 @@ public: bool selected() const { return mSelected; } // setters: - void setName ( const QString& name ); - void setAntialiasedFill ( bool enabled ); - void setAntialiasedScatters ( bool enabled ); - void setAntialiasedErrorBars ( bool enabled ); - void setPen ( const QPen& pen ); - void setSelectedPen ( const QPen& pen ); - void setBrush ( const QBrush& brush ); - void setSelectedBrush ( const QBrush& brush ); - void setKeyAxis ( QCPAxis* axis ); - void setValueAxis ( QCPAxis* axis ); - Q_SLOT void setSelectable ( bool selectable ); - Q_SLOT void setSelected ( bool selected ); + void setName(const QString& name); + void setAntialiasedFill(bool enabled); + void setAntialiasedScatters(bool enabled); + void setAntialiasedErrorBars(bool enabled); + void setPen(const QPen& pen); + void setSelectedPen(const QPen& pen); + void setBrush(const QBrush& brush); + void setSelectedBrush(const QBrush& brush); + void setKeyAxis(QCPAxis* axis); + void setValueAxis(QCPAxis* axis); + Q_SLOT void setSelectable(bool selectable); + Q_SLOT void setSelected(bool selected); // introduced virtual methods: virtual void clearData() = 0; - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const = 0; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const = 0; virtual bool addToLegend(); virtual bool removeFromLegend() const; // non-property methods: - void rescaleAxes ( bool onlyEnlarge = false ) const; - void rescaleKeyAxis ( bool onlyEnlarge = false ) const; - void rescaleValueAxis ( bool onlyEnlarge = false ) const; + void rescaleAxes(bool onlyEnlarge = false) const; + void rescaleKeyAxis(bool onlyEnlarge = false) const; + void rescaleValueAxis(bool onlyEnlarge = false) const; signals: - void selectionChanged ( bool selected ); - void selectableChanged ( bool selectable ); + void selectionChanged(bool selected); + void selectableChanged(bool selectable); protected: /*! @@ -1489,32 +1494,32 @@ protected: // reimplemented virtual methods: virtual QRect clipRect() const; - virtual void draw ( QCPPainter* painter ) = 0; + virtual void draw(QCPPainter* painter) = 0; virtual QCP::Interaction selectionCategory() const; - void applyDefaultAntialiasingHint ( QCPPainter* painter ) const; + void applyDefaultAntialiasingHint(QCPPainter* painter) const; // events: - virtual void selectEvent ( QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged ); - virtual void deselectEvent ( bool* selectionStateChanged ); + virtual void selectEvent(QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged); + virtual void deselectEvent(bool* selectionStateChanged); // introduced virtual methods: - virtual void drawLegendIcon ( QCPPainter* painter, const QRectF& rect ) const = 0; - virtual QCPRange getKeyRange ( bool& foundRange, SignDomain inSignDomain = sdBoth ) const = 0; - virtual QCPRange getValueRange ( bool& foundRange, SignDomain inSignDomain = sdBoth ) const = 0; + virtual void drawLegendIcon(QCPPainter* painter, const QRectF& rect) const = 0; + virtual QCPRange getKeyRange(bool& foundRange, SignDomain inSignDomain = sdBoth) const = 0; + virtual QCPRange getValueRange(bool& foundRange, SignDomain inSignDomain = sdBoth) const = 0; // non-virtual methods: - void coordsToPixels ( double key, double value, double& x, double& y ) const; - const QPointF coordsToPixels ( double key, double value ) const; - void pixelsToCoords ( double x, double y, double& key, double& value ) const; - void pixelsToCoords ( const QPointF& pixelPos, double& key, double& value ) const; + void coordsToPixels(double key, double value, double& x, double& y) const; + const QPointF coordsToPixels(double key, double value) const; + void pixelsToCoords(double x, double y, double& key, double& value) const; + void pixelsToCoords(const QPointF& pixelPos, double& key, double& value) const; QPen mainPen() const; QBrush mainBrush() const; - void applyFillAntialiasingHint ( QCPPainter* painter ) const; - void applyScattersAntialiasingHint ( QCPPainter* painter ) const; - void applyErrorBarsAntialiasingHint ( QCPPainter* painter ) const; - double distSqrToLine ( const QPointF& start, const QPointF& end, const QPointF& point ) const; + void applyFillAntialiasingHint(QCPPainter* painter) const; + void applyScattersAntialiasingHint(QCPPainter* painter) const; + void applyErrorBarsAntialiasingHint(QCPPainter* painter) const; + double distSqrToLine(const QPointF& start, const QPointF& end, const QPointF& point) const; private: - Q_DISABLE_COPY ( QCPAbstractPlottable ) + Q_DISABLE_COPY(QCPAbstractPlottable) friend class QCustomPlot; friend class QCPAxis; @@ -1525,7 +1530,7 @@ private: class QCP_LIB_DECL QCPItemAnchor { public: - QCPItemAnchor ( QCustomPlot* parentPlot, QCPAbstractItem* parentItem, const QString name, int anchorId = -1 ); + QCPItemAnchor(QCustomPlot* parentPlot, QCPAbstractItem* parentItem, const QString name, int anchorId = -1); virtual ~QCPItemAnchor(); // getters: @@ -1546,13 +1551,13 @@ protected: virtual QCPItemPosition* toQCPItemPosition() { return 0; } // non-virtual methods: - void addChildX ( QCPItemPosition* pos ); // called from pos when this anchor is set as parent - void removeChildX ( QCPItemPosition* pos ); // called from pos when its parent anchor is reset or pos deleted - void addChildY ( QCPItemPosition* pos ); // called from pos when this anchor is set as parent - void removeChildY ( QCPItemPosition* pos ); // called from pos when its parent anchor is reset or pos deleted + void addChildX(QCPItemPosition* pos); // called from pos when this anchor is set as parent + void removeChildX(QCPItemPosition* pos); // called from pos when its parent anchor is reset or pos deleted + void addChildY(QCPItemPosition* pos); // called from pos when this anchor is set as parent + void removeChildY(QCPItemPosition* pos); // called from pos when its parent anchor is reset or pos deleted private: - Q_DISABLE_COPY ( QCPItemAnchor ) + Q_DISABLE_COPY(QCPItemAnchor) friend class QCPItemPosition; }; @@ -1578,7 +1583,7 @@ public: , ptPlotCoords ///< Dynamic positioning at a plot coordinate defined by two axes (see \ref setAxes). }; - QCPItemPosition ( QCustomPlot* parentPlot, QCPAbstractItem* parentItem, const QString name ); + QCPItemPosition(QCustomPlot* parentPlot, QCPAbstractItem* parentItem, const QString name); virtual ~QCPItemPosition(); // getters: @@ -1590,24 +1595,24 @@ public: QCPItemAnchor* parentAnchorY() const { return mParentAnchorY; } double key() const { return mKey; } double value() const { return mValue; } - QPointF coords() const { return QPointF ( mKey, mValue ); } + QPointF coords() const { return QPointF(mKey, mValue); } QCPAxis* keyAxis() const { return mKeyAxis.data(); } QCPAxis* valueAxis() const { return mValueAxis.data(); } QCPAxisRect* axisRect() const; virtual QPointF pixelPoint() const; // setters: - void setType ( PositionType type ); - void setTypeX ( PositionType type ); - void setTypeY ( PositionType type ); - bool setParentAnchor ( QCPItemAnchor* parentAnchor, bool keepPixelPosition = false ); - bool setParentAnchorX ( QCPItemAnchor* parentAnchor, bool keepPixelPosition = false ); - bool setParentAnchorY ( QCPItemAnchor* parentAnchor, bool keepPixelPosition = false ); - void setCoords ( double key, double value ); - void setCoords ( const QPointF& coords ); - void setAxes ( QCPAxis* keyAxis, QCPAxis* valueAxis ); - void setAxisRect ( QCPAxisRect* axisRect ); - void setPixelPoint ( const QPointF& pixelPoint ); + void setType(PositionType type); + void setTypeX(PositionType type); + void setTypeY(PositionType type); + bool setParentAnchor(QCPItemAnchor* parentAnchor, bool keepPixelPosition = false); + bool setParentAnchorX(QCPItemAnchor* parentAnchor, bool keepPixelPosition = false); + bool setParentAnchorY(QCPItemAnchor* parentAnchor, bool keepPixelPosition = false); + void setCoords(double key, double value); + void setCoords(const QPointF& coords); + void setAxes(QCPAxis* keyAxis, QCPAxis* valueAxis); + void setAxisRect(QCPAxisRect* axisRect); + void setPixelPoint(const QPointF& pixelPoint); protected: // property members: @@ -1621,7 +1626,7 @@ protected: virtual QCPItemPosition* toQCPItemPosition() { return this; } private: - Q_DISABLE_COPY ( QCPItemPosition ) + Q_DISABLE_COPY(QCPItemPosition) }; @@ -1630,13 +1635,13 @@ class QCP_LIB_DECL QCPAbstractItem : public QCPLayerable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( bool clipToAxisRect READ clipToAxisRect WRITE setClipToAxisRect ) - Q_PROPERTY ( QCPAxisRect* clipAxisRect READ clipAxisRect WRITE setClipAxisRect ) - Q_PROPERTY ( bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged ) - Q_PROPERTY ( bool selected READ selected WRITE setSelected NOTIFY selectionChanged ) + Q_PROPERTY(bool clipToAxisRect READ clipToAxisRect WRITE setClipToAxisRect) + Q_PROPERTY(QCPAxisRect* clipAxisRect READ clipAxisRect WRITE setClipAxisRect) + Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged) + Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectionChanged) /// \endcond public: - QCPAbstractItem ( QCustomPlot* parentPlot ); + QCPAbstractItem(QCustomPlot* parentPlot); virtual ~QCPAbstractItem(); // getters: @@ -1646,24 +1651,24 @@ public: bool selected() const { return mSelected; } // setters: - void setClipToAxisRect ( bool clip ); - void setClipAxisRect ( QCPAxisRect* rect ); - Q_SLOT void setSelectable ( bool selectable ); - Q_SLOT void setSelected ( bool selected ); + void setClipToAxisRect(bool clip); + void setClipAxisRect(QCPAxisRect* rect); + Q_SLOT void setSelectable(bool selectable); + Q_SLOT void setSelected(bool selected); // reimplemented virtual methods: - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const = 0; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const = 0; // non-virtual methods: QList positions() const { return mPositions; } QList anchors() const { return mAnchors; } - QCPItemPosition* position ( const QString& name ) const; - QCPItemAnchor* anchor ( const QString& name ) const; - bool hasAnchor ( const QString& name ) const; + QCPItemPosition* position(const QString& name) const; + QCPItemAnchor* anchor(const QString& name) const; + bool hasAnchor(const QString& name) const; signals: - void selectionChanged ( bool selected ); - void selectableChanged ( bool selectable ); + void selectionChanged(bool selected); + void selectableChanged(bool selectable); protected: // property members: @@ -1676,23 +1681,23 @@ protected: // reimplemented virtual methods: virtual QCP::Interaction selectionCategory() const; virtual QRect clipRect() const; - virtual void applyDefaultAntialiasingHint ( QCPPainter* painter ) const; - virtual void draw ( QCPPainter* painter ) = 0; + virtual void applyDefaultAntialiasingHint(QCPPainter* painter) const; + virtual void draw(QCPPainter* painter) = 0; // events: - virtual void selectEvent ( QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged ); - virtual void deselectEvent ( bool* selectionStateChanged ); + virtual void selectEvent(QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged); + virtual void deselectEvent(bool* selectionStateChanged); // introduced virtual methods: - virtual QPointF anchorPixelPoint ( int anchorId ) const; + virtual QPointF anchorPixelPoint(int anchorId) const; // non-virtual methods: - double distSqrToLine ( const QPointF& start, const QPointF& end, const QPointF& point ) const; - double rectSelectTest ( const QRectF& rect, const QPointF& pos, bool filledRect ) const; - QCPItemPosition* createPosition ( const QString& name ); - QCPItemAnchor* createAnchor ( const QString& name, int anchorId ); + double distSqrToLine(const QPointF& start, const QPointF& end, const QPointF& point) const; + double rectSelectTest(const QRectF& rect, const QPointF& pos, bool filledRect) const; + QCPItemPosition* createPosition(const QString& name); + QCPItemAnchor* createAnchor(const QString& name, int anchorId); private: - Q_DISABLE_COPY ( QCPAbstractItem ) + Q_DISABLE_COPY(QCPAbstractItem) friend class QCustomPlot; friend class QCPItemAnchor; @@ -1703,15 +1708,15 @@ class QCP_LIB_DECL QCustomPlot : public QWidget { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( QRect viewport READ viewport WRITE setViewport ) - Q_PROPERTY ( QPixmap background READ background WRITE setBackground ) - Q_PROPERTY ( bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled ) - Q_PROPERTY ( Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode ) - Q_PROPERTY ( QCPLayoutGrid* plotLayout READ plotLayout ) - Q_PROPERTY ( bool autoAddPlottableToLegend READ autoAddPlottableToLegend WRITE setAutoAddPlottableToLegend ) - Q_PROPERTY ( int selectionTolerance READ selectionTolerance WRITE setSelectionTolerance ) - Q_PROPERTY ( bool noAntialiasingOnDrag READ noAntialiasingOnDrag WRITE setNoAntialiasingOnDrag ) - Q_PROPERTY ( Qt::KeyboardModifier multiSelectModifier READ multiSelectModifier WRITE setMultiSelectModifier ) + Q_PROPERTY(QRect viewport READ viewport WRITE setViewport) + Q_PROPERTY(QPixmap background READ background WRITE setBackground) + Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled) + Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode) + Q_PROPERTY(QCPLayoutGrid* plotLayout READ plotLayout) + Q_PROPERTY(bool autoAddPlottableToLegend READ autoAddPlottableToLegend WRITE setAutoAddPlottableToLegend) + Q_PROPERTY(int selectionTolerance READ selectionTolerance WRITE setSelectionTolerance) + Q_PROPERTY(bool noAntialiasingOnDrag READ noAntialiasingOnDrag WRITE setNoAntialiasingOnDrag) + Q_PROPERTY(Qt::KeyboardModifier multiSelectModifier READ multiSelectModifier WRITE setMultiSelectModifier) /// \endcond public: /*! @@ -1722,7 +1727,7 @@ public: enum LayerInsertMode { limBelow ///< Layer is inserted below other layer , limAbove ///< Layer is inserted above other layer }; - Q_ENUMS ( LayerInsertMode ) + Q_ENUMS(LayerInsertMode) /*! Defines with what timing the QCustomPlot surface is refreshed after a replot. @@ -1734,7 +1739,7 @@ public: , rpHint ///< Whether to use immediate repaint or queued update depends on whether the plotting hint \ref QCP::phForceRepaint is set, see \ref setPlottingHints. }; - explicit QCustomPlot ( QWidget* parent = 0 ); + explicit QCustomPlot(QWidget* parent = 0); virtual ~QCustomPlot(); // getters: @@ -1753,113 +1758,113 @@ public: Qt::KeyboardModifier multiSelectModifier() const { return mMultiSelectModifier; } // setters: - void setViewport ( const QRect& rect ); - void setBackground ( const QPixmap& pm ); - void setBackground ( const QPixmap& pm, bool scaled, Qt::AspectRatioMode mode = Qt::KeepAspectRatioByExpanding ); - void setBackground ( const QBrush& brush ); - void setBackgroundScaled ( bool scaled ); - void setBackgroundScaledMode ( Qt::AspectRatioMode mode ); - void setAntialiasedElements ( const QCP::AntialiasedElements& antialiasedElements ); - void setAntialiasedElement ( QCP::AntialiasedElement antialiasedElement, bool enabled = true ); - void setNotAntialiasedElements ( const QCP::AntialiasedElements& notAntialiasedElements ); - void setNotAntialiasedElement ( QCP::AntialiasedElement notAntialiasedElement, bool enabled = true ); - void setAutoAddPlottableToLegend ( bool on ); - void setInteractions ( const QCP::Interactions& interactions ); - void setInteraction ( const QCP::Interaction& interaction, bool enabled = true ); - void setSelectionTolerance ( int pixels ); - void setNoAntialiasingOnDrag ( bool enabled ); - void setPlottingHints ( const QCP::PlottingHints& hints ); - void setPlottingHint ( QCP::PlottingHint hint, bool enabled = true ); - void setMultiSelectModifier ( Qt::KeyboardModifier modifier ); + void setViewport(const QRect& rect); + void setBackground(const QPixmap& pm); + void setBackground(const QPixmap& pm, bool scaled, Qt::AspectRatioMode mode = Qt::KeepAspectRatioByExpanding); + void setBackground(const QBrush& brush); + void setBackgroundScaled(bool scaled); + void setBackgroundScaledMode(Qt::AspectRatioMode mode); + void setAntialiasedElements(const QCP::AntialiasedElements& antialiasedElements); + void setAntialiasedElement(QCP::AntialiasedElement antialiasedElement, bool enabled = true); + void setNotAntialiasedElements(const QCP::AntialiasedElements& notAntialiasedElements); + void setNotAntialiasedElement(QCP::AntialiasedElement notAntialiasedElement, bool enabled = true); + void setAutoAddPlottableToLegend(bool on); + void setInteractions(const QCP::Interactions& interactions); + void setInteraction(const QCP::Interaction& interaction, bool enabled = true); + void setSelectionTolerance(int pixels); + void setNoAntialiasingOnDrag(bool enabled); + void setPlottingHints(const QCP::PlottingHints& hints); + void setPlottingHint(QCP::PlottingHint hint, bool enabled = true); + void setMultiSelectModifier(Qt::KeyboardModifier modifier); // non-property methods: // plottable interface: - QCPAbstractPlottable* plottable ( int index ); + QCPAbstractPlottable* plottable(int index); QCPAbstractPlottable* plottable(); - bool addPlottable ( QCPAbstractPlottable* plottable ); - bool removePlottable ( QCPAbstractPlottable* plottable ); - bool removePlottable ( int index ); + bool addPlottable(QCPAbstractPlottable* plottable); + bool removePlottable(QCPAbstractPlottable* plottable); + bool removePlottable(int index); int clearPlottables(); int plottableCount() const; QList selectedPlottables() const; - QCPAbstractPlottable* plottableAt ( const QPointF& pos, bool onlySelectable = false ) const; - bool hasPlottable ( QCPAbstractPlottable* plottable ) const; + QCPAbstractPlottable* plottableAt(const QPointF& pos, bool onlySelectable = false) const; + bool hasPlottable(QCPAbstractPlottable* plottable) const; // specialized interface for QCPGraph: - QCPGraph* graph ( int index ) const; + QCPGraph* graph(int index) const; QCPGraph* graph() const; - QCPGraph* addGraph ( QCPAxis* keyAxis = 0, QCPAxis* valueAxis = 0 ); - bool removeGraph ( QCPGraph* graph ); - bool removeGraph ( int index ); + QCPGraph* addGraph(QCPAxis* keyAxis = 0, QCPAxis* valueAxis = 0); + bool removeGraph(QCPGraph* graph); + bool removeGraph(int index); int clearGraphs(); int graphCount() const; QList selectedGraphs() const; // item interface: - QCPAbstractItem* item ( int index ) const; + QCPAbstractItem* item(int index) const; QCPAbstractItem* item() const; - bool addItem ( QCPAbstractItem* item ); - bool removeItem ( QCPAbstractItem* item ); - bool removeItem ( int index ); + bool addItem(QCPAbstractItem* item); + bool removeItem(QCPAbstractItem* item); + bool removeItem(int index); int clearItems(); int itemCount() const; QList selectedItems() const; - QCPAbstractItem* itemAt ( const QPointF& pos, bool onlySelectable = false ) const; - bool hasItem ( QCPAbstractItem* item ) const; + QCPAbstractItem* itemAt(const QPointF& pos, bool onlySelectable = false) const; + bool hasItem(QCPAbstractItem* item) const; // layer interface: - QCPLayer* layer ( const QString& name ) const; - QCPLayer* layer ( int index ) const; + QCPLayer* layer(const QString& name) const; + QCPLayer* layer(int index) const; QCPLayer* currentLayer() const; - bool setCurrentLayer ( const QString& name ); - bool setCurrentLayer ( QCPLayer* layer ); + bool setCurrentLayer(const QString& name); + bool setCurrentLayer(QCPLayer* layer); int layerCount() const; - bool addLayer ( const QString& name, QCPLayer* otherLayer = 0, LayerInsertMode insertMode = limAbove ); - bool removeLayer ( QCPLayer* layer ); - bool moveLayer ( QCPLayer* layer, QCPLayer* otherLayer, LayerInsertMode insertMode = limAbove ); + bool addLayer(const QString& name, QCPLayer* otherLayer = 0, LayerInsertMode insertMode = limAbove); + bool removeLayer(QCPLayer* layer); + bool moveLayer(QCPLayer* layer, QCPLayer* otherLayer, LayerInsertMode insertMode = limAbove); // axis rect/layout interface: int axisRectCount() const; - QCPAxisRect* axisRect ( int index = 0 ) const; + QCPAxisRect* axisRect(int index = 0) const; QList axisRects() const; - QCPLayoutElement* layoutElementAt ( const QPointF& pos ) const; - Q_SLOT void rescaleAxes ( bool onlyVisiblePlottables = false ); + QCPLayoutElement* layoutElementAt(const QPointF& pos) const; + Q_SLOT void rescaleAxes(bool onlyVisiblePlottables = false); QList selectedAxes() const; QList selectedLegends() const; Q_SLOT void deselectAll(); - bool savePdf ( const QString& fileName, bool noCosmeticPen = false, int width = 0, int height = 0, - const QString& pdfCreator = QString(), const QString& pdfTitle = QString() ); - bool savePng ( const QString& fileName, int width = 0, int height = 0, double scale = 1.0, int quality = -1 ); - bool saveJpg ( const QString& fileName, int width = 0, int height = 0, double scale = 1.0, int quality = -1 ); - bool saveBmp ( const QString& fileName, int width = 0, int height = 0, double scale = 1.0 ); - bool saveRastered ( const QString& fileName, int width, int height, double scale, const char* format, - int quality = -1 ); - QPixmap toPixmap ( int width = 0, int height = 0, double scale = 1.0 ); - void toPainter ( QCPPainter* painter, int width = 0, int height = 0 ); - Q_SLOT void replot ( QCustomPlot::RefreshPriority refreshPriority = QCustomPlot::rpHint ); + bool savePdf(const QString& fileName, bool noCosmeticPen = false, int width = 0, int height = 0, + const QString& pdfCreator = QString(), const QString& pdfTitle = QString()); + bool savePng(const QString& fileName, int width = 0, int height = 0, double scale = 1.0, int quality = -1); + bool saveJpg(const QString& fileName, int width = 0, int height = 0, double scale = 1.0, int quality = -1); + bool saveBmp(const QString& fileName, int width = 0, int height = 0, double scale = 1.0); + bool saveRastered(const QString& fileName, int width, int height, double scale, const char* format, + int quality = -1); + QPixmap toPixmap(int width = 0, int height = 0, double scale = 1.0); + void toPainter(QCPPainter* painter, int width = 0, int height = 0); + Q_SLOT void replot(QCustomPlot::RefreshPriority refreshPriority = QCustomPlot::rpHint); QCPAxis* xAxis, *yAxis, *xAxis2, *yAxis2; QCPLegend* legend; signals: - void mouseDoubleClick ( QMouseEvent* event ); - void mousePress ( QMouseEvent* event ); - void mouseMove ( QMouseEvent* event ); - void mouseRelease ( QMouseEvent* event ); - void mouseWheel ( QWheelEvent* event ); + void mouseDoubleClick(QMouseEvent* event); + void mousePress(QMouseEvent* event); + void mouseMove(QMouseEvent* event); + void mouseRelease(QMouseEvent* event); + void mouseWheel(QWheelEvent* event); - void plottableClick ( QCPAbstractPlottable* plottable, QMouseEvent* event ); - void plottableDoubleClick ( QCPAbstractPlottable* plottable, QMouseEvent* event ); - void itemClick ( QCPAbstractItem* item, QMouseEvent* event ); - void itemDoubleClick ( QCPAbstractItem* item, QMouseEvent* event ); - void axisClick ( QCPAxis* axis, QCPAxis::SelectablePart part, QMouseEvent* event ); - void axisDoubleClick ( QCPAxis* axis, QCPAxis::SelectablePart part, QMouseEvent* event ); - void legendClick ( QCPLegend* legend, QCPAbstractLegendItem* item, QMouseEvent* event ); - void legendDoubleClick ( QCPLegend* legend, QCPAbstractLegendItem* item, QMouseEvent* event ); - void titleClick ( QMouseEvent* event, QCPPlotTitle* title ); - void titleDoubleClick ( QMouseEvent* event, QCPPlotTitle* title ); + void plottableClick(QCPAbstractPlottable* plottable, QMouseEvent* event); + void plottableDoubleClick(QCPAbstractPlottable* plottable, QMouseEvent* event); + void itemClick(QCPAbstractItem* item, QMouseEvent* event); + void itemDoubleClick(QCPAbstractItem* item, QMouseEvent* event); + void axisClick(QCPAxis* axis, QCPAxis::SelectablePart part, QMouseEvent* event); + void axisDoubleClick(QCPAxis* axis, QCPAxis::SelectablePart part, QMouseEvent* event); + void legendClick(QCPLegend* legend, QCPAbstractLegendItem* item, QMouseEvent* event); + void legendDoubleClick(QCPLegend* legend, QCPAbstractLegendItem* item, QMouseEvent* event); + void titleClick(QMouseEvent* event, QCPPlotTitle* title); + void titleDoubleClick(QMouseEvent* event, QCPPlotTitle* title); void selectionChangedByUser(); void beforeReplot(); @@ -1896,23 +1901,23 @@ protected: // reimplemented virtual methods: virtual QSize minimumSizeHint() const; virtual QSize sizeHint() const; - virtual void paintEvent ( QPaintEvent* event ); - virtual void resizeEvent ( QResizeEvent* event ); - virtual void mouseDoubleClickEvent ( QMouseEvent* event ); - virtual void mousePressEvent ( QMouseEvent* event ); - virtual void mouseMoveEvent ( QMouseEvent* event ); - virtual void mouseReleaseEvent ( QMouseEvent* event ); - virtual void wheelEvent ( QWheelEvent* event ); + virtual void paintEvent(QPaintEvent* event); + virtual void resizeEvent(QResizeEvent* event); + virtual void mouseDoubleClickEvent(QMouseEvent* event); + virtual void mousePressEvent(QMouseEvent* event); + virtual void mouseMoveEvent(QMouseEvent* event); + virtual void mouseReleaseEvent(QMouseEvent* event); + virtual void wheelEvent(QWheelEvent* event); // introduced virtual methods: - virtual void draw ( QCPPainter* painter ); - virtual void axisRemoved ( QCPAxis* axis ); - virtual void legendRemoved ( QCPLegend* legend ); + virtual void draw(QCPPainter* painter); + virtual void axisRemoved(QCPAxis* axis); + virtual void legendRemoved(QCPLegend* legend); // non-virtual methods: void updateLayerIndices() const; - QCPLayerable* layerableAt ( const QPointF& pos, bool onlySelectable, QVariant* selectionDetails = 0 ) const; - void drawBackground ( QCPPainter* painter ); + QCPLayerable* layerableAt(const QPointF& pos, bool onlySelectable, QVariant* selectionDetails = 0) const; + void drawBackground(QCPPainter* painter); friend class QCPLegend; friend class QCPAxis; @@ -1933,7 +1938,7 @@ public: enum ColorInterpolation { ciRGB ///< Color channels red, green and blue are linearly interpolated , ciHSV ///< Color channels hue, saturation and value are linearly interpolated (The hue is interpolated over the shortest angle distance) }; - Q_ENUMS ( ColorInterpolation ) + Q_ENUMS(ColorInterpolation) /*! Defines the available presets that can be loaded with \ref loadPreset. See the documentation @@ -1952,11 +1957,11 @@ public: , gpJet ///< Hue variation similar to a spectrum, often used in numerical visualization (creates banding illusion but allows more precise magnitude estimates) , gpHues ///< Full hue cycle, with highest and lowest color red (suitable for periodic data, such as angles and phases, see \ref setPeriodic) }; - Q_ENUMS ( GradientPreset ) + Q_ENUMS(GradientPreset) - QCPColorGradient ( GradientPreset preset = gpCold ); - bool operator== ( const QCPColorGradient& other ) const; - bool operator!= ( const QCPColorGradient& other ) const { return ! ( *this == other ); } + QCPColorGradient(GradientPreset preset = gpCold); + bool operator== (const QCPColorGradient& other) const; + bool operator!= (const QCPColorGradient& other) const { return !(*this == other); } // getters: int levelCount() const { return mLevelCount; } @@ -1965,17 +1970,17 @@ public: bool periodic() const { return mPeriodic; } // setters: - void setLevelCount ( int n ); - void setColorStops ( const QMap& colorStops ); - void setColorStopAt ( double position, const QColor& color ); - void setColorInterpolation ( ColorInterpolation interpolation ); - void setPeriodic ( bool enabled ); + void setLevelCount(int n); + void setColorStops(const QMap& colorStops); + void setColorStopAt(double position, const QColor& color); + void setColorInterpolation(ColorInterpolation interpolation); + void setPeriodic(bool enabled); // non-property methods: - void colorize ( const double* data, const QCPRange& range, QRgb* scanLine, int n, int dataIndexFactor = 1, - bool logarithmic = false ); - QRgb color ( double position, const QCPRange& range, bool logarithmic = false ); - void loadPreset ( GradientPreset preset ); + void colorize(const double* data, const QCPRange& range, QRgb* scanLine, int n, int dataIndexFactor = 1, + bool logarithmic = false); + QRgb color(double position, const QCPRange& range, bool logarithmic = false); + void loadPreset(GradientPreset preset); void clearColorStops(); QCPColorGradient inverted() const; @@ -1998,14 +2003,14 @@ class QCP_LIB_DECL QCPAxisRect : public QCPLayoutElement { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( QPixmap background READ background WRITE setBackground ) - Q_PROPERTY ( bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled ) - Q_PROPERTY ( Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode ) - Q_PROPERTY ( Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag ) - Q_PROPERTY ( Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom ) + Q_PROPERTY(QPixmap background READ background WRITE setBackground) + Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled) + Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode) + Q_PROPERTY(Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag) + Q_PROPERTY(Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom) /// \endcond public: - explicit QCPAxisRect ( QCustomPlot* parentPlot, bool setupDefaultAxes = true ); + explicit QCPAxisRect(QCustomPlot* parentPlot, bool setupDefaultAxes = true); virtual ~QCPAxisRect(); // getters: @@ -2014,34 +2019,34 @@ public: Qt::AspectRatioMode backgroundScaledMode() const { return mBackgroundScaledMode; } Qt::Orientations rangeDrag() const { return mRangeDrag; } Qt::Orientations rangeZoom() const { return mRangeZoom; } - QCPAxis* rangeDragAxis ( Qt::Orientation orientation ); - QCPAxis* rangeZoomAxis ( Qt::Orientation orientation ); - double rangeZoomFactor ( Qt::Orientation orientation ); + QCPAxis* rangeDragAxis(Qt::Orientation orientation); + QCPAxis* rangeZoomAxis(Qt::Orientation orientation); + double rangeZoomFactor(Qt::Orientation orientation); // setters: - void setBackground ( const QPixmap& pm ); - void setBackground ( const QPixmap& pm, bool scaled, Qt::AspectRatioMode mode = Qt::KeepAspectRatioByExpanding ); - void setBackground ( const QBrush& brush ); - void setBackgroundScaled ( bool scaled ); - void setBackgroundScaledMode ( Qt::AspectRatioMode mode ); - void setRangeDrag ( Qt::Orientations orientations ); - void setRangeZoom ( Qt::Orientations orientations ); - void setRangeDragAxes ( QCPAxis* horizontal, QCPAxis* vertical ); - void setRangeZoomAxes ( QCPAxis* horizontal, QCPAxis* vertical ); - void setRangeZoomFactor ( double horizontalFactor, double verticalFactor ); - void setRangeZoomFactor ( double factor ); + void setBackground(const QPixmap& pm); + void setBackground(const QPixmap& pm, bool scaled, Qt::AspectRatioMode mode = Qt::KeepAspectRatioByExpanding); + void setBackground(const QBrush& brush); + void setBackgroundScaled(bool scaled); + void setBackgroundScaledMode(Qt::AspectRatioMode mode); + void setRangeDrag(Qt::Orientations orientations); + void setRangeZoom(Qt::Orientations orientations); + void setRangeDragAxes(QCPAxis* horizontal, QCPAxis* vertical); + void setRangeZoomAxes(QCPAxis* horizontal, QCPAxis* vertical); + void setRangeZoomFactor(double horizontalFactor, double verticalFactor); + void setRangeZoomFactor(double factor); // non-property methods: - int axisCount ( QCPAxis::AxisType type ) const; - QCPAxis* axis ( QCPAxis::AxisType type, int index = 0 ) const; - QList axes ( QCPAxis::AxisTypes types ) const; + int axisCount(QCPAxis::AxisType type) const; + QCPAxis* axis(QCPAxis::AxisType type, int index = 0) const; + QList axes(QCPAxis::AxisTypes types) const; QList axes() const; - QCPAxis* addAxis ( QCPAxis::AxisType type, QCPAxis* axis = 0 ); - QList addAxes ( QCPAxis::AxisTypes types ); - bool removeAxis ( QCPAxis* axis ); + QCPAxis* addAxis(QCPAxis::AxisType type, QCPAxis* axis = 0); + QList addAxes(QCPAxis::AxisTypes types); + bool removeAxis(QCPAxis* axis); QCPLayoutInset* insetLayout() const { return mInsetLayout; } - void setupFullAxesBox ( bool connectRanges = false ); + void setupFullAxesBox(bool connectRanges = false); QList plottables() const; QList graphs() const; QList items() const; @@ -2061,8 +2066,8 @@ public: QPoint center() const { return mRect.center(); } // reimplemented virtual methods: - virtual void update ( UpdatePhase phase ); - virtual QList elements ( bool recursive ) const; + virtual void update(UpdatePhase phase); + virtual QList elements(bool recursive) const; protected: // property members: @@ -2083,21 +2088,21 @@ protected: QHash > mAxes; // reimplemented virtual methods: - virtual void applyDefaultAntialiasingHint ( QCPPainter* painter ) const; - virtual void draw ( QCPPainter* painter ); - virtual int calculateAutoMargin ( QCP::MarginSide side ); + virtual void applyDefaultAntialiasingHint(QCPPainter* painter) const; + virtual void draw(QCPPainter* painter); + virtual int calculateAutoMargin(QCP::MarginSide side); // events: - virtual void mousePressEvent ( QMouseEvent* event ); - virtual void mouseMoveEvent ( QMouseEvent* event ); - virtual void mouseReleaseEvent ( QMouseEvent* event ); - virtual void wheelEvent ( QWheelEvent* event ); + virtual void mousePressEvent(QMouseEvent* event); + virtual void mouseMoveEvent(QMouseEvent* event); + virtual void mouseReleaseEvent(QMouseEvent* event); + virtual void wheelEvent(QWheelEvent* event); // non-property methods: - void drawBackground ( QCPPainter* painter ); - void updateAxesOffset ( QCPAxis::AxisType type ); + void drawBackground(QCPPainter* painter); + void updateAxesOffset(QCPAxis::AxisType type); private: - Q_DISABLE_COPY ( QCPAxisRect ) + Q_DISABLE_COPY(QCPAxisRect) friend class QCustomPlot; }; @@ -2107,16 +2112,16 @@ class QCP_LIB_DECL QCPAbstractLegendItem : public QCPLayoutElement { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( QCPLegend* parentLegend READ parentLegend ) - Q_PROPERTY ( QFont font READ font WRITE setFont ) - Q_PROPERTY ( QColor textColor READ textColor WRITE setTextColor ) - Q_PROPERTY ( QFont selectedFont READ selectedFont WRITE setSelectedFont ) - Q_PROPERTY ( QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor ) - Q_PROPERTY ( bool selectable READ selectable WRITE setSelectable NOTIFY selectionChanged ) - Q_PROPERTY ( bool selected READ selected WRITE setSelected NOTIFY selectableChanged ) + Q_PROPERTY(QCPLegend* parentLegend READ parentLegend) + Q_PROPERTY(QFont font READ font WRITE setFont) + Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor) + Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont) + Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor) + Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectionChanged) + Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectableChanged) /// \endcond public: - explicit QCPAbstractLegendItem ( QCPLegend* parent ); + explicit QCPAbstractLegendItem(QCPLegend* parent); // getters: QCPLegend* parentLegend() const { return mParentLegend; } @@ -2128,19 +2133,19 @@ public: bool selected() const { return mSelected; } // setters: - void setFont ( const QFont& font ); - void setTextColor ( const QColor& color ); - void setSelectedFont ( const QFont& font ); - void setSelectedTextColor ( const QColor& color ); - Q_SLOT void setSelectable ( bool selectable ); - Q_SLOT void setSelected ( bool selected ); + void setFont(const QFont& font); + void setTextColor(const QColor& color); + void setSelectedFont(const QFont& font); + void setSelectedTextColor(const QColor& color); + Q_SLOT void setSelectable(bool selectable); + Q_SLOT void setSelected(bool selected); // reimplemented virtual methods: - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; signals: - void selectionChanged ( bool selected ); - void selectableChanged ( bool selectable ); + void selectionChanged(bool selected); + void selectableChanged(bool selectable); protected: // property members: @@ -2153,15 +2158,15 @@ protected: // reimplemented virtual methods: virtual QCP::Interaction selectionCategory() const; - virtual void applyDefaultAntialiasingHint ( QCPPainter* painter ) const; + virtual void applyDefaultAntialiasingHint(QCPPainter* painter) const; virtual QRect clipRect() const; - virtual void draw ( QCPPainter* painter ) = 0; + virtual void draw(QCPPainter* painter) = 0; // events: - virtual void selectEvent ( QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged ); - virtual void deselectEvent ( bool* selectionStateChanged ); + virtual void selectEvent(QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged); + virtual void deselectEvent(bool* selectionStateChanged); private: - Q_DISABLE_COPY ( QCPAbstractLegendItem ) + Q_DISABLE_COPY(QCPAbstractLegendItem) friend class QCPLegend; }; @@ -2171,7 +2176,7 @@ class QCP_LIB_DECL QCPPlottableLegendItem : public QCPAbstractLegendItem { Q_OBJECT public: - QCPPlottableLegendItem ( QCPLegend* parent, QCPAbstractPlottable* plottable ); + QCPPlottableLegendItem(QCPLegend* parent, QCPAbstractPlottable* plottable); // getters: QCPAbstractPlottable* plottable() { return mPlottable; } @@ -2181,7 +2186,7 @@ protected: QCPAbstractPlottable* mPlottable; // reimplemented virtual methods: - virtual void draw ( QCPPainter* painter ); + virtual void draw(QCPPainter* painter); virtual QSize minimumSizeHint() const; // non-virtual methods: @@ -2195,20 +2200,20 @@ class QCP_LIB_DECL QCPLegend : public QCPLayoutGrid { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( QPen borderPen READ borderPen WRITE setBorderPen ) - Q_PROPERTY ( QBrush brush READ brush WRITE setBrush ) - Q_PROPERTY ( QFont font READ font WRITE setFont ) - Q_PROPERTY ( QColor textColor READ textColor WRITE setTextColor ) - Q_PROPERTY ( QSize iconSize READ iconSize WRITE setIconSize ) - Q_PROPERTY ( int iconTextPadding READ iconTextPadding WRITE setIconTextPadding ) - Q_PROPERTY ( QPen iconBorderPen READ iconBorderPen WRITE setIconBorderPen ) - Q_PROPERTY ( SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectionChanged ) - Q_PROPERTY ( SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectableChanged ) - Q_PROPERTY ( QPen selectedBorderPen READ selectedBorderPen WRITE setSelectedBorderPen ) - Q_PROPERTY ( QPen selectedIconBorderPen READ selectedIconBorderPen WRITE setSelectedIconBorderPen ) - Q_PROPERTY ( QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush ) - Q_PROPERTY ( QFont selectedFont READ selectedFont WRITE setSelectedFont ) - Q_PROPERTY ( QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor ) + Q_PROPERTY(QPen borderPen READ borderPen WRITE setBorderPen) + Q_PROPERTY(QBrush brush READ brush WRITE setBrush) + Q_PROPERTY(QFont font READ font WRITE setFont) + Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor) + Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) + Q_PROPERTY(int iconTextPadding READ iconTextPadding WRITE setIconTextPadding) + Q_PROPERTY(QPen iconBorderPen READ iconBorderPen WRITE setIconBorderPen) + Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectionChanged) + Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectableChanged) + Q_PROPERTY(QPen selectedBorderPen READ selectedBorderPen WRITE setSelectedBorderPen) + Q_PROPERTY(QPen selectedIconBorderPen READ selectedIconBorderPen WRITE setSelectedIconBorderPen) + Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush) + Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont) + Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor) /// \endcond public: /*! @@ -2220,8 +2225,8 @@ public: , spLegendBox = 0x001 ///< 0x001 The legend box (frame) , spItems = 0x002 ///< 0x002 Legend items individually (see \ref selectedItems) }; - Q_FLAGS ( SelectablePart SelectableParts ) - Q_DECLARE_FLAGS ( SelectableParts, SelectablePart ) + Q_FLAGS(SelectablePart SelectableParts) + Q_DECLARE_FLAGS(SelectableParts, SelectablePart) explicit QCPLegend(); virtual ~QCPLegend(); @@ -2243,40 +2248,40 @@ public: QColor selectedTextColor() const { return mSelectedTextColor; } // setters: - void setBorderPen ( const QPen& pen ); - void setBrush ( const QBrush& brush ); - void setFont ( const QFont& font ); - void setTextColor ( const QColor& color ); - void setIconSize ( const QSize& size ); - void setIconSize ( int width, int height ); - void setIconTextPadding ( int padding ); - void setIconBorderPen ( const QPen& pen ); - Q_SLOT void setSelectableParts ( const SelectableParts& selectableParts ); - Q_SLOT void setSelectedParts ( const SelectableParts& selectedParts ); - void setSelectedBorderPen ( const QPen& pen ); - void setSelectedIconBorderPen ( const QPen& pen ); - void setSelectedBrush ( const QBrush& brush ); - void setSelectedFont ( const QFont& font ); - void setSelectedTextColor ( const QColor& color ); + void setBorderPen(const QPen& pen); + void setBrush(const QBrush& brush); + void setFont(const QFont& font); + void setTextColor(const QColor& color); + void setIconSize(const QSize& size); + void setIconSize(int width, int height); + void setIconTextPadding(int padding); + void setIconBorderPen(const QPen& pen); + Q_SLOT void setSelectableParts(const SelectableParts& selectableParts); + Q_SLOT void setSelectedParts(const SelectableParts& selectedParts); + void setSelectedBorderPen(const QPen& pen); + void setSelectedIconBorderPen(const QPen& pen); + void setSelectedBrush(const QBrush& brush); + void setSelectedFont(const QFont& font); + void setSelectedTextColor(const QColor& color); // reimplemented virtual methods: - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; // non-virtual methods: - QCPAbstractLegendItem* item ( int index ) const; - QCPPlottableLegendItem* itemWithPlottable ( const QCPAbstractPlottable* plottable ) const; + QCPAbstractLegendItem* item(int index) const; + QCPPlottableLegendItem* itemWithPlottable(const QCPAbstractPlottable* plottable) const; int itemCount() const; - bool hasItem ( QCPAbstractLegendItem* item ) const; - bool hasItemWithPlottable ( const QCPAbstractPlottable* plottable ) const; - bool addItem ( QCPAbstractLegendItem* item ); - bool removeItem ( int index ); - bool removeItem ( QCPAbstractLegendItem* item ); + bool hasItem(QCPAbstractLegendItem* item) const; + bool hasItemWithPlottable(const QCPAbstractPlottable* plottable) const; + bool addItem(QCPAbstractLegendItem* item); + bool removeItem(int index); + bool removeItem(QCPAbstractLegendItem* item); void clearItems(); QList selectedItems() const; signals: - void selectionChanged ( QCPLegend::SelectableParts parts ); - void selectableChanged ( QCPLegend::SelectableParts parts ); + void selectionChanged(QCPLegend::SelectableParts parts); + void selectableChanged(QCPLegend::SelectableParts parts); protected: // property members: @@ -2293,43 +2298,43 @@ protected: QColor mSelectedTextColor; // reimplemented virtual methods: - virtual void parentPlotInitialized ( QCustomPlot* parentPlot ); + virtual void parentPlotInitialized(QCustomPlot* parentPlot); virtual QCP::Interaction selectionCategory() const; - virtual void applyDefaultAntialiasingHint ( QCPPainter* painter ) const; - virtual void draw ( QCPPainter* painter ); + virtual void applyDefaultAntialiasingHint(QCPPainter* painter) const; + virtual void draw(QCPPainter* painter); // events: - virtual void selectEvent ( QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged ); - virtual void deselectEvent ( bool* selectionStateChanged ); + virtual void selectEvent(QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged); + virtual void deselectEvent(bool* selectionStateChanged); // non-virtual methods: QPen getBorderPen() const; QBrush getBrush() const; private: - Q_DISABLE_COPY ( QCPLegend ) + Q_DISABLE_COPY(QCPLegend) friend class QCustomPlot; friend class QCPAbstractLegendItem; }; -Q_DECLARE_OPERATORS_FOR_FLAGS ( QCPLegend::SelectableParts ) -Q_DECLARE_METATYPE ( QCPLegend::SelectablePart ) +Q_DECLARE_OPERATORS_FOR_FLAGS(QCPLegend::SelectableParts) +Q_DECLARE_METATYPE(QCPLegend::SelectablePart) class QCP_LIB_DECL QCPPlotTitle : public QCPLayoutElement { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( QString text READ text WRITE setText ) - Q_PROPERTY ( QFont font READ font WRITE setFont ) - Q_PROPERTY ( QColor textColor READ textColor WRITE setTextColor ) - Q_PROPERTY ( QFont selectedFont READ selectedFont WRITE setSelectedFont ) - Q_PROPERTY ( QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor ) - Q_PROPERTY ( bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged ) - Q_PROPERTY ( bool selected READ selected WRITE setSelected NOTIFY selectionChanged ) + Q_PROPERTY(QString text READ text WRITE setText) + Q_PROPERTY(QFont font READ font WRITE setFont) + Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor) + Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont) + Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor) + Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged) + Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectionChanged) /// \endcond public: - explicit QCPPlotTitle ( QCustomPlot* parentPlot ); - explicit QCPPlotTitle ( QCustomPlot* parentPlot, const QString& text ); + explicit QCPPlotTitle(QCustomPlot* parentPlot); + explicit QCPPlotTitle(QCustomPlot* parentPlot, const QString& text); // getters: QString text() const { return mText; } @@ -2341,20 +2346,20 @@ public: bool selected() const { return mSelected; } // setters: - void setText ( const QString& text ); - void setFont ( const QFont& font ); - void setTextColor ( const QColor& color ); - void setSelectedFont ( const QFont& font ); - void setSelectedTextColor ( const QColor& color ); - Q_SLOT void setSelectable ( bool selectable ); - Q_SLOT void setSelected ( bool selected ); + void setText(const QString& text); + void setFont(const QFont& font); + void setTextColor(const QColor& color); + void setSelectedFont(const QFont& font); + void setSelectedTextColor(const QColor& color); + Q_SLOT void setSelectable(bool selectable); + Q_SLOT void setSelected(bool selected); // reimplemented virtual methods: - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; signals: - void selectionChanged ( bool selected ); - void selectableChanged ( bool selectable ); + void selectionChanged(bool selected); + void selectableChanged(bool selectable); protected: // property members: @@ -2367,20 +2372,20 @@ protected: bool mSelectable, mSelected; // reimplemented virtual methods: - virtual void applyDefaultAntialiasingHint ( QCPPainter* painter ) const; - virtual void draw ( QCPPainter* painter ); + virtual void applyDefaultAntialiasingHint(QCPPainter* painter) const; + virtual void draw(QCPPainter* painter); virtual QSize minimumSizeHint() const; virtual QSize maximumSizeHint() const; // events: - virtual void selectEvent ( QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged ); - virtual void deselectEvent ( bool* selectionStateChanged ); + virtual void selectEvent(QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged); + virtual void deselectEvent(bool* selectionStateChanged); // non-virtual methods: QFont mainFont() const; QColor mainTextColor() const; private: - Q_DISABLE_COPY ( QCPPlotTitle ) + Q_DISABLE_COPY(QCPPlotTitle) }; @@ -2388,7 +2393,7 @@ class QCPColorScaleAxisRectPrivate : public QCPAxisRect { Q_OBJECT public: - explicit QCPColorScaleAxisRectPrivate ( QCPColorScale* parentColorScale ); + explicit QCPColorScaleAxisRectPrivate(QCPColorScale* parentColorScale); protected: QCPColorScale* mParentColorScale; QImage mGradientImage; @@ -2400,10 +2405,10 @@ protected: using QCPAxisRect::mouseReleaseEvent; using QCPAxisRect::wheelEvent; using QCPAxisRect::update; - virtual void draw ( QCPPainter* painter ); + virtual void draw(QCPPainter* painter); void updateGradientImage(); - Q_SLOT void axisSelectionChanged ( QCPAxis::SelectableParts selectedParts ); - Q_SLOT void axisSelectableChanged ( QCPAxis::SelectableParts selectableParts ); + Q_SLOT void axisSelectionChanged(QCPAxis::SelectableParts selectedParts); + Q_SLOT void axisSelectableChanged(QCPAxis::SelectableParts selectableParts); friend class QCPColorScale; }; @@ -2412,17 +2417,17 @@ class QCP_LIB_DECL QCPColorScale : public QCPLayoutElement { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( QCPAxis::AxisType type READ type WRITE setType ) - Q_PROPERTY ( QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged ) - Q_PROPERTY ( QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged ) - Q_PROPERTY ( QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged ) - Q_PROPERTY ( QString label READ label WRITE setLabel ) - Q_PROPERTY ( int barWidth READ barWidth WRITE setBarWidth ) - Q_PROPERTY ( bool rangeDrag READ rangeDrag WRITE setRangeDrag ) - Q_PROPERTY ( bool rangeZoom READ rangeZoom WRITE setRangeZoom ) + Q_PROPERTY(QCPAxis::AxisType type READ type WRITE setType) + Q_PROPERTY(QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged) + Q_PROPERTY(QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged) + Q_PROPERTY(QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged) + Q_PROPERTY(QString label READ label WRITE setLabel) + Q_PROPERTY(int barWidth READ barWidth WRITE setBarWidth) + Q_PROPERTY(bool rangeDrag READ rangeDrag WRITE setRangeDrag) + Q_PROPERTY(bool rangeZoom READ rangeZoom WRITE setRangeZoom) /// \endcond public: - explicit QCPColorScale ( QCustomPlot* parentPlot ); + explicit QCPColorScale(QCustomPlot* parentPlot); virtual ~QCPColorScale(); // getters: @@ -2437,26 +2442,26 @@ public: bool rangeZoom() const; // setters: - void setType ( QCPAxis::AxisType type ); - Q_SLOT void setDataRange ( const QCPRange& dataRange ); - Q_SLOT void setDataScaleType ( QCPAxis::ScaleType scaleType ); - Q_SLOT void setGradient ( const QCPColorGradient& gradient ); - void setLabel ( const QString& str ); - void setBarWidth ( int width ); - void setRangeDrag ( bool enabled ); - void setRangeZoom ( bool enabled ); + void setType(QCPAxis::AxisType type); + Q_SLOT void setDataRange(const QCPRange& dataRange); + Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType); + Q_SLOT void setGradient(const QCPColorGradient& gradient); + void setLabel(const QString& str); + void setBarWidth(int width); + void setRangeDrag(bool enabled); + void setRangeZoom(bool enabled); // non-property methods: QList colorMaps() const; - void rescaleDataRange ( bool onlyVisibleMaps ); + void rescaleDataRange(bool onlyVisibleMaps); // reimplemented virtual methods: - virtual void update ( UpdatePhase phase ); + virtual void update(UpdatePhase phase); signals: - void dataRangeChanged ( QCPRange newRange ); - void dataScaleTypeChanged ( QCPAxis::ScaleType scaleType ); - void gradientChanged ( QCPColorGradient newGradient ); + void dataRangeChanged(QCPRange newRange); + void dataScaleTypeChanged(QCPAxis::ScaleType scaleType); + void gradientChanged(QCPColorGradient newGradient); protected: // property members: @@ -2471,15 +2476,15 @@ protected: QPointer mColorAxis; // reimplemented virtual methods: - virtual void applyDefaultAntialiasingHint ( QCPPainter* painter ) const; + virtual void applyDefaultAntialiasingHint(QCPPainter* painter) const; // events: - virtual void mousePressEvent ( QMouseEvent* event ); - virtual void mouseMoveEvent ( QMouseEvent* event ); - virtual void mouseReleaseEvent ( QMouseEvent* event ); - virtual void wheelEvent ( QWheelEvent* event ); + virtual void mousePressEvent(QMouseEvent* event); + virtual void mouseMoveEvent(QMouseEvent* event); + virtual void mouseReleaseEvent(QMouseEvent* event); + virtual void wheelEvent(QWheelEvent* event); private: - Q_DISABLE_COPY ( QCPColorScale ) + Q_DISABLE_COPY(QCPColorScale) friend class QCPColorScaleAxisRectPrivate; }; @@ -2493,12 +2498,12 @@ class QCP_LIB_DECL QCPData { public: QCPData(); - QCPData ( double key, double value ); + QCPData(double key, double value); double key, value; double keyErrorPlus, keyErrorMinus; double valueErrorPlus, valueErrorMinus; }; -Q_DECLARE_TYPEINFO ( QCPData, Q_MOVABLE_TYPE ); +Q_DECLARE_TYPEINFO(QCPData, Q_MOVABLE_TYPE); /*! \typedef QCPDataMap Container for storing \ref QCPData items in a sorted fashion. The key of the map @@ -2516,14 +2521,14 @@ class QCP_LIB_DECL QCPGraph : public QCPAbstractPlottable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( LineStyle lineStyle READ lineStyle WRITE setLineStyle ) - Q_PROPERTY ( QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle ) - Q_PROPERTY ( ErrorType errorType READ errorType WRITE setErrorType ) - Q_PROPERTY ( QPen errorPen READ errorPen WRITE setErrorPen ) - Q_PROPERTY ( double errorBarSize READ errorBarSize WRITE setErrorBarSize ) - Q_PROPERTY ( bool errorBarSkipSymbol READ errorBarSkipSymbol WRITE setErrorBarSkipSymbol ) - Q_PROPERTY ( QCPGraph* channelFillGraph READ channelFillGraph WRITE setChannelFillGraph ) - Q_PROPERTY ( bool adaptiveSampling READ adaptiveSampling WRITE setAdaptiveSampling ) + Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle) + Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle) + Q_PROPERTY(ErrorType errorType READ errorType WRITE setErrorType) + Q_PROPERTY(QPen errorPen READ errorPen WRITE setErrorPen) + Q_PROPERTY(double errorBarSize READ errorBarSize WRITE setErrorBarSize) + Q_PROPERTY(bool errorBarSkipSymbol READ errorBarSkipSymbol WRITE setErrorBarSkipSymbol) + Q_PROPERTY(QCPGraph* channelFillGraph READ channelFillGraph WRITE setChannelFillGraph) + Q_PROPERTY(bool adaptiveSampling READ adaptiveSampling WRITE setAdaptiveSampling) /// \endcond public: /*! @@ -2539,7 +2544,7 @@ public: , lsStepCenter ///< line is drawn as steps where the step is in between two data points , lsImpulse ///< each data point is represented by a line parallel to the value axis, which reaches from the data point to the zero-value-line }; - Q_ENUMS ( LineStyle ) + Q_ENUMS(LineStyle) /*! Defines what kind of error bars are drawn for each data point */ @@ -2548,9 +2553,9 @@ public: , etValue ///< Error bars for the value dimension of the data point are shown , etBoth ///< Error bars for both key and value dimensions of the data point are shown }; - Q_ENUMS ( ErrorType ) + Q_ENUMS(ErrorType) - explicit QCPGraph ( QCPAxis* keyAxis, QCPAxis* valueAxis ); + explicit QCPGraph(QCPAxis* keyAxis, QCPAxis* valueAxis); virtual ~QCPGraph(); // getters: @@ -2565,47 +2570,47 @@ public: bool adaptiveSampling() const { return mAdaptiveSampling; } // setters: - void setData ( QCPDataMap* data, bool copy = false ); - void setData ( const QVector& key, const QVector& value ); - void setDataKeyError ( const QVector& key, const QVector& value, const QVector& keyError ); - void setDataKeyError ( const QVector& key, const QVector& value, const QVector& keyErrorMinus, - const QVector& keyErrorPlus ); - void setDataValueError ( const QVector& key, const QVector& value, const QVector& valueError ); - void setDataValueError ( const QVector& key, const QVector& value, - const QVector& valueErrorMinus, - const QVector& valueErrorPlus ); - void setDataBothError ( const QVector& key, const QVector& value, const QVector& keyError, - const QVector& valueError ); - void setDataBothError ( const QVector& key, const QVector& value, const QVector& keyErrorMinus, - const QVector& keyErrorPlus, const QVector& valueErrorMinus, const QVector& valueErrorPlus ); - void setLineStyle ( LineStyle ls ); - void setScatterStyle ( const QCPScatterStyle& style ); - void setErrorType ( ErrorType errorType ); - void setErrorPen ( const QPen& pen ); - void setErrorBarSize ( double size ); - void setErrorBarSkipSymbol ( bool enabled ); - void setChannelFillGraph ( QCPGraph* targetGraph ); - void setAdaptiveSampling ( bool enabled ); + void setData(QCPDataMap* data, bool copy = false); + void setData(const QVector& key, const QVector& value); + void setDataKeyError(const QVector& key, const QVector& value, const QVector& keyError); + void setDataKeyError(const QVector& key, const QVector& value, const QVector& keyErrorMinus, + const QVector& keyErrorPlus); + void setDataValueError(const QVector& key, const QVector& value, const QVector& valueError); + void setDataValueError(const QVector& key, const QVector& value, + const QVector& valueErrorMinus, + const QVector& valueErrorPlus); + void setDataBothError(const QVector& key, const QVector& value, const QVector& keyError, + const QVector& valueError); + void setDataBothError(const QVector& key, const QVector& value, const QVector& keyErrorMinus, + const QVector& keyErrorPlus, const QVector& valueErrorMinus, const QVector& valueErrorPlus); + void setLineStyle(LineStyle ls); + void setScatterStyle(const QCPScatterStyle& style); + void setErrorType(ErrorType errorType); + void setErrorPen(const QPen& pen); + void setErrorBarSize(double size); + void setErrorBarSkipSymbol(bool enabled); + void setChannelFillGraph(QCPGraph* targetGraph); + void setAdaptiveSampling(bool enabled); // non-property methods: - void addData ( const QCPDataMap& dataMap ); - void addData ( const QCPData& data ); - void addData ( double key, double value ); - void addData ( const QVector& keys, const QVector& values ); - void removeDataBefore ( double key ); - void removeDataAfter ( double key ); - void removeData ( double fromKey, double toKey ); - void removeData ( double key ); + void addData(const QCPDataMap& dataMap); + void addData(const QCPData& data); + void addData(double key, double value); + void addData(const QVector& keys, const QVector& values); + void removeDataBefore(double key); + void removeDataAfter(double key); + void removeData(double fromKey, double toKey); + void removeData(double key); // reimplemented virtual methods: virtual void clearData(); - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; using QCPAbstractPlottable::rescaleAxes; using QCPAbstractPlottable::rescaleKeyAxis; using QCPAbstractPlottable::rescaleValueAxis; - void rescaleAxes ( bool onlyEnlarge, bool includeErrorBars ) const; // overloads base class interface - void rescaleKeyAxis ( bool onlyEnlarge, bool includeErrorBars ) const; // overloads base class interface - void rescaleValueAxis ( bool onlyEnlarge, bool includeErrorBars ) const; // overloads base class interface + void rescaleAxes(bool onlyEnlarge, bool includeErrorBars) const; // overloads base class interface + void rescaleKeyAxis(bool onlyEnlarge, bool includeErrorBars) const; // overloads base class interface + void rescaleValueAxis(bool onlyEnlarge, bool includeErrorBars) const; // overloads base class interface protected: // property members: @@ -2620,44 +2625,44 @@ protected: bool mAdaptiveSampling; // reimplemented virtual methods: - virtual void draw ( QCPPainter* painter ); - virtual void drawLegendIcon ( QCPPainter* painter, const QRectF& rect ) const; - virtual QCPRange getKeyRange ( bool& foundRange, SignDomain inSignDomain = sdBoth ) const; - virtual QCPRange getValueRange ( bool& foundRange, SignDomain inSignDomain = sdBoth ) const; - virtual QCPRange getKeyRange ( bool& foundRange, SignDomain inSignDomain, - bool includeErrors ) const; // overloads base class interface - virtual QCPRange getValueRange ( bool& foundRange, SignDomain inSignDomain, - bool includeErrors ) const; // overloads base class interface + virtual void draw(QCPPainter* painter); + virtual void drawLegendIcon(QCPPainter* painter, const QRectF& rect) const; + virtual QCPRange getKeyRange(bool& foundRange, SignDomain inSignDomain = sdBoth) const; + virtual QCPRange getValueRange(bool& foundRange, SignDomain inSignDomain = sdBoth) const; + virtual QCPRange getKeyRange(bool& foundRange, SignDomain inSignDomain, + bool includeErrors) const; // overloads base class interface + virtual QCPRange getValueRange(bool& foundRange, SignDomain inSignDomain, + bool includeErrors) const; // overloads base class interface // introduced virtual methods: - virtual void drawFill ( QCPPainter* painter, QVector* lineData ) const; - virtual void drawScatterPlot ( QCPPainter* painter, QVector* scatterData ) const; - virtual void drawLinePlot ( QCPPainter* painter, QVector* lineData ) const; - virtual void drawImpulsePlot ( QCPPainter* painter, QVector* lineData ) const; + virtual void drawFill(QCPPainter* painter, QVector* lineData) const; + virtual void drawScatterPlot(QCPPainter* painter, QVector* scatterData) const; + virtual void drawLinePlot(QCPPainter* painter, QVector* lineData) const; + virtual void drawImpulsePlot(QCPPainter* painter, QVector* lineData) const; // non-virtual methods: - void getPreparedData ( QVector* lineData, QVector* scatterData ) const; - void getPlotData ( QVector* lineData, QVector* scatterData ) const; - void getScatterPlotData ( QVector* scatterData ) const; - void getLinePlotData ( QVector* linePixelData, QVector* scatterData ) const; - void getStepLeftPlotData ( QVector* linePixelData, QVector* scatterData ) const; - void getStepRightPlotData ( QVector* linePixelData, QVector* scatterData ) const; - void getStepCenterPlotData ( QVector* linePixelData, QVector* scatterData ) const; - void getImpulsePlotData ( QVector* linePixelData, QVector* scatterData ) const; - void drawError ( QCPPainter* painter, double x, double y, const QCPData& data ) const; - void getVisibleDataBounds ( QCPDataMap::const_iterator& lower, QCPDataMap::const_iterator& upper ) const; - int countDataInBounds ( const QCPDataMap::const_iterator& lower, const QCPDataMap::const_iterator& upper, - int maxCount ) const; - void addFillBasePoints ( QVector* lineData ) const; - void removeFillBasePoints ( QVector* lineData ) const; - QPointF lowerFillBasePoint ( double lowerKey ) const; - QPointF upperFillBasePoint ( double upperKey ) const; - const QPolygonF getChannelFillPolygon ( const QVector* lineData ) const; - int findIndexBelowX ( const QVector* data, double x ) const; - int findIndexAboveX ( const QVector* data, double x ) const; - int findIndexBelowY ( const QVector* data, double y ) const; - int findIndexAboveY ( const QVector* data, double y ) const; - double pointDistance ( const QPointF& pixelPoint ) const; + void getPreparedData(QVector* lineData, QVector* scatterData) const; + void getPlotData(QVector* lineData, QVector* scatterData) const; + void getScatterPlotData(QVector* scatterData) const; + void getLinePlotData(QVector* linePixelData, QVector* scatterData) const; + void getStepLeftPlotData(QVector* linePixelData, QVector* scatterData) const; + void getStepRightPlotData(QVector* linePixelData, QVector* scatterData) const; + void getStepCenterPlotData(QVector* linePixelData, QVector* scatterData) const; + void getImpulsePlotData(QVector* linePixelData, QVector* scatterData) const; + void drawError(QCPPainter* painter, double x, double y, const QCPData& data) const; + void getVisibleDataBounds(QCPDataMap::const_iterator& lower, QCPDataMap::const_iterator& upper) const; + int countDataInBounds(const QCPDataMap::const_iterator& lower, const QCPDataMap::const_iterator& upper, + int maxCount) const; + void addFillBasePoints(QVector* lineData) const; + void removeFillBasePoints(QVector* lineData) const; + QPointF lowerFillBasePoint(double lowerKey) const; + QPointF upperFillBasePoint(double upperKey) const; + const QPolygonF getChannelFillPolygon(const QVector* lineData) const; + int findIndexBelowX(const QVector* data, double x) const; + int findIndexAboveX(const QVector* data, double x) const; + int findIndexBelowY(const QVector* data, double y) const; + int findIndexAboveY(const QVector* data, double y) const; + double pointDistance(const QPointF& pixelPoint) const; friend class QCustomPlot; friend class QCPLegend; @@ -2672,10 +2677,10 @@ class QCP_LIB_DECL QCPCurveData { public: QCPCurveData(); - QCPCurveData ( double t, double key, double value ); + QCPCurveData(double t, double key, double value); double t, key, value; }; -Q_DECLARE_TYPEINFO ( QCPCurveData, Q_MOVABLE_TYPE ); +Q_DECLARE_TYPEINFO(QCPCurveData, Q_MOVABLE_TYPE); /*! \typedef QCPCurveDataMap Container for storing \ref QCPCurveData items in a sorted fashion. The key of the map @@ -2694,8 +2699,8 @@ class QCP_LIB_DECL QCPCurve : public QCPAbstractPlottable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle ) - Q_PROPERTY ( LineStyle lineStyle READ lineStyle WRITE setLineStyle ) + Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle) + Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle) /// \endcond public: /*! @@ -2706,7 +2711,7 @@ public: enum LineStyle { lsNone ///< No line is drawn between data points (e.g. only scatters) , lsLine ///< Data points are connected with a straight line }; - explicit QCPCurve ( QCPAxis* keyAxis, QCPAxis* valueAxis ); + explicit QCPCurve(QCPAxis* keyAxis, QCPAxis* valueAxis); virtual ~QCPCurve(); // getters: @@ -2715,26 +2720,26 @@ public: LineStyle lineStyle() const { return mLineStyle; } // setters: - void setData ( QCPCurveDataMap* data, bool copy = false ); - void setData ( const QVector& t, const QVector& key, const QVector& value ); - void setData ( const QVector& key, const QVector& value ); - void setScatterStyle ( const QCPScatterStyle& style ); - void setLineStyle ( LineStyle style ); + void setData(QCPCurveDataMap* data, bool copy = false); + void setData(const QVector& t, const QVector& key, const QVector& value); + void setData(const QVector& key, const QVector& value); + void setScatterStyle(const QCPScatterStyle& style); + void setLineStyle(LineStyle style); // non-property methods: - void addData ( const QCPCurveDataMap& dataMap ); - void addData ( const QCPCurveData& data ); - void addData ( double t, double key, double value ); - void addData ( double key, double value ); - void addData ( const QVector& ts, const QVector& keys, const QVector& values ); - void removeDataBefore ( double t ); - void removeDataAfter ( double t ); - void removeData ( double fromt, double tot ); - void removeData ( double t ); + void addData(const QCPCurveDataMap& dataMap); + void addData(const QCPCurveData& data); + void addData(double t, double key, double value); + void addData(double key, double value); + void addData(const QVector& ts, const QVector& keys, const QVector& values); + void removeDataBefore(double t); + void removeDataAfter(double t); + void removeData(double fromt, double tot); + void removeData(double t); // reimplemented virtual methods: virtual void clearData(); - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; protected: // property members: @@ -2743,27 +2748,27 @@ protected: LineStyle mLineStyle; // reimplemented virtual methods: - virtual void draw ( QCPPainter* painter ); - virtual void drawLegendIcon ( QCPPainter* painter, const QRectF& rect ) const; - virtual QCPRange getKeyRange ( bool& foundRange, SignDomain inSignDomain = sdBoth ) const; - virtual QCPRange getValueRange ( bool& foundRange, SignDomain inSignDomain = sdBoth ) const; + virtual void draw(QCPPainter* painter); + virtual void drawLegendIcon(QCPPainter* painter, const QRectF& rect) const; + virtual QCPRange getKeyRange(bool& foundRange, SignDomain inSignDomain = sdBoth) const; + virtual QCPRange getValueRange(bool& foundRange, SignDomain inSignDomain = sdBoth) const; // introduced virtual methods: - virtual void drawScatterPlot ( QCPPainter* painter, const QVector* pointData ) const; + virtual void drawScatterPlot(QCPPainter* painter, const QVector* pointData) const; // non-virtual methods: - void getCurveData ( QVector* lineData ) const; - int getRegion ( double x, double y, double rectLeft, double rectTop, double rectRight, double rectBottom ) const; - QPointF getOptimizedPoint ( int prevRegion, double prevKey, double prevValue, double key, double value, double rectLeft, - double rectTop, double rectRight, double rectBottom ) const; - QVector getOptimizedCornerPoints ( int prevRegion, int currentRegion, double prevKey, double prevValue, - double key, double value, double rectLeft, double rectTop, double rectRight, double rectBottom ) const; - bool mayTraverse ( int prevRegion, int currentRegion ) const; - bool getTraverse ( double prevKey, double prevValue, double key, double value, double rectLeft, double rectTop, - double rectRight, double rectBottom, QPointF& crossA, QPointF& crossB ) const; - void getTraverseCornerPoints ( int prevRegion, int currentRegion, double rectLeft, double rectTop, double rectRight, - double rectBottom, QVector& beforeTraverse, QVector& afterTraverse ) const; - double pointDistance ( const QPointF& pixelPoint ) const; + void getCurveData(QVector* lineData) const; + int getRegion(double x, double y, double rectLeft, double rectTop, double rectRight, double rectBottom) const; + QPointF getOptimizedPoint(int prevRegion, double prevKey, double prevValue, double key, double value, double rectLeft, + double rectTop, double rectRight, double rectBottom) const; + QVector getOptimizedCornerPoints(int prevRegion, int currentRegion, double prevKey, double prevValue, + double key, double value, double rectLeft, double rectTop, double rectRight, double rectBottom) const; + bool mayTraverse(int prevRegion, int currentRegion) const; + bool getTraverse(double prevKey, double prevValue, double key, double value, double rectLeft, double rectTop, + double rectRight, double rectBottom, QPointF& crossA, QPointF& crossB) const; + void getTraverseCornerPoints(int prevRegion, int currentRegion, double rectLeft, double rectTop, double rectRight, + double rectBottom, QVector& beforeTraverse, QVector& afterTraverse) const; + double pointDistance(const QPointF& pixelPoint) const; friend class QCustomPlot; friend class QCPLegend; @@ -2778,8 +2783,8 @@ class QCP_LIB_DECL QCPBarsGroup : public QObject { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( SpacingType spacingType READ spacingType WRITE setSpacingType ) - Q_PROPERTY ( double spacing READ spacing WRITE setSpacing ) + Q_PROPERTY(SpacingType spacingType READ spacingType WRITE setSpacingType) + Q_PROPERTY(double spacing READ spacing WRITE setSpacing) /// \endcond public: /*! @@ -2792,7 +2797,7 @@ public: , stAxisRectRatio ///< Bar spacing is given by a fraction of the axis rect size , stPlotCoords ///< Bar spacing is in key coordinates and thus scales with the key axis range }; - QCPBarsGroup ( QCustomPlot* parentPlot ); + QCPBarsGroup(QCustomPlot* parentPlot); ~QCPBarsGroup(); // getters: @@ -2800,19 +2805,19 @@ public: double spacing() const { return mSpacing; } // setters: - void setSpacingType ( SpacingType spacingType ); - void setSpacing ( double spacing ); + void setSpacingType(SpacingType spacingType); + void setSpacing(double spacing); // non-virtual methods: QList bars() const { return mBars; } - QCPBars* bars ( int index ) const; + QCPBars* bars(int index) const; int size() const { return mBars.size(); } bool isEmpty() const { return mBars.isEmpty(); } void clear(); - bool contains ( QCPBars* bars ) const { return mBars.contains ( bars ); } - void append ( QCPBars* bars ); - void insert ( int i, QCPBars* bars ); - void remove ( QCPBars* bars ); + bool contains(QCPBars* bars) const { return mBars.contains(bars); } + void append(QCPBars* bars); + void insert(int i, QCPBars* bars); + void remove(QCPBars* bars); protected: // non-property members: @@ -2822,15 +2827,15 @@ protected: QList mBars; // non-virtual methods: - void registerBars ( QCPBars* bars ); - void unregisterBars ( QCPBars* bars ); + void registerBars(QCPBars* bars); + void unregisterBars(QCPBars* bars); // virtual methods: - double keyPixelOffset ( const QCPBars* bars, double keyCoord ); - double getPixelSpacing ( const QCPBars* bars, double keyCoord ); + double keyPixelOffset(const QCPBars* bars, double keyCoord); + double getPixelSpacing(const QCPBars* bars, double keyCoord); private: - Q_DISABLE_COPY ( QCPBarsGroup ) + Q_DISABLE_COPY(QCPBarsGroup) friend class QCPBars; }; @@ -2840,10 +2845,10 @@ class QCP_LIB_DECL QCPBarData { public: QCPBarData(); - QCPBarData ( double key, double value ); + QCPBarData(double key, double value); double key, value; }; -Q_DECLARE_TYPEINFO ( QCPBarData, Q_MOVABLE_TYPE ); +Q_DECLARE_TYPEINFO(QCPBarData, Q_MOVABLE_TYPE); /*! \typedef QCPBarDataMap Container for storing \ref QCPBarData items in a sorted fashion. The key of the map @@ -2861,12 +2866,12 @@ class QCP_LIB_DECL QCPBars : public QCPAbstractPlottable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( double width READ width WRITE setWidth ) - Q_PROPERTY ( WidthType widthType READ widthType WRITE setWidthType ) - Q_PROPERTY ( QCPBarsGroup* barsGroup READ barsGroup WRITE setBarsGroup ) - Q_PROPERTY ( double baseValue READ baseValue WRITE setBaseValue ) - Q_PROPERTY ( QCPBars* barBelow READ barBelow ) - Q_PROPERTY ( QCPBars* barAbove READ barAbove ) + Q_PROPERTY(double width READ width WRITE setWidth) + Q_PROPERTY(WidthType widthType READ widthType WRITE setWidthType) + Q_PROPERTY(QCPBarsGroup* barsGroup READ barsGroup WRITE setBarsGroup) + Q_PROPERTY(double baseValue READ baseValue WRITE setBaseValue) + Q_PROPERTY(QCPBars* barBelow READ barBelow) + Q_PROPERTY(QCPBars* barAbove READ barAbove) /// \endcond public: /*! @@ -2879,9 +2884,9 @@ public: , wtAxisRectRatio ///< Bar width is given by a fraction of the axis rect size , wtPlotCoords ///< Bar width is in key coordinates and thus scales with the key axis range }; - Q_ENUMS ( WidthType ) + Q_ENUMS(WidthType) - explicit QCPBars ( QCPAxis* keyAxis, QCPAxis* valueAxis ); + explicit QCPBars(QCPAxis* keyAxis, QCPAxis* valueAxis); virtual ~QCPBars(); // getters: @@ -2894,28 +2899,28 @@ public: QCPBarDataMap* data() const { return mData; } // setters: - void setWidth ( double width ); - void setWidthType ( WidthType widthType ); - void setBarsGroup ( QCPBarsGroup* barsGroup ); - void setBaseValue ( double baseValue ); - void setData ( QCPBarDataMap* data, bool copy = false ); - void setData ( const QVector& key, const QVector& value ); + void setWidth(double width); + void setWidthType(WidthType widthType); + void setBarsGroup(QCPBarsGroup* barsGroup); + void setBaseValue(double baseValue); + void setData(QCPBarDataMap* data, bool copy = false); + void setData(const QVector& key, const QVector& value); // non-property methods: - void moveBelow ( QCPBars* bars ); - void moveAbove ( QCPBars* bars ); - void addData ( const QCPBarDataMap& dataMap ); - void addData ( const QCPBarData& data ); - void addData ( double key, double value ); - void addData ( const QVector& keys, const QVector& values ); - void removeDataBefore ( double key ); - void removeDataAfter ( double key ); - void removeData ( double fromKey, double toKey ); - void removeData ( double key ); + void moveBelow(QCPBars* bars); + void moveAbove(QCPBars* bars); + void addData(const QCPBarDataMap& dataMap); + void addData(const QCPBarData& data); + void addData(double key, double value); + void addData(const QVector& keys, const QVector& values); + void removeDataBefore(double key); + void removeDataAfter(double key); + void removeData(double fromKey, double toKey); + void removeData(double key); // reimplemented virtual methods: virtual void clearData(); - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; protected: // property members: @@ -2927,17 +2932,17 @@ protected: QPointer mBarBelow, mBarAbove; // reimplemented virtual methods: - virtual void draw ( QCPPainter* painter ); - virtual void drawLegendIcon ( QCPPainter* painter, const QRectF& rect ) const; - virtual QCPRange getKeyRange ( bool& foundRange, SignDomain inSignDomain = sdBoth ) const; - virtual QCPRange getValueRange ( bool& foundRange, SignDomain inSignDomain = sdBoth ) const; + virtual void draw(QCPPainter* painter); + virtual void drawLegendIcon(QCPPainter* painter, const QRectF& rect) const; + virtual QCPRange getKeyRange(bool& foundRange, SignDomain inSignDomain = sdBoth) const; + virtual QCPRange getValueRange(bool& foundRange, SignDomain inSignDomain = sdBoth) const; // non-virtual methods: - void getVisibleDataBounds ( QCPBarDataMap::const_iterator& lower, QCPBarDataMap::const_iterator& upperEnd ) const; - QPolygonF getBarPolygon ( double key, double value ) const; - void getPixelWidth ( double key, double& lower, double& upper ) const; - double getStackedBaseValue ( double key, bool positive ) const; - static void connectBars ( QCPBars* lower, QCPBars* upper ); + void getVisibleDataBounds(QCPBarDataMap::const_iterator& lower, QCPBarDataMap::const_iterator& upperEnd) const; + QPolygonF getBarPolygon(double key, double value) const; + void getPixelWidth(double key, double& lower, double& upper) const; + double getStackedBaseValue(double key, bool positive) const; + static void connectBars(QCPBars* lower, QCPBars* upper); friend class QCustomPlot; friend class QCPLegend; @@ -2953,22 +2958,22 @@ class QCP_LIB_DECL QCPStatisticalBox : public QCPAbstractPlottable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( double key READ key WRITE setKey ) - Q_PROPERTY ( double minimum READ minimum WRITE setMinimum ) - Q_PROPERTY ( double lowerQuartile READ lowerQuartile WRITE setLowerQuartile ) - Q_PROPERTY ( double median READ median WRITE setMedian ) - Q_PROPERTY ( double upperQuartile READ upperQuartile WRITE setUpperQuartile ) - Q_PROPERTY ( double maximum READ maximum WRITE setMaximum ) - Q_PROPERTY ( QVector outliers READ outliers WRITE setOutliers ) - Q_PROPERTY ( double width READ width WRITE setWidth ) - Q_PROPERTY ( double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth ) - Q_PROPERTY ( QPen whiskerPen READ whiskerPen WRITE setWhiskerPen ) - Q_PROPERTY ( QPen whiskerBarPen READ whiskerBarPen WRITE setWhiskerBarPen ) - Q_PROPERTY ( QPen medianPen READ medianPen WRITE setMedianPen ) - Q_PROPERTY ( QCPScatterStyle outlierStyle READ outlierStyle WRITE setOutlierStyle ) + Q_PROPERTY(double key READ key WRITE setKey) + Q_PROPERTY(double minimum READ minimum WRITE setMinimum) + Q_PROPERTY(double lowerQuartile READ lowerQuartile WRITE setLowerQuartile) + Q_PROPERTY(double median READ median WRITE setMedian) + Q_PROPERTY(double upperQuartile READ upperQuartile WRITE setUpperQuartile) + Q_PROPERTY(double maximum READ maximum WRITE setMaximum) + Q_PROPERTY(QVector outliers READ outliers WRITE setOutliers) + Q_PROPERTY(double width READ width WRITE setWidth) + Q_PROPERTY(double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth) + Q_PROPERTY(QPen whiskerPen READ whiskerPen WRITE setWhiskerPen) + Q_PROPERTY(QPen whiskerBarPen READ whiskerBarPen WRITE setWhiskerBarPen) + Q_PROPERTY(QPen medianPen READ medianPen WRITE setMedianPen) + Q_PROPERTY(QCPScatterStyle outlierStyle READ outlierStyle WRITE setOutlierStyle) /// \endcond public: - explicit QCPStatisticalBox ( QCPAxis* keyAxis, QCPAxis* valueAxis ); + explicit QCPStatisticalBox(QCPAxis* keyAxis, QCPAxis* valueAxis); // getters: double key() const { return mKey; } @@ -2986,24 +2991,24 @@ public: QCPScatterStyle outlierStyle() const { return mOutlierStyle; } // setters: - void setKey ( double key ); - void setMinimum ( double value ); - void setLowerQuartile ( double value ); - void setMedian ( double value ); - void setUpperQuartile ( double value ); - void setMaximum ( double value ); - void setOutliers ( const QVector& values ); - void setData ( double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum ); - void setWidth ( double width ); - void setWhiskerWidth ( double width ); - void setWhiskerPen ( const QPen& pen ); - void setWhiskerBarPen ( const QPen& pen ); - void setMedianPen ( const QPen& pen ); - void setOutlierStyle ( const QCPScatterStyle& style ); + void setKey(double key); + void setMinimum(double value); + void setLowerQuartile(double value); + void setMedian(double value); + void setUpperQuartile(double value); + void setMaximum(double value); + void setOutliers(const QVector& values); + void setData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum); + void setWidth(double width); + void setWhiskerWidth(double width); + void setWhiskerPen(const QPen& pen); + void setWhiskerBarPen(const QPen& pen); + void setMedianPen(const QPen& pen); + void setOutlierStyle(const QCPScatterStyle& style); // non-property methods: virtual void clearData(); - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; protected: // property members: @@ -3015,16 +3020,16 @@ protected: QCPScatterStyle mOutlierStyle; // reimplemented virtual methods: - virtual void draw ( QCPPainter* painter ); - virtual void drawLegendIcon ( QCPPainter* painter, const QRectF& rect ) const; - virtual QCPRange getKeyRange ( bool& foundRange, SignDomain inSignDomain = sdBoth ) const; - virtual QCPRange getValueRange ( bool& foundRange, SignDomain inSignDomain = sdBoth ) const; + virtual void draw(QCPPainter* painter); + virtual void drawLegendIcon(QCPPainter* painter, const QRectF& rect) const; + virtual QCPRange getKeyRange(bool& foundRange, SignDomain inSignDomain = sdBoth) const; + virtual QCPRange getValueRange(bool& foundRange, SignDomain inSignDomain = sdBoth) const; // introduced virtual methods: - virtual void drawQuartileBox ( QCPPainter* painter, QRectF* quartileBox = 0 ) const; - virtual void drawMedian ( QCPPainter* painter ) const; - virtual void drawWhiskers ( QCPPainter* painter ) const; - virtual void drawOutliers ( QCPPainter* painter ) const; + virtual void drawQuartileBox(QCPPainter* painter, QRectF* quartileBox = 0) const; + virtual void drawMedian(QCPPainter* painter) const; + virtual void drawWhiskers(QCPPainter* painter) const; + virtual void drawOutliers(QCPPainter* painter) const; friend class QCustomPlot; friend class QCPLegend; @@ -3034,10 +3039,10 @@ protected: class QCP_LIB_DECL QCPColorMapData { public: - QCPColorMapData ( int keySize, int valueSize, const QCPRange& keyRange, const QCPRange& valueRange ); + QCPColorMapData(int keySize, int valueSize, const QCPRange& keyRange, const QCPRange& valueRange); ~QCPColorMapData(); - QCPColorMapData ( const QCPColorMapData& other ); - QCPColorMapData& operator= ( const QCPColorMapData& other ); + QCPColorMapData(const QCPColorMapData& other); + QCPColorMapData& operator= (const QCPColorMapData& other); // getters: int keySize() const { return mKeySize; } @@ -3045,26 +3050,26 @@ public: QCPRange keyRange() const { return mKeyRange; } QCPRange valueRange() const { return mValueRange; } QCPRange dataBounds() const { return mDataBounds; } - double data ( double key, double value ); - double cell ( int keyIndex, int valueIndex ); + double data(double key, double value); + double cell(int keyIndex, int valueIndex); // setters: - void setSize ( int keySize, int valueSize ); - void setKeySize ( int keySize ); - void setValueSize ( int valueSize ); - void setRange ( const QCPRange& keyRange, const QCPRange& valueRange ); - void setKeyRange ( const QCPRange& keyRange ); - void setValueRange ( const QCPRange& valueRange ); - void setData ( double key, double value, double z ); - void setCell ( int keyIndex, int valueIndex, double z ); + void setSize(int keySize, int valueSize); + void setKeySize(int keySize); + void setValueSize(int valueSize); + void setRange(const QCPRange& keyRange, const QCPRange& valueRange); + void setKeyRange(const QCPRange& keyRange); + void setValueRange(const QCPRange& valueRange); + void setData(double key, double value, double z); + void setCell(int keyIndex, int valueIndex, double z); // non-property methods: void recalculateDataBounds(); void clear(); - void fill ( double z ); + void fill(double z); bool isEmpty() const { return mIsEmpty; } - void coordToCell ( double key, double value, int* keyIndex, int* valueIndex ) const; - void cellToCoord ( int keyIndex, int valueIndex, double* key, double* value ) const; + void coordToCell(double key, double value, int* keyIndex, int* valueIndex) const; + void cellToCoord(int keyIndex, int valueIndex, double* key, double* value) const; protected: // property members: @@ -3084,15 +3089,15 @@ class QCP_LIB_DECL QCPColorMap : public QCPAbstractPlottable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged ) - Q_PROPERTY ( QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged ) - Q_PROPERTY ( QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged ) - Q_PROPERTY ( bool interpolate READ interpolate WRITE setInterpolate ) - Q_PROPERTY ( bool tightBoundary READ tightBoundary WRITE setTightBoundary ) - Q_PROPERTY ( QCPColorScale* colorScale READ colorScale WRITE setColorScale ) + Q_PROPERTY(QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged) + Q_PROPERTY(QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged) + Q_PROPERTY(QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged) + Q_PROPERTY(bool interpolate READ interpolate WRITE setInterpolate) + Q_PROPERTY(bool tightBoundary READ tightBoundary WRITE setTightBoundary) + Q_PROPERTY(QCPColorScale* colorScale READ colorScale WRITE setColorScale) /// \endcond public: - explicit QCPColorMap ( QCPAxis* keyAxis, QCPAxis* valueAxis ); + explicit QCPColorMap(QCPAxis* keyAxis, QCPAxis* valueAxis); virtual ~QCPColorMap(); // getters: @@ -3105,27 +3110,27 @@ public: QCPColorScale* colorScale() const { return mColorScale.data(); } // setters: - void setData ( QCPColorMapData* data, bool copy = false ); - Q_SLOT void setDataRange ( const QCPRange& dataRange ); - Q_SLOT void setDataScaleType ( QCPAxis::ScaleType scaleType ); - Q_SLOT void setGradient ( const QCPColorGradient& gradient ); - void setInterpolate ( bool enabled ); - void setTightBoundary ( bool enabled ); - void setColorScale ( QCPColorScale* colorScale ); + void setData(QCPColorMapData* data, bool copy = false); + Q_SLOT void setDataRange(const QCPRange& dataRange); + Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType); + Q_SLOT void setGradient(const QCPColorGradient& gradient); + void setInterpolate(bool enabled); + void setTightBoundary(bool enabled); + void setColorScale(QCPColorScale* colorScale); // non-property methods: - void rescaleDataRange ( bool recalculateDataBounds = false ); - Q_SLOT void updateLegendIcon ( Qt::TransformationMode transformMode = Qt::SmoothTransformation, - const QSize& thumbSize = QSize ( 32, 18 ) ); + void rescaleDataRange(bool recalculateDataBounds = false); + Q_SLOT void updateLegendIcon(Qt::TransformationMode transformMode = Qt::SmoothTransformation, + const QSize& thumbSize = QSize(32, 18)); // reimplemented virtual methods: virtual void clearData(); - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; signals: - void dataRangeChanged ( QCPRange newRange ); - void dataScaleTypeChanged ( QCPAxis::ScaleType scaleType ); - void gradientChanged ( QCPColorGradient newGradient ); + void dataRangeChanged(QCPRange newRange); + void dataScaleTypeChanged(QCPAxis::ScaleType scaleType); + void gradientChanged(QCPColorGradient newGradient); protected: // property members: @@ -3145,10 +3150,10 @@ protected: virtual void updateMapImage(); // reimplemented virtual methods: - virtual void draw ( QCPPainter* painter ); - virtual void drawLegendIcon ( QCPPainter* painter, const QRectF& rect ) const; - virtual QCPRange getKeyRange ( bool& foundRange, SignDomain inSignDomain = sdBoth ) const; - virtual QCPRange getValueRange ( bool& foundRange, SignDomain inSignDomain = sdBoth ) const; + virtual void draw(QCPPainter* painter); + virtual void drawLegendIcon(QCPPainter* painter, const QRectF& rect) const; + virtual QCPRange getKeyRange(bool& foundRange, SignDomain inSignDomain = sdBoth) const; + virtual QCPRange getValueRange(bool& foundRange, SignDomain inSignDomain = sdBoth) const; friend class QCustomPlot; friend class QCPLegend; @@ -3163,10 +3168,10 @@ class QCP_LIB_DECL QCPFinancialData { public: QCPFinancialData(); - QCPFinancialData ( double key, double open, double high, double low, double close ); + QCPFinancialData(double key, double open, double high, double low, double close); double key, open, high, low, close; }; -Q_DECLARE_TYPEINFO ( QCPFinancialData, Q_MOVABLE_TYPE ); +Q_DECLARE_TYPEINFO(QCPFinancialData, Q_MOVABLE_TYPE); /*! \typedef QCPFinancialDataMap Container for storing \ref QCPFinancialData items in a sorted fashion. The key of the map @@ -3184,13 +3189,13 @@ class QCP_LIB_DECL QCPFinancial : public QCPAbstractPlottable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( ChartStyle chartStyle READ chartStyle WRITE setChartStyle ) - Q_PROPERTY ( double width READ width WRITE setWidth ) - Q_PROPERTY ( bool twoColored READ twoColored WRITE setTwoColored ) - Q_PROPERTY ( QBrush brushPositive READ brushPositive WRITE setBrushPositive ) - Q_PROPERTY ( QBrush brushNegative READ brushNegative WRITE setBrushNegative ) - Q_PROPERTY ( QPen penPositive READ penPositive WRITE setPenPositive ) - Q_PROPERTY ( QPen penNegative READ penNegative WRITE setPenNegative ) + Q_PROPERTY(ChartStyle chartStyle READ chartStyle WRITE setChartStyle) + Q_PROPERTY(double width READ width WRITE setWidth) + Q_PROPERTY(bool twoColored READ twoColored WRITE setTwoColored) + Q_PROPERTY(QBrush brushPositive READ brushPositive WRITE setBrushPositive) + Q_PROPERTY(QBrush brushNegative READ brushNegative WRITE setBrushNegative) + Q_PROPERTY(QPen penPositive READ penPositive WRITE setPenPositive) + Q_PROPERTY(QPen penNegative READ penNegative WRITE setPenNegative) /// \endcond public: /*! @@ -3201,9 +3206,9 @@ public: enum ChartStyle { csOhlc ///< Open-High-Low-Close bar representation , csCandlestick ///< Candlestick representation }; - Q_ENUMS ( ChartStyle ) + Q_ENUMS(ChartStyle) - explicit QCPFinancial ( QCPAxis* keyAxis, QCPAxis* valueAxis ); + explicit QCPFinancial(QCPAxis* keyAxis, QCPAxis* valueAxis); virtual ~QCPFinancial(); // getters: @@ -3218,35 +3223,35 @@ public: // setters: - void setData ( QCPFinancialDataMap* data, bool copy = false ); - void setData ( const QVector& key, const QVector& open, const QVector& high, - const QVector& low, const QVector& close ); - void setChartStyle ( ChartStyle style ); - void setWidth ( double width ); - void setTwoColored ( bool twoColored ); - void setBrushPositive ( const QBrush& brush ); - void setBrushNegative ( const QBrush& brush ); - void setPenPositive ( const QPen& pen ); - void setPenNegative ( const QPen& pen ); + void setData(QCPFinancialDataMap* data, bool copy = false); + void setData(const QVector& key, const QVector& open, const QVector& high, + const QVector& low, const QVector& close); + void setChartStyle(ChartStyle style); + void setWidth(double width); + void setTwoColored(bool twoColored); + void setBrushPositive(const QBrush& brush); + void setBrushNegative(const QBrush& brush); + void setPenPositive(const QPen& pen); + void setPenNegative(const QPen& pen); // non-property methods: - void addData ( const QCPFinancialDataMap& dataMap ); - void addData ( const QCPFinancialData& data ); - void addData ( double key, double open, double high, double low, double close ); - void addData ( const QVector& key, const QVector& open, const QVector& high, - const QVector& low, const QVector& close ); - void removeDataBefore ( double key ); - void removeDataAfter ( double key ); - void removeData ( double fromKey, double toKey ); - void removeData ( double key ); + void addData(const QCPFinancialDataMap& dataMap); + void addData(const QCPFinancialData& data); + void addData(double key, double open, double high, double low, double close); + void addData(const QVector& key, const QVector& open, const QVector& high, + const QVector& low, const QVector& close); + void removeDataBefore(double key); + void removeDataAfter(double key); + void removeData(double fromKey, double toKey); + void removeData(double key); // reimplemented virtual methods: virtual void clearData(); - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; // static methods: - static QCPFinancialDataMap timeSeriesToOhlc ( const QVector& time, const QVector& value, - double timeBinSize, double timeBinOffset = 0 ); + static QCPFinancialDataMap timeSeriesToOhlc(const QVector& time, const QVector& value, + double timeBinSize, double timeBinOffset = 0); protected: // property members: @@ -3258,22 +3263,22 @@ protected: QPen mPenPositive, mPenNegative; // reimplemented virtual methods: - virtual void draw ( QCPPainter* painter ); - virtual void drawLegendIcon ( QCPPainter* painter, const QRectF& rect ) const; - virtual QCPRange getKeyRange ( bool& foundRange, SignDomain inSignDomain = sdBoth ) const; - virtual QCPRange getValueRange ( bool& foundRange, SignDomain inSignDomain = sdBoth ) const; + virtual void draw(QCPPainter* painter); + virtual void drawLegendIcon(QCPPainter* painter, const QRectF& rect) const; + virtual QCPRange getKeyRange(bool& foundRange, SignDomain inSignDomain = sdBoth) const; + virtual QCPRange getValueRange(bool& foundRange, SignDomain inSignDomain = sdBoth) const; // non-virtual methods: - void drawOhlcPlot ( QCPPainter* painter, const QCPFinancialDataMap::const_iterator& begin, - const QCPFinancialDataMap::const_iterator& end ); - void drawCandlestickPlot ( QCPPainter* painter, const QCPFinancialDataMap::const_iterator& begin, - const QCPFinancialDataMap::const_iterator& end ); - double ohlcSelectTest ( const QPointF& pos, const QCPFinancialDataMap::const_iterator& begin, - const QCPFinancialDataMap::const_iterator& end ) const; - double candlestickSelectTest ( const QPointF& pos, const QCPFinancialDataMap::const_iterator& begin, - const QCPFinancialDataMap::const_iterator& end ) const; - void getVisibleDataBounds ( QCPFinancialDataMap::const_iterator& lower, - QCPFinancialDataMap::const_iterator& upper ) const; + void drawOhlcPlot(QCPPainter* painter, const QCPFinancialDataMap::const_iterator& begin, + const QCPFinancialDataMap::const_iterator& end); + void drawCandlestickPlot(QCPPainter* painter, const QCPFinancialDataMap::const_iterator& begin, + const QCPFinancialDataMap::const_iterator& end); + double ohlcSelectTest(const QPointF& pos, const QCPFinancialDataMap::const_iterator& begin, + const QCPFinancialDataMap::const_iterator& end) const; + double candlestickSelectTest(const QPointF& pos, const QCPFinancialDataMap::const_iterator& begin, + const QCPFinancialDataMap::const_iterator& end) const; + void getVisibleDataBounds(QCPFinancialDataMap::const_iterator& lower, + QCPFinancialDataMap::const_iterator& upper) const; friend class QCustomPlot; friend class QCPLegend; @@ -3284,11 +3289,11 @@ class QCP_LIB_DECL QCPItemStraightLine : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( QPen pen READ pen WRITE setPen ) - Q_PROPERTY ( QPen selectedPen READ selectedPen WRITE setSelectedPen ) + Q_PROPERTY(QPen pen READ pen WRITE setPen) + Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) /// \endcond public: - QCPItemStraightLine ( QCustomPlot* parentPlot ); + QCPItemStraightLine(QCustomPlot* parentPlot); virtual ~QCPItemStraightLine(); // getters: @@ -3296,11 +3301,11 @@ public: QPen selectedPen() const { return mSelectedPen; } // setters; - void setPen ( const QPen& pen ); - void setSelectedPen ( const QPen& pen ); + void setPen(const QPen& pen); + void setSelectedPen(const QPen& pen); // reimplemented virtual methods: - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; QCPItemPosition* const point1; QCPItemPosition* const point2; @@ -3310,11 +3315,11 @@ protected: QPen mPen, mSelectedPen; // reimplemented virtual methods: - virtual void draw ( QCPPainter* painter ); + virtual void draw(QCPPainter* painter); // non-virtual methods: - double distToStraightLine ( const QVector2D& point1, const QVector2D& vec, const QVector2D& point ) const; - QLineF getRectClippedStraightLine ( const QVector2D& point1, const QVector2D& vec, const QRect& rect ) const; + double distToStraightLine(const QVector2D& point1, const QVector2D& vec, const QVector2D& point) const; + QLineF getRectClippedStraightLine(const QVector2D& point1, const QVector2D& vec, const QRect& rect) const; QPen mainPen() const; }; @@ -3323,13 +3328,13 @@ class QCP_LIB_DECL QCPItemLine : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( QPen pen READ pen WRITE setPen ) - Q_PROPERTY ( QPen selectedPen READ selectedPen WRITE setSelectedPen ) - Q_PROPERTY ( QCPLineEnding head READ head WRITE setHead ) - Q_PROPERTY ( QCPLineEnding tail READ tail WRITE setTail ) + Q_PROPERTY(QPen pen READ pen WRITE setPen) + Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) + Q_PROPERTY(QCPLineEnding head READ head WRITE setHead) + Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail) /// \endcond public: - QCPItemLine ( QCustomPlot* parentPlot ); + QCPItemLine(QCustomPlot* parentPlot); virtual ~QCPItemLine(); // getters: @@ -3339,13 +3344,13 @@ public: QCPLineEnding tail() const { return mTail; } // setters; - void setPen ( const QPen& pen ); - void setSelectedPen ( const QPen& pen ); - void setHead ( const QCPLineEnding& head ); - void setTail ( const QCPLineEnding& tail ); + void setPen(const QPen& pen); + void setSelectedPen(const QPen& pen); + void setHead(const QCPLineEnding& head); + void setTail(const QCPLineEnding& tail); // reimplemented virtual methods: - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; QCPItemPosition* const start; QCPItemPosition* const end; @@ -3356,10 +3361,10 @@ protected: QCPLineEnding mHead, mTail; // reimplemented virtual methods: - virtual void draw ( QCPPainter* painter ); + virtual void draw(QCPPainter* painter); // non-virtual methods: - QLineF getRectClippedLine ( const QVector2D& start, const QVector2D& end, const QRect& rect ) const; + QLineF getRectClippedLine(const QVector2D& start, const QVector2D& end, const QRect& rect) const; QPen mainPen() const; }; @@ -3368,13 +3373,13 @@ class QCP_LIB_DECL QCPItemCurve : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( QPen pen READ pen WRITE setPen ) - Q_PROPERTY ( QPen selectedPen READ selectedPen WRITE setSelectedPen ) - Q_PROPERTY ( QCPLineEnding head READ head WRITE setHead ) - Q_PROPERTY ( QCPLineEnding tail READ tail WRITE setTail ) + Q_PROPERTY(QPen pen READ pen WRITE setPen) + Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) + Q_PROPERTY(QCPLineEnding head READ head WRITE setHead) + Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail) /// \endcond public: - QCPItemCurve ( QCustomPlot* parentPlot ); + QCPItemCurve(QCustomPlot* parentPlot); virtual ~QCPItemCurve(); // getters: @@ -3384,13 +3389,13 @@ public: QCPLineEnding tail() const { return mTail; } // setters; - void setPen ( const QPen& pen ); - void setSelectedPen ( const QPen& pen ); - void setHead ( const QCPLineEnding& head ); - void setTail ( const QCPLineEnding& tail ); + void setPen(const QPen& pen); + void setSelectedPen(const QPen& pen); + void setHead(const QCPLineEnding& head); + void setTail(const QCPLineEnding& tail); // reimplemented virtual methods: - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; QCPItemPosition* const start; QCPItemPosition* const startDir; @@ -3403,7 +3408,7 @@ protected: QCPLineEnding mHead, mTail; // reimplemented virtual methods: - virtual void draw ( QCPPainter* painter ); + virtual void draw(QCPPainter* painter); // non-virtual methods: QPen mainPen() const; @@ -3414,13 +3419,13 @@ class QCP_LIB_DECL QCPItemRect : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( QPen pen READ pen WRITE setPen ) - Q_PROPERTY ( QPen selectedPen READ selectedPen WRITE setSelectedPen ) - Q_PROPERTY ( QBrush brush READ brush WRITE setBrush ) - Q_PROPERTY ( QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush ) + Q_PROPERTY(QPen pen READ pen WRITE setPen) + Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) + Q_PROPERTY(QBrush brush READ brush WRITE setBrush) + Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush) /// \endcond public: - QCPItemRect ( QCustomPlot* parentPlot ); + QCPItemRect(QCustomPlot* parentPlot); virtual ~QCPItemRect(); // getters: @@ -3430,13 +3435,13 @@ public: QBrush selectedBrush() const { return mSelectedBrush; } // setters; - void setPen ( const QPen& pen ); - void setSelectedPen ( const QPen& pen ); - void setBrush ( const QBrush& brush ); - void setSelectedBrush ( const QBrush& brush ); + void setPen(const QPen& pen); + void setSelectedPen(const QPen& pen); + void setBrush(const QBrush& brush); + void setSelectedBrush(const QBrush& brush); // reimplemented virtual methods: - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; QCPItemPosition* const topLeft; QCPItemPosition* const bottomRight; @@ -3455,8 +3460,8 @@ protected: QBrush mBrush, mSelectedBrush; // reimplemented virtual methods: - virtual void draw ( QCPPainter* painter ); - virtual QPointF anchorPixelPoint ( int anchorId ) const; + virtual void draw(QCPPainter* painter); + virtual QPointF anchorPixelPoint(int anchorId) const; // non-virtual methods: QPen mainPen() const; @@ -3468,22 +3473,22 @@ class QCP_LIB_DECL QCPItemText : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( QColor color READ color WRITE setColor ) - Q_PROPERTY ( QColor selectedColor READ selectedColor WRITE setSelectedColor ) - Q_PROPERTY ( QPen pen READ pen WRITE setPen ) - Q_PROPERTY ( QPen selectedPen READ selectedPen WRITE setSelectedPen ) - Q_PROPERTY ( QBrush brush READ brush WRITE setBrush ) - Q_PROPERTY ( QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush ) - Q_PROPERTY ( QFont font READ font WRITE setFont ) - Q_PROPERTY ( QFont selectedFont READ selectedFont WRITE setSelectedFont ) - Q_PROPERTY ( QString text READ text WRITE setText ) - Q_PROPERTY ( Qt::Alignment positionAlignment READ positionAlignment WRITE setPositionAlignment ) - Q_PROPERTY ( Qt::Alignment textAlignment READ textAlignment WRITE setTextAlignment ) - Q_PROPERTY ( double rotation READ rotation WRITE setRotation ) - Q_PROPERTY ( QMargins padding READ padding WRITE setPadding ) + Q_PROPERTY(QColor color READ color WRITE setColor) + Q_PROPERTY(QColor selectedColor READ selectedColor WRITE setSelectedColor) + Q_PROPERTY(QPen pen READ pen WRITE setPen) + Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) + Q_PROPERTY(QBrush brush READ brush WRITE setBrush) + Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush) + Q_PROPERTY(QFont font READ font WRITE setFont) + Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont) + Q_PROPERTY(QString text READ text WRITE setText) + Q_PROPERTY(Qt::Alignment positionAlignment READ positionAlignment WRITE setPositionAlignment) + Q_PROPERTY(Qt::Alignment textAlignment READ textAlignment WRITE setTextAlignment) + Q_PROPERTY(double rotation READ rotation WRITE setRotation) + Q_PROPERTY(QMargins padding READ padding WRITE setPadding) /// \endcond public: - QCPItemText ( QCustomPlot* parentPlot ); + QCPItemText(QCustomPlot* parentPlot); virtual ~QCPItemText(); // getters: @@ -3502,22 +3507,22 @@ public: QMargins padding() const { return mPadding; } // setters; - void setColor ( const QColor& color ); - void setSelectedColor ( const QColor& color ); - void setPen ( const QPen& pen ); - void setSelectedPen ( const QPen& pen ); - void setBrush ( const QBrush& brush ); - void setSelectedBrush ( const QBrush& brush ); - void setFont ( const QFont& font ); - void setSelectedFont ( const QFont& font ); - void setText ( const QString& text ); - void setPositionAlignment ( Qt::Alignment alignment ); - void setTextAlignment ( Qt::Alignment alignment ); - void setRotation ( double degrees ); - void setPadding ( const QMargins& padding ); + void setColor(const QColor& color); + void setSelectedColor(const QColor& color); + void setPen(const QPen& pen); + void setSelectedPen(const QPen& pen); + void setBrush(const QBrush& brush); + void setSelectedBrush(const QBrush& brush); + void setFont(const QFont& font); + void setSelectedFont(const QFont& font); + void setText(const QString& text); + void setPositionAlignment(Qt::Alignment alignment); + void setTextAlignment(Qt::Alignment alignment); + void setRotation(double degrees); + void setPadding(const QMargins& padding); // reimplemented virtual methods: - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; QCPItemPosition* const position; QCPItemAnchor* const topLeft; @@ -3544,11 +3549,11 @@ protected: QMargins mPadding; // reimplemented virtual methods: - virtual void draw ( QCPPainter* painter ); - virtual QPointF anchorPixelPoint ( int anchorId ) const; + virtual void draw(QCPPainter* painter); + virtual QPointF anchorPixelPoint(int anchorId) const; // non-virtual methods: - QPointF getTextDrawPoint ( const QPointF& pos, const QRectF& rect, Qt::Alignment positionAlignment ) const; + QPointF getTextDrawPoint(const QPointF& pos, const QRectF& rect, Qt::Alignment positionAlignment) const; QFont mainFont() const; QColor mainColor() const; QPen mainPen() const; @@ -3560,13 +3565,13 @@ class QCP_LIB_DECL QCPItemEllipse : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( QPen pen READ pen WRITE setPen ) - Q_PROPERTY ( QPen selectedPen READ selectedPen WRITE setSelectedPen ) - Q_PROPERTY ( QBrush brush READ brush WRITE setBrush ) - Q_PROPERTY ( QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush ) + Q_PROPERTY(QPen pen READ pen WRITE setPen) + Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) + Q_PROPERTY(QBrush brush READ brush WRITE setBrush) + Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush) /// \endcond public: - QCPItemEllipse ( QCustomPlot* parentPlot ); + QCPItemEllipse(QCustomPlot* parentPlot); virtual ~QCPItemEllipse(); // getters: @@ -3576,13 +3581,13 @@ public: QBrush selectedBrush() const { return mSelectedBrush; } // setters; - void setPen ( const QPen& pen ); - void setSelectedPen ( const QPen& pen ); - void setBrush ( const QBrush& brush ); - void setSelectedBrush ( const QBrush& brush ); + void setPen(const QPen& pen); + void setSelectedPen(const QPen& pen); + void setBrush(const QBrush& brush); + void setSelectedBrush(const QBrush& brush); // reimplemented virtual methods: - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; QCPItemPosition* const topLeft; QCPItemPosition* const bottomRight; @@ -3604,8 +3609,8 @@ protected: QBrush mBrush, mSelectedBrush; // reimplemented virtual methods: - virtual void draw ( QCPPainter* painter ); - virtual QPointF anchorPixelPoint ( int anchorId ) const; + virtual void draw(QCPPainter* painter); + virtual QPointF anchorPixelPoint(int anchorId) const; // non-virtual methods: QPen mainPen() const; @@ -3617,15 +3622,15 @@ class QCP_LIB_DECL QCPItemPixmap : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( QPixmap pixmap READ pixmap WRITE setPixmap ) - Q_PROPERTY ( bool scaled READ scaled WRITE setScaled ) - Q_PROPERTY ( Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode ) - Q_PROPERTY ( Qt::TransformationMode transformationMode READ transformationMode ) - Q_PROPERTY ( QPen pen READ pen WRITE setPen ) - Q_PROPERTY ( QPen selectedPen READ selectedPen WRITE setSelectedPen ) + Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap) + Q_PROPERTY(bool scaled READ scaled WRITE setScaled) + Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode) + Q_PROPERTY(Qt::TransformationMode transformationMode READ transformationMode) + Q_PROPERTY(QPen pen READ pen WRITE setPen) + Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) /// \endcond public: - QCPItemPixmap ( QCustomPlot* parentPlot ); + QCPItemPixmap(QCustomPlot* parentPlot); virtual ~QCPItemPixmap(); // getters: @@ -3637,14 +3642,14 @@ public: QPen selectedPen() const { return mSelectedPen; } // setters; - void setPixmap ( const QPixmap& pixmap ); - void setScaled ( bool scaled, Qt::AspectRatioMode aspectRatioMode = Qt::KeepAspectRatio, - Qt::TransformationMode transformationMode = Qt::SmoothTransformation ); - void setPen ( const QPen& pen ); - void setSelectedPen ( const QPen& pen ); + void setPixmap(const QPixmap& pixmap); + void setScaled(bool scaled, Qt::AspectRatioMode aspectRatioMode = Qt::KeepAspectRatio, + Qt::TransformationMode transformationMode = Qt::SmoothTransformation); + void setPen(const QPen& pen); + void setSelectedPen(const QPen& pen); // reimplemented virtual methods: - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; QCPItemPosition* const topLeft; QCPItemPosition* const bottomRight; @@ -3667,12 +3672,12 @@ protected: QPen mPen, mSelectedPen; // reimplemented virtual methods: - virtual void draw ( QCPPainter* painter ); - virtual QPointF anchorPixelPoint ( int anchorId ) const; + virtual void draw(QCPPainter* painter); + virtual QPointF anchorPixelPoint(int anchorId) const; // non-virtual methods: - void updateScaledPixmap ( QRect finalRect = QRect(), bool flipHorz = false, bool flipVert = false ); - QRect getFinalRect ( bool* flippedHorz = 0, bool* flippedVert = 0 ) const; + void updateScaledPixmap(QRect finalRect = QRect(), bool flipHorz = false, bool flipVert = false); + QRect getFinalRect(bool* flippedHorz = 0, bool* flippedVert = 0) const; QPen mainPen() const; }; @@ -3681,15 +3686,15 @@ class QCP_LIB_DECL QCPItemTracer : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( QPen pen READ pen WRITE setPen ) - Q_PROPERTY ( QPen selectedPen READ selectedPen WRITE setSelectedPen ) - Q_PROPERTY ( QBrush brush READ brush WRITE setBrush ) - Q_PROPERTY ( QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush ) - Q_PROPERTY ( double size READ size WRITE setSize ) - Q_PROPERTY ( TracerStyle style READ style WRITE setStyle ) - Q_PROPERTY ( QCPGraph* graph READ graph WRITE setGraph ) - Q_PROPERTY ( double graphKey READ graphKey WRITE setGraphKey ) - Q_PROPERTY ( bool interpolating READ interpolating WRITE setInterpolating ) + Q_PROPERTY(QPen pen READ pen WRITE setPen) + Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) + Q_PROPERTY(QBrush brush READ brush WRITE setBrush) + Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush) + Q_PROPERTY(double size READ size WRITE setSize) + Q_PROPERTY(TracerStyle style READ style WRITE setStyle) + Q_PROPERTY(QCPGraph* graph READ graph WRITE setGraph) + Q_PROPERTY(double graphKey READ graphKey WRITE setGraphKey) + Q_PROPERTY(bool interpolating READ interpolating WRITE setInterpolating) /// \endcond public: /*! @@ -3703,9 +3708,9 @@ public: , tsCircle ///< A circle , tsSquare ///< A square }; - Q_ENUMS ( TracerStyle ) + Q_ENUMS(TracerStyle) - QCPItemTracer ( QCustomPlot* parentPlot ); + QCPItemTracer(QCustomPlot* parentPlot); virtual ~QCPItemTracer(); // getters: @@ -3720,18 +3725,18 @@ public: bool interpolating() const { return mInterpolating; } // setters; - void setPen ( const QPen& pen ); - void setSelectedPen ( const QPen& pen ); - void setBrush ( const QBrush& brush ); - void setSelectedBrush ( const QBrush& brush ); - void setSize ( double size ); - void setStyle ( TracerStyle style ); - void setGraph ( QCPGraph* graph ); - void setGraphKey ( double key ); - void setInterpolating ( bool enabled ); + void setPen(const QPen& pen); + void setSelectedPen(const QPen& pen); + void setBrush(const QBrush& brush); + void setSelectedBrush(const QBrush& brush); + void setSize(double size); + void setStyle(TracerStyle style); + void setGraph(QCPGraph* graph); + void setGraphKey(double key); + void setInterpolating(bool enabled); // reimplemented virtual methods: - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; // non-virtual methods: void updatePosition(); @@ -3749,7 +3754,7 @@ protected: bool mInterpolating; // reimplemented virtual methods: - virtual void draw ( QCPPainter* painter ); + virtual void draw(QCPPainter* painter); // non-virtual methods: QPen mainPen() const; @@ -3761,10 +3766,10 @@ class QCP_LIB_DECL QCPItemBracket : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES - Q_PROPERTY ( QPen pen READ pen WRITE setPen ) - Q_PROPERTY ( QPen selectedPen READ selectedPen WRITE setSelectedPen ) - Q_PROPERTY ( double length READ length WRITE setLength ) - Q_PROPERTY ( BracketStyle style READ style WRITE setStyle ) + Q_PROPERTY(QPen pen READ pen WRITE setPen) + Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) + Q_PROPERTY(double length READ length WRITE setLength) + Q_PROPERTY(BracketStyle style READ style WRITE setStyle) /// \endcond public: enum BracketStyle { bsSquare ///< A brace with angled edges @@ -3773,7 +3778,7 @@ public: , bsCalligraphic ///< A curly brace with varying stroke width giving a calligraphic impression }; - QCPItemBracket ( QCustomPlot* parentPlot ); + QCPItemBracket(QCustomPlot* parentPlot); virtual ~QCPItemBracket(); // getters: @@ -3783,13 +3788,13 @@ public: BracketStyle style() const { return mStyle; } // setters; - void setPen ( const QPen& pen ); - void setSelectedPen ( const QPen& pen ); - void setLength ( double length ); - void setStyle ( BracketStyle style ); + void setPen(const QPen& pen); + void setSelectedPen(const QPen& pen); + void setLength(double length); + void setStyle(BracketStyle style); // reimplemented virtual methods: - virtual double selectTest ( const QPointF& pos, bool onlySelectable, QVariant* details = 0 ) const; + virtual double selectTest(const QPointF& pos, bool onlySelectable, QVariant* details = 0) const; QCPItemPosition* const left; QCPItemPosition* const right; @@ -3803,8 +3808,8 @@ protected: BracketStyle mStyle; // reimplemented virtual methods: - virtual void draw ( QCPPainter* painter ); - virtual QPointF anchorPixelPoint ( int anchorId ) const; + virtual void draw(QCPPainter* painter); + virtual QPointF anchorPixelPoint(int anchorId) const; // non-virtual methods: QPen mainPen() const; diff --git a/src/network/qqtwebaccessmanager.cpp b/src/network/qqtwebaccessmanager.cpp new file mode 100644 index 00000000..978f1702 --- /dev/null +++ b/src/network/qqtwebaccessmanager.cpp @@ -0,0 +1,183 @@ +#include "qqtwebaccessmanager.h" +#include "qqtcore.h" + + +QQtWebAccessManager::QQtWebAccessManager(QObject* parent) : QNetworkAccessManager(parent) +{ + m_listWebWorkSession.clear(); + + connect(this, SIGNAL(finished(QNetworkReply*)), + this, SLOT(finished(QNetworkReply*))); + + connect(this, SIGNAL(finished(QNetworkReply*)), + this, SIGNAL(replyFinished(QNetworkReply*))); + + connect(this, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), + this, SLOT(authenticationRequired(QNetworkReply*, QAuthenticator*))); + + connect(this, SIGNAL(proxyAuthenticationRequired(QNetworkProxy, QAuthenticator*)), + this, SLOT(proxyAuthenticationRequired(QNetworkProxy, QAuthenticator*))); + + connect(this, SIGNAL(sslErrors(QNetworkReply*, QList)), + this, SLOT(sslErrors(QNetworkReply*, QList))); + + connect(this, SIGNAL(networkAccessibleChanged(QNetworkAccessManager::NetworkAccessibility)), + this, SLOT(networkAccessibleChanged(QNetworkAccessManager::NetworkAccessibility))); + + connect(this, SIGNAL(networkSessionConnected()), + this, SLOT(networkSessionConnected())); +} + +void QQtWebAccessManager::sendGetRequest(QString& strUrl) +{ + QQtWebAccessSession* s0 = new QQtWebAccessSession(this); + + s0->m_strUrl = strUrl; + s0->m_pTimer = new QTimer(this); + s0->m_pTimer->setSingleShot(true); + s0->m_pTimer->setInterval(10000); + connect(s0->m_pTimer, SIGNAL(timeout()), + this, SLOT(localReplyTimeOut())); //超时信号 + + QNetworkRequest netRequest; + netRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); + netRequest.setUrl(QUrl(strUrl)); //地址信息 + + if (strUrl.toLower().startsWith("https")) //https请求,需ssl支持(下载openssl拷贝libeay32.dll和ssleay32.dll文件至Qt bin目录或程序运行目录) + { + QSslConfiguration sslConfig; + sslConfig.setPeerVerifyMode(QSslSocket::VerifyNone); + sslConfig.setProtocol(QSsl::TlsV1_1); + netRequest.setSslConfiguration(sslConfig); + } + + s0->m_pNetworkReply = get(netRequest); //发起get请求 + m_listWebWorkSession.push_back(s0); + /*下面关联信号和槽*/ + + /*下载完成后开始一阵一阵堆取数据*/ + connect(s0->m_pNetworkReply, SIGNAL(readyRead()), + this, SLOT(localReadyRead())); + + /*有可用数据时 */ + connect(s0->m_pNetworkReply, SIGNAL(downloadProgress(qint64, qint64)), + this, SLOT(localUpdateDownloadProgress(qint64, qint64))); + connect(s0->m_pNetworkReply, SIGNAL(uploadProgress(qint64, qint64)), + this, SLOT(localUpdateUploadProgress(qint64, qint64))); + + //ignore +// connect ( s0->m_pNetworkReply, SIGNAL ( finished() ), +// this, SLOT ( finished(QNetworkReply*); ) ); //请求完成信号 + + s0->m_pTimer->start(); +} + +void QQtWebAccessManager::sendPostRequest(QString& strUrl) +{ + //post +// QString strBody; //http body部分,可封装参数信息 +// QByteArray contentByteArray = strBody.toLatin1();//转成二进制 +// m_pNetworkReply = m_pNetworkManager->post(netRequest,contentByteArray);//发起post请求 +} + +void QQtWebAccessManager::finished(QNetworkReply* reply) +{ + pline() << reply; + + //clear resource + QQtWebAccessSession* s0 = NULL; + QListIterator itor(m_listWebWorkSession); + + while (itor.hasNext()) + { + QQtWebAccessSession* s1 = itor.next(); + + if (s1->m_pNetworkReply == reply) + { + s0 = s1; + break; + } + } + + if (!s0) + return; + + pline() << s0->m_pNetworkReply << s0->m_pTimer; + + s0->m_pTimer->stop(); + s0->m_pNetworkReply->deleteLater(); + m_listWebWorkSession.removeOne(s0); +} + +void QQtWebAccessManager::authenticationRequired(QNetworkReply* r, QAuthenticator* a) +{ + pline() << r << a; +} + +void QQtWebAccessManager::proxyAuthenticationRequired(QNetworkProxy p, QAuthenticator* a) +{ + pline() << p.hostName() << a; +} + +void QQtWebAccessManager::sslErrors(QNetworkReply* r, QList e) +{ + pline() << r << e.size(); +} + +void QQtWebAccessManager::networkAccessibleChanged(QNetworkAccessManager::NetworkAccessibility a) +{ + pline() << a; +} + +void QQtWebAccessManager::networkSessionConnected() +{ + pline(); +} + +void QQtWebAccessManager::localReplyTimeOut() +{ + QTimer* obj = (QTimer*) sender(); + pline() << obj; + + QQtWebAccessSession* s0 = NULL; + QListIterator itor(m_listWebWorkSession); + + while (itor.hasNext()) + { + QQtWebAccessSession* s1 = itor.next(); + + if (s1->m_pTimer == obj) + { + s0 = s1; + break; + } + } + + if (!s0) + return; + + emit replyTimeOut(s0->m_pNetworkReply); //请求失败 + + s0->m_pNetworkReply->deleteLater(); +} + +void QQtWebAccessManager::localReadyRead() +{ + QNetworkReply* obj = (QNetworkReply*) sender(); + pline() << obj; + emit readyRead(obj); +} + +void QQtWebAccessManager::localUpdateUploadProgress(qint64 bytesSent, qint64 bytesTotal) +{ + QNetworkReply* obj = (QNetworkReply*) sender(); + pline() << obj; + emit updateUploadProgress(obj, bytesSent, bytesTotal); +} + +void QQtWebAccessManager::localUpdateDownloadProgress(qint64 bytesReceived, qint64 bytesTotal) +{ + QNetworkReply* obj = (QNetworkReply*) sender(); + pline() << obj; + emit updateDownloadProgress(obj, bytesReceived, bytesTotal); +} diff --git a/src/network/qqtwebaccessmanager.h b/src/network/qqtwebaccessmanager.h new file mode 100644 index 00000000..74e9f39e --- /dev/null +++ b/src/network/qqtwebaccessmanager.h @@ -0,0 +1,78 @@ +#ifndef QQTWEBWORKCLIENT_H +#define QQTWEBWORKCLIENT_H + +#include +#include +//import this struct will not build fail +#include +#include +#include +#include +#include + +class QQTSHARED_EXPORT QQtWebAccessSession : public QObject +{ + Q_OBJECT +public: + explicit QQtWebAccessSession(QObject* parent = 0) : + QObject(parent) {} + virtual ~QQtWebAccessSession() {} + + QNetworkReply* m_pNetworkReply; //封装请求返回信息 + QTimer* m_pTimer; //请求超时计时器 + QString m_strUrl; //记录当前请求的url + /** + * @brief m_sessionName + * talk with whom, which protocol, req content, all represented by this name; + */ + QString m_sessionName; +} ; +/** + * @brief The QQtWebworkClient class + * One Ftp Http 单工... + * Multi 半双工(客户端并发,服务器序列) QNetworkAccessManager + * Multi New Protocol 全双工 QWebSocket + * need ssl + * Qt team 实现了几种协议的管理,就能进行几种协议的通讯。supportedSchemes + */ +class QQTSHARED_EXPORT QQtWebAccessManager : public QNetworkAccessManager +{ + Q_OBJECT +public: + explicit QQtWebAccessManager(QObject* parent = 0); + + QNetworkReply* getReplyHandler(QString& strUrl) {} + + void sendGetRequest(QString& strUrl); + void sendPostRequest(QString& strUrl); + +signals: + void updateUploadProgress(QNetworkReply* reply, qint64 bytesSent, qint64 bytesTotal); + void updateDownloadProgress(QNetworkReply* reply, qint64 bytesReceived, qint64 bytesTotal); + //reply->readAll but maybe not all data once + void readyRead(QNetworkReply* reply); + //reply->readAll all data once in theory + void replyFinished(QNetworkReply* reply); + void replyTimeOut(QNetworkReply* reply); + +public slots: + +private slots: + void finished(QNetworkReply* reply); + void authenticationRequired(QNetworkReply*, QAuthenticator*); + void proxyAuthenticationRequired(QNetworkProxy, QAuthenticator*); + void sslErrors(QNetworkReply*, QList); + void networkAccessibleChanged(QNetworkAccessManager::NetworkAccessibility); + void networkSessionConnected(); + + void localReplyTimeOut(); + void localReadyRead(); + void localUpdateUploadProgress(qint64 bytesSent, qint64 bytesTotal); + void localUpdateDownloadProgress(qint64 bytesReceived, qint64 bytesTotal); + +private: + + QList m_listWebWorkSession; +}; + +#endif // QQTWEBWORKCLIENT_H diff --git a/src/network/qqtwebprotocolmanager.cpp b/src/network/qqtwebprotocolmanager.cpp deleted file mode 100644 index 8e1ec8eb..00000000 --- a/src/network/qqtwebprotocolmanager.cpp +++ /dev/null @@ -1,183 +0,0 @@ -#include "qqtwebprotocolmanager.h" -#include "qqtcore.h" - - -QQtWebProtocolManager::QQtWebProtocolManager ( QObject* parent ) : QNetworkAccessManager ( parent ) -{ - m_listWebWorkSession.clear(); - - connect ( this, SIGNAL ( finished ( QNetworkReply* ) ), - this, SLOT ( finished ( QNetworkReply* ) ) ); - - connect ( this, SIGNAL ( finished ( QNetworkReply* ) ), - this, SIGNAL ( replyFinished ( QNetworkReply* ) ) ); - - connect ( this, SIGNAL ( authenticationRequired ( QNetworkReply*, QAuthenticator* ) ), - this, SLOT ( authenticationRequired ( QNetworkReply*, QAuthenticator* ) ) ); - - connect ( this, SIGNAL ( proxyAuthenticationRequired ( QNetworkProxy, QAuthenticator* ) ), - this, SLOT ( proxyAuthenticationRequired ( QNetworkProxy, QAuthenticator* ) ) ); - - connect ( this, SIGNAL ( sslErrors ( QNetworkReply*, QList ) ), - this, SLOT ( sslErrors ( QNetworkReply*, QList ) ) ); - - connect ( this, SIGNAL ( networkAccessibleChanged ( QNetworkAccessManager::NetworkAccessibility ) ), - this, SLOT ( networkAccessibleChanged ( QNetworkAccessManager::NetworkAccessibility ) ) ); - - connect ( this, SIGNAL ( networkSessionConnected() ), - this, SLOT ( networkSessionConnected() ) ); -} - -void QQtWebProtocolManager::sendGetRequest ( QString& strUrl ) -{ - QQtWebWorkSession* s0 = new QQtWebWorkSession ( this ); - - s0->m_strUrl = strUrl; - s0->m_pTimer = new QTimer ( this ); - s0->m_pTimer->setSingleShot ( true ); - s0->m_pTimer->setInterval ( 10000 ); - connect ( s0->m_pTimer, SIGNAL ( timeout() ), - this, SLOT ( localReplyTimeOut() ) ); //超时信号 - - QNetworkRequest netRequest; - netRequest.setHeader ( QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded" ); - netRequest.setUrl ( QUrl ( strUrl ) ); //地址信息 - - if ( strUrl.toLower().startsWith ( "https" ) ) //https请求,需ssl支持(下载openssl拷贝libeay32.dll和ssleay32.dll文件至Qt bin目录或程序运行目录) - { - QSslConfiguration sslConfig; - sslConfig.setPeerVerifyMode ( QSslSocket::VerifyNone ); - sslConfig.setProtocol ( QSsl::TlsV1_1 ); - netRequest.setSslConfiguration ( sslConfig ); - } - - s0->m_pNetworkReply = get ( netRequest ); //发起get请求 - m_listWebWorkSession.push_back ( s0 ); - /*下面关联信号和槽*/ - - /*下载完成后开始一阵一阵堆取数据*/ - connect ( s0->m_pNetworkReply, SIGNAL ( readyRead() ), - this, SLOT ( localReadyRead() ) ); - - /*有可用数据时 */ - connect ( s0->m_pNetworkReply, SIGNAL ( downloadProgress ( qint64, qint64 ) ), - this, SLOT ( localUpdateDownloadProgress ( qint64, qint64 ) ) ); - connect ( s0->m_pNetworkReply, SIGNAL ( uploadProgress ( qint64, qint64 ) ), - this, SLOT ( localUpdateUploadProgress ( qint64, qint64 ) ) ); - - //ignore -// connect ( s0->m_pNetworkReply, SIGNAL ( finished() ), -// this, SLOT ( finished(QNetworkReply*); ) ); //请求完成信号 - - s0->m_pTimer->start ( ); -} - -void QQtWebProtocolManager::sendPostRequest ( QString& strUrl ) -{ - //post -// QString strBody; //http body部分,可封装参数信息 -// QByteArray contentByteArray = strBody.toLatin1();//转成二进制 -// m_pNetworkReply = m_pNetworkManager->post(netRequest,contentByteArray);//发起post请求 -} - -void QQtWebProtocolManager::finished ( QNetworkReply* reply ) -{ - pline() << reply; - - //clear resource - QQtWebWorkSession* s0 = NULL; - QListIterator itor ( m_listWebWorkSession ); - - while ( itor.hasNext() ) - { - QQtWebWorkSession* s1 = itor.next(); - - if ( s1->m_pNetworkReply == reply ) - { - s0 = s1; - break; - } - } - - if ( !s0 ) - return; - - pline() << s0->m_pNetworkReply << s0->m_pTimer; - - s0->m_pTimer->stop(); - s0->m_pNetworkReply->deleteLater(); - m_listWebWorkSession.removeOne ( s0 ); -} - -void QQtWebProtocolManager::authenticationRequired ( QNetworkReply* r, QAuthenticator* a ) -{ - pline() << r << a; -} - -void QQtWebProtocolManager::proxyAuthenticationRequired ( QNetworkProxy p, QAuthenticator* a ) -{ - pline() << p.hostName() << a; -} - -void QQtWebProtocolManager::sslErrors ( QNetworkReply* r, QList e ) -{ - pline() << r << e.size(); -} - -void QQtWebProtocolManager::networkAccessibleChanged ( QNetworkAccessManager::NetworkAccessibility a ) -{ - pline() << a; -} - -void QQtWebProtocolManager::networkSessionConnected() -{ - pline(); -} - -void QQtWebProtocolManager::localReplyTimeOut() -{ - QTimer* obj = ( QTimer* ) sender(); - pline() << obj; - - QQtWebWorkSession* s0 = NULL; - QListIterator itor ( m_listWebWorkSession ); - - while ( itor.hasNext() ) - { - QQtWebWorkSession* s1 = itor.next(); - - if ( s1->m_pTimer == obj ) - { - s0 = s1; - break; - } - } - - if ( !s0 ) - return; - - emit replyTimeOut ( s0->m_pNetworkReply ); //请求失败 - - s0->m_pNetworkReply->deleteLater(); -} - -void QQtWebProtocolManager::localReadyRead() -{ - QNetworkReply* obj = ( QNetworkReply* ) sender(); - pline() << obj; - emit readyRead ( obj ); -} - -void QQtWebProtocolManager::localUpdateUploadProgress ( qint64 bytesSent, qint64 bytesTotal ) -{ - QNetworkReply* obj = ( QNetworkReply* ) sender(); - pline() << obj; - emit updateUploadProgress ( obj, bytesSent, bytesTotal ); -} - -void QQtWebProtocolManager::localUpdateDownloadProgress ( qint64 bytesReceived, qint64 bytesTotal ) -{ - QNetworkReply* obj = ( QNetworkReply* ) sender(); - pline() << obj; - emit updateDownloadProgress ( obj, bytesReceived, bytesTotal ); -} diff --git a/src/network/qqtwebprotocolmanager.h b/src/network/qqtwebprotocolmanager.h deleted file mode 100644 index 87d03d64..00000000 --- a/src/network/qqtwebprotocolmanager.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef QQTWEBWORKCLIENT_H -#define QQTWEBWORKCLIENT_H - -#include -#include -//import this struct will not build fail -#include -#include -#include -#include - - -/** - * @brief The QQtWebworkClient class - * One Ftp Http 单工... - * Multi 半双工(客户端并发,服务器序列) QNetworkAccessManager - * Multi New Protocol 全双工 QWebSocket - * need ssl - * Qt team 实现了几种协议的管理,就能进行几种协议的通讯。supportedSchemes - */ -class QQtWebWorkSession; -class QQTSHARED_EXPORT QQtWebProtocolManager : public QNetworkAccessManager -{ - Q_OBJECT -public: - explicit QQtWebProtocolManager ( QObject* parent = 0 ); - - QNetworkReply* getReplyHandler ( QString& strUrl ) {} - - void sendGetRequest ( QString& strUrl ); - void sendPostRequest ( QString& strUrl ); - -signals: - void updateUploadProgress ( QNetworkReply* reply, qint64 bytesSent, qint64 bytesTotal ); - void updateDownloadProgress ( QNetworkReply* reply, qint64 bytesReceived, qint64 bytesTotal ); - //reply->readAll but maybe not all data once - void readyRead ( QNetworkReply* reply ); - //reply->readAll all data once in theory - void replyFinished ( QNetworkReply* reply ); - void replyTimeOut ( QNetworkReply* reply ); - -public slots: - -private slots: - void finished ( QNetworkReply* reply ); - void authenticationRequired ( QNetworkReply*, QAuthenticator* ); - void proxyAuthenticationRequired ( QNetworkProxy, QAuthenticator* ); - void sslErrors ( QNetworkReply*, QList ); - void networkAccessibleChanged ( QNetworkAccessManager::NetworkAccessibility ); - void networkSessionConnected(); - - void localReplyTimeOut(); - void localReadyRead(); - void localUpdateUploadProgress ( qint64 bytesSent, qint64 bytesTotal ); - void localUpdateDownloadProgress ( qint64 bytesReceived, qint64 bytesTotal ); - -private: - - QList m_listWebWorkSession; -}; - -class QQtWebWorkSession : public QObject -{ - Q_OBJECT -public: - explicit QQtWebWorkSession ( QObject* parent ) : - QObject ( parent ) {} - virtual ~QQtWebWorkSession() {} - - QNetworkReply* m_pNetworkReply; //封装请求返回信息 - QTimer* m_pTimer; //请求超时计时器 - QString m_strUrl; //记录当前请求的url - /** - * @brief m_sessionName - * talk with whom, which protocol, req content, all represented by this name; - */ - QString m_sessionName; -} ; - -#endif // QQTWEBWORKCLIENT_H diff --git a/src/qqt_header.pri b/src/qqt_header.pri index 42744a48..74ecf0de 100644 --- a/src/qqt_header.pri +++ b/src/qqt_header.pri @@ -183,9 +183,9 @@ DEFINES += __WEBSERVICESUPPORT__ #One Ftp Http 单工... #Multi 半双工(客户端并发,服务器序列) QNetworkAccessManager #if you use QNetworkAccessManagerSupport , open this annotation -DEFINES += __WEBPROTOCOLSUPPORT__ -lessThan(QT_MAJOR_VERSION, 5): DEFINES -= __WEBPROTOCOLSUPPORT__ -contains (DEFINES, __WEBPROTOCOLSUPPORT__) { +DEFINES += __WEBACCESSSUPPORT__ +lessThan(QT_MAJOR_VERSION, 5): DEFINES -= __WEBACCESSSUPPORT__ +contains (DEFINES, __WEBACCESSSUPPORT__) { #QSslError not found, you need recompiler Qt4 #TODO: QT += webkit } @@ -203,6 +203,7 @@ contains (DEFINES, __WEBSOCKETSUPPORT__) { ##################Charts Module############################### #if you use QQtCharts, open this annotation DEFINES += __QQTCHARTS__ +lessThan(QT_MAJOR_VERSION, 5):DEFINES-=__QQTCHARTS__ #based on QtCharts, need charts module contains(DEFINES, __QQTCHARTS__) { QT += charts diff --git a/src/qqt_source.pri b/src/qqt_source.pri index 17ba0bb8..929ae974 100644 --- a/src/qqt_source.pri +++ b/src/qqt_source.pri @@ -252,11 +252,12 @@ contains(DEFINES, __WEBSERVICESUPPORT__) { HEADERS += \ $$PWD/network/soap/qtsoap.h } -contains (DEFINES, __WEBPROTOCOLSUPPORT__) { +#webaccess manager +contains (DEFINES, __WEBACCESSSUPPORT__) { SOURCES += \ - $$PWD/network/qqtwebprotocolmanager.cpp + $$PWD/network/qqtwebaccessmanager.cpp HEADERS += \ - $$PWD/network/qqtwebprotocolmanager.h + $$PWD/network/qqtwebaccessmanager.h } contains (DEFINES, __WEBSOCKETSUPPORT__) { diff --git a/test/gumbo_query_test/main.cpp b/test/gumbo_query_test/main.cpp index f66a9aa3..38f687dc 100644 --- a/test/gumbo_query_test/main.cpp +++ b/test/gumbo_query_test/main.cpp @@ -4,42 +4,45 @@ #include #include +#include "stdlib.h" +#include "stdio.h" + void test_parser() { - std::string page ( "

wrong linksome link

" ); + std::string page("

wrong linksome link

"); GumboQueryDocument doc; - doc.parse ( page.c_str() ); + doc.parse(page.c_str()); - GumboQuerySelection c = doc.find ( "h1 a.special" ); - GumboQueryNode node = c.nodeAt ( 0 ); - printf ( "Node: %s\n", node.text().c_str() ); - std::string content = page.substr ( node.startPos(), node.endPos() - node.startPos() ); - printf ( "Node: %s\n", content.c_str() ); + GumboQuerySelection c = doc.find("h1 a.special"); + GumboQueryNode node = c.nodeAt(0); + printf("Node: %s\n", node.text().c_str()); + std::string content = page.substr(node.startPos(), node.endPos() - node.startPos()); + printf("Node: %s\n", content.c_str()); } void test_html() { std::string page = "
1\n2\n
"; GumboQueryDocument doc; - doc.parse ( page.c_str() ); - GumboQueryNode pNode = doc.find ( "div" ).nodeAt ( 0 ); - std::string content = page.substr ( pNode.startPos(), pNode.endPos() - pNode.startPos() ); - printf ( "Node: #%s#\n", content.c_str() ); + doc.parse(page.c_str()); + GumboQueryNode pNode = doc.find("div").nodeAt(0); + std::string content = page.substr(pNode.startPos(), pNode.endPos() - pNode.startPos()); + printf("Node: #%s#\n", content.c_str()); } void test_escape() { std::string page = "
1\n2\n
"; GumboQueryDocument doc; - doc.parse ( page.c_str() ); - GumboQueryNode pNode = doc.find ( "span[id=\"that's\"]" ).nodeAt ( 0 ); - std::string content = page.substr ( pNode.startPos(), pNode.endPos() - pNode.startPos() ); - printf ( "Node: #%s#\n", content.c_str() ); + doc.parse(page.c_str()); + GumboQueryNode pNode = doc.find("span[id=\"that's\"]").nodeAt(0); + std::string content = page.substr(pNode.startPos(), pNode.endPos() - pNode.startPos()); + printf("Node: #%s#\n", content.c_str()); } -int main ( int argc, char* argv[] ) +int main(int argc, char* argv[]) { - QCoreApplication a ( argc, argv ); + QCoreApplication a(argc, argv); test_parser(); test_html(); test_escape();