小工具知识网

当前位置: 首页 > 行业知识 > 没有事情做 随手写的小程序

行业知识

没有事情做 随手写的小程序

2026-10-25 10:35:43 来源:互联网转载

Qt�index.php/tags-41973.html" >� 代码包  https://download.csdn.net/download/nn_84/88830445

()

dialog.h :

#ifndef DIALOG_H#define DIALOG_H#include #include QT_BEGIN_NAMESPACEnamespace Ui {class Dialog;}QT_END_NAMESPACEclass Dialog : public QDialog{    Q_OBJECTpublic:    Dialog(QWidget *parent = nullptr);    ~Dialog();    mythread thread1;    mythread thread2;    mythread thread3;    mythread thread4;    mythread thread5;private slots:    void on_pushButton_1_clicked();    void on_pushButton_clicked();private:    Ui::Dialog *ui;};#endif // DIALOG_H

mythread.h  :

()
#ifndef MYTHREAD_H#define MYTHREAD_H#include #include #include #include #include class mythread : public QThread{    Q_OBJECTpublic:    mythread();    QString name;    bool boolvalue;    QByteArray buffer;    QUdpSocket *socket;    QString address;    QString port;public slots:    void run ();};#endif // MYTHREAD_H

dialog.cpp :

#include "dialog.h"#include "ui_dialog.h"Dialog::Dialog(QWidget *parent)    : QDialog(parent)    , ui(new Ui::Dialog){    ui->setupUi(this);    thread1.boolvalue = false;    thread2.boolvalue = false;    thread3.boolvalue = false;    thread4.boolvalue = false;    thread5.boolvalue = false;}Dialog::~Dialog(){    delete ui;}void Dialog::on_pushButton_1_clicked(){    thread1.boolvalue = true;    thread1.name = "1";    thread1.address = ui->lineEdit->text();    thread1.port = ui->lineEdit_2->text();    thread1.start();    thread2.boolvalue = true;    thread2.name = "2";    thread2.address = ui->lineEdit->text();    thread2.port = ui->lineEdit_2->text();    thread2.start();    thread3.boolvalue = true;    thread3.name = "3";    thread3.address = ui->lineEdit->text();    thread3.port = ui->lineEdit_2->text();    thread3.start();    thread4.boolvalue = true;    thread4.name = "4";    thread4.address = ui->lineEdit->text();    thread4.port = ui->lineEdit_2->text();    thread4.start();    thread5.boolvalue = true;    thread5.name = "5";    thread5.address = ui->lineEdit->text();    thread5.port = ui->lineEdit_2->text();    thread5.start();}void Dialog::on_pushButton_clicked(){    thread1.boolvalue = false;    thread2.boolvalue = false;    thread3.boolvalue = false;    thread4.boolvalue = false;    thread5.boolvalue = false;}

mythread.cpp  :

#include "mythread.h"mythread::mythread(){    socket = new QUdpSocket(this);}void mythread::run(){    for(int i=0;iwriteDatagram(buffer,QHostAddress(address),port.toInt());    }}

.pro  :

QT       += core gui networkgreaterThan(QT_MAJOR_VERSION, 4): QT += widgetsCONFIG += c++17# You can make your code fail to compile if it uses deprecated APIs.# In order to do so, uncomment the following line.#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0SOURCES += \    main.cpp \    dialog.cpp \    mythread.cppHEADERS += \    dialog.h \    mythread.hFORMS += \    dialog.ui# Default rules for deployment.qnx: target.path = /tmp/$${TARGET}/binelse: unix:!android: target.path = /opt/$${TARGET}/bin!isEmpty(target.path): INSTALLS += target

嘿 大家知道 攻击哪个端口吗  53 53 53 记住 udp 53端口  

上一篇:去听说英语怎么说?

下一篇:揭秘百度网盘暗号输入秘籍,轻松上手使用技巧!