Using the capabilities of winExtras when working with QML

TaskbarButton, winextras, qml, JumpList, ThumbnailToolBar, qt


Some time ago I wrote several articles about using the QtWinExtras library, which opens access to special features that are available only for Windows. Now I want to say a few words about how to repeat, too, using QML. For this we need to create a Qt Quick project, connect the winextras module in the project

import QtWinExtras 1.0

And use 3 objects: TaskbarButton to create a progress bar and manage it, ThumbnailToolBar for work with buttons on the pop-up window of the taskbar and JumpList (for working with jumpList). Also add FileDialog for the full work of jumpList.

For TaskbarButton, you need to set the id properties (to access this object from outside), progress.visible: true. Additionally, you can set the overlay.iconSource icon.

In ThumbnailToolBar we create the ThumbnailToolButton (from one to seven) buttons, set the icons and write the click processing.

In JumpList, the recent section is visible to show the last opened files and frequent to display frequently opened files.

JumpList {
    id: jumpList
    recent.visible: true
    frequent.visible: true

Do not forget that the file extensions that fall into the jumpList must be registered in the registry. Therefore, add the function associateFileTypes () to the main file, as shown in the previous article. .

Another curious possibility is the setting of the transparency of the window. To do this, you need the DwmFeatures object. Its blurBehindEnabled property makes the window transparent if its value is true. If you set it to false, the background color becomes black. I also note that the transparency can be set using the opacity property of the Window object. It differs from blurBehindEnabled in that the latter can have only 2 states (transparent and opaque) and makes only the main part of the window transparent (without widgets placed on it), while opacity sets the degree of transparency and makes the whole window transparent with all the widgets And a frame. Another 4 leftGlassMargin, rightGlassMargin, topGlassMargin, and bottomGlassMargin properties are responsible for the size of the extra margin from the left, right, top, and bottom side of the window, respectively. Indentation values ​​are specified in pixels. The default values ​​are 0. I do not see the application application in these properties, but I wrote about them for completeness.


import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Controls 2.0
import QtQuick.Dialogs 1.0
import QtWinExtras 1.0

Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello WinExtras")
    DwmFeatures {
        id: dwmFeatures
        blurBehindEnabled: true
        leftGlassMargin : 10
        rightGlassMargin : 10
        topGlassMargin : 10
        bottomGlassMargin : 10
        excludedFromPeek : false
        peekDisallowed : false
        flip3DPolicy: QtWin.FlipExcludeBelow

        height: 100
        text: "button"

    TaskbarButton {
        id: taskbarButton 
       //overlay.iconSource: "loading.png" 
       overlay.accessibleDescription: "Loading"
        progress.visible: true
        progress.value: 50

   ThumbnailToolBar {
        ThumbnailToolButton { iconSource: "r.png"; tooltip: "Next"; onClicked: taskbarButton.progress.value = taskbarButton.progress.value+1 } 
       ThumbnailToolButton { iconSource: "l.png"; tooltip: "Prep"; onClicked: taskbarButton.progress.value = taskbarButton.progress.value-1 }
        ThumbnailToolButton { iconSource: "pause.png"; tooltip: "Pause"; onClicked: taskbarButton.progress.setPaused(!taskbarButton.progress.paused) }
        ThumbnailToolButton { interactive: false; flat: true }
        ThumbnailToolButton { iconSource: "open.png"; tooltip: "OpenFile"; onClicked:}
        ThumbnailToolButton { iconSource: "exit.png"; tooltip: "Open"; onClicked: Qt.quit() }

    JumpList {
        id: jumpList 
       recent.visible: true 
       frequent.visible: true
        //tasks.visible: true 

    FileDialog {
          id: fileDialog
          selectFolder: true
          title: "Please choose a file"
          folder: shortcuts.home
          onAccepted: {
              console.log("You chose: " + fileDialog.fileUrls)


clude <QFileInfo>
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QDir>
#include <QSettings>

static void associateFileTypes(const QStringList &fileTypes)
    QString displayName = QGuiApplication::applicationDisplayName();
    QString filePath = QCoreApplication::applicationFilePath();
    QString fileName = QFileInfo(filePath).fileName();
    //qDebug() << displayName << filePath << fileName;
    QSettings settings("HKEY_CURRENT_USER\\Software\\Classes\\Applications\\" + fileName, QSettings::NativeFormat);
    settings.setValue("FriendlyAppName", displayName);
    foreach (const QString& fileType, fileTypes)
        settings.setValue(fileType, QString());
    settings.setValue("FriendlyAppName", displayName);
    settings.setValue(".", QChar('"') + QDir::toNativeSeparators(filePath) + QString("\" \"%1\""));

int main(int argc, char *argv[])
    QGuiApplication app(argc, argv);
    app.setApplicationDisplayName("QtWinExtras Test");
    QQmlApplicationEngine engine;
    return app.exec();

Text of the program

We recommend hosting TIMEWEB
We recommend hosting TIMEWEB
Stable hosting, on which the social network EVILEG is located. For projects on Django we recommend VDS hosting.


Only authorized users can post comments.
Please, Log in or Sign up
How to become an author?

Contribute to the evolution of the EVILEG community.

Learn how to become a site author.

Learn it

Good day, Dear Users!!!

I am Evgenii Legotckoi, developer of EVILEG. And it is my hobby project, which helps to learn programming another programmers and developers

If the site helped you, and you want also support the development of the site, than you can donate by following ways


Let me recommend you the excellent hosting on which EVILEG is located.

For many years, Timeweb has been proving his stability.

For projects on Django I recommend VDS hosting

View Hosting Timeweb
June 5, 2020, 2:28 a.m.

Qt - Test 001. Signals and slots

  • Result:0points,
  • Rating points-10
June 3, 2020, 1:56 a.m.

C++ - Тест 003. Условия и циклы

  • Result:35points,
  • Rating points-10
June 2, 2020, 9:11 p.m.
Aleksej Pikenin

C++ - Test 005. Structures and Classes

  • Result:75points,
  • Rating points2
Last comments
June 5, 2020, 1:39 a.m.
Evgenij Legotskoj

Qt/C++ - Tutorial 091. How to write a custom delegate controlling the highlighting of a row in a table

По-моему, смысла в этом нет особого. Если делегат будет игнорировать настройки таблицы, то это приведёт ещё к большему непониманию, что вообще происходит, для программиста, который после вас буд…
June 5, 2020, 1:34 a.m.

Qt/C++ - Tutorial 091. How to write a custom delegate controlling the highlighting of a row in a table

Сижу, размышляю: можно ли переписать делегата так, чтобы независимо от настроек строк выделялись строки?
June 5, 2020, 1:31 a.m.
Evgenij Legotskoj

Qt/C++ - Tutorial 091. How to write a custom delegate controlling the highlighting of a row in a table

Понятно. Я не обратил внимания на то, что там было в старом коде по настройкам строк :)
June 5, 2020, 1:27 a.m.

Qt/C++ - Tutorial 091. How to write a custom delegate controlling the highlighting of a row in a table

Разобрался. У вас изначально в проекте были вот эти настройки: ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);ui->tableView->setSelectionMode(QAbstractItemVie…
June 4, 2020, 11:10 a.m.

Qt/C++ - Tutorial 091. How to write a custom delegate controlling the highlighting of a row in a table

Полностью скопировал пример - всё правильно работает. Значит, где-то у меня ошибки в тестовом проекте. Буду разбираться. Извините за беспокойство. :)
Now discuss on the forum
June 5, 2020, 6:13 a.m.

Фильтр для QtableView sql

Добрый день. Для такой фильтрации необходимо использовать QSortFilterProxyModel. В оффдоках есть хороший пример.
June 4, 2020, 2:46 a.m.
Mihail A

Qt- C++ QTableView подсветить строку

June 3, 2020, 1:49 a.m.

Можно ли сделать в QML таблицу как в Excel?

edi-tableview - нашел пока такое выглядит коряво, посмотрим что можно сделать
June 2, 2020, 2:46 a.m.
Evgenij Legotskoj

Медиа файлы Google Firebase

Картинки можете попробовать сжимать через QPixmap, там есть возможность установки scaleFactor, через него можете устанавливать нужные параметры. А что касается конвертации видео, то лучше п…
June 2, 2020, 2:01 a.m.
Evgenij Legotskoj

Перехват обращения к локальным файлам QWebEngineView

В вашем случае вполне адекватное решение. Так сказать меньше зло. В противном случае пришлось бы очень много переписывать и перепиливать.
© EVILEG 2015-2020
Recommend hosting TIMEWEB