zoukankan      html  css  js  c++  java
  • QCustomPlot使用手冊(三)

    一、改变范围

    QCustomPlot *customplot;
    customplot->setInteraction(QCP::iRangeDrag,true);

    使控件能够拖拉。

    customplot->axisRect()->setRangeDrag(Qt::Vertical);// Qt::Horizontal

    使控件仅仅能在某一方向上拖拉,默认是水平和垂直都支持。

    customplot->setInteraction(QCP::iRangeZoom,true);

    使控件能够伸缩。

    customplot->axisRect()->setRangeZoomAxes(QCPAxis *  horizontal, QCPAxis *  vertical);

    设置伸缩的坐标轴。

    customplot->axisRect()->setRangeZoom();

    设置伸缩的方向。默认水平和垂直都能够。

    customplot->axisRect()->setRangeZoomFactor();

    设置伸缩比例。可设置成一样的。也可分别对水平和垂直进行设置。

    二、选择图元

    customplot->setInteraction(QCP::iSelectPlottables,true);

    将图元设置成可选择的。
    setInteraction
    在setInteraction函数中可开启的有上图这些。

    customplot->graph()->setSelected(bool);

    可通过setSelected设置图元是否能被选中。

    customplot->deselectAll();

    取消全部选中。


    被选中的图元的属性可通过下面设置:

    QCPGraph::setSelectedPen, 
    QCPGraph::setSelectedBrush, QCPAxis::setSelectedLabelFont, QCPAxis::setSelectedBasePen, QCPItemText::setSelectedColor

    QCPAxis 由刻度、数值、标签组成,每部分都能够单独选中,因此通过:

    customplot->xAxis->setSelectableParts();

    參数能够是

     QCPAxis::spNone, QCPAxis::spAxis, QCPAxis::spTickLabels, and QCPAxis::spAxisLabel

    的并集。

    QCustomPlot 支持低级的响应信号。如:

    QCustomPlot::mouseDoubleClick, mousePress, mouseMove, mouseRelease, and mouseWheel

    以及高级的,如:

    QCustomPlot::plottableClick, plottableDoubleClick, itemClick, itemDoubleClick, axisClick, axisDoubleClick, legendClick, legendDoubleClick, titleClick, and titleDoubleClick
  • 相关阅读:
    java语言实现堆排序
    堆排序
    静态分派
    谈mysql优化
    Unity2017.1官方UGUI文档翻译——Canvas
    Unity2017.1官方UGUI文档翻译——Rect Transform
    Unity2017.1官方UGUI文档翻译——Rich Text
    Unity2017.1官方UGUI文档翻译——Auto Layout
    Unity2017.1官方UGUI文档翻译——Animation Integration
    Unity2017.1官方UGUI文档翻译——Interaction Components
  • 原文地址:https://www.cnblogs.com/bhlsheji/p/5280232.html
Copyright © 2011-2022 走看看