![]() |
Qt 6.x
The Qt SDK
|
The QGtk3Interface class centralizes communication with the GTK3 library. More...
#include <qgtk3interface_p.h>
Public Types | |
enum class | QGtkWidget { gtk_menu_bar , gtk_menu , gtk_button , gtk_button_box , gtk_check_button , gtk_radio_button , gtk_frame , gtk_statusbar , gtk_entry , gtk_popup , gtk_notebook , gtk_toolbar , gtk_tree_view , gtk_combo_box , gtk_combo_box_text , gtk_progress_bar , gtk_fixed , gtk_separator_menu_item , gtk_Default , gtk_offscreen_window } |
enum class | QGtkColorSource { Foreground , Background , Text , Base , Border } |
enum class | QGtkColorDefault { Foreground , Background , Border } |
Public Member Functions | |
QGtk3Interface (QGtk3Storage *) | |
~QGtk3Interface () | |
QBrush | brush (QGtkWidget wtype, QGtkColorSource source, GtkStateFlags state) const |
Create a QBrush from a GTK widget. | |
QImage | standardPixmap (QPlatformTheme::StandardPixmap standardPixmap) const |
Returns a QImage corresponding to. | |
QFont | font (QPlatformTheme::Font type) const |
Return a GTK styled font. | |
QIcon | fileIcon (const QFileInfo &fileInfo) const |
Returns a GTK styled file icon for. | |
const QString | themeName () const |
Returns the name of the current GTK theme. | |
Qt::ColorScheme | colorSchemeByColors () const |
Determine color scheme by colors. | |
Static Public Member Functions | |
static int | toGtkState (const QString &state) |
Converts a string into the GtkStateFlags enum. | |
static const QLatin1String | fromGtkState (GtkStateFlags state) |
Returns. | |
The QGtk3Interface class centralizes communication with the GTK3 library.
By encapsulating all GTK version specific syntax and conversions, it makes Qt's GTK theme independent from GTK versions.
Definition at line 53 of file qgtk3interface_p.h.
|
strong |
Enumerator | |
---|---|
Foreground | |
Background | |
Border |
Definition at line 121 of file qgtk3interface_p.h.
|
strong |
Enumerator | |
---|---|
Foreground | |
Background | |
Text | |
Base | |
Border |
Definition at line 100 of file qgtk3interface_p.h.
|
strong |
Definition at line 67 of file qgtk3interface_p.h.
QGtk3Interface::QGtk3Interface | ( | QGtk3Storage * | s | ) |
Definition at line 29 of file qgtk3interface.cpp.
References QGtk3Storage::handleThemeChange(), m_storage, qCDebug, and settings.
QGtk3Interface::~QGtk3Interface | ( | ) |
Definition at line 56 of file qgtk3interface.cpp.
References m_storage.
QBrush QGtk3Interface::brush | ( | QGtkWidget | wtype, |
QGtkColorSource | source, | ||
GtkStateFlags | state | ||
) | const |
Create a QBrush from a GTK widget.
Returns a QBrush corresponding to GTK widget type
wtype |
param source and
state. |
Brush height and width is ignored in GTK3, because brush assets (e.g. 9-patches) can't be accessed by the GTK3 API. It's therefore unknown, if the brush relates only to colors, or to a pixmap based style.
Definition at line 467 of file qgtk3interface.cpp.
Qt::ColorScheme QGtk3Interface::colorSchemeByColors | ( | ) | const |
Determine color scheme by colors.
Returns the color scheme of the current GTK theme, heuristically determined by the lightness difference between default background and foreground colors.
Definition at line 498 of file qgtk3interface.cpp.
References Background, Qt::Dark, Foreground, gtk_Default, Qt::Light, QColor::lightness(), Qt::Unknown, and widget.
Returns a GTK styled file icon for.
fileInfo. |
Definition at line 660 of file qgtk3interface.cpp.
References QFileInfo::absoluteFilePath(), QByteArray::constData(), file, QPixmap::fromImage(), icon, info, and QString::toLatin1().
QFont QGtk3Interface::font | ( | QPlatformTheme::Font | type | ) | const |
Return a GTK styled font.
Returns the QFont corresponding to
type | by reading the corresponding GTK widget type's font. |
Definition at line 601 of file qgtk3interface.cpp.
References con, context, QFont::family(), QPlatformTheme::FixedFont, font, QString::fromLatin1(), QString::isEmpty(), qCDebug, QFont::setFamily(), QFont::setFixedPitch(), QFont::setPointSizeF(), QFont::setStyle(), and widget.
|
static |
Returns.
state | converted into a string. |
Definition at line 105 of file qgtk3interface.cpp.
References CONVERT, and state.
Referenced by QGtk3Json::fromGtkState().
QImage QGtk3Interface::standardPixmap | ( | QPlatformTheme::StandardPixmap | standardPixmap | ) | const |
Returns a QImage corresponding to.
standardPixmap. |
A QImage (not a QPixmap) is returned so it can be cached and re-scaled in case the pixmap is requested multiple times with different resolutions.
Definition at line 159 of file qgtk3interface.cpp.
References QPlatformTheme::ArrowBack, QPlatformTheme::ArrowDown, QPlatformTheme::ArrowForward, QPlatformTheme::ArrowLeft, QPlatformTheme::ArrowRight, QPlatformTheme::ArrowUp, QPlatformTheme::BrowserReload, QPlatformTheme::BrowserStop, QPlatformTheme::CommandLink, QPlatformTheme::ComputerIcon, QPlatformTheme::CustomBase, QPlatformTheme::DesktopIcon, QPlatformTheme::DialogAbortButton, QPlatformTheme::DialogApplyButton, QPlatformTheme::DialogCancelButton, QPlatformTheme::DialogCloseButton, QPlatformTheme::DialogDiscardButton, QPlatformTheme::DialogHelpButton, QPlatformTheme::DialogIgnoreButton, QPlatformTheme::DialogNoButton, QPlatformTheme::DialogNoToAllButton, QPlatformTheme::DialogOkButton, QPlatformTheme::DialogOpenButton, QPlatformTheme::DialogResetButton, QPlatformTheme::DialogRetryButton, QPlatformTheme::DialogSaveAllButton, QPlatformTheme::DialogSaveButton, QPlatformTheme::DialogYesButton, QPlatformTheme::DialogYesToAllButton, QPlatformTheme::DirClosedIcon, QPlatformTheme::DirHomeIcon, QPlatformTheme::DirIcon, QPlatformTheme::DirLinkIcon, QPlatformTheme::DirLinkOpenIcon, QPlatformTheme::DirOpenIcon, QPlatformTheme::DockWidgetCloseButton, QPlatformTheme::DriveCDIcon, QPlatformTheme::DriveDVDIcon, QPlatformTheme::DriveFDIcon, QPlatformTheme::DriveHDIcon, QPlatformTheme::DriveNetIcon, QPlatformTheme::FileDialogBack, QPlatformTheme::FileDialogContentsView, QPlatformTheme::FileDialogDetailedView, QPlatformTheme::FileDialogEnd, QPlatformTheme::FileDialogInfoView, QPlatformTheme::FileDialogListView, QPlatformTheme::FileDialogNewFolder, QPlatformTheme::FileDialogStart, QPlatformTheme::FileDialogToParent, QPlatformTheme::FileIcon, QPlatformTheme::FileLinkIcon, QPlatformTheme::LineEditClearButton, QPlatformTheme::MediaPause, QPlatformTheme::MediaPlay, QPlatformTheme::MediaSeekBackward, QPlatformTheme::MediaSeekForward, QPlatformTheme::MediaSkipBackward, QPlatformTheme::MediaSkipForward, QPlatformTheme::MediaStop, QPlatformTheme::MediaVolume, QPlatformTheme::MediaVolumeMuted, QPlatformTheme::MessageBoxCritical, QPlatformTheme::MessageBoxInformation, QPlatformTheme::MessageBoxQuestion, QPlatformTheme::MessageBoxWarning, QPlatformTheme::NStandardPixmap, QPlatformTheme::RestoreDefaultsButton, standardPixmap(), QPlatformTheme::TabCloseButton, QPlatformTheme::TitleBarCloseButton, QPlatformTheme::TitleBarContextHelpButton, QPlatformTheme::TitleBarMaxButton, QPlatformTheme::TitleBarMenuButton, QPlatformTheme::TitleBarMinButton, QPlatformTheme::TitleBarNormalButton, QPlatformTheme::TitleBarShadeButton, QPlatformTheme::TitleBarUnshadeButton, QPlatformTheme::ToolBarHorizontalExtensionButton, QPlatformTheme::ToolBarVerticalExtensionButton, QPlatformTheme::TrashIcon, and QPlatformTheme::VistaShield.
Referenced by standardPixmap().
const QString QGtk3Interface::themeName | ( | ) | const |
Returns the name of the current GTK theme.
Definition at line 478 of file qgtk3interface.cpp.
References settings.
|
static |
Converts a string into the GtkStateFlags enum.
Converts a string formatted GTK color
state | into an enum value. Returns an integer corresponding to GtkStateFlags. Returns -1 if |
state | does not correspond to a valid enum key. |
Definition at line 74 of file qgtk3interface.cpp.
References CONVERT.
Referenced by QGtk3Json::toGtkState().