如何在Windows 7任务栏中显示进度(使用Qt)?
发布时间:2020-12-13 21:11:35 所属栏目:Windows 来源:网络整理
导读:原文转载于:https://cloud.tencent.com/developer/ask/120278 你可以使用这个 QWinTaskbarProgress 类。要使用这个类,你需要添加 win32:QT += winextras 你的.pro文件。 下面是一个示例代码,演示如何 QProgressBar 在Windows任务栏中显示a的值(从此示例中
原文转载于:https://cloud.tencent.com/developer/ask/120278 你可以使用这个 下面是一个示例代码,演示如何 #ifdef _WIN32 //The _WIN32 macro is automatically generated when compiling for Windows #include <QWinTaskbarProgress> #include <QWinTaskbarButton> #endif QProgressBar *progressBar = new QProgressBar; progressBar->show(); #ifdef _WIN32 QWinTaskbarButton *windowsTaskbarButton new QWinTaskbarButton; //Create the taskbar button which will show the progress windowsTaskbarButtonsetWindow(progressBarwindowHandle//Associate the taskbar button to the progress bar,assuming that the progress bar is its own window QWinTaskbarProgress *windowsTaskbarProgress = windowsTaskbarButtonprogress; windowsTaskbarProgress; QObject::connect(loadingWindow, &QProgressBar:valueChanged[windowsTaskbarProgress](int value{ windowsTaskbarProgresssetValue(value; //Change the value of the progress in the taskbar when the value of the progress bar changes }; #endif (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
热点阅读