Qt第三方庫QCustomPlot——QCustomPlot解讀

Qt第三方庫QCustomPlot——QCustomPlot解讀


QCustomPlot(2) arrow_triangle%20_down.jpg數組

這個小部件類,對於QCustomPlot的全部方面都有所體現緩存

下面閱讀它的函數:ide

函數組織順序爲: 基本設置---添加圖線---刪除圖線---添加額外Item---層次管理---座標軸管理----導出圖表函數


[cpp] view plain copyurl

  1.     QCustomPlot (QWidget *parent=0)  spa

  2.   

  3. void    setViewport (const QRect &rect)//視口設置,一般就是本部件所在的長寬  .net

  4. void    setBackground (const QPixmap &pm)//在整個視口的最底層繪製圖片,用做背景  orm

  5. void    setBackground (const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding)  對象

  6. void    setBackground (const QBrush &brush)  blog

  7. void    setBackgroundScaled (bool scaled)//設置setBackground 所繪的圖是否進行縮放以適應Viewport  

  8. void    setBackgroundScaledMode (Qt::AspectRatioMode mode)//有Qt::IgnoreAspectRatio(忽略比例,縮放至適應視口),Qt::KeepAspectRatio(保持長寬比,直到一邊最大至視口邊緣)Qt::KeepAspectRatioByExpanding(保持長寬比,縮放至充滿視口)  

  9. void    setAntialiasedElements (const QCP::AntialiasedElements &antialiasedElements)//抗鋸齒效果,對於各對象,都有默認設置,可經過本函數,改變默認不抗鋸齒的元素,使它也抗。  

  10. void    setAntialiasedElement (QCP::AntialiasedElement antialiasedElement, bool enabled=true)//更方便的開關  

  11. void    setNotAntialiasedElements (const QCP::AntialiasedElements AntialiasedElements)//設置不抗  

  12. void    setNotAntialiasedElement (QCP::AntialiasedElement notAntialiasedElement, bool enabled=true)  

  13. void    setAutoAddPlottableToLegend (bool on)//是否自動添加圖形到圖例,默認是  

  14. void    setInteraction (const QCP::Interaction &interaction, bool enabled=true)//設置交互方式,如是否可拖動或縮放軸,是否可選中軸或圖例等。  

  15. void    setInteractions (const QCP::Interactions &interactions)  

  16. void    setSelectionTolerance (int pixels)//選擇公差設置,在多少像素中能選中某個元素  

  17. void    setNoAntialiasingOnDrag (bool enabled)//拖動時是否也抗鋸齒  

  18. void    setPlottingHint (QCP::PlottingHint hint, bool enabled=true)//設置其它參數,如快速繪製線(損失質量),緩存軸的lable(提升效率)  

  19. void    setPlottingHints (const QCP::PlottingHints &hints)  

  20. void    setMultiSelectModifier (Qt::KeyboardModifier modifier)//要多選時的按鍵,默認Qt::ControlModifier,即ctrl  

  21.   

  22. QRect   viewport () const//與上述大體對應  

  23. QPixmap     background () const  

  24. bool    backgroundScaled () const  

  25. Qt::AspectRatioMode     backgroundScaledMode () const  

  26. QCPLayoutGrid *     plotLayout () const  

  27. QCP::AntialiasedElements    antialiasedElements () const  

  28. QCP::AntialiasedElements    notAntialiasedElements () const  

  29. bool    autoAddPlottableToLegend () const  

  30. const QCP::Interactions     interactions () const  

  31. int     selectionTolerance () const  

  32. bool    noAntialiasingOnDrag () const  

  33. QCP::PlottingHints  plottingHints () const  

  34. Qt::KeyboardModifier    multiSelectModifier () const  

  35.   

  36.   

  37. QCPAbstractPlottable *  plottable (int index)//全部添加的圖線都自動加了索引,按前後順序  

  38. QCPAbstractPlottable *  plottable ()  

  39. bool    addPlottable (QCPAbstractPlottable *plottable)//添加除graph線外的其它種類型的曲線或圖  

  40. bool    removePlottable (QCPAbstractPlottable *plottable)  

  41. bool    removePlottable (int index)  

  42. int     clearPlottables ()  

  43. int     plottableCount () const  

  44. QList< QCPAbstractPlottable * >   selectedPlottables () const//返回選中的線  

  45. QCPAbstractPlottable *  plottableAt (const QPointF &pos, bool onlySelectable=falseconst//返回某個點是否有圖線  

  46. bool    hasPlottable (QCPAbstractPlottable *plottable) const  

  47.   

  48. QCPGraph *  addGraph (QCPAxis *keyAxis=0, QCPAxis *valueAxis=0)//爲Graph線留的特殊接口,因Graph是最經常使用的  

  49. bool    removeGraph (QCPGraph *graph)  

  50. bool    removeGraph (int index)  

  51. QCPGraph *  graph (int index) const  

  52. QCPGraph *  graph () const  

  53. int     clearGraphs ()  

  54. int     graphCount () const  

  55. QList< QCPGraph * >   selectedGraphs () const  

  56.   

  57.   

  58. bool    addItem (QCPAbstractItem *item)//添加一些附加item,如箭頭等  

  59. bool    removeItem (QCPAbstractItem *item)  

  60. bool    removeItem (int index)  

  61. int     clearItems ()  

  62. int     itemCount () const  

  63. QCPAbstractItem *   item (int index) const  

  64. QCPAbstractItem *   item () const  

  65. QList< QCPAbstractItem * >    selectedItems () const  

  66. QCPAbstractItem *   itemAt (const QPointF &pos, bool onlySelectable=falseconst  

  67. bool    hasItem (QCPAbstractItem *item) const  

  68. QCPLayoutElement *  layoutElementAt (const QPointF &pos) const  

  69.   

  70. QCPLayer *  layer (const QString &name) const//QCustomPlot分層的實現與管理  

  71. QCPLayer *  layer (int index) const  

  72. QCPLayer *  currentLayer () const  

  73. bool    setCurrentLayer (const QString &name)  

  74. bool    setCurrentLayer (QCPLayer *layer)  

  75. int     layerCount () const  

  76. bool    addLayer (const QString &name, QCPLayer *otherLayer=0, LayerInsertMode insertMode=limAbove)  

  77. bool    removeLayer (QCPLayer *layer)  

  78. bool    moveLayer (QCPLayer *layer, QCPLayer *otherLayer, LayerInsertMode insertMode=limAbove)  

  79.   

  80. QCPAxisRect *   axisRect (int index=0) const  

  81. QList< QCPAxisRect * >    axisRects () const  

  82. QList< QCPAxis * >    selectedAxes () const  

  83. QList< QCPLegend * >  selectedLegends () const  

  84. int     axisRectCount () const  

  85.   

  86. bool    savePdf (const QString &fileName, bool noCosmeticPen=falseint width=0, int height=0, const QString &pdfCreator=""const QString &pdfTitle="")//將圖表導出成各類格式  

  87. bool    savePng (const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1)  

  88. bool    saveJpg (const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1)  

  89. bool    saveBmp (const QString &fileName, int width=0, int height=0, double scale=1.0)  

  90. bool    saveRastered (const QString &fileName, int width, int height, double scale, const char *format, int quality=-1)  

  91. QPixmap     toPixmap (int width=0, int height=0, double scale=1.0)  

  92. void    toPainter (QCPPainter *painter, int width=0, int height=0)  

  93.   

  94. //三個槽  

  95. Q_SLOT void     replot (QCustomPlot::RefreshPriority refreshPriority=QCustomPlot::rpHint)//從新生成圖表  

  96. Q_SLOT void     rescaleAxes (bool onlyVisiblePlottables=false)  

  97. Q_SLOT void     deselectAll ()//取消選擇

相關文章
相關標籤/搜索