Qt第三方库QCustomPlot——QCustomPlot解读
(2016-06-02 09:43:12)分类: qt |
这个小部件类,对于QCustomPlot的所有方面都有所体现
下面阅读它的函数:
函数组织顺序为: 基本设置---添加图线---删除图线---添加额外Item---层次管理---坐标轴管理----导出图表
[cpp] view plain copy
-
QCustomPlot (QWidget *parent=0) -
-
void
setViewport ( QRect //视口设置,通常就是本部件所在的长宽&rect) -
void
setBackground ( QPixmap //在整个视口的最底层绘制图片,用作背景&pm) -
void
setBackground ( QPixmap bool&pm, scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpandi ng) -
void
setBackground ( QBrush &brush) -
void
setBackgroundScaled ( scaled) //设置setBackground所绘的图是否进行缩放以适应Viewport -
void
setBackgroundScaledMode (Qt::AspectRatioMode mode) ng(保持长宽比,缩放至充满视口) -
void
setAntialiasedElements ( QCP::AntialiasedElements //抗锯齿效果,对于各对象,都有默认设置,可通过本函数,改变默认不抗锯齿的元素,使它也抗。&antialiasedElements) -
void
setAntialiasedElement (QCP::AntialiasedElement antialiasedElement, enabled= true)//更方便的开关 -
void
setNotAntialiasedElement s ( QCP::AntialiasedElements //设置不抗¬AntialiasedElements) -
void
setNotAntialiasedElement (QCP::AntialiasedElement notAntialiasedElement, enabled= true) -
void
setAutoAddPlottableToLeg end ( on) //是否自动添加图形到图例,默认是 -
void
setInteraction ( QCP::Interaction bool&interaction, enabled= true)//设置交互方式,如是否可拖动或缩放轴,是否可选中轴或图例等。 -
void
setInteractions ( QCP::Interactions &interactions) -
void
setSelectionTolerance ( pixels) //选择公差设置,在多少像素中能选中某个元素 -
void
setNoAntialiasingOnDrag ( enabled) //拖动时是否也抗锯齿 -
void
setPlottingHint (QCP::PlottingHint hint, enabled= true)//设置其它参数,如快速绘制线(损失质量),缓存轴的lable(提高效率) -
void
setPlottingHints ( QCP::PlottingHints &hints) -
void
setMultiSelectModifier (Qt::KeyboardModifier modifier) -
-
QRect
viewport () const//与上述大致对应 -
QPixmap
background () const -
bool
backgroundScaled () -
Qt::AspectRatioMode
backgroundScaledMode () const -
QCPLayoutGrid
* plotLayout () const -
QCP::AntialiasedElements
antialiasedElements () const -
QCP::AntialiasedElements
notAntialiasedElements () const -
bool
autoAddPlottableToLegend () -
const
QCP::Interactions constinteractions () -
int
selectionTolerance () -
bool
noAntialiasingOnDrag () -
QCP::PlottingHints
plottingHints () const -
Qt::KeyboardModifier
multiSelectModifier () const -
-
-
QCPAbstractPlottable
* plottable (int index) //所有添加的图线都自动加了索引,按先后顺序 -
QCPAbstractPlottable
* plottable () -
bool
addPlottable (QCPAbstractPlottable *plottable) -
bool
removePlottable (QCPAbstractPlottable *plottable) -
bool
removePlottable ( index) -
int
clearPlottables () -
int
plottableCount () -
QList<
QCPAbstractPlottable * > selectedPlottables () const//返回选中的线 -
QCPAbstractPlottable
* plottableAt (const QPointF bool&pos, onlySelectable= false)const//返回某个点是否有图线 -
bool
hasPlottable (QCPAbstractPlottable *plottable) -
-
QCPGraph
* addGraph (QCPAxis *keyAxis=0, QCPAxis *valueAxis=0)//为Graph线留的特殊接口,因Graph是最常用的 -
bool
removeGraph (QCPGraph *graph) -
bool
removeGraph ( index) -
QCPGraph
* graph (int index) const -
QCPGraph
* graph () const -
int
clearGraphs () -
int
graphCount () -
QList<
QCPGraph * > selectedGraphs () const -
-
-
bool
addItem (QCPAbstractItem *item) -
bool
removeItem (QCPAbstractItem *item) -
bool
removeItem ( index) -
int
clearItems () -
int
itemCount () -
QCPAbstractItem
* item (int index) const -
QCPAbstractItem
* item () const -
QList<
QCPAbstractItem * > selectedItems () const -
QCPAbstractItem
* itemAt (const QPointF bool&pos, onlySelectable= false)const -
bool
hasItem (QCPAbstractItem *item) -
QCPLayoutElement
* layoutElementAt (const QPointF const&pos) -
-
QCPLayer
* layer (const QString const//QCustomPlot分层的实现与管理&name) -
QCPLayer
* layer (int index) const -
QCPLayer
* currentLayer () const -
bool
setCurrentLayer ( QString &name) -
bool
setCurrentLayer (QCPLayer *layer) -
int
layerCount () -
bool
addLayer ( 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 () -
-
bool
savePdf ( QString bool&fileName, noCosmeticPen= false,int width=0, intheight=0, constQString "",&pdfCreator= const QString "")//将图表导出成各种格式&pdfTitle= -
bool
savePng ( QString int&fileName, width=0, intheight=0, doublescale=1.0, intquality=-1) -
bool
saveJpg ( QString int&fileName, width=0, intheight=0, doublescale=1.0, intquality=-1) -
bool
saveBmp ( QString int&fileName, width=0, intheight=0, doublescale=1.0) -
bool
saveRastered ( QString int&fileName, width, intheight, doublescale, constchar *format, intquality=-1) -
QPixmap
toPixmap (int width=0, intheight=0, doublescale=1.0) -
void
toPainter (QCPPainter *painter, width=0, intheight=0) -
-
//三个槽
-
Q_SLOT
void replot (QCustomPlot::RefreshPriority refreshPriority=QCustomPlot::rpHint) -
Q_SLOT
void rescaleAxes ( onlyVisiblePlottables= false) -
Q_SLOT
void deselectAll ()