Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QGtk3Storage Class Reference

#include <qgtk3storage_p.h>

Collaboration diagram for QGtk3Storage:

Classes

struct  FixedSource
struct  Gtk3Source
struct  MixSources
struct  RecursiveSource
struct  Source
struct  TargetBrush

Public Types

enum class  SourceType {
  Gtk , Fixed , Modified , Mixed ,
  Invalid
}
 This enum represents the type of a color source. More...
typedef QFlatMap< TargetBrush, SourceBrushMap
typedef QFlatMap< QPlatformTheme::Palette, BrushMapPaletteMap

Public Member Functions

 QGtk3Storage ()
 ~QGtk3Storage ()
const QPalettepalette (QPlatformTheme::Palette=QPlatformTheme::SystemPalette) const
 Return a GTK styled QPalette.
QPixmap standardPixmap (QPlatformTheme::StandardPixmap standardPixmap, const QSizeF &size) const
 Return a GTK styled standard pixmap if available.
Qt::ColorScheme colorScheme () const
const QString themeName () const
const QFontfont (QPlatformTheme::Font type) const
 Return a GTK styled font.
QIcon fileIcon (const QFileInfo &fileInfo) const
 Returns a GTK styled file icon corresponding to.
void populateMap ()
 Populates a map with information about how to locate colors in GTK.
void handleThemeChange ()
 Handles a theme change at runtime.

Static Public Member Functions

static QPalette standardPalette ()
 Returns a simple, hard coded base palette.

Detailed Description

Definition at line 36 of file qgtk3storage_p.h.

Member Typedef Documentation

◆ BrushMap

Definition at line 225 of file qgtk3storage_p.h.

◆ PaletteMap

Member Enumeration Documentation

◆ SourceType

enum class QGtk3Storage::SourceType
strong

This enum represents the type of a color source.

\value Gtk Color is read from a GTK widget \value Fixed A fixed brush is specified \value Modified The color is a modification of another color (fixed or read from GTK) \omitvalue Invalid

Enumerator
Gtk 
Fixed 
Modified 
Mixed 
Invalid 

Definition at line 44 of file qgtk3storage_p.h.

Constructor & Destructor Documentation

◆ QGtk3Storage()

QT_BEGIN_NAMESPACE QGtk3Storage::QGtk3Storage ( )

Definition at line 25 of file qgtk3storage.cpp.

◆ ~QGtk3Storage()

QGtk3Storage::~QGtk3Storage ( )

Definition at line 34 of file qgtk3storage.cpp.

Member Function Documentation

◆ colorScheme()

Qt::ColorScheme QGtk3Storage::colorScheme ( ) const
inline

Definition at line 233 of file qgtk3storage_p.h.

◆ fileIcon()

QIcon QGtk3Storage::fileIcon ( const QFileInfo & fileInfo) const

Returns a GTK styled file icon corresponding to.

Parameters
fileInfo.

Definition at line 281 of file qgtk3storage.cpp.

◆ font()

const QFont * QGtk3Storage::font ( QPlatformTheme::Font type) const

Return a GTK styled font.

Returns a QFont of

Parameters
type,styledaccording to the current GTK theme.

Definition at line 244 of file qgtk3storage.cpp.

◆ handleThemeChange()

void QGtk3Storage::handleThemeChange ( )

Handles a theme change at runtime.

Clear all caches, re-populate with current GTK theme and notify the window system interface. This method is a callback for the theme change signal sent from GTK.

Definition at line 308 of file qgtk3storage.cpp.

References populateMap().

Referenced by QGtk3Interface::QGtk3Interface().

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

◆ palette()

const QPalette * QGtk3Storage::palette ( QPlatformTheme::Palette type = QPlatformTheme::SystemPalette) const

Return a GTK styled QPalette.

Returns the pointer to a (cached) QPalette for

Parameters
type,withits brushes populated according to the current GTK theme.

Definition at line 184 of file qgtk3storage.cpp.

◆ populateMap()

void QGtk3Storage::populateMap ( )

Populates a map with information about how to locate colors in GTK.

This method creates a data structure to locate color information for each brush of a QPalette within GTK. The structure can hold mapping information for each QPlatformTheme::Palette enum value. If no specific mapping is stored for an enum value, the system palette is returned instead of a specific one. If no mapping is stored for the system palette, it will fall back to QGtk3Storage::standardPalette.

The method will populate the data structure with a standard mapping, covering the following palette types: \list

The method will check the environment variable {{QT_GUI_GTK_JSON_SAVE}}. If it points to a valid path with write access, it will write the standard mapping into a Json file. That Json file can be modified and/or extended. The Json syntax is

If the environment variable {{QT_GUI_GTK_JSON_HARDCODED}} contains the keyword true, all sources are converted to fixed sources. In that case, they contain the hard coded HexRGBA values read from GTK.

The method will also check the environment variable {{QT_GUI_GTK_JSON}}. If it points to a valid Json file with read access, it will be parsed instead of creating a standard mapping. Parsing errors will be printed out with qCInfo if the logging category {{qt.qpa.gtk}} is activated. In case of a parsing error, the method will fall back to creating a standard mapping.

Note
If a Json file contains only fixed brushes (e.g. exported with {{QT_GUI_GTK_JSON_HARDCODED=true}}), no colors will be imported from GTK.

Definition at line 362 of file qgtk3storage.cpp.

Referenced by handleThemeChange().

Here is the caller graph for this function:

◆ standardPalette()

QPalette QGtk3Storage::standardPalette ( )
static

Returns a simple, hard coded base palette.

Create a hard coded palette with default colors as a fallback for any color that can't be obtained from GTK.

Note
This palette will be used as a default baseline for the system palette, which then will be used as a default baseline for any other palette type.

Definition at line 161 of file qgtk3storage.cpp.

◆ standardPixmap()

QPixmap QGtk3Storage::standardPixmap ( QPlatformTheme::StandardPixmap standardPixmap,
const QSizeF & size ) const

Return a GTK styled standard pixmap if available.

Returns a pixmap specified by

Parameters
standardPixmapand
size.Returns an empty pixmap if GTK doesn't support the requested one.

Definition at line 260 of file qgtk3storage.cpp.

◆ themeName()

const QString QGtk3Storage::themeName ( ) const
inline

Definition at line 235 of file qgtk3storage_p.h.


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