Qt Windows Extras Overview
Qt Windows Extras provide classes and functions that enable you to use miscellaneous Windows-specific functions. For example, you can convert Qt objects to Windows object handles and manipulate DWM glass frames.
In addition, you can use features introduced with Windows 7, such as Aero Peek, Jump Lists, a progress indicator on a taskbar button, or a thumbnail toolbar.
Type Conversion
The QtWin namespace provides functions to convert Qt objects of classes such as QPixmap or QImage to Windows HBITMAP or HICON handles, and vice versa.
DWM and Glass Frame
You can determine whether a window is included in the DWM Flip3D rendering.
The glass frame that was first introduced with Windows Vista can be easily manipulated using the QtWin::extendFrameIntoClientArea() and QtWin::enableBlurBehindWindow() functions. Windows 8 lost the glass effect, but applications can still integrate their windows into the system frame to visually separate window controls from the rest of the window or to focus the user's attention on window content.
Aero Peek
The Windows 7 Aero Peek feature gives the users the powers of X-ray vision that enable them to peek past all open windows straight at the desktop and the gadgets placed there. They can view the contents of a window without actually switching to it. You can enable Aero Peek for a gadget-like window or for a window that constantly displays monitoring data.
You can use the QtWin::setWindowExcludedFromPeek() function to exclude an application window from Aero Peek.
Note: Aero Peek is disabled in Windows 8 by default but can be enabled by the user.
Taskbar
The taskbar provides users with access to applications that are open on the desktop. Windows automatically creates buttons on the taskbar for accessing application windows. Windows 7 adds new features to the taskbar buttons that are discussed in the following sections.
Overlay Icons and Progress Indicators
You can use the QWinTaskbarButton class to set an overlay icon and the QWinTaskbarProgress class to display a progress indicator on a taskbar button. An overlay icon indicates change in the state of the application. A progress indicator shows how time-consuming tasks are progressing.
Taskbar Example
The following example code illustrates how to use the QWinTaskbarButton and QWinTaskbarProgress classes to adjust the look of the taskbar button:
QWinTaskbarButton *button = new QWinTaskbarButton(widget); button->setWindow(widget->windowHandle()); button->setOverlayIcon(QIcon(":/loading.png")); QWinTaskbarProgress *progress = button->progress(); progress->setVisible(true); progress->setValue(50);
Jump Lists
An application can use Jump Lists to provide users with faster access to files or to display shortcuts to tasks or commands.
- Destinations — categorized shortcuts to files and URLs that the application can handle and even links to other applications. Windows provides two standard categories that can be added to the custom Jump List, in addition to the ones that the application can create itself.
- Recent and Frequent — so called known categories that are populated automatically by Windows when the application uses the QFileDialog::getOpenFileName() function or when the application is launched to open a file from the Windows shell.
- Tasks — shortcuts to application functionality. An application can display its most frequently used context-independent functions on task lists.
Note: To be able to add destinations to its Jump Lists, the application should associate itself with the file types it can handle.
Jump List Example
The following example code illustrates how to use the classes in the QWinJumpList and QWinJumpListItem classes to implement Jump Lists:
QWinJumpList jumplist; QWinJumpListCategory *tasks = jumplist.tasks(); QWinJumpListItem *newProject = new QWinJumpListItem(QWinJumpListItem::Link); newProject->setTitle(tr("Create new project")); newProject->setFilePath(QDir::toNativeSeparators(QCoreApplication::applicationFilePath())); newProject->setArguments(QStringList("--new-project")); tasks->addItem(newProject); tasks->addLink(tr("Launch SDK Manager"), QDir::toNativeSeparators(QCoreApplication::applicationDirPath()) + "\\sdk-manager.exe"); tasks->setVisible(true);
Thumbnail Toolbar
Applications can embed a toolbar in the thumbnail of a window, which is shown when hovering over its taskbar icon. A thumbnail toolbar may provide quick access to the window's commands without requiring the user to restore or activate the window.
Thumbnail Toolbar Example
The following example code illustrates how to use the functions in the QWinThumbnailToolBar and QWinThumbnailToolButton class to implement a thumbnail toolbar:
QWinThumbnailToolBar *thumbbar = new QWinThumbnailToolBar(widget); thumbbar->setWindow(widget->windowHandle()); QWinThumbnailToolButton *settings = new QWinThumbnailToolButton(thumbbar); settings->setToolTip("Settings"); settings->setIcon(":/settings.png"); settings->setDismissOnClick(true); connect(settings, SIGNAL(clicked()), settingsPage, SLOT(show())); QWinThumbnailToolButton *playPause = new QWinThumbnailToolButton(thumbbar); playPause->setToolTip("Play/Pause"); playPause->setIcon(":/play.png"); connect(playPause, SIGNAL(clicked()), mediaPlayer, SLOT(play())); thumbbar->addButton(settings); thumbbar->addButton(playPause);
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.