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
24QT_BEGIN_NAMESPACE
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::stack< EventContextData > eventContextDataStack
QOhosConsumer< QOhosCloseEventContext::CloseResolution > closeResolutionConsumer
QOhosCloseEventContext::CloseRootCause closeRootCause