diff --git a/FFmpegDemo/AVIOReading/AVIOReading.pro b/FFmpegDemo/AVIOReading/AVIOReading.pro index 4c1f2b72b0f6640bc982140e5caff7bc50b7b639..1a65bdce239f3a86f0d0067428e5b384d2403689 100644 --- a/FFmpegDemo/AVIOReading/AVIOReading.pro +++ b/FFmpegDemo/AVIOReading/AVIOReading.pro @@ -35,7 +35,7 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target # 定义程序版本号 -VERSION = 1.0.1 +VERSION = 1.0.2 DEFINES += APP_VERSION=\\\"$$VERSION\\\" TARGET = AVIOReading diff --git a/FFmpegDemo/AVIOReading/widget.cpp b/FFmpegDemo/AVIOReading/widget.cpp index c586ee026e6ede1351902494ac9e71ee53add30a..788e4d8e68dd3418d04a9ef16a4bfcaf85fce686 100644 --- a/FFmpegDemo/AVIOReading/widget.cpp +++ b/FFmpegDemo/AVIOReading/widget.cpp @@ -14,7 +14,7 @@ extern "C" { // 用C规则编译指定的代码 typedef struct BufferData { uchar* ptr; - quint64 size; // 缓冲区中剩余的大小 + size_t size; // 缓冲区中剩余的大小 }BufferData; Widget::Widget(QWidget *parent) diff --git a/FFmpegDemo/AVIOReading/widget.h b/FFmpegDemo/AVIOReading/widget.h index ff1e730549d83fc2e475e980781415db09df34d0..7fc8b28a522e0f83d0175198dbe12ee2ccbf8d47 100644 --- a/FFmpegDemo/AVIOReading/widget.h +++ b/FFmpegDemo/AVIOReading/widget.h @@ -37,7 +37,7 @@ private: AVFormatContext* m_formatContext = nullptr; AVIOContext * m_avioContext = nullptr; uchar * m_buffer = nullptr; // 保存打开的媒体文件的所有数据 - quint64 m_bufSize = 0; // 打开的文件的总大小 + size_t m_bufSize = 0; // 打开的文件的总大小 uchar * m_avioBuffer = nullptr; // 从m_buffer中一次读取的数据 int m_avioBufSize = 4096; // 从m_buffer中一次读取的数据长度 }; diff --git a/FFmpegDemo/Screencap/Screencap.pro b/FFmpegDemo/Screencap/Screencap.pro index 9dfdb14b5cbfea2ae79b557b5d46125e124127b6..76edcc6d87750b6b38198e30c30f59a2f54483db 100644 --- a/FFmpegDemo/Screencap/Screencap.pro +++ b/FFmpegDemo/Screencap/Screencap.pro @@ -37,7 +37,7 @@ include(./Screencap/Screencap.pri) INCLUDEPATH += ./Screencap # 定义程序版本号 -VERSION = 1.0.2 +VERSION = 1.0.3 DEFINES += APP_VERSION=\\\"$$VERSION\\\" contains(QT_ARCH, i386){ # 使用32位编译器 diff --git a/FFmpegDemo/Screencap/Screencap/readthread.cpp b/FFmpegDemo/Screencap/Screencap/readthread.cpp index a1edb8ed30c7e0dac75f3267711b95b51468b260..eb8c971feb074bd03f2248a098b4a3aa068a7617 100644 --- a/FFmpegDemo/Screencap/Screencap/readthread.cpp +++ b/FFmpegDemo/Screencap/Screencap/readthread.cpp @@ -6,6 +6,8 @@ #include #include #include +#include +#include ReadThread::ReadThread(QObject *parent) : QThread(parent) { @@ -31,6 +33,12 @@ void ReadThread::setPath(const QString &path) { if(path.isEmpty()) return; + if(QFileInfo(path).suffix().isEmpty()) + { + QMessageBox::warning(nullptr, "注意~", "输入文件没有后缀名,无法使用"); + m_path.clear(); + return; + } m_path = path; } @@ -78,6 +86,8 @@ void sleepMsec(int msec) void ReadThread::run() { + if(m_path.isEmpty()) return; + bool ret = m_videoDecode->open(m_url); // 打开网络流时会比较慢,如果放到Ui线程会卡 if(ret) { diff --git a/FFmpegDemo/Screencap/widget.cpp b/FFmpegDemo/Screencap/widget.cpp index 08143c221ff5d8545103ff7c5f5deb687de45e5f..8c7ae88b2ea14e3c7f5f7cc4663641a981eba799 100644 --- a/FFmpegDemo/Screencap/widget.cpp +++ b/FFmpegDemo/Screencap/widget.cpp @@ -33,7 +33,7 @@ void Widget::on_but_open_clicked() { if(ui->but_open->text() == "开始录屏") { - setSavePath(); + if(!setSavePath()) return; #if defined(Q_OS_WIN) m_readThread->open("desktop"); #elif defined(Q_OS_LINUX) @@ -70,18 +70,20 @@ void Widget::on_playState(ReadThread::PlayState state) /** * @brief 设置文件保存路径 */ -void Widget::setSavePath() +bool Widget::setSavePath() { - QString strDefault = QString("%1/%2").arg(QStandardPaths::writableLocation(QStandardPaths::MoviesLocation)) + // 如果不指定文件后缀则在linux下默认保存的视频文件没有后缀,就无法通过后缀名推测视频保存格式 + QString strDefault = QString("%1/%2.mp4").arg(QStandardPaths::writableLocation(QStandardPaths::MoviesLocation)) .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd HH-mm-ss")); QString strPath = QFileDialog::getSaveFileName(this, "视频保存到~", strDefault, "常用视频文件 (*.mp4 *.avi *.mov *.wmv *.flv *.h264 *.h265);;" "其它文件格式 (*)"); - if(strPath.isEmpty()) return; + if(strPath.isEmpty()) return false; ui->line_path->setText(strPath); m_readThread->setPath(strPath); + return true; } /** diff --git a/FFmpegDemo/Screencap/widget.h b/FFmpegDemo/Screencap/widget.h index 1725d1296f1f7fbcb88967a0624409acdd4101d4..b5374751c12cec134a0468584a73c7436d355832 100644 --- a/FFmpegDemo/Screencap/widget.h +++ b/FFmpegDemo/Screencap/widget.h @@ -21,7 +21,7 @@ private slots: void on_but_open_clicked(); void on_playState(ReadThread::PlayState state); - void setSavePath(); + bool setSavePath(); void on_timeout(); private: diff --git a/FunctionalModule/FunctionalModule.pro b/FunctionalModule/FunctionalModule.pro index deded5817ecf44e66890ac0c7ffcfdcc59d7da44..113a70acb18a6733b69cc385b66c4f7312c6e16b 100644 --- a/FunctionalModule/FunctionalModule.pro +++ b/FunctionalModule/FunctionalModule.pro @@ -10,15 +10,15 @@ #--------------------------------------------------------------------------------------- TEMPLATE = subdirs -SUBDIRS += QMWidget # qt自定义窗口 SUBDIRS += WindowRect # 使用透明窗口框选鼠标所在窗口范围 SUBDIRS += SnippingTool # Qt实现截图工具 SUBDIRS += DeviceManagement # 串口、鼠标、键盘热插拔检测模块 SUBDIRS += QLog # 自定义日志系统 -SUBDIRS += QMPlayer # 视频播放器界面 SUBDIRS += NtpClient # NTP时间同步客户端(需要管理员权限/超级用户权限打开) SUBDIRS += MouseKeyEvent # 自定义全局鼠标键盘事件监听器 win32 { +SUBDIRS += QMWidget # qt自定义窗口 +SUBDIRS += QMPlayer # 视频播放器界面 SUBDIRS += TestCrashHandler # windows下Qt程序崩溃问题定位Demo(只在msvc编译下有效) } diff --git a/FunctionalModule/NtpClient/NtpClient.pro b/FunctionalModule/NtpClient/NtpClient.pro index fc64dcfed1f873607dd2b80d5945598891ade99f..be7e3d4717b3a5561777896b34d2917c6ebc58d3 100644 --- a/FunctionalModule/NtpClient/NtpClient.pro +++ b/FunctionalModule/NtpClient/NtpClient.pro @@ -49,7 +49,7 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target # 定义程序版本号 -VERSION = 1.0.1 +VERSION = 1.0.2 DEFINES += APP_VERSION=\\\"$$VERSION\\\" contains(QT_ARCH, i386){ # 使用32位编译器 diff --git a/FunctionalModule/NtpClient/ntpclient.cpp b/FunctionalModule/NtpClient/ntpclient.cpp index dfead050fea1838bacdbdf2f187586949f247d7d..0d774472280fa2fc07a50a891e52b27f2a40e99c 100644 --- a/FunctionalModule/NtpClient/ntpclient.cpp +++ b/FunctionalModule/NtpClient/ntpclient.cpp @@ -202,7 +202,7 @@ void NtpClient::setDateTime(QDateTime& dateTime) struct timeval tv; tptr.tm_year = date.year() - 1900; // 这里必须-1900,否则设置不成功 - tptr.tm_mon = date.month(); + tptr.tm_mon = date.month() - 1; // 月份取值范围为[0-11] tptr.tm_mday = date.day(); tptr.tm_hour = time.hour(); tptr.tm_min = time.minute(); diff --git a/OpenCVDemo/OpenCVDemo.pro b/OpenCVDemo/OpenCVDemo.pro index 7597a919facd35bca57b28273dfea45492026713..9d3ac625020798f3d169bb32e256ae4782ee8b21 100644 --- a/OpenCVDemo/OpenCVDemo.pro +++ b/OpenCVDemo/OpenCVDemo.pro @@ -10,5 +10,4 @@ #--------------------------------------------------------------------------------------- TEMPLATE = subdirs -SUBDIRS += \ - VideoPlay +SUBDIRS += VideoPlay diff --git a/QMDemo.pro b/QMDemo.pro index 08391df7546cf376e2271289a0d6d86e6984abb6..2b16def1fc5a62b68d70e7b0fa4d7fff33f49e36 100644 --- a/QMDemo.pro +++ b/QMDemo.pro @@ -23,6 +23,6 @@ SUBDIRS += XlsxDemo # Qt使用QXlsx读写Excel Demo SUBDIRS += QtChartsDemo # Qt使用QtCharts绘制图表 Demo SUBDIRS += QSqlDemo # Qt使用数据库Demo SUBDIRS += PaintingDemo # 使用 QPainter绘制图片 -SUBDIRS += Web # Qt并发编程示例 +SUBDIRS += Web # Qt + web编程 SUBDIRS += ConcurrentExamples # Qt并发编程示例 diff --git a/QtChartsDemo/Audio/xyseriesiodevice.cpp b/QtChartsDemo/Audio/xyseriesiodevice.cpp index 11b3fc1998d3141e51106a3e70a2c838425a6819..dcc35a02d29cfb124c60c63f73f79aa15c7481b6 100644 --- a/QtChartsDemo/Audio/xyseriesiodevice.cpp +++ b/QtChartsDemo/Audio/xyseriesiodevice.cpp @@ -1,6 +1,5 @@ #include "xyseriesiodevice.h" #include -#include #include #include diff --git a/QtChartsDemo/Audio/xyseriesiodevice.h b/QtChartsDemo/Audio/xyseriesiodevice.h index 5537493052147f366fdf47fa9a5d9c4827050333..d662080471478698b9dc891e1f014cc7bb9fff89 100644 --- a/QtChartsDemo/Audio/xyseriesiodevice.h +++ b/QtChartsDemo/Audio/xyseriesiodevice.h @@ -15,6 +15,7 @@ #include #include #include +#include QT_CHARTS_BEGIN_NAMESPACE class QXYSeries; diff --git a/Web/QtWebExamples/QtWebExamples.pro b/Web/QtWebExamples/QtWebExamples.pro index 58c66dda37391fc8deb17567a72721c58409edc6..c37c060f1f79de40ae0447a3501f07d1cbbdf8af 100644 --- a/Web/QtWebExamples/QtWebExamples.pro +++ b/Web/QtWebExamples/QtWebExamples.pro @@ -1,3 +1,12 @@ +#--------------------------------------------------------------------- +# 模块功能: QWebEngineView、QtWebChannel使用示例 +# 支持编译器: +# 开发者: mhf +# 邮箱 1603291350@qq.com +# 时间: 2023/02/03 +# 错误解决:如果在linux下编译报错:-1: error: /opt/Qt5.14.2/5.14.2/gcc_64/lib/libQt5WebEngineCore.so: .dynsym local symbol at index 3 (>= sh_info of 3) +# 则执行命令sudo ln -sf /usr/bin/x86_64-linux-gnu-ld.gold /usr/bin/ld +#--------------------------------------------------------------------- TEMPLATE = subdirs # 只有当前系统、编译器支持webenginewidgets模块才编译下列程序(MinGW没有),这里 { 不能换行