Qt第三庫QCustomPlot—繪圖三

這個小部件類,對于QCustomPlot的所有方面都有所體現

下面閱讀它的函數:

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

[.cpp]
   QCustomPlot (QWidget *parent=0)  
  
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)//設置setBackground 所繪的圖是否進行縮放以適應Viewport  
void    setBackgroundScaledMode (Qt::AspectRatioMode mode)//有Qt::IgnoreAspectRatio(忽略比例,縮放至適應視口),Qt::KeepAspectRatio(保持長寬比,直到一邊最大至視口邊緣)Qt::KeepAspectRatioByExpanding(保持長寬比,縮放至充滿視口)  
void    setAntialiasedElements (const QCP::AntialiasedElements &antialiasedElements)//抗鋸齒效果,對于各對象,都有默認設置,可通過本函數,改變默認不抗鋸齒的元素,使它也抗。  
void    setAntialiasedElement (QCP::AntialiasedElement antialiasedElement, bool enabled=true)//更方便的開關  
void    setNotAntialiasedElements (const QCP::AntialiasedElements ?AntialiasedElements)//設置不抗  
void    setNotAntialiasedElement (QCP::AntialiasedElement notAntialiasedElement, bool enabled=true)  
void    setAutoAddPlottableToLegend (bool on)//是否自動添加圖形到圖例,默認是  
void    setInteraction (const QCP::Interaction &interaction, bool enabled=true)//設置交互方式,如是否可拖動或縮放軸,是否可選中軸或圖例等。  
void    setInteractions (const QCP::Interactions &interactions)  
void    setSelectionTolerance (int pixels)//選擇公差設置,在多少像素中能選中某個元素  
void    setNoAntialiasingOnDrag (bool enabled)//拖動時是否也抗鋸齒  
void    setPlottingHint (QCP::PlottingHint hint, bool enabled=true)//設置其它參數,如快速繪制線(損失質量),緩存軸的lable(提高效率)  
void    setPlottingHints (const QCP::PlottingHints &hints)  
void    setMultiSelectModifier (Qt::KeyboardModifier modifier)//要多選時的按鍵,默認Qt::ControlModifier,即ctrl  
  
QRect   viewport () const//與上述大致對應  
QPixmap     background () const  
bool    backgroundScaled () const  
Qt::AspectRatioMode     backgroundScaledMode () const  
QCPLayoutGrid *     plotLayout () const  
QCP::AntialiasedElements    antialiasedElements () const  
QCP::AntialiasedElements    notAntialiasedElements () const  
bool    autoAddPlottableToLegend () const  
const QCP::Interactions     interactions () const  
int     selectionTolerance () const  
bool    noAntialiasingOnDrag () const  
QCP::PlottingHints  plottingHints () const  
Qt::KeyboardModifier    multiSelectModifier () const  
  
  
QCPAbstractPlottable *  plottable (int index)//所有添加的圖線都自動加了索引,按先后順序  
QCPAbstractPlottable *  plottable ()  
bool    addPlottable (QCPAbstractPlottable *plottable)//添加除graph線外的其它種類型的曲線或圖  
bool    removePlottable (QCPAbstractPlottable *plottable)  
bool    removePlottable (int index)  
int     clearPlottables ()  
int     plottableCount () const  
QList< QCPAbstractPlottable * >   selectedPlottables () const//返回選中的線  
QCPAbstractPlottable *  plottableAt (const QPointF &pos, bool onlySelectable=false) const//返回某個點是否有圖線  
bool    hasPlottable (QCPAbstractPlottable *plottable) const  
  
QCPGraph *  addGraph (QCPAxis *keyAxis=0, QCPAxis *valueAxis=0)//為Graph線留的特殊接口,因Graph是最常用的  
bool    removeGraph (QCPGraph *graph)  
bool    removeGraph (int index)  
QCPGraph *  graph (int index) const  
QCPGraph *  graph () const  
int     clearGraphs ()  
int     graphCount () const  
QList< QCPGraph * >   selectedGraphs () const  
  
  
bool    addItem (QCPAbstractItem *item)//添加一些附加item,如箭頭等  
bool    removeItem (QCPAbstractItem *item)  
bool    removeItem (int index)  
int     clearItems ()  
int     itemCount () const  
QCPAbstractItem *   item (int index) const  
QCPAbstractItem *   item () const  
QList< QCPAbstractItem * >    selectedItems () const  
QCPAbstractItem *   itemAt (const QPointF &pos, bool onlySelectable=false) const  
bool    hasItem (QCPAbstractItem *item) const  
QCPLayoutElement *  layoutElementAt (const QPointF &pos) const  
  
QCPLayer *  layer (const QString &name) const//QCustomPlot分層的實現與管理  
QCPLayer *  layer (int index) const  
QCPLayer *  currentLayer () const  
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)  
  
QCPAxisRect *   axisRect (int index=0) const  
QList< QCPAxisRect * >    axisRects () const  
QList< QCPAxis * >    selectedAxes () const  
QList< QCPLegend * >  selectedLegends () const  
int     axisRectCount () const  
  
bool    savePdf (const QString &fileName, bool noCosmeticPen=false, int width=0, int height=0, const QString &pdfCreator="", const QString &pdfTitle="")//將圖表導出成各種格式  
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)//重新生成圖表  
Q_SLOT void     rescaleAxes (bool onlyVisiblePlottables=false)  
Q_SLOT void     deselectAll ()//取消選擇  
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容

  • 簡述 圖形視圖(Graphics View)提供了一個平臺,用于大量自定義2D圖元的管理與交互,并提供了一個視圖部...
    YBshone閱讀 5,373評論 0 5
  • Android 自定義View的各種姿勢1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 173,523評論 25 708
  • The Graphic View 提供了一個 Surface,用于管理和交互大量定制的 2D 圖形化 Item;同...
    勤勞的悄悄閱讀 6,122評論 1 3
  • 今晚突然想看看電影,不知道該看什么,就上了豆瓣看看評分比較高的影片推薦。 手指劃過一部部高分電影,最后...
    逐夢拾光閱讀 700評論 0 4
  • 從來沒有像今天這般,覺得生活如此的殘酷。 25歲的年紀,伸手拿出的竟然只是無盡的拘束,淘寶幾十塊的衣服是這個夏天最...
    愉心閱讀 446評論 0 1