1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00

add qqt udp example

This commit is contained in:
tianduanrui 2018-01-30 15:22:02 +08:00
parent abc6f91df0
commit c6ba124ee1
18 changed files with 143 additions and 28 deletions

View File

@ -22,7 +22,11 @@ SUBDIRS = src/qqt.pro
#SUBDIRS += examples/exquisite #SUBDIRS += examples/exquisite
#SUBDIRS += examples/tabwidgetexamples #SUBDIRS += examples/tabwidgetexamples
#SUBDIRS += examples/qrcodeexample #SUBDIRS += examples/qrcodeexample
#SUBDIRS += examples/qqtnetworkexample #
SUBDIRS += examples/qqtnetworkexample
#udp 嵌入式linuxQt编译了udp后支持
#
SUBDIRS += examples/qqtudpexample
#SUBDIRS += examples/qqtchartexample #SUBDIRS += examples/qqtchartexample
# #
# #

View File

@ -1,6 +1,5 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include "cedianudpprotocol.h"
MainWindow::MainWindow ( QWidget* parent ) : MainWindow::MainWindow ( QWidget* parent ) :
@ -9,20 +8,6 @@ MainWindow::MainWindow ( QWidget* parent ) :
{ {
ui->setupUi ( this ); ui->setupUi ( this );
/*初始化端口*/
qint32 nPort[9] = {0};
for ( int i = 0 ; i < 9; i++ )
{
//int port = ui->widget_12->getLocalPort ( i + 1 );
/*正式版*/
//nPort[i] = port;
/*有规律版*/
nPort[i] = 7000 + i * 10;
//pline() << nPort[i];
}
cedianUdpPort ( 5, nPort );
// serialport example // serialport example
// tcpsocket example // tcpsocket example
// websocket? // websocket?

View File

@ -29,12 +29,7 @@ SOURCES += \
qqtnetworkmessage.cpp \ qqtnetworkmessage.cpp \
qqtserialmessage.cpp \ qqtserialmessage.cpp \
qqtuserserialprotocol.cpp \ qqtuserserialprotocol.cpp \
qqtsubprotocoltest.cpp \ qqtsubprotocoltest.cpp
cedianudpmessage.cpp \
cedianudpprotocol.cpp \
cedianudpserver.cpp \
kongzhiqiudpmessage.cpp \
kongzhiqiudpprotocol.cpp
HEADERS += \ HEADERS += \
mainwindow.h \ mainwindow.h \
@ -43,12 +38,7 @@ HEADERS += \
qqtnetworkmessage.h \ qqtnetworkmessage.h \
qqtserialmessage.h \ qqtserialmessage.h \
qqtuserserialprotocol.h \ qqtuserserialprotocol.h \
qqtsubprotocoltest.h \ qqtsubprotocoltest.h
cedianudpmessage.h \
cedianudpprotocol.h \
cedianudpserver.h \
kongzhiqiudpmessage.h \
kongzhiqiudpprotocol.h
FORMS += \ FORMS += \
mainwindow.ui mainwindow.ui

View File

@ -0,0 +1,11 @@
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}

View File

@ -0,0 +1,29 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "cedianudpprotocol.h"
MainWindow::MainWindow ( QWidget* parent ) :
QMainWindow ( parent ),
ui ( new Ui::MainWindow )
{
ui->setupUi ( this );
/*初始化端口*/
qint32 nPort[9] = {0};
for ( int i = 0 ; i < 9; i++ )
{
//int port = ui->widget_12->getLocalPort ( i + 1 );
/*正式版*/
//nPort[i] = port;
/*有规律版*/
nPort[i] = 7000 + i * 10;
//pline() << nPort[i];
}
cedianUdpPort ( 5, nPort );
}
MainWindow::~MainWindow()
{
delete ui;
}

View File

@ -0,0 +1,22 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H

View File

@ -0,0 +1,21 @@
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle" >
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralWidget" />
</widget>
<layoutDefault spacing="6" margin="11" />
<pixmapfunction></pixmapfunction>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,53 @@
#-------------------------------------------------
#
# Project created by QtCreator 2018-01-30T15:14:36
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = qqtudpexample
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
mainwindow.cpp \
cedianudpmessage.cpp \
cedianudpprotocol.cpp \
cedianudpserver.cpp \
kongzhiqiudpmessage.cpp \
kongzhiqiudpprotocol.cpp
HEADERS += \
mainwindow.h \
cedianudpmessage.h \
cedianudpprotocol.h \
cedianudpserver.h \
kongzhiqiudpmessage.h \
kongzhiqiudpprotocol.h
FORMS += \
mainwindow.ui
CONFIG += mobility
MOBILITY =
#促使编译源代码qmake pri配置里面的QMAKE_XX_LINK命令就会执行
system("touch main.cpp")
include(../../src/app_base_manager.pri)