Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QWindowsTheme Class Reference

#include <qwindowstheme.h>

+ Inheritance diagram for QWindowsTheme:
+ Collaboration diagram for QWindowsTheme:

Public Member Functions

 QWindowsTheme ()
 
 ~QWindowsTheme () override
 
bool usePlatformNativeDialog (DialogType type) const override
 
QPlatformDialogHelpercreatePlatformDialogHelper (DialogType type) const override
 
QVariant themeHint (ThemeHint) const override
 
Qt::ColorScheme colorScheme () const override
 
const QPalettepalette (Palette type=SystemPalette) const override
 
const QFontfont (Font type=SystemFont) const override
 
QPixmap standardPixmap (StandardPixmap sp, const QSizeF &size) const override
 
QIcon fileIcon (const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions={}) const override
 Return an icon for fileInfo, observing iconOptions.
 
void windowsThemeChanged (QWindow *window)
 
void displayChanged ()
 
QList< QSizeavailableFileIconSizes () const
 
QPlatformMenuItemcreatePlatformMenuItem () const override
 
QPlatformMenucreatePlatformMenu () const override
 
QPlatformMenuBarcreatePlatformMenuBar () const override
 
void showPlatformMenuBar () override
 
void refreshFonts ()
 
void refresh ()
 
- Public Member Functions inherited from QPlatformTheme
 Q_ENUM (DialogType)
 
 QPlatformTheme ()
 
virtual ~QPlatformTheme ()
 
virtual QPlatformMenuItemcreatePlatformMenuItem () const
 
virtual QPlatformMenucreatePlatformMenu () const
 
virtual QPlatformMenuBarcreatePlatformMenuBar () const
 
virtual void showPlatformMenuBar ()
 
virtual bool usePlatformNativeDialog (DialogType type) const
 
virtual QPlatformDialogHelpercreatePlatformDialogHelper (DialogType type) const
 
virtual QPlatformSystemTrayIconcreatePlatformSystemTrayIcon () const
 Factory function for QSystemTrayIcon.
 
virtual Qt::ColorScheme colorScheme () const
 
virtual const QPalettepalette (Palette type=SystemPalette) const
 
virtual const QFontfont (Font type=SystemFont) const
 
virtual QVariant themeHint (ThemeHint hint) const
 
virtual QPixmap standardPixmap (StandardPixmap sp, const QSizeF &size) const
 
virtual QIcon fileIcon (const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions={ }) const
 Return an icon for fileInfo, observing iconOptions.
 
virtual QIconEnginecreateIconEngine (const QString &iconName) const
 Factory function for the QIconEngine used by QIcon::fromTheme().
 
virtual QString standardButtonText (int button) const
 Returns the text of a standard button.
 
QString name () const
 

Static Public Member Functions

static QWindowsThemeinstance ()
 
static bool useNativeMenus ()
 
static bool queryDarkMode ()
 
static bool queryHighContrast ()
 
static QPalette systemPalette (Qt::ColorScheme)
 
- Static Public Member Functions inherited from QPlatformTheme
static QVariant defaultThemeHint (ThemeHint hint)
 
static QString defaultStandardButtonText (int button)
 
static QString removeMnemonics (const QString &original)
 

Static Public Attributes

static const char * name = "windows"
 

Additional Inherited Members

- Public Types inherited from QPlatformTheme
enum  ThemeHint {
  CursorFlashTime , KeyboardInputInterval , MouseDoubleClickInterval , StartDragDistance ,
  StartDragTime , KeyboardAutoRepeatRate , PasswordMaskDelay , StartDragVelocity ,
  TextCursorWidth , DropShadow , MaximumScrollBarDragDistance , ToolButtonStyle ,
  ToolBarIconSize , ItemViewActivateItemOnSingleClick , SystemIconThemeName , SystemIconFallbackThemeName ,
  IconThemeSearchPaths , StyleNames , WindowAutoPlacement , DialogButtonBoxLayout ,
  DialogButtonBoxButtonsHaveIcons , UseFullScreenForPopupMenu , KeyboardScheme , UiEffects ,
  SpellCheckUnderlineStyle , TabFocusBehavior , IconPixmapSizes , PasswordMaskCharacter ,
  DialogSnapToDefaultButton , ContextMenuOnMouseRelease , MousePressAndHoldInterval , MouseDoubleClickDistance ,
  WheelScrollLines , TouchDoubleTapDistance , ShowShortcutsInContextMenus , IconFallbackSearchPaths ,
  MouseQuickSelectionThreshold , InteractiveResizeAcrossScreens , ShowDirectoriesFirst , PreselectFirstFileInDirectory ,
  ButtonPressKeys , SetFocusOnTouchRelease , FlickStartDistance , FlickMaximumVelocity ,
  FlickDeceleration , MenuBarFocusOnAltPressRelease , MouseCursorTheme , MouseCursorSize ,
  UnderlineShortcut
}
 This enum describes the available theme hints. More...
 
enum  DialogType { FileDialog , ColorDialog , FontDialog , MessageDialog }
 
enum  Palette {
  SystemPalette , ToolTipPalette , ToolButtonPalette , ButtonPalette ,
  CheckBoxPalette , RadioButtonPalette , HeaderPalette , ComboBoxPalette ,
  ItemViewPalette , MessageBoxLabelPelette , MessageBoxLabelPalette = MessageBoxLabelPelette , TabBarPalette ,
  LabelPalette , GroupBoxPalette , MenuPalette , MenuBarPalette ,
  TextEditPalette , TextLineEditPalette , NPalettes
}
 
enum  Font {
  SystemFont , MenuFont , MenuBarFont , MenuItemFont ,
  MessageBoxFont , LabelFont , TipLabelFont , StatusBarFont ,
  TitleBarFont , MdiSubWindowTitleFont , DockWidgetTitleFont , PushButtonFont ,
  CheckBoxFont , RadioButtonFont , ToolButtonFont , ItemViewFont ,
  ListViewFont , HeaderViewFont , ListBoxFont , ComboMenuItemFont ,
  ComboLineEditFont , SmallFont , MiniFont , FixedFont ,
  GroupBoxTitleFont , TabButtonFont , EditorFont , NFonts
}
 
enum  StandardPixmap {
  TitleBarMenuButton , TitleBarMinButton , TitleBarMaxButton , TitleBarCloseButton ,
  TitleBarNormalButton , TitleBarShadeButton , TitleBarUnshadeButton , TitleBarContextHelpButton ,
  DockWidgetCloseButton , MessageBoxInformation , MessageBoxWarning , MessageBoxCritical ,
  MessageBoxQuestion , DesktopIcon , TrashIcon , ComputerIcon ,
  DriveFDIcon , DriveHDIcon , DriveCDIcon , DriveDVDIcon ,
  DriveNetIcon , DirOpenIcon , DirClosedIcon , DirLinkIcon ,
  DirLinkOpenIcon , FileIcon , FileLinkIcon , ToolBarHorizontalExtensionButton ,
  ToolBarVerticalExtensionButton , FileDialogStart , FileDialogEnd , FileDialogToParent ,
  FileDialogNewFolder , FileDialogDetailedView , FileDialogInfoView , FileDialogContentsView ,
  FileDialogListView , FileDialogBack , DirIcon , DialogOkButton ,
  DialogCancelButton , DialogHelpButton , DialogOpenButton , DialogSaveButton ,
  DialogCloseButton , DialogApplyButton , DialogResetButton , DialogDiscardButton ,
  DialogYesButton , DialogNoButton , ArrowUp , ArrowDown ,
  ArrowLeft , ArrowRight , ArrowBack , ArrowForward ,
  DirHomeIcon , CommandLink , VistaShield , BrowserReload ,
  BrowserStop , MediaPlay , MediaStop , MediaPause ,
  MediaSkipForward , MediaSkipBackward , MediaSeekForward , MediaSeekBackward ,
  MediaVolume , MediaVolumeMuted , LineEditClearButton , DialogYesToAllButton ,
  DialogNoToAllButton , DialogSaveAllButton , DialogAbortButton , DialogRetryButton ,
  DialogIgnoreButton , RestoreDefaultsButton , TabCloseButton , NStandardPixmap ,
  CustomBase = 0xf0000000
}
 
enum  KeyboardSchemes {
  WindowsKeyboardScheme , MacKeyboardScheme , X11KeyboardScheme , KdeKeyboardScheme ,
  GnomeKeyboardScheme , CdeKeyboardScheme
}
 
enum  UiEffect {
  GeneralUiEffect = 0x1 , AnimateMenuUiEffect = 0x2 , FadeMenuUiEffect = 0x4 , AnimateComboUiEffect = 0x8 ,
  AnimateTooltipUiEffect = 0x10 , FadeTooltipUiEffect = 0x20 , AnimateToolBoxUiEffect = 0x40 , HoverEffect = 0x80
}
 
enum  IconOption { DontUseCustomDirectoryIcons = 0x01 }
 
- Protected Member Functions inherited from QPlatformTheme
 QPlatformTheme (QPlatformThemePrivate *priv)
 
- Protected Attributes inherited from QPlatformTheme
QScopedPointer< QPlatformThemePrivated_ptr
 

Detailed Description

Definition at line 18 of file qwindowstheme.h.

Constructor & Destructor Documentation

◆ QWindowsTheme()

QWindowsTheme::QWindowsTheme ( )

Definition at line 443 of file qwindowstheme.cpp.

References QPlatformTheme::NFonts, QPlatformTheme::NPalettes, and refresh().

+ Here is the call graph for this function:

◆ ~QWindowsTheme()

QWindowsTheme::~QWindowsTheme ( )
override

Definition at line 452 of file qwindowstheme.cpp.

Member Function Documentation

◆ availableFileIconSizes()

QList< QSize > QWindowsTheme::availableFileIconSizes ( ) const
inline

Definition at line 48 of file qwindowstheme.h.

Referenced by QWindowsFileIconEngine::availableSizes().

+ Here is the caller graph for this function:

◆ colorScheme()

Qt::ColorScheme QWindowsTheme::colorScheme ( ) const
overridevirtual

Reimplemented from QPlatformTheme.

Definition at line 530 of file qwindowstheme.cpp.

References Qt::Dark, QWindowsContext::isDarkMode(), and Qt::Light.

Referenced by systemPalette().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createPlatformDialogHelper()

QPlatformDialogHelper * QWindowsTheme::createPlatformDialogHelper ( DialogType  type) const
overridevirtual

Reimplemented from QPlatformTheme.

Definition at line 696 of file qwindowstheme.cpp.

References QWindowsDialogs::createHelper().

+ Here is the call graph for this function:

◆ createPlatformMenu()

QPlatformMenu * QWindowsTheme::createPlatformMenu ( ) const
overridevirtual

Reimplemented from QPlatformTheme.

Definition at line 1119 of file qwindowstheme.cpp.

References qCDebug, and useNativeMenus().

+ Here is the call graph for this function:

◆ createPlatformMenuBar()

QPlatformMenuBar * QWindowsTheme::createPlatformMenuBar ( ) const
overridevirtual

Reimplemented from QPlatformTheme.

Definition at line 1129 of file qwindowstheme.cpp.

References qCDebug, and useNativeMenus().

+ Here is the call graph for this function:

◆ createPlatformMenuItem()

QPlatformMenuItem * QWindowsTheme::createPlatformMenuItem ( ) const
overridevirtual

Reimplemented from QPlatformTheme.

Definition at line 1113 of file qwindowstheme.cpp.

References qCDebug, and useNativeMenus().

+ Here is the call graph for this function:

◆ displayChanged()

void QWindowsTheme::displayChanged ( )
inline

Definition at line 46 of file qwindowstheme.h.

◆ fileIcon()

QIcon QWindowsTheme::fileIcon ( const QFileInfo fileInfo,
QPlatformTheme::IconOptions  iconOptions = {} 
) const
overridevirtual

Return an icon for fileInfo, observing iconOptions.

This function is queried by QFileIconProvider and similar classes to obtain an icon for a file. If it does not return a non-null icon, fileIconPixmap() is queried for a specific size.

Since
5.8

Reimplemented from QPlatformTheme.

Definition at line 1069 of file qwindowstheme.cpp.

◆ font()

const QFont * QWindowsTheme::font ( Font  type = SystemFont) const
inlineoverridevirtual

Reimplemented from QPlatformTheme.

Definition at line 38 of file qwindowstheme.h.

◆ instance()

static QWindowsTheme * QWindowsTheme::instance ( )
inlinestatic

Definition at line 25 of file qwindowstheme.h.

Referenced by QWindowsFileIconEngine::availableSizes(), QWindowsScreenManager::handleScreenChanges(), qDisplayChangeObserverWndProc(), and QWindowsContext::windowsProc().

+ Here is the caller graph for this function:

◆ palette()

const QPalette * QWindowsTheme::palette ( Palette  type = SystemPalette) const
inlineoverridevirtual

Reimplemented from QPlatformTheme.

Definition at line 36 of file qwindowstheme.h.

◆ queryDarkMode()

bool QWindowsTheme::queryDarkMode ( )
static

Definition at line 1098 of file qwindowstheme.cpp.

References QWinRegistryKey::dwordValue(), and queryHighContrast().

Referenced by QWindowsContextPrivate::QWindowsContextPrivate(), and QWindowsContext::windowsProc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ queryHighContrast()

bool QWindowsTheme::queryHighContrast ( )
static

Definition at line 1108 of file qwindowstheme.cpp.

References booleanSystemParametersInfo().

Referenced by queryDarkMode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ refresh()

void QWindowsTheme::refresh ( )

Definition at line 620 of file qwindowstheme.cpp.

References refreshFonts().

Referenced by QWindowsTheme(), QWindowsContext::windowsProc(), and windowsThemeChanged().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ refreshFonts()

void QWindowsTheme::refreshFonts ( )

Definition at line 648 of file qwindowstheme.cpp.

References QGuiApplication::desktopSettingsAware(), QPlatformTheme::DockWidgetTitleFont, QPlatformTheme::FixedFont, QPlatformTheme::ItemViewFont, QWindowsFontDatabaseBase::LOGFONT_to_QFont(), QPlatformTheme::MdiSubWindowTitleFont, QPlatformTheme::MenuBarFont, QPlatformTheme::MenuFont, QPlatformTheme::MessageBoxFont, QWindowsContext::nonClientMetrics(), QFont::pointSize(), qCDebug, QStringLiteral, QFont::setStyleHint(), QPlatformTheme::StatusBarFont, QWindowsFontDatabaseBase::systemDefaultFont(), QPlatformTheme::SystemFont, QPlatformTheme::TipLabelFont, and QFont::TypeWriter.

Referenced by refresh().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showPlatformMenuBar()

void QWindowsTheme::showPlatformMenuBar ( )
overridevirtual

Reimplemented from QPlatformTheme.

Definition at line 1135 of file qwindowstheme.cpp.

References qCDebug.

◆ standardPixmap()

◆ systemPalette()

QPalette QWindowsTheme::systemPalette ( Qt::ColorScheme  colorScheme)
static

Definition at line 573 of file qwindowstheme.cpp.

References QPalette::AccentColor, QPalette::Base, QPalette::ButtonText, colorScheme(), Qt::Dark, QPalette::Disabled, disabled, QPalette::Highlight, QPalette::HighlightedText, QPalette::Inactive, Qt::Light, mixColors(), populateDarkSystemBasePalette(), populateLightSystemBasePalette(), qFatal, standardPalette(), QPalette::Text, QPalette::Window, and QPalette::WindowText.

Referenced by QWindowsApplication::populateLightSystemPalette().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ themeHint()

◆ useNativeMenus()

bool QWindowsTheme::useNativeMenus ( )
static

Definition at line 1092 of file qwindowstheme.cpp.

References doUseNativeMenus().

Referenced by QWindowsSystemTrayIcon::createMenu(), createPlatformMenu(), createPlatformMenuBar(), and createPlatformMenuItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ usePlatformNativeDialog()

bool QWindowsTheme::usePlatformNativeDialog ( DialogType  type) const
overridevirtual

Reimplemented from QPlatformTheme.

Definition at line 691 of file qwindowstheme.cpp.

References QWindowsDialogs::useHelper().

+ Here is the call graph for this function:

◆ windowsThemeChanged()

void QWindowsTheme::windowsThemeChanged ( QWindow window)

Definition at line 708 of file qwindowstheme.cpp.

References QWindowSystemInterface::handleThemeChange(), refresh(), and window().

+ Here is the call graph for this function:

Member Data Documentation

◆ name

const char * QWindowsTheme::name = "windows"
static

The documentation for this class was generated from the following files: