Дмитрий
ДмитрийAug. 5, 2017, 1:13 a.m.

Using the buttons WinThumbnailToolButton when working with Qt on Windows

Buttons of class QWinThumbnailToolButton - one of the options available only for Windows (7 and older). You could see such buttons in Windows Media Player


Step-by-step instruction

To use these buttons, you need to

Connect the winextras module to the project

QT  += winextras

Create a QWinThumbnailToolBar class panel and bind it to the window

thumbnailToolBar = new QWinThumbnailToolBar(this);
thumbnailToolBar->setWindow(windowHandle());

Add the following code to the constructor:

if (QtWin::isCompositionEnabled())
    QtWin::extendFrameIntoClientArea(this, 0, 0, 0, 0);
else
    QtWin::resetExtendedFrame(this);

Now you can create a button (buttons) and bind it (them) to the panel

B1 = new QWinThumbnailToolButton(thumbnailToolBar);
thumbnailToolBar->addButton(B1);

Conclusion

These buttons work just like QPushButton. For example, you can set an icon for the button using the setIcon() method, associate its clicked() signal with any slot, and so on. A unique property of this class is the boolean variable, dismissOnClick . If its value is set to true (setDismissOnClick (true)), then after clicking on the corresponding button the panel will instantly be wrinkled. Otherwise, the panel will be available until the user moves the mouse away from it. The maximum number of buttons that can be added to the QWinThumbnailToolBar panel is 7.

Using the flat (setFlat (true)) property, you can make the button invisible and use it as a separator between groups of buttons, as in the figure below.

Here you can download the text of the described 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.

Do you like it? Share on social networks!

Comments

Only authorized users can post comments.
Please, Log in or Sign up
Г

C++ - Test 001. The first program and data types

  • Result:66points,
  • Rating points-1
t

C++ - Test 001. The first program and data types

  • Result:33points,
  • Rating points-10
t

Qt - Test 001. Signals and slots

  • Result:52points,
  • Rating points-4
Last comments
G
GoattRockSept. 3, 2024, 11:50 p.m.
How to Copy Files in Linux Задумывались когда-нибудь о том, как мы привыкли доверять свои вещи службам грузоперевозок? Сейчас такие услуги стали неотъемлемой частью нашей жизни, особенно когда речь идет о переездах между …
ВР
Влад РусоковAug. 2, 2024, 11:47 a.m.
How to Copy Files in Linux Screenshot_20240802-065123.png
d
dblas5July 5, 2024, 9:02 p.m.
QML - Lesson 016. SQLite database and the working with it in QML Qt Здравствуйте, возникает такая проблема (я новичок): ApplicationWindow неизвестный элемент. (М300) для TextField и Button аналогично. Могу предположить, что из-за более новой верси…
k
kmssrFeb. 9, 2024, 5:43 a.m.
Qt Linux - Lesson 001. Autorun Qt application under Linux как сделать автозапуск для флэтпака, который не даёт создавать файлы в ~/.config - вот это вопрос ))
Qt WinAPI - Lesson 007. Working with ICMP Ping in Qt Без строки #include <QRegularExpressionValidator> в заголовочном файле не работает валидатор.
Now discuss on the forum
Evgenii Legotckoi
Evgenii LegotckoiJune 25, 2024, 1:11 a.m.
добавить qlineseries в функции Я тут. Работы оень много. Отправил его в бан.
F
FynjyJuly 22, 2024, 2:15 p.m.
при создании qml проекта Kits есть но недоступны для выбора Поставил Qt Creator 11.0.2. Qt 6.4.3 При создании проекта Qml не могу выбрать Kits, они все недоступны, хотя настроены и при создании обычного Qt Widget приложения их можно выбрать. В чем может …
BlinCT
BlinCTJune 25, 2024, 11 a.m.
Нарисовать кривую в qml Всем привет. Имеется Лист листов с тосками, точки получаны интерполяцией Лагранжа. Вопрос, как этими точками нарисовать кривую? ChartView отпадает сразу, в qt6.7 появился новый элемент…
BlinCT
BlinCTMay 5, 2024, 3:46 p.m.
Написать свой GraphsView Всем привет. В Qt есть давольно старый обьект дял работы с графиками ChartsView и есть в 6.7 новый но очень сырой и со слабым функционалом GraphsView. По этой причине я хочу написать х…
Evgenii Legotckoi
Evgenii LegotckoiMay 3, 2024, 12:07 a.m.
Мобильное приложение на C++Qt и бэкенд к нему на Django Rest Framework Добрый день. По моему мнению - да, но то, что будет касаться вызовов к функционалу Андроида, может создать огромные трудности.

Follow us in social networks