⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainfrm.cpp

📁 linux下用QT 做的串口编程工具,在linux下做串口调试有一定的参考价值
💻 CPP
字号:
/****************************************************************************** Form implementation generated from reading ui file 'mainfrm.ui'**** Created: 一  8月 25 16:01:59 2008**      by: The User Interface Compiler ($Id: qt/main.cpp   3.1.1   edited Nov 21 17:40 $)**** WARNING! All changes made in this file will be lost!****************************************************************************/#include "mainfrm.h"#include <qvariant.h>#include <qcombobox.h>#include <qlabel.h>#include <qlineedit.h>#include <qpushbutton.h>#include <qtextedit.h>#include <qlayout.h>#include <qtooltip.h>#include <qwhatsthis.h>#include <qimage.h>#include <qpixmap.h>#include "../mainfrm.ui.h"/*  *  Constructs a mainFrm as a child of 'parent', with the  *  name 'name' and widget flags set to 'f'. * *  The dialog will by default be modeless, unless you set 'modal' to *  TRUE to construct a modal dialog. */mainFrm::mainFrm( QWidget* parent, const char* name, bool modal, WFlags fl )    : QDialog( parent, name, modal, fl ){    if ( !name )	setName( "mainFrm" );    textLabel5 = new QLabel( this, "textLabel5" );    textLabel5->setGeometry( QRect( 280, 170, 49, 21 ) );    comboBox5 = new QComboBox( FALSE, this, "comboBox5" );    comboBox5->setGeometry( QRect( 330, 170, 81, 21 ) );    textLabel4 = new QLabel( this, "textLabel4" );    textLabel4->setGeometry( QRect( 290, 130, 46, 21 ) );    textLabel3 = new QLabel( this, "textLabel3" );    textLabel3->setGeometry( QRect( 280, 90, 59, 21 ) );    textLabel2 = new QLabel( this, "textLabel2" );    textLabel2->setGeometry( QRect( 280, 50, 50, 21 ) );    textLabel1 = new QLabel( this, "textLabel1" );    textLabel1->setGeometry( QRect( 290, 10, 43, 21 ) );    comboBox4 = new QComboBox( FALSE, this, "comboBox4" );    comboBox4->setGeometry( QRect( 330, 130, 80, 21 ) );    comPort = new QComboBox( FALSE, this, "comPort" );    comPort->setGeometry( QRect( 331, 10, 80, 20 ) );    comBaud = new QComboBox( FALSE, this, "comBaud" );    comBaud->setGeometry( QRect( 330, 50, 81, 21 ) );    comData = new QComboBox( FALSE, this, "comData" );    comData->setGeometry( QRect( 330, 90, 81, 20 ) );    closeBtn = new QPushButton( this, "closeBtn" );    closeBtn->setEnabled( FALSE );    closeBtn->setGeometry( QRect( 360, 220, 51, 21 ) );    txt = new QLineEdit( this, "txt" );    txt->setGeometry( QRect( 65, 255, 351, 22 ) );    sendBtn = new QPushButton( this, "sendBtn" );    sendBtn->setGeometry( QRect( 10, 250, 50, 30 ) );    show_content = new QTextEdit( this, "show_content" );    show_content->setGeometry( QRect( 10, 0, 261, 241 ) );    openBtn = new QPushButton( this, "openBtn" );    openBtn->setGeometry( QRect( 280, 220, 61, 21 ) );    languageChange();    resize( QSize(432, 290).expandedTo(minimumSizeHint()) );    // signals and slots connections    connect( openBtn, SIGNAL( clicked() ), this, SLOT( OpenPort() ) );    connect( closeBtn, SIGNAL( clicked() ), this, SLOT( closeComm() ) );    connect( sendBtn, SIGNAL( clicked() ), this, SLOT( sendData() ) );}/* *  Destroys the object and frees any allocated resources */mainFrm::~mainFrm(){    // no need to delete child widgets, Qt does it all for us}/* *  Sets the strings of the subwidgets using the current *  language. */void mainFrm::languageChange(){    setCaption( trUtf8( "串口通讯工具" ) );    textLabel5->setText( trUtf8( "停止位:" ) );    comboBox5->clear();    comboBox5->insertItem( tr( "1" ) );    comboBox5->insertItem( tr( "2" ) );    textLabel4->setText( trUtf8( "校验:" ) );    textLabel3->setText( trUtf8( "数据位:" ) );    textLabel2->setText( trUtf8( "波特率:" ) );    textLabel1->setText( trUtf8( "串口 :" ) );    comboBox4->clear();    comboBox4->insertItem( tr( "N" ) );    comboBox4->insertItem( tr( "O" ) );    comboBox4->insertItem( tr( "E" ) );    comboBox4->insertItem( tr( "S" ) );    comPort->clear();    comPort->insertItem( tr( "COM1" ) );    comPort->insertItem( tr( "COM2" ) );    comBaud->clear();    comBaud->insertItem( tr( "1200" ) );    comBaud->insertItem( tr( "2400" ) );    comBaud->insertItem( tr( "4800" ) );    comBaud->insertItem( tr( "9600" ) );    comBaud->insertItem( tr( "19200" ) );    comData->clear();    comData->insertItem( tr( "6" ) );    comData->insertItem( tr( "7" ) );    comData->insertItem( tr( "8" ) );    closeBtn->setText( trUtf8( "关闭" ) );    sendBtn->setText( trUtf8( "发送" ) );    openBtn->setText( trUtf8( "打开" ) );}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -