Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qwindowstheme.cpp File Reference
#include <QtCore/qt_windows.h>
#include "qwindowstheme.h"
#include "qwindowsmenu.h"
#include "qwindowsdialoghelpers.h"
#include "qwindowscontext.h"
#include "qwindowsintegration.h"
#include "qwindowsscreen.h"
#include <commctrl.h>
#include <objbase.h>
#include <commoncontrols.h>
#include <shellapi.h>
#include <QtCore/qvariant.h>
#include <QtCore/qcoreapplication.h>
#include <QtCore/qdebug.h>
#include <QtCore/qsysinfo.h>
#include <QtCore/qcache.h>
#include <QtCore/qthread.h>
#include <QtCore/qmutex.h>
#include <QtCore/qwaitcondition.h>
#include <QtGui/qcolor.h>
#include <QtGui/qpalette.h>
#include <QtGui/qguiapplication.h>
#include <QtGui/qpainter.h>
#include <QtGui/qpixmapcache.h>
#include <qpa/qwindowsysteminterface.h>
#include <QtGui/private/qabstractfileiconengine_p.h>
#include <QtGui/private/qwindowsfontdatabase_p.h>
#include <private/qhighdpiscaling_p.h>
#include <private/qsystemlibrary_p.h>
#include <private/qwinregistry_p.h>
#include <QtCore/private/qfunctions_win_p.h>
#include <algorithm>
+ Include dependency graph for qwindowstheme.cpp:

Go to the source code of this file.

Classes

struct  QShGetFileInfoParams
 
class  QShGetFileInfoThread
 
class  FakePointer< T >
 
class  QWindowsFileIconEngine
 

Enumerations

enum  FileIconSize {
  SmallFileIcon , LargeFileIcon , ExtraLargeFileIcon , JumboFileIcon ,
  FileIconSizeCount
}
 
enum  { sHIL_EXTRALARGE = 0x2 , sHIL_JUMBO = 0x4 }
 

Functions

static bool booleanSystemParametersInfo (UINT what, bool defaultValue)
 
static DWORD dWordSystemParametersInfo (UINT what, DWORD defaultValue)
 
static QColor mixColors (const QColor &c1, const QColor &c2)
 
static QColor getSysColor (int index)
 
static bool shGetFileInfoBackground (const QString &fileName, DWORD attributes, SHFILEINFO *info, UINT flags, qint64 timeOutMSecs=5000)
 
static QPalette standardPalette ()
 
static QColor placeHolderColor (QColor textColor)
 
static QColor qt_accentColor ()
 
static void populateLightSystemBasePalette (QPalette &result)
 
static void populateDarkSystemBasePalette (QPalette &result)
 
static QPalette toolTipPalette (const QPalette &systemPalette, bool light)
 
static QPalette menuPalette (const QPalette &systemPalette, bool light)
 
static QPalettemenuBarPalette (const QPalette &menuPalette, bool light)
 
static QStringList iconThemeSearchPaths ()
 
static QStringList styleNames ()
 
static int uiEffects ()
 
QDebug operator<< (QDebug d, const NONCLIENTMETRICS &m)
 
Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON (HICON icon)
 
static QPixmap loadIconFromShell32 (int resourceId, QSizeF size)
 
static QString dirIconPixmapCacheKey (int iIcon, int iconSize, int imageListSize)
 
static QPixmap pixmapFromShellImageList (int iImageList, const SHFILEINFO &info)
 
static bool doUseNativeMenus ()
 

Variables

static int fileIconSizes [FileIconSizeCount]
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
sHIL_EXTRALARGE 
sHIL_JUMBO 

Definition at line 877 of file qwindowstheme.cpp.

◆ FileIconSize

Enumerator
SmallFileIcon 
LargeFileIcon 
ExtraLargeFileIcon 
JumboFileIcon 
FileIconSizeCount 

Definition at line 682 of file qwindowstheme.cpp.

Function Documentation

◆ booleanSystemParametersInfo()

static bool booleanSystemParametersInfo ( UINT  what,
bool  defaultValue 
)
inlinestatic

Definition at line 59 of file qwindowstheme.cpp.

Referenced by menuBarPalette(), menuPalette(), QWindowsTheme::queryHighContrast(), QWindowsTheme::themeHint(), and uiEffects().

+ Here is the caller graph for this function:

◆ dirIconPixmapCacheKey()

static QString dirIconPixmapCacheKey ( int  iIcon,
int  iconSize,
int  imageListSize 
)
static

Definition at line 882 of file qwindowstheme.cpp.

References iconSize, QString::number(), sHIL_EXTRALARGE, and sHIL_JUMBO.

Referenced by QWindowsFileIconEngine::filePixmap().

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

◆ doUseNativeMenus()

static bool doUseNativeMenus ( )
inlinestatic

Definition at line 1074 of file qwindowstheme.cpp.

References QWindowsIntegration::AlwaysUseNativeMenus, inherits(), QWindowsIntegration::instance(), QCoreApplication::instance(), QWindowsIntegration::NoNativeMenus, QWindowsIntegration::options(), and QGuiApplication::topLevelWindows().

Referenced by QWindowsTheme::useNativeMenus().

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

◆ dWordSystemParametersInfo()

static DWORD dWordSystemParametersInfo ( UINT  what,
DWORD  defaultValue 
)
inlinestatic

Definition at line 67 of file qwindowstheme.cpp.

Referenced by QWindowsTheme::themeHint().

+ Here is the caller graph for this function:

◆ getSysColor()

static QColor getSysColor ( int  index)
inlinestatic

Definition at line 82 of file qwindowstheme.cpp.

Referenced by menuBarPalette(), menuPalette(), populateDarkSystemBasePalette(), populateLightSystemBasePalette(), and toolTipPalette().

+ Here is the caller graph for this function:

◆ iconThemeSearchPaths()

static QStringList iconThemeSearchPaths ( )
inlinestatic

Definition at line 459 of file qwindowstheme.cpp.

References QFileInfo::absoluteFilePath(), QCoreApplication::applicationDirPath(), and QFileInfo::isDir().

Referenced by QWindowsTheme::themeHint().

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

◆ loadIconFromShell32()

static QPixmap loadIconFromShell32 ( int  resourceId,
QSizeF  size 
)
static

Definition at line 737 of file qwindowstheme.cpp.

References qt_pixmapFromWinHICON().

Referenced by QWindowsTheme::standardPixmap().

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

◆ menuBarPalette()

static QPalette * menuBarPalette ( const QPalette menuPalette,
bool  light 
)
inlinestatic

Definition at line 426 of file qwindowstheme.cpp.

References QPalette::Active, booleanSystemParametersInfo(), QPalette::Button, QPalette::Disabled, getSysColor(), QPalette::Inactive, menuPalette(), and SPI_GETFLATMENU.

+ Here is the call graph for this function:

◆ menuPalette()

static QPalette menuPalette ( const QPalette systemPalette,
bool  light 
)
inlinestatic

Definition at line 387 of file qwindowstheme.cpp.

References QPalette::Active, booleanSystemParametersInfo(), QPalette::Button, QPalette::ButtonText, QPalette::color(), QPalette::Dark, QPalette::Disabled, disabled, getSysColor(), QPalette::Highlight, QPalette::HighlightedText, QPalette::Inactive, SPI_GETFLATMENU, QPalette::Text, and QPalette::WindowText.

Referenced by menuBarPalette().

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

◆ mixColors()

static QColor mixColors ( const QColor c1,
const QColor c2 
)
inlinestatic

Definition at line 75 of file qwindowstheme.cpp.

References QColor::blue(), c2, QColor::green(), and QColor::red().

Referenced by QWindowsTheme::systemPalette(), and toolTipPalette().

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

◆ operator<<()

QDebug operator<< ( QDebug  d,
const NONCLIENTMETRICS &  m 
)

Definition at line 627 of file qwindowstheme.cpp.

References d, and QWindowsFontDatabase::debugFormat().

+ Here is the call graph for this function:

◆ pixmapFromShellImageList()

static QPixmap pixmapFromShellImageList ( int  iImageList,
const SHFILEINFO &  info 
)
static

Definition at line 920 of file qwindowstheme.cpp.

References IID, info, Q_UNUSED, and qt_pixmapFromWinHICON().

Referenced by QWindowsFileIconEngine::filePixmap().

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

◆ placeHolderColor()

static QColor placeHolderColor ( QColor  textColor)
static

Definition at line 218 of file qwindowstheme.cpp.

References QColor::setAlpha().

Referenced by populateDarkSystemBasePalette(), and populateLightSystemBasePalette().

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

◆ populateDarkSystemBasePalette()

static void populateDarkSystemBasePalette ( QPalette result)
static

Definition at line 293 of file qwindowstheme.cpp.

References QPalette::AccentColor, QPalette::All, QPalette::AlternateBase, QPalette::Base, Qt::black, QPalette::BrightText, QPalette::Button, QPalette::ButtonText, QPalette::Dark, QColor::darker(), getSysColor(), QPalette::Highlight, QPalette::HighlightedText, QPalette::Light, QColor::lighter(), QColor::lightness(), QPalette::Link, QPalette::LinkVisited, QPalette::Mid, QPalette::Midlight, placeHolderColor(), QPalette::PlaceholderText, qt_accentColor(), settings, QPalette::Shadow, QPalette::Text, QPalette::ToolTipBase, QPalette::ToolTipText, Qt::white, QPalette::Window, and QPalette::WindowText.

Referenced by QWindowsTheme::systemPalette().

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

◆ populateLightSystemBasePalette()

static void populateLightSystemBasePalette ( QPalette result)
static

Definition at line 244 of file qwindowstheme.cpp.

References QPalette::AccentColor, QPalette::Base, QPalette::BrightText, QPalette::Button, QPalette::ButtonText, QPalette::Dark, QColor::darker(), getSysColor(), QPalette::Highlight, QPalette::HighlightedText, QPalette::Inactive, QPalette::Light, QPalette::Link, QPalette::LinkVisited, QPalette::Mid, QPalette::Midlight, placeHolderColor(), QPalette::PlaceholderText, qt_accentColor(), settings, QPalette::Shadow, QPalette::Text, QPalette::Window, and QPalette::WindowText.

Referenced by QWindowsTheme::systemPalette().

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

◆ qt_accentColor()

static QColor qt_accentColor ( )
inlinestatic

Definition at line 224 of file qwindowstheme.cpp.

References QColor::alpha(), QColor::blue(), QColor::fromRgb(), QColor::fromRgba(), QColor::green(), QWinRegistryKey::isValid(), QColor::isValid(), QColor::red(), and QWinRegistryKey::value().

Referenced by populateDarkSystemBasePalette(), and populateLightSystemBasePalette().

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

◆ qt_pixmapFromWinHICON()

Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON ( HICON  icon)

Definition at line 645 of file qpixmap_win.cpp.

References QPixmap::fromImage(), and icon.

Referenced by QWindowsFileIconEngine::filePixmap(), loadIconFromShell32(), pixmapFromShellImageList(), and QWindowsTheme::standardPixmap().

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

◆ shGetFileInfoBackground()

static bool shGetFileInfoBackground ( const QString fileName,
DWORD  attributes,
SHFILEINFO *  info,
UINT  flags,
qint64  timeOutMSecs = 5000 
)
static

Definition at line 178 of file qwindowstheme.cpp.

References QShGetFileInfoThread::cancel(), fileName, info, qWarning, QShGetFileInfoThread::runWithParams(), and QThread::start().

Referenced by QWindowsFileIconEngine::filePixmap().

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

◆ standardPalette()

static QPalette standardPalette ( )
inlinestatic

Definition at line 202 of file qwindowstheme.cpp.

References QPalette::Base, Qt::black, QPalette::ButtonText, QColor::darker(), QPalette::Disabled, Qt::gray, QColor::lighter(), palette, QPalette::Text, Qt::white, and QPalette::WindowText.

Referenced by QWindowsTheme::systemPalette().

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

◆ styleNames()

static QStringList styleNames ( )
inlinestatic

Definition at line 465 of file qwindowstheme.cpp.

References QStringLiteral.

Referenced by QMacStyle::standardPalette(), QGenericUnixTheme::themeHint(), QGnomeTheme::themeHint(), and QWindowsTheme::themeHint().

+ Here is the caller graph for this function:

◆ toolTipPalette()

static QPalette toolTipPalette ( const QPalette systemPalette,
bool  light 
)
inlinestatic

Definition at line 357 of file qwindowstheme.cpp.

References QPalette::All, QPalette::Base, QPalette::BrightText, QPalette::Button, QPalette::button(), QPalette::ButtonText, QPalette::buttonText(), QBrush::color(), QColor::darker(), QPalette::Disabled, disabled, getSysColor(), mixColors(), QPalette::Text, QPalette::ToolTipBase, QPalette::ToolTipText, Qt::white, QPalette::Window, and QPalette::WindowText.

Referenced by qt_init_tooltip_palette().

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

◆ uiEffects()

static int uiEffects ( )
inlinestatic

Definition at line 470 of file qwindowstheme.cpp.

References QPlatformTheme::AnimateComboUiEffect, QPlatformTheme::AnimateMenuUiEffect, QPlatformTheme::AnimateTooltipUiEffect, booleanSystemParametersInfo(), QPlatformTheme::FadeMenuUiEffect, QPlatformTheme::GeneralUiEffect, QPlatformTheme::HoverEffect, SPI_GETCOMBOBOXANIMATION, SPI_GETMENUANIMATION, SPI_GETMENUFADE, SPI_GETTOOLTIPANIMATION, and SPI_GETUIEFFECTS.

Referenced by QWindowsTheme::themeHint().

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

Variable Documentation

◆ fileIconSizes

int fileIconSizes[FileIconSizeCount]
static

Definition at line 714 of file qwindowstheme.cpp.

Referenced by QWindowsFileIconEngine::filePixmap().