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
qohoscloseeventcontext_p.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 QOHOSCLOSEEVENTCONTEXT_P_H
5#define QOHOSCLOSEEVENTCONTEXT_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/private/qohoscommon_p.h>
19#include <QtCore/qcoreevent.h>
20#include <QtCore/qglobal.h>
21#include <functional>
22#include <memory>
23
25
26class QOhosCloseEventContext
27{
28public:
29 enum class CloseRootCause
30 {
31 NotSpecified,
32 OnPrepareToTerminate,
33 WindowStageClose,
34 SubWindowClose,
35 };
36
37 enum class CloseResolution
38 {
39 Reject,
40 Close,
41 };
42
43 static CloseRootCause getCloseRootCauseForEventOrDefault(QEvent *event);
44 static void runWithCloseRootCauseSet(CloseRootCause rootCause, const std::function<void()> &task);
45 static void runWithCloseRootCauseAndCloseResolutionConsumerSet(
46 CloseRootCause rootCause, QOhosConsumer<CloseResolution> closeResolutionConsumer, const std::function<void()> &task);
47 static void notifyCloseResolutionFromEventIfValid(QEvent *event);
48};
49
50QT_END_NAMESPACE
51
52#endif
std::vector< QOhosDisplayInfo > getRegisteredDisplayInfos()
static std::shared_ptr< QOhosDisplayManager > create(QtOhos::JsState &jsState, CreateInfo createInfo)
QOhosDisplayInfo::JsDisplayId JsDisplayId
JsState & jsState() const
QPoint mapFromDisplayToGlobal(const QPoint &displayOffset, QOhosDisplayInfo::JsDisplayId jsDisplayId)
Combined button and popup list for selecting options.
void clearJsTimeout(JsState &jsState, int timerId)
std::optional< std::uint32_t > tryGetCodeFromJsBusinessError(const Napi::Error &error)
int setJsTimeout(JsState &jsState, std::function< void(const CallbackInfo &)> timeoutFunc, std::chrono::milliseconds delay)
bool runIgnoringJsBusinessError(JsState &, std::uint32_t suppressedErrorCode, const char *callerContextName, const std::function< void()> &action)
QNapi::Promise adaptAsyncCallResultToJsPromise(JsState &jsState, std::function< QNapi::Value(JsState &, T)> promiseValueFactory, const QOhosConsumer< JsState &, QOhosConsumer< JsState &, T > > &asyncCallFunc)
std::optional< T > getOptionalProperty(const QNapi::Object &object, const std::string &propName)
QNapi::Promise makeResolvedPromise(QNapi::Value valueForResolve)
QOhosSupplier< T > makeDataSource(std::function< T(JsState &)> initialValueReader, std::function< std::shared_ptr< void >(JsState &, QOhosConsumer< T >)> changeListenerFactory, QOhosConsumer< T > valueChangedHandler, QOhosConsumer< std::function< void()> > targetThreadExecutor, std::string callerContextName={})
void rethrowUnlessJsBusinessErrorIs(const Napi::Error &error, std::uint32_t suppressedErrorCode, const char *callerContextName)
QOhosSupplier< ConfigValue > makeOhosConfigValueDataSource(std::function< ConfigValue(QtOhos::JsState &)> initValueSupplier, std::function< ConfigValue(QtOhos::JsState &, const QNapi::Object &)> valueFetcher, QOhosConsumer< ConfigValue > valueChangedHandler)
QOhosConsumer< QtOhos::JsState &, JsDisplayId, QRectF > displayAvailableAreaChangedCb
QOhosConsumer< QtOhos::JsState &, std::vector< QOhosDisplayInfo > > displaysUpdatedCb