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
qwindowsapplication.cpp
Go to the documentation of this file.
1// Copyright (C) 2020 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// Qt-Security score:significant reason:default
4
6#if QT_CONFIG(clipboard)
7#include "qwindowsclipboard.h"
8#endif
11#include "qwin10helpers.h"
13#include "qwindowswindow.h"
15#include "qwindowstheme.h"
16
17#include <QtCore/qvariant.h>
18#include <QtCore/private/qfunctions_win_p.h>
19
20#include <QtGui/qpalette.h>
21
23
24void QWindowsApplication::setTouchWindowTouchType(QWindowsApplication::TouchWindowTouchTypes type)
25{
26 if (m_touchWindowTouchTypes == type)
27 return;
28 m_touchWindowTouchTypes = type;
29 if (auto ctx = QWindowsContext::instance())
31}
32
33QWindowsApplication::TouchWindowTouchTypes QWindowsApplication::touchWindowTouchType() const
34{
35 return m_touchWindowTouchTypes;
36}
37
38QWindowsApplication::WindowActivationBehavior QWindowsApplication::windowActivationBehavior() const
39{
40 return m_windowActivationBehavior;
41}
42
43void QWindowsApplication::setWindowActivationBehavior(WindowActivationBehavior behavior)
44{
45 m_windowActivationBehavior = behavior;
46}
47
48void QWindowsApplication::setHasBorderInFullScreenDefault(bool border)
49{
51}
52
53bool QWindowsApplication::isTabletMode() const
54{
55#if QT_CONFIG(clipboard)
56 if (const QWindowsClipboard *clipboard = QWindowsClipboard::instance())
57 return qt_windowsIsTabletMode(clipboard->clipboardViewer());
58#endif
59 return false;
60}
61
62bool QWindowsApplication::isWinTabEnabled() const
63{
65 return ctx != nullptr && ctx->tabletSupport() != nullptr;
66}
67
68bool QWindowsApplication::setWinTabEnabled(bool enabled)
69{
70 if (enabled == isWinTabEnabled())
71 return true;
73 if (!ctx)
74 return false;
75 return enabled ? ctx->initTablet() : ctx->disposeTablet();
76}
77
78QWindowsApplication::DarkModeHandling QWindowsApplication::darkModeHandling() const
79{
80 return m_darkModeHandling;
81}
82
83void QWindowsApplication::setDarkModeHandling(QWindowsApplication::DarkModeHandling handling)
84{
85 m_darkModeHandling = handling;
86}
87
88void QWindowsApplication::registerMime(QWindowsMimeConverter *mime)
89{
90 if (auto ctx = QWindowsContext::instance())
91 ctx->mimeConverter().registerMime(mime);
92}
93
94void QWindowsApplication::unregisterMime(QWindowsMimeConverter *mime)
95{
96 if (auto ctx = QWindowsContext::instance())
97 ctx->mimeConverter().unregisterMime(mime);
98}
99
100int QWindowsApplication::registerMimeType(const QString &mime)
101{
102 return QWindowsMimeRegistry::registerMimeType(mime);
103}
104
105HWND QWindowsApplication::createMessageWindow(const QString &classNameTemplate,
106 const QString &windowName,
107 QFunctionPointer eventProc) const
108{
110 if (!ctx)
111 return nullptr;
112 auto wndProc = eventProc ? reinterpret_cast<WNDPROC>(eventProc) : DefWindowProc;
113 return ctx->createDummyWindow(classNameTemplate,
114 reinterpret_cast<const wchar_t*>(windowName.utf16()),
115 wndProc);
116}
117
118bool QWindowsApplication::asyncExpose() const
119{
121 return ctx && ctx->asyncExpose();
122}
123
124void QWindowsApplication::setAsyncExpose(bool value)
125{
127 ctx->setAsyncExpose(value);
128}
129
130QVariant QWindowsApplication::gpu() const
131{
133}
134
135QVariant QWindowsApplication::gpuList() const
136{
137 QVariantList result;
138 const auto gpus = GpuDescription::detectAll();
139 for (const auto &gpu : gpus)
140 result.append(gpu.toVariant());
141 return result;
142}
143
144void QWindowsApplication::populateLightSystemPalette(QPalette &result) const
145{
146 result = QWindowsTheme::systemPalette(Qt::ColorScheme::Light);
147}
148
149QT_END_NAMESPACE
Singleton container for all relevant information.
bool asyncExpose() const
QWindowsTabletSupport * tabletSupport() const
void setAsyncExpose(bool value)
QWindowsMimeRegistry & mimeConverter() const
static QWindowsContext * instance()
Raster or OpenGL Window.
static void setHasBorderInFullScreenDefault(bool border)
Combined button and popup list for selecting options.
static GpuDescription detect()
QVariant toVariant() const