zoukankan      html  css  js  c++  java
  • Qt-Chart在的使用(生成双线、隐藏线,实时动态生成线、时间轴、定义线的颜色)

    相关资料:

    https://www.cnblogs.com/mrlayfolk/p/13375358.html   官方实例

    https://www.freesion.com/article/7245531685/    实时动态曲线

    https://blog.csdn.net/gongjianbo1992/article/details/98615059   增加背景图片

     .pro

     1 QT       += core gui
     2 QT += charts
     3 
     4 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
     5 
     6 CONFIG += c++11
     7 CONFIG += console
     8 
     9 # The following define makes your compiler emit warnings if you use
    10 # any Qt feature that has been marked deprecated (the exact warnings
    11 # depend on your compiler). Please consult the documentation of the
    12 # deprecated API in order to know how to port your code away from it.
    13 DEFINES += QT_DEPRECATED_WARNINGS
    14 
    15 QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO
    16 QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO
    17 
    18 # You can also make your code fail to compile if it uses deprecated APIs.
    19 # In order to do so, uncomment the following line.
    20 # You can also select to disable deprecated APIs only up to a certain version of Qt.
    21 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    22 
    23 SOURCES += 
    24     main.cpp 
    25     mainwindow.cpp
    26 
    27 HEADERS += 
    28     mainwindow.h 
    29     usb103.h
    30 
    31 FORMS += 
    32     mainwindow.ui
    33 
    34 dllPath = D:/QtDemo/testDLL/testDLL
    35 LIBS += -L$${dllPath} -lusb103 
    36 
    37 TARGET = ../../Project/bin/USB192
    38 
    39 # Default rules for deployment.
    40 qnx: target.path = /tmp/$${TARGET}/bin
    41 else: unix:!android: target.path = /opt/$${TARGET}/bin
    42 !isEmpty(target.path): INSTALLS += target
    View Code

    mainwindows.h

     1 #ifndef MAINWINDOW_H
     2 #define MAINWINDOW_H
     3 
     4 #include <QMainWindow>
     5 #include <QLibrary>
     6 #include <QDebug>
     7 #include <QtWidgets/QApplication>
     8 #include <QtCharts/QChartView>
     9 #include <QtCharts/QSplineSeries>
    10 #include <QChart>
    11 #include <QLineEdit>
    12 #include <QLabel>
    13 #include <QVBoxLayout>
    14 #include <QHBoxLayout>
    15 #include <QDateTimeAxis>
    16 #include <QValueAxis>
    17 #include <QTimer>
    18 #include <QDateTime>
    19 #include <QPushButton>
    20 #include <QSlider>
    21 #include <QCheckBox>
    22 #include <QColorDialog>
    23 #include <QStringListModel>
    24 #include <QStandardItemModel>
    25 #include <QModelIndex>
    26 
    27 #include <usb103.h>
    28 
    29 QT_CHARTS_USE_NAMESPACE   //浣跨敤QChart蹇呴』瑕佹坊鍔犺繖鍙�
    30 
    31 QT_BEGIN_NAMESPACE
    32 namespace Ui { class MainWindow; }
    33 QT_END_NAMESPACE
    34 
    35 class QtChartDemoZoom : public QChartView
    36 {
    37     Q_OBJECT
    38 public:
    39     QtChartDemoZoom(QChart *chart, QWidget *parent = nullptr);
    40     ~QtChartDemoZoom();
    41 protected:
    42     virtual void wheelEvent(QWheelEvent *pEvent) override;
    43     virtual void mouseMoveEvent(QMouseEvent *pEvent) override;
    44     virtual void mousePressEvent(QMouseEvent *pEvent) override;
    45     virtual void mouseReleaseEvent(QMouseEvent *pEvent) override;
    46 private:
    47     bool m_bMiddleButtonPressed;
    48     QPoint m_oPrePos;
    49 };
    50 
    51 class MainWindow : public QMainWindow
    52 {
    53     Q_OBJECT
    54 public:
    55     MainWindow(QWidget *parent = nullptr);
    56     ~MainWindow();
    57 
    58     void resizeEvent(QResizeEvent* size);
    59 private:
    60     void initDraw();// 鍒濆�鍖栫敾甯�
    61     void on_DrawLine();// 鐢荤嚎
    62 private slots:
    63     void on_pushButton_clicked();
    64     void on_pushButton_6_clicked();
    65     void on_pushButton_2_clicked();
    66     void on_pushButton_7_clicked();
    67     void on_horizontalSlider_valueChanged(int value);
    68     void on_pushButton_4_clicked();
    69     void on_Timer();
    70     void on_pushButton_5_clicked();
    71     void on_pushButton_3_clicked();
    72 
    73     void on_pushButton_8_clicked();
    74 
    75     void on_pushButton_9_clicked();
    76 
    77 private:
    78     Ui::MainWindow *ui;
    79     HANDLE g_pDevice = INVALID_HANDLE_VALUE;
    80     QTimer *m_pTimer = NULL;
    81     QtChartDemoZoom *m_pChartView;
    82     double m_data[20];
    83     QStandardItemModel *m_pItemModel;
    84     //
    85     QtCharts::QChart *m_pChart;  // 鐢诲竷
    86     QtCharts::QSplineSeries *m_pSeries0; // 绾�
    87     QtCharts::QDateTimeAxis *m_pAxisX; // 杞�
    88     QtCharts::QValueAxis *m_pAxisY;
    89     //
    90     int m_nSeriesCount = 19;// 绾跨殑鎬绘暟
    91     QList<QColor> m_ColorList= {Qt::red, Qt::green, Qt::white, Qt::gray, Qt::blue,
    92                                 Qt::cyan, Qt::magenta, Qt::yellow, Qt::darkRed, Qt::darkGreen,
    93                                 Qt::darkBlue, Qt::darkYellow, Qt::darkMagenta, Qt::darkCyan, Qt::darkBlue,
    94                                 Qt::lightGray, Qt::darkGray, Qt::black, Qt::color1,};//绾跨殑棰滆壊
    95 };
    96 #endif // MAINWINDOW_H
    View Code

    usb192.h

      1 #include <windows.h>
      2 
      3 //////////////////////////////////////////////////////////////////////////
      4 //功能: 读取数据
      5 DWORD  _stdcall USB_Read(    
      6                          LONG CODEINDEX,       //控制码
      7                          PVOID pData,          //接收缓冲区 
      8                          DWORD dwLen,          //要读取的长度
      9                          PDWORD pLength,       //实际读到的数据
     10                          DWORD dwMilliseconds);//设置超时
     11 
     12 //////////////////////////////////////////////////////////////////////////
     13 //功能: 写入数据
     14 DWORD  _stdcall USB_Write(
     15                           LONG CODEINDEX,      //控制码
     16                           PVOID pData,         //发送缓冲区
     17                           DWORD dwLen,         //发送长度
     18                           PDWORD pLength,      //实际发送的长度
     19     DWORD dwMilliseconds);//设置超时
     20 
     21 //////////////////////////////////////////////////////////////////////////
     22 //功能: 读取某个端点的数据
     23 //返回: TRUE - 成功 , FALSE - 失败
     24 DWORD  _stdcall USB_Read_EndPoint(
     25                                   UCHAR EndPointNO,      //端点号
     26                                   PVOID pData,           //接收缓冲区 
     27                                   DWORD dwLen,           //要读取的长度
     28                                   PDWORD pLength,        //实际读到的数据
     29                                   DWORD dwMilliseconds); //设置超时
     30 
     31 //////////////////////////////////////////////////////////////////////////
     32 //功能: 写入数据到某个端点
     33 //返回: TRUE - 成功 , FALSE - 失败
     34 DWORD  _stdcall USB_Write_EndPoint(
     35                                    UCHAR EndPointNO,     //端点号
     36                                    PVOID pData,          //发送缓冲区
     37                                    DWORD dwLen,          //发送长度
     38                                    PDWORD pLength,       //实际发送的长度
     39                                    DWORD dwMilliseconds);//设置超时
     40 //======================================================================================================================//
     41 
     42 //////////////////////////////////////////////////////////////////////////
     43 //功能: 获取当前连接的设备数目
     44 DWORD    _stdcall USB_GetDeviceCount(void);
     45 
     46 //////////////////////////////////////////////////////////////////////////
     47 //功能: 打开设备
     48 //参数: dwDeviceNum设备序号,值为:0 ~ count-1 (count为USBIO_GetDeviceCount());
     49 //返回: 指向设备的句柄
     50 HANDLE    _stdcall USB_OpenDevice(DWORD dwDeviceNum);
     51 
     52 //////////////////////////////////////////////////////////////////////////
     53 //功能: 关闭设备
     54 //参数: handle 要关闭的设备句柄
     55 BOOL    _stdcall USB_CloseDevice(HANDLE handle);
     56 
     57 //////////////////////////////////////////////////////////////////////////
     58 //功能: 配置IO为输入或输出
     59 //参数: configdata 需要14个字节的数组
     60 //      0.1->PA , 2.3->PB , 4.5->PC , 6.7->PD , 8.9->PE , 10.11->PF , 12.13->PG
     61 //      例如:configdata[0],configdata[1]这两个字节(16位)对应PA口的16个引脚
     62 //           字节configdata[0],configdata[1]分别对应PA15-8 PA7-0的配置值
     63 //           configdata[0]最高位对应PA^15,configdata[0]最低位对应PA^8 
     64 //           configdata[1]最高位对应PA^7,configdata[1]最低位对应PA^0
     65 //      每位值表示的含义: 0:表示输出(即用作控制) , 1:表示输入(即用作采集)
     66 //返回: 0 - 失败,1 - 成功
     67 DWORD _stdcall USBIO_ConfigAll(UCHAR configdata[]);
     68 
     69 //////////////////////////////////////////////////////////////////////////
     70 //功能: 读位
     71 //返回: 0 - 低电平,1 - 高电平,2 - 通信错误请求重发,3 - 数据出错,4 - 未响应
     72 DWORD _stdcall USBIO_ReadBit(
     73     UCHAR port,              //端口0-6对应A-G
     74     UCHAR bit);              //引脚0-15
     75     
     76 //////////////////////////////////////////////////////////////////////////
     77 //功能: 写位
     78 //返回: 0 - 低电平, 1 - 高电平, 2 - 失败
     79 DWORD _stdcall USBIO_WriteBit(
     80     UCHAR port,           //端口0-6对应A-G
     81     UCHAR bit,            //引脚0-15
     82     UCHAR value);         //写入内容:0 或者 1
     83 /////////////////////////////////////////////////////////////////////////
     84 //功能: 写端口
     85 DWORD _stdcall USBIO_WriteALL(
     86     UCHAR port,//端口0-6
     87     UCHAR value);//写入内容:0 或者 1
     88                                   
     89 
     90 //////////////////////////////////////////////////////////////////////////
     91 //功能: 读取全部端口状态
     92 //参数: data 双字节型数组,数组的每个元素对应一个端口
     93 //      data[0]的最高位对应PA^15,data[6]最低位对应PG^0
     94 //      每位值表示的含义: 0 - 低电平,1 - 高电平
     95 //返回: 0 - 失败,1 - 成功
     96 DWORD _stdcall USBIO_ReadAll(USHORT data[]/*接收缓冲区*/);
     97 
     98 //////////////////////////////////////////////////////////////////////////
     99 //功能: 配置AD采样率
    100 //参数: 0-7
    101 //返回: 0 - 失败 , 1 - 成功
    102 DWORD _stdcall USBAD_Config(UCHAR ConfigData);
    103 
    104 //////////////////////////////////////////////////////////////////////////
    105 //功能: 读取19个通道的AD数据
    106 //参数: data[0]为通道0数据,data[1]为通道1数据...
    107 //      data[0]/4096.0*3.3 为通道0实际电压值,data[1]/4096.0*3.3为通道1实际电压值...
    108 //返回: 0 - 失败 , 1 - 成功
    109 DWORD _stdcall USBAD_ReadAll(USHORT data[]);
    110 
    111 //////////////////////////////////////////////////////////////////////////
    112 //功能: 配置DA采样率
    113 //参数: 0-65535
    114 //返回: 0 - 失败 , 1 - 成功
    115 DWORD _stdcall USBDA_Config(USHORT OutData);
    116 
    117 //////////////////////////////////////////////////////////////////////////
    118 //功能: DA输出
    119 //参数: 需要长度为2的双字节数组 
    120 //      OutData[0]的低12位(0-11)为DA1
    121 //      OutData[1]的低12位为(0-11)为DA2
    122 //      OutData[0],OutData[1]高4位无效
    123 //返回: 0 - 失败 , 1 - 成功
    124 DWORD _stdcall USBDA_Out(USHORT OutData[]);
    125 
    126 //////////////////////////////////////////////////////////////////////////
    127 //功能: PWM输出
    128 //参数: 需要长度为5的单字节数组
    129 //      OutData[0] 通道
    130 //      OutData[1] 分频高字节
    131 //      OutData[2] 分频低字节
    132 //      OutData[3] 占空比高字节
    133 //      OutData[4] 占空比低字节
    134 //返回: 0 - 失败 , 1 - 成功
    135 DWORD _stdcall USBPWM_Out(UCHAR OutData[]);
    136 
    137 
    138 //////////////////////////////////////////////////////////////////////////
    139 //功能: 配置地址
    140 //参数: Address 配置地址范围0-255
    141 DWORD _stdcall USB_SetAddress(UCHAR Address);
    142 
    143 //////////////////////////////////////////////////////////////////////////
    144 //功能: 获取设备的序列号
    145 //返回: 成功:设备序列号 失败:-1
    146 int _stdcall USB_GetSerialNumber();
    View Code

    main.cpp

    #include "mainwindow.h"
    
    #include <QApplication>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        MainWindow w;
        w.show();
        return a.exec();
    }
    View Code

    mainwindows.cpp

      1 #include "mainwindow.h"
      2 #include "ui_mainwindow.h"
      3 
      4 MainWindow::MainWindow(QWidget *parent)
      5     : QMainWindow(parent)
      6     , ui(new Ui::MainWindow)
      7 {
      8     ui->setupUi(this);
      9 
     10     initDraw();
     11 
     12     m_pItemModel = new QStandardItemModel(this);
     13     ui->listView_showmaxmin->setModel(m_pItemModel);
     14 
     15     m_pTimer = new QTimer;
     16 //    m_pTimer->start(10);
     17     m_pTimer->setInterval(30);
     18     m_pTimer->setSingleShot(false);
     19     connect(m_pTimer, &QTimer::timeout, this, &MainWindow::on_Timer);
     20 
     21 
     22 
     23 }
     24 
     25 MainWindow::~MainWindow()
     26 {
     27     delete ui;
     28 }
     29 
     30 void MainWindow::resizeEvent(QResizeEvent *size)
     31 {
     32     if (m_pChartView)
     33     {
     34         m_pChartView->setGeometry(30, 260, this->width(), this->height() - 260);
     35     }
     36 }
     37 
     38 void MainWindow::initDraw()
     39 {
     40     QPen penY(Qt::black, 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
     41     m_pChart = new QChart();
     42     m_pChart->setBackgroundVisible(false);
     43     // m_pChart->setTheme(QChart::ChartThemeBlueCerulean);// 设置系统主题
     44     // m_pChart->setAnimationOptions(QChart::AllAnimations);// 设置启用或禁用动画
     45     // m_pChart->setBackgroundBrush(QBrush(QColor(170,170,255)));// 设置背景色,主题和背景二选一
     46     // m_pChart->setDropShadowEnabled(true);// 是否背景阴影
     47     // m_pChart->setLocalizeNumbers(true);//数字是否本地化
     48     // m_pChart->legend()->show();//legend是否显示,show和hide
     49     // m_pChart->legend()->setVisible(true);
     50     // m_pChart->legend()->setAlignment(Qt::AlignBottom);//底部对齐
     51     // m_pChart->legend()->detachFromChart();
     52     // m_pChart->legend()->setBackgroundVisible(true);//设置背景是否可视
     53     // m_pChart->legend()->setAutoFillBackground(true);//设置背景自动填充
     54     // m_pChart->legend()->setColor(QColor(255,128,128,128));//设置颜色
     55     // m_pChart->legend()->setContentsMargins(10,10,10,10);//设置边距left,top,right,bottom
     56     // m_pChart->legend()->setLabelColor(QColor(255,128,255));//设置标签颜色
     57     // m_pChart->legend()->setVisible(true);//设置是否可视
     58     // m_pChart->legend()->setMaximumHeight(50);
     59     // m_pChart->legend()->setMaximumWidth(120);
     60     // m_pChart->legend()->setMaximumSize(10000);
     61     // m_pChart->legend()->setGeometry(50,50,120,50);//设置几何位置x,y,w,h
     62     // m_pChart->legend()->setBrush(QBrush(QColor(128,128,128,128)));
     63     // m_pChart->legend()->setPen(QPen(QColor(192,192, 192,192)));
     64     // m_pChart->legend()->setBorderColor(QColor(255,255,170,185));//设置边框颜色
     65     // QFont font = chart->legend()->font();
     66     // font.setItalic(!font.italic());
     67     // m_pChart->legend()->setFont(font);//设置字体为斜体
     68     // font.setPointSizeF(12);
     69     // m_pChart->legend()->setFont(font);//设置字体大小
     70     // m_pChart->legend()->setFont(QFont("微软雅黑"));//设置字体类型
     71 
     72     // m_pChart->addSeries(series1);//添加系列到QChart上
     73     // m_pChart->createDefaultAxes();//创建默认轴
     74     // m_pChart->setTitle("Simple line chart example");//设置标题
     75     // m_pChart->setTitleBrush(QBrush(QColor(255,170,255)));//设置标题Brush
     76     // m_pChart->setTitleFont(QFont("微软雅黑"));//设置标题字体
     77 
     78 
     79     m_pSeries0 = new QSplineSeries;
     80     m_pSeries0->setName("Series_0");// 设置线条名称
     81     m_pSeries0->setUseOpenGL(true);
     82     // m_pSeries0->setColor(QColor(255,0,255));// 设置线条颜色,如果不设置会给默认颜色
     83     // series1->setBrush(QColor(255,0,255));
     84     // series1->setPen(QColor(255,0,255))
     85     // m_pSeries0->setVisible(true); // 设置是否线条可视
     86     // m_pSeries0->setPointLabelsVisible(true);// 点标签是否可视
     87     // m_pSeries0->setPointLabelsColor(QColor(255,255,255)); // 点标签颜色
     88     // m_pSeries0->setPointLabelsFont(QFont("微软雅黑"));// 点标签字体
     89     // m_pSeries0->setPointLabelsFormat("(@xPoint,@yPoint)");// 设置点标签显示格式
     90     // m_pSeries0->setPointLabelsClipping(false);// 是否切割边缘点标签,默认为true
     91     // m_pSeries0->setPointsVisible(true);// 设置点标签是否可视
     92     // m_pSeries0->append(0, 6);// 添加坐标点
     93     // m_pSeries0 << QPointF(11, 1);// 添加坐标点
     94 
     95     m_pAxisX = new QDateTimeAxis();
     96     m_pAxisY = new QValueAxis();
     97 
     98     m_pChart->legend()->hide();                             //隐藏图例
     99     m_pChart->addSeries(m_pSeries0);                         //把线添加到chart
    100     m_pAxisX->setTickCount(10);        //设置坐标轴格数
    101     m_pAxisY->setTickCount(5);
    102     m_pAxisX->setFormat("hh:mm:ss");                        //设置时间显示格式
    103     m_pAxisY->setMin(0);                                    //设置Y轴范围
    104     m_pAxisY->setMax(4095);
    105     m_pAxisX->setTitleText(QStringLiteral("实时时间"));       //设置X轴名称
    106     m_pAxisY->setLinePenColor(QColor(Qt::darkBlue));        //设置坐标轴颜色样式
    107     m_pAxisY->setGridLineColor(QColor(Qt::darkBlue));
    108     m_pAxisY->setGridLineVisible(false);                    //设置Y轴网格不显示
    109     m_pAxisY->setLinePen(penY);
    110     m_pAxisX->setLinePen(penY);
    111 
    112     m_pChart->addAxis(m_pAxisX,Qt::AlignBottom);               // 设置坐标轴位于chart中的位置
    113     m_pChart->addAxis(m_pAxisY,Qt::AlignLeft);
    114 
    115     m_pSeries0->attachAxis(m_pAxisX);                           // 把数据添加到坐标轴上
    116     m_pSeries0->attachAxis(m_pAxisY);
    117     QPen S1Pen(m_ColorList[0], 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
    118     m_pSeries0->setPen(S1Pen);
    119 
    120     m_pAxisY->setTitleText("y1");
    121     m_pAxisY->setTitleVisible(false);
    122 
    123     // 把chart显示到窗口上
    124 //    QtCharts::QChartView *chartView = new QtCharts::QChartView(m_pChart, this);
    125     m_pChartView = new QtChartDemoZoom(m_pChart, this);
    126     m_pChartView->setRenderHint(QPainter::Antialiasing);   // 设置抗锯齿
    127     m_pChartView->setStyleSheet(R"(QGraphicsView{background-image:url(:/new/prefix1/12954363.jpg);})");
    128     m_pChartView->setGeometry(30, 260, 1000, 250);
    129 
    130     QtCharts::QSplineSeries *oNewSeries;
    131     QString sSeriesName = "Series_%1";
    132     for (int i = 1; i < m_nSeriesCount; i++)
    133     {
    134         oNewSeries= new QSplineSeries;
    135         oNewSeries->setUseOpenGL(true);
    136         oNewSeries->setName(sSeriesName.arg(QString::number(i)));
    137         m_pChart->addSeries(oNewSeries);                         //把线添加到chart
    138         oNewSeries->attachAxis(m_pAxisX);                        // 把数据添加到坐标轴上
    139         oNewSeries->attachAxis(m_pAxisY);
    140         QPen S2Pen(m_ColorList[i], 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
    141         oNewSeries->setPen(S2Pen);
    142     }
    143 }
    144 
    145 void MainWindow::on_DrawLine()
    146 {
    147     int number;
    148     QDateTime currentTime = QDateTime::currentDateTime();
    149     // 设置坐标轴显示范围
    150     m_pChart->axisX()->setMin(QDateTime::currentDateTime().addSecs(-60 * 1));       //系统当前时间的前一秒
    151     m_pChart->axisX()->setMax(QDateTime::currentDateTime().addSecs(0));            //系统当前时间
    152     // 刷新显示最大最小值
    153     m_pItemModel->clear();
    154     // 增加新的点到曲线末端
    155     for(int nSeriesIndex = 0; nSeriesIndex < m_pChart->series().size(); ++nSeriesIndex)
    156     {
    157         // 增加实时数据
    158         QtCharts::QSplineSeries *oSeries = dynamic_cast<QtCharts::QSplineSeries*>(m_pChart->series().at(nSeriesIndex));
    159         oSeries->append(currentTime.toMSecsSinceEpoch(), m_data[nSeriesIndex+1]);
    160 
    161         QString sCheckBoxName = "checkBox_%1";
    162         QCheckBox *oCheckBox = QWidget::findChild<QCheckBox*>(sCheckBoxName.arg(QString::number(nSeriesIndex)));
    163         if (oCheckBox->isChecked())
    164         {
    165             oSeries->setVisible(true);
    166             // 刷新显示最大最小值
    167             QString sCount = QStringLiteral("端口:%1 总数:%2");
    168             QStandardItem *item = new QStandardItem(sCount.arg(oCheckBox->text()).arg(oSeries->pointsVector().size()));
    169             m_pItemModel->appendRow(item);
    170         }
    171         else
    172             oSeries->setVisible(false);
    173     }
    174 }
    175 
    176 
    177 void MainWindow::on_pushButton_clicked()
    178 {
    179     g_pDevice = USB_OpenDevice(0);
    180     if (g_pDevice != INVALID_HANDLE_VALUE)
    181     {
    182         int n = USB_GetSerialNumber();
    183         QString sTitle = QStringLiteral("锟借备锟窖达拷锟斤拷,锟借备ID锟斤拷: %1");
    184         setWindowTitle(sTitle.arg(QString::number(n)));
    185     }
    186     else
    187     {
    188        setWindowTitle(QStringLiteral("锟斤拷锟斤拷失锟斤拷"));
    189     }
    190 }
    191 
    192 void MainWindow::on_pushButton_6_clicked()
    193 {
    194     int DeviceNumber = USB_GetDeviceCount();
    195     setWindowTitle(QString::number(DeviceNumber));
    196 }
    197 
    198 void MainWindow::on_pushButton_2_clicked()
    199 {
    200     if (USB_CloseDevice(g_pDevice))
    201     {
    202         //锟借备锟窖关憋拷
    203         setWindowTitle(QStringLiteral("锟借备锟窖关憋拷"));
    204     }
    205 }
    206 
    207 void MainWindow::on_pushButton_7_clicked()
    208 {
    209     if (USBAD_Config(ui->lineEdit->text().toDouble()))
    210     {
    211         setWindowTitle(QStringLiteral("锟斤拷锟矫成癸拷"));
    212     }
    213     else
    214     {
    215         setWindowTitle(QStringLiteral("锟斤拷锟斤拷失锟斤拷"));
    216     }
    217 
    218 }
    219 
    220 void MainWindow::on_horizontalSlider_valueChanged(int value)
    221 {
    222     ui->lineEdit->setText(QString::number(value));
    223 }
    224 
    225 void MainWindow::on_pushButton_4_clicked()
    226 {
    227     m_pTimer->start();
    228 }
    229 
    230 void MainWindow::on_Timer()
    231 {
    232 //    qDebug() << "-------------------------------";
    233     USHORT data[19];
    234     if(USBAD_ReadAll(data))
    235     {
    236         for (int i = 0;i < 19;i++)
    237         {
    238             m_data[i+1] = data[i];//4096.0*3.3;
    239             QString str;
    240             str = QString::number(m_data[i+1], 'f', 4);
    241             m_data[i+1] = str.toDouble();
    242         }
    243         ui->lineEdit_0->setText(QString::number(m_data[1], 'f', 4));
    244         ui->lineEdit_1->setText(QString::number(m_data[2], 'f', 4));
    245         ui->lineEdit_2->setText(QString::number(m_data[3], 'f', 4));
    246         ui->lineEdit_3->setText(QString::number(m_data[4], 'f', 4));
    247         ui->lineEdit_4->setText(QString::number(m_data[5], 'f', 4));
    248         ui->lineEdit_5->setText(QString::number(m_data[6], 'f', 4));
    249         ui->lineEdit_6->setText(QString::number(m_data[7], 'f', 4));
    250         ui->lineEdit_7->setText(QString::number(m_data[8], 'f', 4));
    251         ui->lineEdit_8->setText(QString::number(m_data[9], 'f', 4));
    252         ui->lineEdit_9->setText(QString::number(m_data[10], 'f', 4));
    253         ui->lineEdit_10->setText(QString::number(m_data[11], 'f', 4));
    254         ui->lineEdit_11->setText(QString::number(m_data[12], 'f', 4));
    255         ui->lineEdit_12->setText(QString::number(m_data[13], 'f', 4));
    256         ui->lineEdit_13->setText(QString::number(m_data[14], 'f', 4));
    257         ui->lineEdit_14->setText(QString::number(m_data[15], 'f', 4));
    258         ui->lineEdit_15->setText(QString::number(m_data[16], 'f', 4));
    259         ui->lineEdit_16->setText(QString::number(m_data[17], 'f', 4));
    260         ui->lineEdit_17->setText(QString::number(m_data[18], 'f', 4));
    261         ui->lineEdit_18->setText(QString::number(m_data[19], 'f', 4));
    262 
    263         on_DrawLine();
    264     }
    265 }
    266 
    267 void MainWindow::on_pushButton_5_clicked()
    268 {
    269     m_pTimer->stop();
    270 }
    271 
    272 QtChartDemoZoom::QtChartDemoZoom(QChart *chart, QWidget *parent)
    273     : QChartView(chart, parent)
    274     , m_bMiddleButtonPressed(false)
    275     , m_oPrePos(0, 0)
    276 {
    277 
    278 }
    279 
    280 QtChartDemoZoom::~QtChartDemoZoom()
    281 {
    282 
    283 }
    284 
    285 void QtChartDemoZoom::wheelEvent(QWheelEvent *pEvent)
    286 {
    287     qreal rVal = std::pow(0.999, pEvent->delta()); // 设置比例
    288      // 1. 读取视图基本信息
    289      QRectF oPlotAreaRect = this->chart()->plotArea();
    290      QPointF oCenterPoint = oPlotAreaRect.center();
    291      // 2. 水平调整
    292      oPlotAreaRect.setWidth(oPlotAreaRect.width() * rVal);
    293      // 3. 竖直调整
    294      oPlotAreaRect.setHeight(oPlotAreaRect.height() * rVal);
    295      // 4.1 计算视点,视点不变,围绕中心缩放
    296      //QPointF oNewCenterPoint(oCenterPoint);
    297      // 4.2 计算视点,让鼠标点击的位置移动到窗口中心
    298      //QPointF oNewCenterPoint(pEvent->pos());
    299      // 4.3 计算视点,让鼠标点击的位置尽量保持不动(等比换算,存在一点误差)
    300      QPointF oNewCenterPoint(2 * oCenterPoint - pEvent->pos() - (oCenterPoint - pEvent->pos()) / rVal);
    301      // 5. 设置视点
    302      oPlotAreaRect.moveCenter(oNewCenterPoint);
    303      // 6. 提交缩放调整
    304      this->chart()->zoomIn(oPlotAreaRect);
    305      __super::wheelEvent(pEvent);
    306 }
    307 
    308 void QtChartDemoZoom::mouseMoveEvent(QMouseEvent *pEvent)
    309 {
    310     if (m_bMiddleButtonPressed)
    311      {
    312      QPoint oDeltaPos = pEvent->pos() - m_oPrePos;
    313      this->chart()->scroll(-oDeltaPos.x(), oDeltaPos.y());
    314      m_oPrePos = pEvent->pos();
    315      }
    316     __super::mouseMoveEvent(pEvent);
    317 }
    318 
    319 void QtChartDemoZoom::mousePressEvent(QMouseEvent *pEvent)
    320 {
    321     if (pEvent->button() == Qt::MiddleButton)
    322     {
    323     m_bMiddleButtonPressed = true;
    324     m_oPrePos = pEvent->pos();
    325     this->setCursor(Qt::OpenHandCursor);
    326     }
    327     __super::mousePressEvent(pEvent);
    328 }
    329 
    330 void QtChartDemoZoom::mouseReleaseEvent(QMouseEvent *pEvent)
    331 {
    332     if (pEvent->button() == Qt::MiddleButton)
    333     {
    334     m_bMiddleButtonPressed = false;
    335     this->setCursor(Qt::ArrowCursor);
    336     }
    337     __super::mouseReleaseEvent(pEvent);
    338 }
    339 
    340 void MainWindow::on_pushButton_3_clicked()
    341 {
    342     m_pAxisY->setMin(0);                                    //设置Y轴范围
    343     m_pAxisY->setMax(4095);
    344 }
    345 
    346 void MainWindow::on_pushButton_8_clicked()
    347 {
    348     m_pAxisY->setMin(ui->lineEdit_Y1->text().toInt());                                    //设置Y轴范围
    349     m_pAxisY->setMax(ui->lineEdit_Y2->text().toInt());
    350 }
    351 
    352 void MainWindow::on_pushButton_9_clicked()
    353 {
    354     QtCharts::QSplineSeries *oSeries = dynamic_cast<QtCharts::QSplineSeries*>(m_pChart->series().at(0));
    355     QVector<QPointF> Points = oSeries->pointsVector();
    356     qDebug() << "----------------------------------------------------";
    357     for (int i = 0; i < Points.size(); i++)
    358     {
    359         qDebug() << "x:" << QString::number(Points[i].x(), 'f', 0); // << Points[i].x();//QString::number(d, 'f', 0);
    360         qDebug() << "x:" << QDateTime::fromMSecsSinceEpoch(Points[i].x()).toString("yyyy-MM-dd hh:mm:ss.zzz");
    361         qDebug() << "y:" << Points[i].y();
    362     }
    363 }
    View Code

    mainwindows.ui

      1 <?xml version="1.0" encoding="UTF-8"?>
      2 <ui version="4.0">
      3  <class>MainWindow</class>
      4  <widget class="QMainWindow" name="MainWindow">
      5   <property name="geometry">
      6    <rect>
      7     <x>0</x>
      8     <y>0</y>
      9     <width>1037</width>
     10     <height>487</height>
     11    </rect>
     12   </property>
     13   <property name="windowTitle">
     14    <string>MainWindow</string>
     15   </property>
     16   <widget class="QWidget" name="centralwidget">
     17    <widget class="QPushButton" name="pushButton">
     18     <property name="geometry">
     19      <rect>
     20       <x>160</x>
     21       <y>10</y>
     22       <width>100</width>
     23       <height>30</height>
     24      </rect>
     25     </property>
     26     <property name="text">
     27      <string>打开</string>
     28     </property>
     29    </widget>
     30    <widget class="QPushButton" name="pushButton_2">
     31     <property name="geometry">
     32      <rect>
     33       <x>260</x>
     34       <y>10</y>
     35       <width>100</width>
     36       <height>30</height>
     37      </rect>
     38     </property>
     39     <property name="text">
     40      <string>关闭</string>
     41     </property>
     42    </widget>
     43    <widget class="QPushButton" name="pushButton_4">
     44     <property name="geometry">
     45      <rect>
     46       <x>630</x>
     47       <y>10</y>
     48       <width>100</width>
     49       <height>30</height>
     50      </rect>
     51     </property>
     52     <property name="text">
     53      <string>采集开始</string>
     54     </property>
     55    </widget>
     56    <widget class="QPushButton" name="pushButton_5">
     57     <property name="geometry">
     58      <rect>
     59       <x>730</x>
     60       <y>10</y>
     61       <width>100</width>
     62       <height>30</height>
     63      </rect>
     64     </property>
     65     <property name="text">
     66      <string>停止采集</string>
     67     </property>
     68    </widget>
     69    <widget class="QPushButton" name="pushButton_6">
     70     <property name="geometry">
     71      <rect>
     72       <x>30</x>
     73       <y>10</y>
     74       <width>100</width>
     75       <height>30</height>
     76      </rect>
     77     </property>
     78     <property name="text">
     79      <string>总数</string>
     80     </property>
     81    </widget>
     82    <widget class="QSlider" name="horizontalSlider">
     83     <property name="geometry">
     84      <rect>
     85       <x>400</x>
     86       <y>15</y>
     87       <width>61</width>
     88       <height>16</height>
     89      </rect>
     90     </property>
     91     <property name="minimum">
     92      <number>0</number>
     93     </property>
     94     <property name="maximum">
     95      <number>7</number>
     96     </property>
     97     <property name="orientation">
     98      <enum>Qt::Horizontal</enum>
     99     </property>
    100    </widget>
    101    <widget class="QPushButton" name="pushButton_7">
    102     <property name="geometry">
    103      <rect>
    104       <x>510</x>
    105       <y>10</y>
    106       <width>100</width>
    107       <height>30</height>
    108      </rect>
    109     </property>
    110     <property name="text">
    111      <string>设置采样率</string>
    112     </property>
    113    </widget>
    114    <widget class="QLineEdit" name="lineEdit">
    115     <property name="geometry">
    116      <rect>
    117       <x>470</x>
    118       <y>15</y>
    119       <width>31</width>
    120       <height>20</height>
    121      </rect>
    122     </property>
    123     <property name="text">
    124      <string>0</string>
    125     </property>
    126    </widget>
    127    <widget class="QCheckBox" name="checkBox_0">
    128     <property name="geometry">
    129      <rect>
    130       <x>30</x>
    131       <y>50</y>
    132       <width>120</width>
    133       <height>20</height>
    134      </rect>
    135     </property>
    136     <property name="font">
    137      <font>
    138       <family>微软雅黑</family>
    139       <pointsize>12</pointsize>
    140       <weight>50</weight>
    141       <bold>false</bold>
    142      </font>
    143     </property>
    144     <property name="text">
    145      <string>通道0(PA0)</string>
    146     </property>
    147    </widget>
    148    <widget class="QCheckBox" name="checkBox_1">
    149     <property name="geometry">
    150      <rect>
    151       <x>30</x>
    152       <y>80</y>
    153       <width>120</width>
    154       <height>20</height>
    155      </rect>
    156     </property>
    157     <property name="font">
    158      <font>
    159       <family>微软雅黑</family>
    160       <pointsize>12</pointsize>
    161       <weight>50</weight>
    162       <bold>false</bold>
    163      </font>
    164     </property>
    165     <property name="text">
    166      <string>通道1(PA1)</string>
    167     </property>
    168    </widget>
    169    <widget class="QCheckBox" name="checkBox_2">
    170     <property name="geometry">
    171      <rect>
    172       <x>30</x>
    173       <y>110</y>
    174       <width>120</width>
    175       <height>20</height>
    176      </rect>
    177     </property>
    178     <property name="font">
    179      <font>
    180       <family>微软雅黑</family>
    181       <pointsize>12</pointsize>
    182       <weight>50</weight>
    183       <bold>false</bold>
    184      </font>
    185     </property>
    186     <property name="text">
    187      <string>通道2(PA2)</string>
    188     </property>
    189    </widget>
    190    <widget class="QCheckBox" name="checkBox_3">
    191     <property name="geometry">
    192      <rect>
    193       <x>30</x>
    194       <y>140</y>
    195       <width>120</width>
    196       <height>20</height>
    197      </rect>
    198     </property>
    199     <property name="font">
    200      <font>
    201       <family>微软雅黑</family>
    202       <pointsize>12</pointsize>
    203       <weight>50</weight>
    204       <bold>false</bold>
    205      </font>
    206     </property>
    207     <property name="text">
    208      <string>通道3(PA3)</string>
    209     </property>
    210    </widget>
    211    <widget class="QCheckBox" name="checkBox_4">
    212     <property name="geometry">
    213      <rect>
    214       <x>30</x>
    215       <y>170</y>
    216       <width>120</width>
    217       <height>20</height>
    218      </rect>
    219     </property>
    220     <property name="font">
    221      <font>
    222       <family>微软雅黑</family>
    223       <pointsize>12</pointsize>
    224       <weight>50</weight>
    225       <bold>false</bold>
    226      </font>
    227     </property>
    228     <property name="text">
    229      <string>通道4(PA6)</string>
    230     </property>
    231    </widget>
    232    <widget class="QCheckBox" name="checkBox_5">
    233     <property name="geometry">
    234      <rect>
    235       <x>30</x>
    236       <y>200</y>
    237       <width>120</width>
    238       <height>20</height>
    239      </rect>
    240     </property>
    241     <property name="font">
    242      <font>
    243       <family>微软雅黑</family>
    244       <pointsize>12</pointsize>
    245       <weight>50</weight>
    246       <bold>false</bold>
    247      </font>
    248     </property>
    249     <property name="text">
    250      <string>通道5(PA7)</string>
    251     </property>
    252    </widget>
    253    <widget class="QCheckBox" name="checkBox_6">
    254     <property name="geometry">
    255      <rect>
    256       <x>230</x>
    257       <y>50</y>
    258       <width>120</width>
    259       <height>20</height>
    260      </rect>
    261     </property>
    262     <property name="font">
    263      <font>
    264       <family>微软雅黑</family>
    265       <pointsize>12</pointsize>
    266       <weight>50</weight>
    267       <bold>false</bold>
    268      </font>
    269     </property>
    270     <property name="text">
    271      <string>通道6(PB0)</string>
    272     </property>
    273    </widget>
    274    <widget class="QCheckBox" name="checkBox_7">
    275     <property name="geometry">
    276      <rect>
    277       <x>230</x>
    278       <y>80</y>
    279       <width>120</width>
    280       <height>20</height>
    281      </rect>
    282     </property>
    283     <property name="font">
    284      <font>
    285       <family>微软雅黑</family>
    286       <pointsize>12</pointsize>
    287       <weight>50</weight>
    288       <bold>false</bold>
    289      </font>
    290     </property>
    291     <property name="text">
    292      <string>通道7(PB1)</string>
    293     </property>
    294    </widget>
    295    <widget class="QCheckBox" name="checkBox_8">
    296     <property name="geometry">
    297      <rect>
    298       <x>430</x>
    299       <y>50</y>
    300       <width>120</width>
    301       <height>20</height>
    302      </rect>
    303     </property>
    304     <property name="font">
    305      <font>
    306       <family>微软雅黑</family>
    307       <pointsize>12</pointsize>
    308       <weight>50</weight>
    309       <bold>false</bold>
    310      </font>
    311     </property>
    312     <property name="text">
    313      <string>通道8(PC0)</string>
    314     </property>
    315    </widget>
    316    <widget class="QCheckBox" name="checkBox_9">
    317     <property name="geometry">
    318      <rect>
    319       <x>430</x>
    320       <y>80</y>
    321       <width>120</width>
    322       <height>20</height>
    323      </rect>
    324     </property>
    325     <property name="font">
    326      <font>
    327       <family>微软雅黑</family>
    328       <pointsize>12</pointsize>
    329       <weight>50</weight>
    330       <bold>false</bold>
    331      </font>
    332     </property>
    333     <property name="text">
    334      <string>通道9(PC1)</string>
    335     </property>
    336    </widget>
    337    <widget class="QCheckBox" name="checkBox_10">
    338     <property name="geometry">
    339      <rect>
    340       <x>430</x>
    341       <y>110</y>
    342       <width>120</width>
    343       <height>20</height>
    344      </rect>
    345     </property>
    346     <property name="font">
    347      <font>
    348       <family>微软雅黑</family>
    349       <pointsize>12</pointsize>
    350       <weight>50</weight>
    351       <bold>false</bold>
    352      </font>
    353     </property>
    354     <property name="text">
    355      <string>通道10(PC2)</string>
    356     </property>
    357    </widget>
    358    <widget class="QCheckBox" name="checkBox_11">
    359     <property name="geometry">
    360      <rect>
    361       <x>430</x>
    362       <y>140</y>
    363       <width>120</width>
    364       <height>20</height>
    365      </rect>
    366     </property>
    367     <property name="font">
    368      <font>
    369       <family>微软雅黑</family>
    370       <pointsize>12</pointsize>
    371       <weight>50</weight>
    372       <bold>false</bold>
    373      </font>
    374     </property>
    375     <property name="text">
    376      <string>通道11(PC3)</string>
    377     </property>
    378    </widget>
    379    <widget class="QCheckBox" name="checkBox_12">
    380     <property name="geometry">
    381      <rect>
    382       <x>430</x>
    383       <y>170</y>
    384       <width>120</width>
    385       <height>20</height>
    386      </rect>
    387     </property>
    388     <property name="font">
    389      <font>
    390       <family>微软雅黑</family>
    391       <pointsize>12</pointsize>
    392       <weight>50</weight>
    393       <bold>false</bold>
    394      </font>
    395     </property>
    396     <property name="text">
    397      <string>通道12(PC4)</string>
    398     </property>
    399    </widget>
    400    <widget class="QCheckBox" name="checkBox_13">
    401     <property name="geometry">
    402      <rect>
    403       <x>430</x>
    404       <y>200</y>
    405       <width>120</width>
    406       <height>20</height>
    407      </rect>
    408     </property>
    409     <property name="font">
    410      <font>
    411       <family>微软雅黑</family>
    412       <pointsize>12</pointsize>
    413       <weight>50</weight>
    414       <bold>false</bold>
    415      </font>
    416     </property>
    417     <property name="text">
    418      <string>通道13(PC5)</string>
    419     </property>
    420    </widget>
    421    <widget class="QCheckBox" name="checkBox_14">
    422     <property name="geometry">
    423      <rect>
    424       <x>630</x>
    425       <y>50</y>
    426       <width>120</width>
    427       <height>20</height>
    428      </rect>
    429     </property>
    430     <property name="font">
    431      <font>
    432       <family>微软雅黑</family>
    433       <pointsize>12</pointsize>
    434       <weight>50</weight>
    435       <bold>false</bold>
    436      </font>
    437     </property>
    438     <property name="text">
    439      <string>通道14(PF6)</string>
    440     </property>
    441    </widget>
    442    <widget class="QCheckBox" name="checkBox_15">
    443     <property name="geometry">
    444      <rect>
    445       <x>630</x>
    446       <y>80</y>
    447       <width>120</width>
    448       <height>20</height>
    449      </rect>
    450     </property>
    451     <property name="font">
    452      <font>
    453       <family>微软雅黑</family>
    454       <pointsize>12</pointsize>
    455       <weight>50</weight>
    456       <bold>false</bold>
    457      </font>
    458     </property>
    459     <property name="text">
    460      <string>通道15(PF7)</string>
    461     </property>
    462    </widget>
    463    <widget class="QCheckBox" name="checkBox_16">
    464     <property name="geometry">
    465      <rect>
    466       <x>630</x>
    467       <y>110</y>
    468       <width>120</width>
    469       <height>20</height>
    470      </rect>
    471     </property>
    472     <property name="font">
    473      <font>
    474       <family>微软雅黑</family>
    475       <pointsize>12</pointsize>
    476       <weight>50</weight>
    477       <bold>false</bold>
    478      </font>
    479     </property>
    480     <property name="text">
    481      <string>通道16(PF8)</string>
    482     </property>
    483    </widget>
    484    <widget class="QCheckBox" name="checkBox_17">
    485     <property name="geometry">
    486      <rect>
    487       <x>630</x>
    488       <y>140</y>
    489       <width>120</width>
    490       <height>20</height>
    491      </rect>
    492     </property>
    493     <property name="font">
    494      <font>
    495       <family>微软雅黑</family>
    496       <pointsize>12</pointsize>
    497       <weight>50</weight>
    498       <bold>false</bold>
    499      </font>
    500     </property>
    501     <property name="text">
    502      <string>通道17(PF9)</string>
    503     </property>
    504    </widget>
    505    <widget class="QCheckBox" name="checkBox_18">
    506     <property name="geometry">
    507      <rect>
    508       <x>630</x>
    509       <y>170</y>
    510       <width>120</width>
    511       <height>20</height>
    512      </rect>
    513     </property>
    514     <property name="font">
    515      <font>
    516       <family>微软雅黑</family>
    517       <pointsize>12</pointsize>
    518       <weight>50</weight>
    519       <bold>false</bold>
    520      </font>
    521     </property>
    522     <property name="text">
    523      <string>通道18(PF10)</string>
    524     </property>
    525    </widget>
    526    <widget class="QLineEdit" name="lineEdit_0">
    527     <property name="geometry">
    528      <rect>
    529       <x>140</x>
    530       <y>50</y>
    531       <width>60</width>
    532       <height>20</height>
    533      </rect>
    534     </property>
    535    </widget>
    536    <widget class="QLineEdit" name="lineEdit_1">
    537     <property name="geometry">
    538      <rect>
    539       <x>140</x>
    540       <y>80</y>
    541       <width>60</width>
    542       <height>20</height>
    543      </rect>
    544     </property>
    545    </widget>
    546    <widget class="QLineEdit" name="lineEdit_2">
    547     <property name="geometry">
    548      <rect>
    549       <x>140</x>
    550       <y>110</y>
    551       <width>60</width>
    552       <height>20</height>
    553      </rect>
    554     </property>
    555    </widget>
    556    <widget class="QLineEdit" name="lineEdit_3">
    557     <property name="geometry">
    558      <rect>
    559       <x>140</x>
    560       <y>140</y>
    561       <width>60</width>
    562       <height>20</height>
    563      </rect>
    564     </property>
    565    </widget>
    566    <widget class="QLineEdit" name="lineEdit_4">
    567     <property name="geometry">
    568      <rect>
    569       <x>140</x>
    570       <y>170</y>
    571       <width>60</width>
    572       <height>20</height>
    573      </rect>
    574     </property>
    575    </widget>
    576    <widget class="QLineEdit" name="lineEdit_5">
    577     <property name="geometry">
    578      <rect>
    579       <x>140</x>
    580       <y>200</y>
    581       <width>60</width>
    582       <height>20</height>
    583      </rect>
    584     </property>
    585    </widget>
    586    <widget class="QLineEdit" name="lineEdit_6">
    587     <property name="geometry">
    588      <rect>
    589       <x>340</x>
    590       <y>50</y>
    591       <width>60</width>
    592       <height>20</height>
    593      </rect>
    594     </property>
    595    </widget>
    596    <widget class="QLineEdit" name="lineEdit_7">
    597     <property name="geometry">
    598      <rect>
    599       <x>340</x>
    600       <y>80</y>
    601       <width>60</width>
    602       <height>20</height>
    603      </rect>
    604     </property>
    605    </widget>
    606    <widget class="QLineEdit" name="lineEdit_8">
    607     <property name="geometry">
    608      <rect>
    609       <x>540</x>
    610       <y>50</y>
    611       <width>60</width>
    612       <height>20</height>
    613      </rect>
    614     </property>
    615    </widget>
    616    <widget class="QLineEdit" name="lineEdit_9">
    617     <property name="geometry">
    618      <rect>
    619       <x>540</x>
    620       <y>80</y>
    621       <width>60</width>
    622       <height>20</height>
    623      </rect>
    624     </property>
    625    </widget>
    626    <widget class="QLineEdit" name="lineEdit_11">
    627     <property name="geometry">
    628      <rect>
    629       <x>540</x>
    630       <y>140</y>
    631       <width>60</width>
    632       <height>20</height>
    633      </rect>
    634     </property>
    635    </widget>
    636    <widget class="QLineEdit" name="lineEdit_10">
    637     <property name="geometry">
    638      <rect>
    639       <x>540</x>
    640       <y>110</y>
    641       <width>60</width>
    642       <height>20</height>
    643      </rect>
    644     </property>
    645    </widget>
    646    <widget class="QLineEdit" name="lineEdit_13">
    647     <property name="geometry">
    648      <rect>
    649       <x>540</x>
    650       <y>200</y>
    651       <width>60</width>
    652       <height>20</height>
    653      </rect>
    654     </property>
    655    </widget>
    656    <widget class="QLineEdit" name="lineEdit_12">
    657     <property name="geometry">
    658      <rect>
    659       <x>540</x>
    660       <y>170</y>
    661       <width>60</width>
    662       <height>20</height>
    663      </rect>
    664     </property>
    665    </widget>
    666    <widget class="QLineEdit" name="lineEdit_18">
    667     <property name="geometry">
    668      <rect>
    669       <x>750</x>
    670       <y>170</y>
    671       <width>60</width>
    672       <height>20</height>
    673      </rect>
    674     </property>
    675    </widget>
    676    <widget class="QLineEdit" name="lineEdit_15">
    677     <property name="geometry">
    678      <rect>
    679       <x>750</x>
    680       <y>80</y>
    681       <width>60</width>
    682       <height>20</height>
    683      </rect>
    684     </property>
    685    </widget>
    686    <widget class="QLineEdit" name="lineEdit_17">
    687     <property name="geometry">
    688      <rect>
    689       <x>750</x>
    690       <y>140</y>
    691       <width>60</width>
    692       <height>20</height>
    693      </rect>
    694     </property>
    695    </widget>
    696    <widget class="QLineEdit" name="lineEdit_16">
    697     <property name="geometry">
    698      <rect>
    699       <x>750</x>
    700       <y>110</y>
    701       <width>60</width>
    702       <height>20</height>
    703      </rect>
    704     </property>
    705    </widget>
    706    <widget class="QLineEdit" name="lineEdit_14">
    707     <property name="geometry">
    708      <rect>
    709       <x>750</x>
    710       <y>50</y>
    711       <width>60</width>
    712       <height>20</height>
    713      </rect>
    714     </property>
    715    </widget>
    716    <widget class="QPushButton" name="pushButton_3">
    717     <property name="geometry">
    718      <rect>
    719       <x>30</x>
    720       <y>228</y>
    721       <width>75</width>
    722       <height>23</height>
    723      </rect>
    724     </property>
    725     <property name="text">
    726      <string>复位</string>
    727     </property>
    728    </widget>
    729    <widget class="QLineEdit" name="lineEdit_Y1">
    730     <property name="geometry">
    731      <rect>
    732       <x>140</x>
    733       <y>230</y>
    734       <width>80</width>
    735       <height>20</height>
    736      </rect>
    737     </property>
    738     <property name="text">
    739      <string>0</string>
    740     </property>
    741    </widget>
    742    <widget class="QLineEdit" name="lineEdit_Y2">
    743     <property name="geometry">
    744      <rect>
    745       <x>240</x>
    746       <y>230</y>
    747       <width>80</width>
    748       <height>20</height>
    749      </rect>
    750     </property>
    751     <property name="text">
    752      <string>0</string>
    753     </property>
    754    </widget>
    755    <widget class="QPushButton" name="pushButton_8">
    756     <property name="geometry">
    757      <rect>
    758       <x>320</x>
    759       <y>228</y>
    760       <width>75</width>
    761       <height>23</height>
    762      </rect>
    763     </property>
    764     <property name="text">
    765      <string>设置Y轴区间</string>
    766     </property>
    767    </widget>
    768    <widget class="QLabel" name="label">
    769     <property name="geometry">
    770      <rect>
    771       <x>222</x>
    772       <y>230</y>
    773       <width>54</width>
    774       <height>12</height>
    775      </rect>
    776     </property>
    777     <property name="font">
    778      <font>
    779       <family>微软雅黑</family>
    780       <pointsize>16</pointsize>
    781      </font>
    782     </property>
    783     <property name="text">
    784      <string>~</string>
    785     </property>
    786    </widget>
    787    <widget class="QListView" name="listView_showmaxmin">
    788     <property name="geometry">
    789      <rect>
    790       <x>840</x>
    791       <y>50</y>
    792       <width>181</width>
    793       <height>201</height>
    794      </rect>
    795     </property>
    796    </widget>
    797    <widget class="QPushButton" name="pushButton_9">
    798     <property name="geometry">
    799      <rect>
    800       <x>430</x>
    801       <y>230</y>
    802       <width>75</width>
    803       <height>23</height>
    804      </rect>
    805     </property>
    806     <property name="text">
    807      <string>PushButton</string>
    808     </property>
    809    </widget>
    810    <zorder>label</zorder>
    811    <zorder>pushButton</zorder>
    812    <zorder>pushButton_2</zorder>
    813    <zorder>pushButton_4</zorder>
    814    <zorder>pushButton_5</zorder>
    815    <zorder>pushButton_6</zorder>
    816    <zorder>horizontalSlider</zorder>
    817    <zorder>pushButton_7</zorder>
    818    <zorder>lineEdit</zorder>
    819    <zorder>checkBox_0</zorder>
    820    <zorder>checkBox_1</zorder>
    821    <zorder>checkBox_2</zorder>
    822    <zorder>checkBox_3</zorder>
    823    <zorder>checkBox_4</zorder>
    824    <zorder>checkBox_5</zorder>
    825    <zorder>checkBox_6</zorder>
    826    <zorder>checkBox_7</zorder>
    827    <zorder>checkBox_8</zorder>
    828    <zorder>checkBox_9</zorder>
    829    <zorder>checkBox_10</zorder>
    830    <zorder>checkBox_11</zorder>
    831    <zorder>checkBox_12</zorder>
    832    <zorder>checkBox_13</zorder>
    833    <zorder>checkBox_14</zorder>
    834    <zorder>checkBox_15</zorder>
    835    <zorder>checkBox_16</zorder>
    836    <zorder>checkBox_17</zorder>
    837    <zorder>checkBox_18</zorder>
    838    <zorder>lineEdit_0</zorder>
    839    <zorder>lineEdit_1</zorder>
    840    <zorder>lineEdit_2</zorder>
    841    <zorder>lineEdit_3</zorder>
    842    <zorder>lineEdit_4</zorder>
    843    <zorder>lineEdit_5</zorder>
    844    <zorder>lineEdit_6</zorder>
    845    <zorder>lineEdit_7</zorder>
    846    <zorder>lineEdit_8</zorder>
    847    <zorder>lineEdit_9</zorder>
    848    <zorder>lineEdit_11</zorder>
    849    <zorder>lineEdit_10</zorder>
    850    <zorder>lineEdit_13</zorder>
    851    <zorder>lineEdit_12</zorder>
    852    <zorder>lineEdit_18</zorder>
    853    <zorder>lineEdit_15</zorder>
    854    <zorder>lineEdit_17</zorder>
    855    <zorder>lineEdit_16</zorder>
    856    <zorder>lineEdit_14</zorder>
    857    <zorder>pushButton_3</zorder>
    858    <zorder>lineEdit_Y1</zorder>
    859    <zorder>lineEdit_Y2</zorder>
    860    <zorder>pushButton_8</zorder>
    861    <zorder>listView_showmaxmin</zorder>
    862    <zorder>pushButton_9</zorder>
    863   </widget>
    864   <widget class="QMenuBar" name="menubar">
    865    <property name="geometry">
    866     <rect>
    867      <x>0</x>
    868      <y>0</y>
    869      <width>1037</width>
    870      <height>23</height>
    871     </rect>
    872    </property>
    873   </widget>
    874   <widget class="QStatusBar" name="statusbar"/>
    875  </widget>
    876  <resources/>
    877  <connections/>
    878 </ui>
    View Code
    作者:疯狂Delphi
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.

    欢迎关注我,一起进步!扫描下方二维码即可加我

  • 相关阅读:
    JavaScript对iframe的DOM操作
    如何处理JSON中的特殊字符
    JavaScript引擎是单线程的
    JSONP跨域的原理解析
    四道JavaScript面试题检测你的js基本功
    让IE6也支持position:fixed
    Keras Layer 的 call(x) 和 input_shape
    C++文件读写 fwrite 和 fread
    Windows Ubuntu 子系统修改默认登陆用户·
    Python新建文件夹(如果不存在)
  • 原文地址:https://www.cnblogs.com/FKdelphi/p/14482360.html
Copyright © 2011-2022 走看看