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
qohosplatformtheme.h
Go to the documentation of this file.
1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QOHOSPLATFORMTHEME_H
5#define QOHOSPLATFORMTHEME_H
6
7#include <QtCore/qfileinfo.h>
8#include <QtCore/qhash.h>
9#include <QtCore/qmap.h>
10#include <QtGui/qcolor.h>
11#include <QtGui/qicon.h>
12#include <QtGui/qpalette.h>
13#include <functional>
14#include <optional>
15#include <qpa/qplatformtheme.h>
16#include <qpa/qplatformdialoghelper.h>
17
19
20template<typename T>
21using QOhosSupplier = std::function<T()>;
22
24{
25public:
26
27 static constexpr int defaultWheelScrollLines = 3;
28
30
31 void requestColorScheme(Qt::ColorScheme scheme) override;
32 Qt::ColorScheme colorScheme() const override;
33
34 QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const override;
35 bool usePlatformNativeDialog(DialogType type) const override;
36 QVariant themeHint(ThemeHint hint) const override;
37
38 const QPalette *palette(Palette type) const override;
39 const QFont *font(Font type) const override;
40 void setWheelScrollLines(int wheelScrollLines);
41
43
44 QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions) const override;
45 QIconEngine *createIconEngine(const QString &iconName) const override;
46
47private:
48 void refreshPalettes();
49
50 QHash<Palette, QPalette> m_themePalette;
51 QHash<Font, QFont> m_fonts;
52 int m_wheelScrollLines;
53 QOhosSupplier<std::optional<bool>> m_ohosConfigDarkModeFlagSupplier;
54 QOhosSupplier<QColor> m_ohosAccentColorSupplier;
55};
56
57QT_END_NAMESPACE
58
59#endif // QOHOSPLATFORMTHEME_H
void onMouseWheelEvent(const QOhosWheelEvent &event, QWindow *window)
void onNonClientAreaTouchEvents(QWindow *targetWindow, std::vector< QOhosWindowProxy::NonClientAreaTouchEvent > eventBatch)
void onHoverEvent(const QOhosHoverEvent &hoverEvent)
void onMouseEvent(const QOhosMouseEvent &mouseEvent)
void onGestureEventFromNativeNode(const QOhosGestureEvent &gestureEvent)
void onTouchEventFromXComponent(QWindow *targetWindow, std::chrono::nanoseconds timeStamp, const std::vector< QOhosTouchEventTouchPointData > &touchPoints, QInputDevice::DeviceType deviceType, QFlags< OhosKeyboardModifier > modifiers)
void onNonClientAreaMouseEvents(QWindow *targetWindow, std::vector< QOhosWindowProxy::NonClientAreaMouseEvent > eventBatch)
void onKeyEvent(const QOhosKeyEvent &keyEvent, QWindow *targetWindow)
virtual std::optional< QOhosQtKeyEvent > tryConvertToQOhosQtKeyEvent() const =0
static QOhosPlatformIntegration * instance()
bool usePlatformNativeDialog(DialogType type) const override
QIconEngine * createIconEngine(const QString &iconName) const override
Factory function for the QIconEngine used by QIcon::fromTheme().
void requestColorScheme(Qt::ColorScheme scheme) override
QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions) const override
Return an icon for fileInfo, observing iconOptions.
Qt::ColorScheme colorScheme() const override
void setWheelScrollLines(int wheelScrollLines)
QPlatformDialogHelper * createPlatformDialogHelper(DialogType type) const override
const QFont * font(Font type) const override
const QPalette * palette(Palette type) const override
Return a color palette for type type.
QPlatformSystemTrayIcon * createPlatformSystemTrayIcon() const override
Factory function for QSystemTrayIcon.
static constexpr int defaultWheelScrollLines
QVariant themeHint(ThemeHint hint) const override
Combined button and popup list for selecting options.
QRectF calculateTouchPointArea(const QPointF &clickPoint)
bool windowShouldTakeFocusOnPress(QWindow *qWindow)
QPoint determineScreenGlobalDisplayOffset(QWindow *qWindow)
QPoint makeWindowLocalPosition(const QPoint &globalPosition, QWindow *qWindow)
QInputDevice * registerPointingDevice(std::unique_ptr< QPointingDevice > device)
QPointF calculateTouchPointNormalPosition(QWindow *targetWindow, const QPointF &clickPoint)
std::shared_ptr< void > registerObjectDestroyedSignalHandler(QObject *object, QObject *context, std::function< void()> signalHandler)
QInputDevice * createPointingDevice(QInputDevice::DeviceType deviceType)
std::optional< QEventPoint::State > tryMapXComponentTouchEventTypeToQt(::OH_NativeXComponent_TouchEventType eventType)