摘要: 服务端写文件: #include "UpdateServer.h" UpdateServer::UpdateServer(QWidget *parent) : QWidget(parent), m_filesize(0), m_socket(nullptr), m_currentWritten(0) 阅读全文
posted @ 2021-02-10 20:57 tonny1000 阅读(319) 评论(0) 推荐(0)
摘要: 客户端: QNetworkProxyFactory::setUseSystemConfiguration(false); //取消代理链接 serverIP = new QHostAddress(); if (!serverIP->setAddress("127.0.0.1")) QMessageB 阅读全文
posted @ 2021-02-10 20:37 tonny1000 阅读(304) 评论(0) 推荐(0)
摘要: emit sendInfo(sinfo); 需要在头文件中 定义自己的信号,不需要实现 signals: void sendInfo(QString); 阅读全文
posted @ 2021-02-10 20:29 tonny1000 阅读(237) 评论(0) 推荐(0)
摘要: if (fra == mv->frameCount() - 1) { mv->stop(); } 阅读全文
posted @ 2021-02-10 20:27 tonny1000 阅读(304) 评论(0) 推荐(0)
摘要: m_play = new MediaPlay(this); m_play->setMedia("qrc:/music/run.MP3"); //先将run.MP3添加到 QRC 资源中 m_play->play(); 阅读全文
posted @ 2021-02-10 20:26 tonny1000 阅读(210) 评论(0) 推荐(0)
摘要: QT 播放动画 可以通过QLabel 设置Movie来实现 mv = new QMovie("hello.gif"); //添加 动画文件 mv->setScaledSize(ui.label->size()); // 设置动画画布和QLabel尺寸一样大小 ui.label->setMovie(m 阅读全文
posted @ 2021-02-10 20:25 tonny1000 阅读(150) 评论(0) 推荐(0)
摘要: this->setMaximumSize(this->size()); this->setMinimumSize(this->size()); 通过将现有尺寸同时设置最大,最小尺寸实现 阅读全文
posted @ 2021-02-10 20:22 tonny1000 阅读(598) 评论(0) 推荐(0)
摘要: 通过运行QT 安装目录下bin 下的 windowdeploy.exe D:\myproject\horse.exe 就会在D:\project下 自动生成运行所需 动态库和文件夹, 移植到新的环境发现还不能运行的化,请下载VS 插件 vcredist_x64.exe 基本上就OK了 阅读全文
posted @ 2021-02-10 20:20 tonny1000 阅读(55) 评论(0) 推荐(0)
摘要: QPalette palette = this->palette(); palette.setBrush(QPalette::Window, QBrush(QPixmap(":/bak/gc.jpg").scaled(this->size(), Qt::IgnoreAspectRatio, Qt:: 阅读全文
posted @ 2021-02-10 20:15 tonny1000 阅读(122) 评论(0) 推荐(0)
摘要: setWindowFlags(windowFlags()&~Qt::WindowMinMaxButtonsHint); 其中&~ 是按位与 操作 阅读全文
posted @ 2021-02-10 20:12 tonny1000 阅读(647) 评论(0) 推荐(0)
摘要: db = QSqlDatabase::addDatabase("QMYSQL"); //连接的MYSQL的数据库驱动 db.setHostName("localhost"); //主机名 db.setPort(3306); //端口 db.setDatabaseName("test"); //数据库 阅读全文
posted @ 2021-02-10 20:10 tonny1000 阅读(47) 评论(0) 推荐(0)
摘要: m_set = new QSettings("userinfo.ini", QSettings::IniFormat); //读取userinfo.ini文件 return m_set->value("info/cli_ver", "").toString();// 读取 info 下的 cli_v 阅读全文
posted @ 2021-02-10 20:08 tonny1000 阅读(87) 评论(0) 推荐(0)
摘要: QFile file("userinfo.ini"); file.open(QIODevice::Text | QIODevice::WriteOnly); QTextStream out(&file); out << "[info]" << endl << "id=" //其中 endl 就是回车 阅读全文
posted @ 2021-02-10 20:04 tonny1000 阅读(581) 评论(0) 推荐(0)
摘要: QT 通过QProcess 加载外部应用 QProcess.start("应用.exe");这个是同步加载,系统随着应用的退出,所加持的应用程序也会被退出; QProcess.startDetacher("应用.exe")这个是异步加载,系统运行应用后,系统退出,不影响应用的继续执行,在通过更新的应 阅读全文
posted @ 2021-02-10 20:01 tonny1000 阅读(199) 评论(0) 推荐(0)
摘要: playList = new QMediaPlaylist(this); //创建 播放列别 player = new QMediaPlayer(this);//创建播放器 // playList->setPlaybackMode(QMediaPlaylist::Loop);// 通过设置 播放列表 阅读全文
posted @ 2021-02-10 19:57 tonny1000 阅读(4440) 评论(0) 推荐(0)