Дмитрий
Aug. 5, 2017, 11: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

  1. QT += winextras

Create a QWinThumbnailToolBar class panel and bind it to the window

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

Add the following code to the constructor:

  1. if (QtWin::isCompositionEnabled())
  2. QtWin::extendFrameIntoClientArea(this, 0, 0, 0, 0);
  3. else
  4. QtWin::resetExtendedFrame(this);

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

  1. B1 = new QWinThumbnailToolButton(thumbnailToolBar);
  2. 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

Do you like it? Share on social networks!

Comments

Only authorized users can post comments.
Please, Log in or Sign up
  • Last comments
  • Evgenii Legotckoi
    March 9, 2025, 9:02 p.m.
    К сожалению, я этого подсказать не могу, поскольку у меня нет необходимости в обходе блокировок и т.д. Поэтому я и не задавался решением этой проблемы. Ну выглядит так, что вам действитель…
  • VP
    March 9, 2025, 4:14 p.m.
    Здравствуйте! Я устанавливал Qt6 из исходников а также Qt Creator по отдельности. Все компоненты, связанные с разработкой для Android, установлены. Кроме одного... Когда пытаюсь скомпилиров…
  • ИМ
    Nov. 22, 2024, 9:51 p.m.
    Добрый вечер Евгений! Я сделал себе авторизацию аналогичную вашей, все работает, кроме возврата к предидущей странице. Редеректит всегда на главную, хотя в логах сервера вижу запросы на правильн…
  • Evgenii Legotckoi
    Oct. 31, 2024, 11:37 p.m.
    Добрый день. Да, можно. Либо через такие же плагины, либо с постобработкой через python библиотеку Beautiful Soup
  • A
    Oct. 19, 2024, 5:19 p.m.
    Подскажите как это запустить? Я не шарю в программировании и кодинге. Скачал и установаил Qt, но куча ошибок выдается и не запустить. А очень надо fb3 переконвертировать в html