8#include <QtCore/QOperatingSystemVersion>
9#include <QtCore/QVariant>
17#include <QtCore/qfileinfo.h>
18#include <QtCore/private/qcore_mac_p.h>
19#include <QtGui/private/qfont_p.h>
20#include <QtGui/private/qguiapplication_p.h>
21#include <QtGui/private/qcoregraphics_p.h>
22#include <QtGui/qpainter.h>
23#include <QtGui/qtextformat.h>
24#include <QtGui/private/qcoretextfontdatabase_p.h>
25#include <QtGui/private/qfontengine_coretext_p.h>
26#include <QtGui/private/qabstractfileiconengine_p.h>
27#include <qpa/qplatformdialoghelper.h>
28#include <qpa/qplatformintegration.h>
29#include <qpa/qplatformnativeinterface.h>
36#include <CoreServices/CoreServices.h>
67 const auto inactiveHighlight =
qt_mac_toQBrush([NSColor unemphasizedSelectedContentBackgroundColor]);
112#define MAC_PALETTE_ENTRY(pal, active, inactive) \
113 QMacPaletteMap(pal, [NSColor active], [NSColor inactive])
129#undef MAC_PALETTE_ENTRY
158 auto selectedMenuItemColor = [[NSColor controlAccentColor] highlightWithLevel:0.3];
177 NSArray<NSColor *> *baseColors = nil;
178 NSColor *activeHighlightColor = nil;
179 baseColors = [NSColor alternatingContentBackgroundColors];
180 activeHighlightColor = [NSColor selectedContentBackgroundColor];
218 NSAppearance.currentAppearance = NSApp.effectiveAppearance;
224 NSSystemColorsDidChangeNotification, [
this] {
236 delete m_systemPalette;
237 m_systemPalette =
nullptr;
253 QWindowSystemInterface::handleThemeChange<QWindowSystemInterface::SynchronousDelivery>();
258 switch (dialogType) {
271 switch (dialogType) {
285#ifndef QT_NO_SYSTEMTRAYICON
288 return new QCocoaSystemTrayIcon;
295 if (!m_systemPalette)
297 return m_systemPalette;
309 const auto *coreTextFontDatabase =
static_cast<QCoreTextFontDatabase *
>(platformIntegration->fontDatabase());
322 CGAffineTransform old_xform = CGContextGetCTM(
ctx);
323 CGContextConcatCTM(
ctx, CGAffineTransformInvert(old_xform));
324 CGContextConcatCTM(
ctx, CGAffineTransformIdentity);
327 b.blue =
b.green =
b.red = 255*255;
328 PlotIconRefInContext(
ctx, &
rect, kAlignNone, kTransformNone, &
b, kPlotIconRefNormalFlags,
icon);
337 iconType = kQuestionMarkIcon;
340 iconType = kAlertNoteIcon;
343 iconType = kAlertCautionIcon;
346 iconType = kAlertStopIcon;
349 iconType = kDesktopIcon;
352 iconType = kTrashIcon;
355 iconType = kComputerIcon;
358 iconType = kGenericFloppyIcon;
361 iconType = kGenericHardDiskIcon;
365 iconType = kGenericCDROMIcon;
368 iconType = kGenericNetworkIcon;
371 iconType = kOpenFolderIcon;
375 iconType = kGenericFolderIcon;
379 iconType = kGenericDocumentIcon;
386 IconRef
icon =
nullptr;
404 QPlatformTheme::IconOptions opts) :
409 const qreal devicePixelRatio =
qGuiApp->devicePixelRatio();
410 const int sizes[] = {
411 qRound(16 * devicePixelRatio),
qRound(32 * devicePixelRatio),
412 qRound(64 * devicePixelRatio),
qRound(128 * devicePixelRatio),
413 qRound(256 * devicePixelRatio)
429 return qt_mac_toQPixmap(iconImage,
size);
448 return QVariant([[NSApplication sharedApplication] isFullKeyboardAccessEnabled] ?
459 return QVariant(
bool([[NSApplication sharedApplication] presentationOptions] & NSApplicationPresentationFullScreen));
461 return !NSScreen.screensHaveSeparateSpaces;
465 return NSEvent.doubleClickInterval * 1000;
467 return NSEvent.keyRepeatDelay * 1000;
469 return 1.0 / NSEvent.keyRepeatInterval;
491 : QPlatformTheme::standardButtonShortcut(
button);
506 static bool haveMenubar =
false;
517#ifndef QT_NO_SHORTCUT
528 auto bindings = QPlatformTheme::keyBindings(
key);
532 const auto originalKeyModifiers = keyCombination.keyboardModifiers();
542 for (
auto binding : bindings) {
547 bindings = swappedBindings;
Helper base class for retrieving icons for files for usage by QFileIconProvider and related.
QFileInfo fileInfo() const
static QList< QSize > toSizeList(It i1, It i2)
const QColor & color() const
Returns the brush color.
QPixmap filePixmap(const QSize &size, QIcon::Mode, QIcon::State) override
QCocoaFileIconEngine(const QFileInfo &info, QPlatformTheme::IconOptions opts)
QList< QSize > availableSizes(QIcon::Mode=QIcon::Normal, QIcon::State=QIcon::Off) override
static QList< QSize > availableIconSizes()
QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions options={}) const override
Return an icon for fileInfo, observing iconOptions.
Qt::ColorScheme colorScheme() const override
QString standardButtonText(int button) const override
Returns the text of a standard button.
QPlatformDialogHelper * createPlatformDialogHelper(DialogType dialogType) const override
QPlatformMenu * createPlatformMenu() const override
void handleSystemThemeChange()
QPlatformMenuBar * createPlatformMenuBar() const override
QList< QKeySequence > keyBindings(QKeySequence::StandardKey key) const override
const QPalette * palette(Palette type=SystemPalette) const override
bool usePlatformNativeDialog(DialogType dialogType) const override
QKeySequence standardButtonShortcut(int button) const override
QPlatformSystemTrayIcon * createPlatformSystemTrayIcon() const override
Factory function for QSystemTrayIcon.
QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const override
QVariant themeHint(ThemeHint hint) const override
const QFont * font(Font type=SystemFont) const override
QPlatformMenuItem * createPlatformMenuItem() const override
The QColor class provides colors based on RGB, HSV or CMYK values.
QColor darker(int f=200) const noexcept
QColor lighter(int f=150) const noexcept
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
QFont * themeFont(QPlatformTheme::Font) const
static FontSmoothing fontSmoothing()
\inmodule QtCore \reentrant
QString canonicalFilePath() const
Returns the canonical path including the file name, i.e.
static QFontCache * instance()
static QPlatformIntegration * platformIntegration()
T value(const Key &key) const noexcept
void clear() noexcept(std::is_nothrow_destructible< Node >::value)
Removes all items from the hash and frees up all memory used by it.
bool isEmpty() const noexcept
Returns true if the hash contains no items; otherwise returns false.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
The QIcon class provides scalable icons in different modes and states.
Mode
This enum type describes the mode for which a pixmap is intended to be used.
State
This enum describes the state for which a pixmap is intended to be used.
The QKeySequence class encapsulates a key sequence as used by shortcuts.
void append(parameter_type t)
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
static constexpr QOperatingSystemVersionBase MacOSMojave
\variable QOperatingSystemVersion::MacOSMojave
static QOperatingSystemVersion current()
[0]
The QPalette class contains color groups for each widget state.
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
void setBrush(ColorRole cr, const QBrush &brush)
Sets the brush for the given color role to the specified brush for all groups in the palette.
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
\macro QT_RESTRICTED_CAST_FROM_ASCII
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
qDeleteAll(list.begin(), list.end())
Combined button and popup list for selecting options.
@ AA_MacDontSwapCtrlAndMeta
static const int mac_widget_colors_count
#define MAC_PALETTE_ENTRY(pal, active, inactive)
QPixmap qt_mac_convert_iconref(const IconRef icon, int width, int height)
static QHash< QPlatformTheme::Palette, QPalette * > qt_mac_createRolePalettes()
static QT_BEGIN_NAMESPACE QPalette * qt_mac_createSystemPalette()
static QMacPaletteMap mac_widget_colors[]
#define QT_IGNORE_DEPRECATIONS(statement)
QBrush qt_mac_toQBrush(CGColorRef color)
QColor qt_mac_toQColor(CGColorRef color)
int qRound(qfloat16 d) noexcept
GLboolean GLboolean GLboolean b
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLsizei const GLuint const GLintptr const GLsizeiptr * sizes
#define QStringLiteral(str)
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
QFileInfo info(fileName)
[8]
QPlatformTheme::Palette paletteRole
QMacPaletteMap(QPlatformTheme::Palette p, NSColor *a, NSColor *i)