用QT写UART串口曲线变化

做项目经常会调试一下有变化规律的器件,如果只是打印出来显得观察变化规律不明显,所以自己用QT写了个串口数据变化曲线。

 

效果图:(点击查看,将就)

使用方法:

串口数据格式 (ASCII): 序号+空格+数据+空格。。。(后面数据不讲究)

                            如数据:642  22.4600  \r\n

序号为1的时候会重画另一条颜色不同的曲线。

 

缺点:不支持界面缩放(一开始没布局,差不多完成的时候才发现,屏幕分辩率1920*1080)

 

 

源码下载地址:https://download.csdn.net/download/sudaroot/11149854

源码:(因为程序用了一个第三方的qcustomplot库,下面我就不复制上来了,太大了,网上下载添加编译即可)

main.cpp

#include "mainwindow.h"
#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;

    w.setWindowTitle("Serial Port Curve Debugging");
    w.show();

    return a.exec();
}

mainwindow.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include <QMessageBox>


static const char blankString[] = QT_TRANSLATE_NOOP("SettingsDialog", "N/A");


MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    serial(new QSerialPort)
{
    ui->setupUi(this);

    curveZoom_flag = 1;

    fillPortsParameters();
    fillPortsInfo();
    SerialSetinfo();

    connect(ui->refreshButton, &QPushButton::clicked, this, &MainWindow::fillPortsInfo);    //按键刷新串口
    connect(ui->serialCtrlButton, &QPushButton::clicked, this, &MainWindow::switchSerialPort);  //串口开关
    connect(serial, &QSerialPort::readyRead, this, &MainWindow::readData);
    connect(serial, &QSerialPort::errorOccurred, this, &MainWindow::handleError);
    connect(ui->clearDataButton, &QPushButton::clicked, this, &MainWindow::clearData);
    connect(ui->sendDataButton, &QPushButton::clicked, this, &MainWindow::writeData);
    connect(ui->curveZoomButton, &QPushButton::clicked, this, &MainWindow::curveZoom);
    connect(ui->curveClearButton, &QPushButton::clicked, this, &MainWindow::curveClear);
    connect(ui->allClearButton, &QPushButton::clicked, this, &MainWindow::allClear);

    ui->curveShowWidget->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom|
                                         QCP :: iSelectPlottables|QCP::iSelectItems|
                                         QCP :: iSelectAxes| QCP::iSelectLegend);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::fillPortsParameters()
{
    ui->baudRateBox->addItem(QStringLiteral("9600"), QSerialPort::Baud9600);
    ui->baudRateBox->addItem(QStringLiteral("19200"), QSerialPort::Baud19200);
    ui->baudRateBox->addItem(QStringLiteral("38400"), QSerialPort::Baud38400);
    ui->baudRateBox->addItem(QStringLiteral("115200"), QSerialPort::Baud115200);
    ui->baudRateBox->addItem(tr("Custom"));

    ui->dataBitsBox->addItem(QStringLiteral("5"), QSerialPort::Data5);
    ui->dataBitsBox->addItem(QStringLiteral("6"), QSerialPort::Data6);
    ui->dataBitsBox->addItem(QStringLiteral("7"), QSerialPort::Data7);
    ui->dataBitsBox->addItem(QStringLiteral("8"), QSerialPort::Data8);
    ui->dataBitsBox->setCurrentIndex(3);

    ui->parityBox->addItem(tr("None"), QSerialPort::NoParity);
    ui->parityBox->addItem(tr("Even"), QSerialPort::EvenParity);
    ui->parityBox->addItem(tr("Odd"), QSerialPort::OddParity);
    ui->parityBox->addItem(tr("Mark"), QSerialPort::MarkParity);
    ui->parityBox->addItem(tr("Space"), QSerialPort::SpaceParity);

    ui->stopBitsBox->addItem(QStringLiteral("1"), QSerialPort::OneStop);
    ui->stopBitsBox->addItem(QStringLiteral("2"), QSerialPort::TwoStop);

    ui->flowControlBox->addItem(tr("None"), QSerialPort::NoFlowControl);
    ui->flowControlBox->addItem(tr("RTS/CTS"), QSerialPort::HardwareControl);
    ui->flowControlBox->addItem(tr("XON/XOFF"), QSerialPort::SoftwareControl);
}

void MainWindow::fillPortsInfo()
{
    QString description, manufacturer, serialNumber;

    ui->serialPortInfoListBox->clear();
    const auto infos = QSerialPortInfo::availablePorts();
    for(const QSerialPortInfo &info : infos)
    {
        QStringList list;
        description = info.description();
        manufacturer = info.manufacturer();
        serialNumber = info.serialNumber();
        list << info.portName()
             << (!description.isEmpty() ? description : blankString)
             << (!manufacturer.isEmpty() ? manufacturer : blankString)
             << (!serialNumber.isEmpty() ? serialNumber : blankString)
             << info.systemLocation()
             << (info.vendorIdentifier() ? QString::number(info.vendorIdentifier(), 16) : blankString)
             <<(info.productIdentifier() ? QString::number(info.productIdentifier(), 16) : blankString);

        ui->serialPortInfoListBox->addItem(list.first(), list.size());
    }
    ui->serialPortInfoListBox->addItem(tr("Custom"));
}

void MainWindow::SerialSetinfo()
{
    //串口名
    currentSerialSetings.name = ui->serialPortInfoListBox->currentText();

    //波特率
    if(ui->baudRateBox->currentIndex() == 4){
        currentSerialSetings.baudRate = ui->baudRateBox->currentText().toInt();
    }
    else{
        currentSerialSetings.baudRate = static_cast<QSerialPort::BaudRate>(ui->baudRateBox->itemData(ui->baudRateBox->currentIndex()).toInt());
    }
    currentSerialSetings.stringBaudRate = QString::number(currentSerialSetings.baudRate);

    //数据位
    currentSerialSetings.dataBits = static_cast<QSerialPort::DataBits>(ui->dataBitsBox->itemData(ui->dataBitsBox->currentIndex()).toInt());
    currentSerialSetings.stringDataBits = ui->dataBitsBox->currentText();

    //校验位
    currentSerialSetings.parity = static_cast<QSerialPort::Parity>(ui->parityBox->itemData(ui->parityBox->currentIndex()).toInt());
    currentSerialSetings.stringParity = ui->parityBox->currentText();

    //停止位
    currentSerialSetings.stopBits = static_cast<QSerialPort::StopBits>(ui->stopBitsBox->itemData(ui->stopBitsBox->currentIndex()).toInt());
    currentSerialSetings.stringStopBits = ui->stopBitsBox->currentText();

    //流控
    currentSerialSetings.flowControl = static_cast<QSerialPort::FlowControl>(ui->flowControlBox->itemData(ui->flowControlBox->currentIndex()).toInt());
    currentSerialSetings.stringFlowControl = ui->flowControlBox->currentText();
}

void MainWindow::openSerialPort()
{
    serial->setPortName(currentSerialSetings.name);
    serial->setBaudRate(currentSerialSetings.baudRate);
    serial->setDataBits(currentSerialSetings.dataBits);
    serial->setStopBits(currentSerialSetings.stopBits);
    serial->setParity(currentSerialSetings.parity);
    serial->setFlowControl(currentSerialSetings.flowControl);

    if(serial->open(QIODevice::ReadWrite)){
        qDebug() << "OK";
        ui->refreshButton->setEnabled(false);
        ui->serialPortInfoListBox->setEnabled(false);
        ui->baudRateBox->setEnabled(false);
        ui->dataBitsBox->setEnabled(false);
        ui->parityBox->setEnabled(false);
        ui->stopBitsBox->setEnabled(false);
        ui->flowControlBox->setEnabled(false);
        ui->serialCtrlButton->setText("关闭串口");
    }
    else {
        qDebug() << "ERROR";
        QMessageBox::critical(this, tr("Error"), serial->errorString());
    }
}

void MainWindow::closeSerialPort()
{
    if (serial->isOpen())
        serial->close();
    ui->refreshButton->setEnabled(true);
    ui->serialPortInfoListBox->setEnabled(true);
    ui->baudRateBox->setEnabled(true);
    ui->dataBitsBox->setEnabled(true);
    ui->parityBox->setEnabled(true);
    ui->stopBitsBox->setEnabled(true);
    ui->flowControlBox->setEnabled(true);
    ui->serialCtrlButton->setText("打开串口");
}

void MainWindow::switchSerialPort()
{
    SerialSetinfo();
    if(serial_flag == 0){
        serial_flag = 1;
        openSerialPort();
    }
    else {
        serial_flag = 0;
        closeSerialPort();
    }
}

void MainWindow::readData()
{
    static int graph_count = 0;
    static unsigned long count = 0;
    QColor test[12] = {
        Qt:: black, Qt:: red, Qt:: green, Qt:: blue, Qt:: cyan,
        Qt:: magenta, Qt:: darkRed, Qt:: darkGreen,
        Qt:: darkBlue, Qt:: darkCyan, Qt:: darkMagenta, Qt:: darkYellow
    };

    QByteArray temp = serial->readAll();

    if(temp.isEmpty() != true){
#if 1
        QString str = ui->receiveDataText->toPlainText();  //添加文本
        str+=tr(temp);
        ui->receiveDataText->clear();
        ui->receiveDataText->append(str);
#else
        ui->receiveDataText->append(temp);  //添加文本
#endif
        QByteArrayList list = temp.split(' '); //分割字符串

        if(list.count() < 2)                //数据缺失,丢包
            return;

        unsigned int num = list[0].toUInt();
        double  r_data = list[1].toDouble();

        graph_count = ui->curveShowWidget->graphCount();
        if(num == 1 || graph_count == 0 )
        {
            ui->curveShowWidget->addGraph();
            graph_count = ui->curveShowWidget->graphCount();
            qDebug() << graph_count;
            ui->curveShowWidget->graph(graph_count - 1)->setPen(QPen(test[graph_count % 12 - 1]));
            count = 0;
        }

        ui->curveShowWidget->graph(graph_count - 1)->addData(count++, r_data);
        if(curveZoom_flag == 1){
            ui->curveShowWidget->graph(graph_count - 1)->rescaleKeyAxis(true);
            ui->curveShowWidget->graph(graph_count - 1)->rescaleValueAxis(true);
            ui->curveShowWidget->graph(graph_count - 1)->rescaleAxes(true);
        }
        ui->curveShowWidget->replot();
    }
}

void MainWindow::clearData()
{
    ui->receiveDataText->clear();
}

void MainWindow::writeData()
{
    if(ui->sendDataText->toPlainText().isEmpty() != true){
        serial->write(ui->sendDataText->toPlainText().toLatin1());
    }
}


void MainWindow::curveZoom()
{
    if(curveZoom_flag == 0){
        ui->curveZoomButton->setText("关闭缩放");
        curveZoom_flag = 1;
    }
    else {
        ui->curveZoomButton->setText("自动缩放");
        curveZoom_flag = 0;
    }
}

void MainWindow::curveClear()
{
    int i = 0;
    int graph_count = ui->curveShowWidget->graphCount();

    for(i = 0; i < graph_count; i++)
    {
        ui->curveShowWidget->removeGraph(i);
    }
}

void MainWindow::allClear()
{
    curveClear();
    clearData();
}


void MainWindow::handleError(QSerialPort::SerialPortError error)
{
    if (error == QSerialPort::ResourceError) {
        closeSerialPort();
    }
}

 mainwindow.ui

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>1920</width>
    <height>1000</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <widget class="QWidget" name="centralWidgets">
   <widget class="QLabel" name="Author">
    <property name="geometry">
     <rect>
      <x>0</x>
      <y>970</y>
      <width>101</width>
      <height>20</height>
     </rect>
    </property>
    <property name="text">
     <string>Author:sudaroot</string>
    </property>
   </widget>
   <widget class="QCustomPlot" name="curveShowWidget" native="true">
    <property name="geometry">
     <rect>
      <x>159</x>
      <y>39</y>
      <width>1461</width>
      <height>921</height>
     </rect>
    </property>
   </widget>
   <widget class="QWidget" name="layoutWidget1">
    <property name="geometry">
     <rect>
      <x>20</x>
      <y>40</y>
      <width>124</width>
      <height>921</height>
     </rect>
    </property>
    <layout class="QVBoxLayout" name="verticalLayout">
     <item>
      <widget class="QLabel" name="serialSetLable">
       <property name="font">
        <font>
         <family>宋体</family>
         <pointsize>14</pointsize>
        </font>
       </property>
       <property name="text">
        <string>串口设置:</string>
       </property>
       <property name="alignment">
        <set>Qt::AlignCenter</set>
       </property>
      </widget>
     </item>
     <item>
      <spacer name="verticalSpacer_14">
       <property name="orientation">
        <enum>Qt::Vertical</enum>
       </property>
       <property name="sizeHint" stdset="0">
        <size>
         <width>122</width>
         <height>13</height>
        </size>
       </property>
      </spacer>
     </item>
     <item>
      <widget class="QSplitter" name="splitter">
       <property name="orientation">
        <enum>Qt::Horizontal</enum>
       </property>
       <widget class="QLabel" name="serialPortInfoListLabel">
        <property name="font">
         <font>
          <family>宋体</family>
          <pointsize>12</pointsize>
         </font>
        </property>
        <property name="text">
         <string>端  口</string>
        </property>
       </widget>
       <widget class="QComboBox" name="serialPortInfoListBox">
        <property name="toolTipDuration">
         <number>-1</number>
        </property>
        <property name="currentIndex">
         <number>-1</number>
        </property>
       </widget>
      </widget>
     </item>
     <item>
      <spacer name="verticalSpacer">
       <property name="orientation">
        <enum>Qt::Vertical</enum>
       </property>
       <property name="sizeHint" stdset="0">
        <size>
         <width>17</width>
         <height>13</height>
        </size>
       </property>
      </spacer>
     </item>
     <item>
      <widget class="QSplitter" name="splitter_2">
       <property name="orientation">
        <enum>Qt::Horizontal</enum>
       </property>
       <widget class="QLabel" name="baudRateLabel">
        <property name="font">
         <font>
          <family>宋体</family>
          <pointsize>12</pointsize>
         </font>
        </property>
        <property name="text">
         <string>波特率</string>
        </property>
       </widget>
       <widget class="QComboBox" name="baudRateBox"/>
      </widget>
     </item>
     <item>
      <spacer name="verticalSpacer_2">
       <property name="orientation">
        <enum>Qt::Vertical</enum>
       </property>
       <property name="sizeHint" stdset="0">
        <size>
         <width>122</width>
         <height>13</height>
        </size>
       </property>
      </spacer>
     </item>
     <item>
      <widget class="QSplitter" name="splitter_3">
       <property name="orientation">
        <enum>Qt::Horizontal</enum>
       </property>
       <widget class="QLabel" name="dataBitsLabel">
        <property name="font">
         <font>
          <family>宋体</family>
          <pointsize>12</pointsize>
         </font>
        </property>
        <property name="text">
         <string>数据位</string>
        </property>
       </widget>
       <widget class="QComboBox" name="dataBitsBox"/>
      </widget>
     </item>
     <item>
      <spacer name="verticalSpacer_3">
       <property name="orientation">
        <enum>Qt::Vertical</enum>
       </property>
       <property name="sizeHint" stdset="0">
        <size>
         <width>17</width>
         <height>13</height>
        </size>
       </property>
      </spacer>
     </item>
     <item>
      <widget class="QSplitter" name="splitter_4">
       <property name="orientation">
        <enum>Qt::Horizontal</enum>
       </property>
       <widget class="QLabel" name="parityLabel">
        <property name="font">
         <font>
          <family>宋体</family>
          <pointsize>12</pointsize>
         </font>
        </property>
        <property name="text">
         <string>校验位</string>
        </property>
       </widget>
       <widget class="QComboBox" name="parityBox"/>
      </widget>
     </item>
     <item>
      <spacer name="verticalSpacer_4">
       <property name="orientation">
        <enum>Qt::Vertical</enum>
       </property>
       <property name="sizeHint" stdset="0">
        <size>
         <width>122</width>
         <height>13</height>
        </size>
       </property>
      </spacer>
     </item>
     <item>
      <widget class="QSplitter" name="splitter_5">
       <property name="orientation">
        <enum>Qt::Horizontal</enum>
       </property>
       <widget class="QLabel" name="stopBitsLabel">
        <property name="font">
         <font>
          <family>宋体</family>
          <pointsize>12</pointsize>
         </font>
        </property>
        <property name="text">
         <string>停止位</string>
        </property>
       </widget>
       <widget class="QComboBox" name="stopBitsBox"/>
      </widget>
     </item>
     <item>
      <spacer name="verticalSpacer_13">
       <property name="orientation">
        <enum>Qt::Vertical</enum>
       </property>
       <property name="sizeHint" stdset="0">
        <size>
         <width>122</width>
         <height>13</height>
        </size>
       </property>
      </spacer>
     </item>
     <item>
      <widget class="QSplitter" name="splitter_6">
       <property name="orientation">
        <enum>Qt::Horizontal</enum>
       </property>
       <widget class="QLabel" name="flowControlLabel">
        <property name="font">
         <font>
          <family>宋体</family>
          <pointsize>12</pointsize>
         </font>
        </property>
        <property name="text">
         <string>流  控</string>
        </property>
       </widget>
       <widget class="QComboBox" name="flowControlBox"/>
      </widget>
     </item>
     <item>
      <spacer name="verticalSpacer_9">
       <property name="orientation">
        <enum>Qt::Vertical</enum>
       </property>
       <property name="sizeHint" stdset="0">
        <size>
         <width>105</width>
         <height>50</height>
        </size>
       </property>
      </spacer>
     </item>
     <item>
      <widget class="QPushButton" name="refreshButton">
       <property name="font">
        <font>
         <family>宋体</family>
         <pointsize>12</pointsize>
        </font>
       </property>
       <property name="text">
        <string>刷新</string>
       </property>
      </widget>
     </item>
     <item>
      <spacer name="verticalSpacer_6">
       <property name="orientation">
        <enum>Qt::Vertical</enum>
       </property>
       <property name="sizeHint" stdset="0">
        <size>
         <width>122</width>
         <height>30</height>
        </size>
       </property>
      </spacer>
     </item>
     <item>
      <widget class="QPushButton" name="serialCtrlButton">
       <property name="font">
        <font>
         <family>宋体</family>
         <pointsize>12</pointsize>
        </font>
       </property>
       <property name="text">
        <string>打开串口</string>
       </property>
      </widget>
     </item>
     <item>
      <spacer name="verticalSpacer_10">
       <property name="orientation">
        <enum>Qt::Vertical</enum>
       </property>
       <property name="sizeHint" stdset="0">
        <size>
         <width>122</width>
         <height>80</height>
        </size>
       </property>
      </spacer>
     </item>
     <item>
      <widget class="QLabel" name="curveSetLable">
       <property name="font">
        <font>
         <family>宋体</family>
         <pointsize>12</pointsize>
        </font>
       </property>
       <property name="text">
        <string>曲线设置:</string>
       </property>
       <property name="alignment">
        <set>Qt::AlignCenter</set>
       </property>
      </widget>
     </item>
     <item>
      <spacer name="verticalSpacer_12">
       <property name="orientation">
        <enum>Qt::Vertical</enum>
       </property>
       <property name="sizeHint" stdset="0">
        <size>
         <width>115</width>
         <height>13</height>
        </size>
       </property>
      </spacer>
     </item>
     <item>
      <widget class="QPushButton" name="curveZoomButton">
       <property name="font">
        <font>
         <family>宋体</family>
         <pointsize>12</pointsize>
        </font>
       </property>
       <property name="text">
        <string>关闭缩放</string>
       </property>
      </widget>
     </item>
     <item>
      <spacer name="verticalSpacer_11">
       <property name="orientation">
        <enum>Qt::Vertical</enum>
       </property>
       <property name="sizeHint" stdset="0">
        <size>
         <width>122</width>
         <height>13</height>
        </size>
       </property>
      </spacer>
     </item>
     <item>
      <widget class="QPushButton" name="curveClearButton">
       <property name="font">
        <font>
         <family>宋体</family>
         <pointsize>12</pointsize>
        </font>
       </property>
       <property name="text">
        <string>清除曲线</string>
       </property>
      </widget>
     </item>
     <item>
      <spacer name="verticalSpacer_5">
       <property name="orientation">
        <enum>Qt::Vertical</enum>
       </property>
       <property name="sizeHint" stdset="0">
        <size>
         <width>20</width>
         <height>100</height>
        </size>
       </property>
      </spacer>
     </item>
     <item>
      <widget class="QPushButton" name="allClearButton">
       <property name="font">
        <font>
         <family>宋体</family>
         <pointsize>12</pointsize>
        </font>
       </property>
       <property name="text">
        <string>全部清除</string>
       </property>
      </widget>
     </item>
     <item>
      <spacer name="verticalSpacer_15">
       <property name="orientation">
        <enum>Qt::Vertical</enum>
       </property>
       <property name="sizeHint" stdset="0">
        <size>
         <width>122</width>
         <height>13</height>
        </size>
       </property>
      </spacer>
     </item>
    </layout>
   </widget>
   <widget class="QLabel" name="curveShowLable">
    <property name="geometry">
     <rect>
      <x>830</x>
      <y>12</y>
      <width>111</width>
      <height>24</height>
     </rect>
    </property>
    <property name="font">
     <font>
      <family>宋体</family>
      <pointsize>18</pointsize>
     </font>
    </property>
    <property name="text">
     <string>曲线显示</string>
    </property>
    <property name="alignment">
     <set>Qt::AlignCenter</set>
    </property>
   </widget>
   <widget class="QWidget" name="layoutWidget2">
    <property name="geometry">
     <rect>
      <x>1630</x>
      <y>32</y>
      <width>263</width>
      <height>610</height>
     </rect>
    </property>
    <layout class="QVBoxLayout" name="verticalLayout_2">
     <item>
      <layout class="QHBoxLayout" name="horizontalLayout">
       <item>
        <spacer name="horizontalSpacer">
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
         </property>
         <property name="sizeHint" stdset="0">
          <size>
           <width>78</width>
           <height>20</height>
          </size>
         </property>
        </spacer>
       </item>
       <item>
        <widget class="QLabel" name="receiveDataLable">
         <property name="font">
          <font>
           <family>宋体</family>
           <pointsize>14</pointsize>
          </font>
         </property>
         <property name="text">
          <string>接收数据</string>
         </property>
         <property name="alignment">
          <set>Qt::AlignCenter</set>
         </property>
        </widget>
       </item>
       <item>
        <spacer name="horizontalSpacer_2">
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
         </property>
         <property name="sizeHint" stdset="0">
          <size>
           <width>88</width>
           <height>20</height>
          </size>
         </property>
        </spacer>
       </item>
      </layout>
     </item>
     <item>
      <widget class="QTextBrowser" name="receiveDataText">
       <property name="enabled">
        <bool>true</bool>
       </property>
       <property name="minimumSize">
        <size>
         <width>261</width>
         <height>531</height>
        </size>
       </property>
      </widget>
     </item>
     <item>
      <layout class="QHBoxLayout" name="horizontalLayout_2">
       <item>
        <spacer name="horizontalSpacer_4">
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
         </property>
         <property name="sizeHint" stdset="0">
          <size>
           <width>40</width>
           <height>38</height>
          </size>
         </property>
        </spacer>
       </item>
       <item>
        <widget class="QPushButton" name="clearDataButton">
         <property name="minimumSize">
          <size>
           <width>101</width>
           <height>41</height>
          </size>
         </property>
         <property name="text">
          <string>清空</string>
         </property>
        </widget>
       </item>
       <item>
        <spacer name="horizontalSpacer_3">
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
         </property>
         <property name="sizeHint" stdset="0">
          <size>
           <width>30</width>
           <height>35</height>
          </size>
         </property>
        </spacer>
       </item>
      </layout>
     </item>
    </layout>
   </widget>
   <widget class="QWidget" name="layoutWidget">
    <property name="geometry">
     <rect>
      <x>1633</x>
      <y>690</y>
      <width>263</width>
      <height>271</height>
     </rect>
    </property>
    <layout class="QVBoxLayout" name="verticalLayout_3">
     <item>
      <layout class="QHBoxLayout" name="horizontalLayout_3">
       <item>
        <spacer name="horizontalSpacer_5">
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
         </property>
         <property name="sizeHint" stdset="0">
          <size>
           <width>40</width>
           <height>20</height>
          </size>
         </property>
        </spacer>
       </item>
       <item>
        <widget class="QLabel" name="sendDataLable">
         <property name="minimumSize">
          <size>
           <width>76</width>
           <height>20</height>
          </size>
         </property>
         <property name="font">
          <font>
           <family>宋体</family>
           <pointsize>14</pointsize>
          </font>
         </property>
         <property name="text">
          <string>发送数据</string>
         </property>
         <property name="alignment">
          <set>Qt::AlignCenter</set>
         </property>
        </widget>
       </item>
       <item>
        <spacer name="horizontalSpacer_6">
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
         </property>
         <property name="sizeHint" stdset="0">
          <size>
           <width>40</width>
           <height>20</height>
          </size>
         </property>
        </spacer>
       </item>
      </layout>
     </item>
     <item>
      <widget class="QTextEdit" name="sendDataText">
       <property name="minimumSize">
        <size>
         <width>261</width>
         <height>191</height>
        </size>
       </property>
      </widget>
     </item>
     <item>
      <layout class="QHBoxLayout" name="horizontalLayout_4">
       <item>
        <spacer name="horizontalSpacer_7">
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
         </property>
         <property name="sizeHint" stdset="0">
          <size>
           <width>40</width>
           <height>20</height>
          </size>
         </property>
        </spacer>
       </item>
       <item>
        <widget class="QPushButton" name="sendDataButton">
         <property name="minimumSize">
          <size>
           <width>101</width>
           <height>41</height>
          </size>
         </property>
         <property name="text">
          <string>发送</string>
         </property>
        </widget>
       </item>
       <item>
        <spacer name="horizontalSpacer_8">
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
         </property>
         <property name="sizeHint" stdset="0">
          <size>
           <width>40</width>
           <height>20</height>
          </size>
         </property>
        </spacer>
       </item>
      </layout>
     </item>
    </layout>
   </widget>
  </widget>
  <widget class="QToolBar" name="mainToolBar">
   <attribute name="toolBarArea">
    <enum>TopToolBarArea</enum>
   </attribute>
   <attribute name="toolBarBreak">
    <bool>false</bool>
   </attribute>
  </widget>
 </widget>
 <layoutdefault spacing="6" margin="11"/>
 <customwidgets>
  <customwidget>
   <class>QCustomPlot</class>
   <extends>QWidget</extends>
   <header location="global">qcustomplot.h</header>
   <container>1</container>
  </customwidget>
 </customwidgets>
 <resources/>
 <connections/>
</ui>

全篇完。

本人博客仅仅代表我个人见解方便记录成长笔记。

若有与 看官老爷见解有冲突,我坚信看官老爷见解是对的,我的是错的。

感谢~!

  • 5
    点赞
  • 33
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值