From a735038376e1c229c293c36bd67800851323baf1 Mon Sep 17 00:00:00 2001 From: Karsten Heimrich Date: Tue, 18 Aug 2020 14:26:50 +0200 Subject: Move QStateMachine from QtCore to QtScxml Task-number: QTBUG-80316 Change-Id: I2ee74110fd55e94d86321d3b3dc5bb8297424ed4 Reviewed-by: Maurice Kalinowski --- src/gui/kernel/kernel.pri | 3 +- src/gui/kernel/qguiapplication_p.h | 1 + src/gui/kernel/qguistatemachine.cpp | 345 ++++++++++++++++++++++++++++++++++++ 3 files changed, 348 insertions(+), 1 deletion(-) create mode 100644 src/gui/kernel/qguistatemachine.cpp (limited to 'src/gui/kernel') diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index c86489e9fa..011e0ce00d 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -128,7 +128,8 @@ SOURCES += \ kernel/qplatformgraphicsbufferhelper.cpp \ kernel/qinputdevicemanager.cpp \ kernel/qhighdpiscaling.cpp \ - kernel/qtestsupport_gui.cpp + kernel/qtestsupport_gui.cpp \ + kernel/qguistatemachine.cpp qtConfig(action) { HEADERS += \ diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 48fe62ad98..7019c55fac 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -331,6 +331,7 @@ public: #endif static void updatePalette(); + QEvent *cloneEvent(QEvent *e) override; protected: virtual void notifyThemeChanged(); diff --git a/src/gui/kernel/qguistatemachine.cpp b/src/gui/kernel/qguistatemachine.cpp new file mode 100644 index 0000000000..dacfa7793a --- /dev/null +++ b/src/gui/kernel/qguistatemachine.cpp @@ -0,0 +1,345 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWidgets module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include "private/qguiapplication_p.h" + +QT_BEGIN_NAMESPACE + +QEvent *QGuiApplicationPrivate::cloneEvent(QEvent *e) +{ + switch (e->type()) { + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseButtonDblClick: + case QEvent::MouseMove: + return new QMouseEvent(*static_cast(e)); + case QEvent::KeyPress: + case QEvent::KeyRelease: + return new QKeyEvent(*static_cast(e)); + case QEvent::FocusIn: + case QEvent::FocusOut: + return new QFocusEvent(*static_cast(e)); + case QEvent::Enter: + return new QEvent(*e); + case QEvent::Leave: + return new QEvent(*e); + case QEvent::Paint: + Q_ASSERT_X(false, "cloneEvent()", "not implemented"); + break; + case QEvent::Move: + return new QMoveEvent(*static_cast(e)); + case QEvent::Resize: + return new QResizeEvent(*static_cast(e)); + case QEvent::Create: + Q_ASSERT_X(false, "cloneEvent()", "not implemented"); + break; + case QEvent::Destroy: + Q_ASSERT_X(false, "cloneEvent()", "not implemented"); + break; + case QEvent::Show: + return new QShowEvent(*static_cast(e)); + case QEvent::Hide: + return new QHideEvent(*static_cast(e)); + case QEvent::Close: + return new QCloseEvent(*static_cast(e)); + case QEvent::Quit: + return new QEvent(*e); + case QEvent::ParentChange: + return new QEvent(*e); + case QEvent::ParentAboutToChange: + return new QEvent(*e); + case QEvent::ThreadChange: + return new QEvent(*e); + + case QEvent::WindowActivate: + case QEvent::WindowDeactivate: + return new QEvent(*e); + + case QEvent::ShowToParent: + return new QEvent(*e); + case QEvent::HideToParent: + return new QEvent(*e); +#if QT_CONFIG(wheelevent) + case QEvent::Wheel: + return new QWheelEvent(*static_cast(e)); +#endif // QT_CONFIG(wheelevent) + case QEvent::WindowTitleChange: + return new QEvent(*e); + case QEvent::WindowIconChange: + return new QEvent(*e); + case QEvent::ApplicationWindowIconChange: + return new QEvent(*e); + case QEvent::ApplicationFontChange: + return new QEvent(*e); + case QEvent::ApplicationLayoutDirectionChange: + return new QEvent(*e); + case QEvent::ApplicationPaletteChange: + return new QEvent(*e); + case QEvent::PaletteChange: + return new QEvent(*e); + case QEvent::Clipboard: + Q_ASSERT_X(false, "cloneEvent()", "not implemented"); + break; + case QEvent::Speech: + Q_ASSERT_X(false, "cloneEvent()", "not implemented"); + break; + case QEvent::MetaCall: + Q_ASSERT_X(false, "cloneEvent()", "not implemented"); + break; + case QEvent::SockAct: + return new QEvent(*e); + case QEvent::WinEventAct: + return new QEvent(*e); + case QEvent::DeferredDelete: + return new QEvent(*e); +#if QT_CONFIG(draganddrop) + case QEvent::DragEnter: + return new QDragEnterEvent(*static_cast(e)); + case QEvent::DragMove: + return new QDragMoveEvent(*static_cast(e)); + case QEvent::DragLeave: + return new QDragLeaveEvent(*static_cast(e)); + case QEvent::Drop: + return new QDropEvent(*static_cast(e)); +#endif + case QEvent::ChildAdded: + return new QChildEvent(*static_cast(e)); + case QEvent::ChildPolished: + return new QChildEvent(*static_cast(e)); + case QEvent::ChildRemoved: + return new QChildEvent(*static_cast(e)); + case QEvent::ShowWindowRequest: + return new QEvent(*e); + case QEvent::PolishRequest: + return new QEvent(*e); + case QEvent::Polish: + return new QEvent(*e); + case QEvent::LayoutRequest: + return new QEvent(*e); + case QEvent::UpdateRequest: + return new QEvent(*e); + case QEvent::UpdateLater: + return new QEvent(*e); + + case QEvent::EmbeddingControl: + return new QEvent(*e); + case QEvent::ActivateControl: + return new QEvent(*e); + case QEvent::DeactivateControl: + return new QEvent(*e); + +#ifndef QT_NO_CONTEXTMENU + case QEvent::ContextMenu: + return new QContextMenuEvent(*static_cast(e)); +#endif + case QEvent::InputMethod: + return new QInputMethodEvent(*static_cast(e)); + case QEvent::LocaleChange: + return new QEvent(*e); + case QEvent::LanguageChange: + return new QEvent(*e); + case QEvent::LayoutDirectionChange: + return new QEvent(*e); + case QEvent::Style: + return new QEvent(*e); +#if QT_CONFIG(tabletevent) + case QEvent::TabletMove: + case QEvent::TabletPress: + case QEvent::TabletRelease: + return new QTabletEvent(*static_cast(e)); +#endif // QT_CONFIG(tabletevent) + case QEvent::OkRequest: + return new QEvent(*e); + case QEvent::HelpRequest: + return new QEvent(*e); + + case QEvent::IconDrag: + return new QIconDragEvent(*static_cast(e)); + + case QEvent::FontChange: + return new QEvent(*e); + case QEvent::EnabledChange: + return new QEvent(*e); + case QEvent::ActivationChange: + return new QEvent(*e); + case QEvent::StyleChange: + return new QEvent(*e); + case QEvent::IconTextChange: + return new QEvent(*e); + case QEvent::ModifiedChange: + return new QEvent(*e); + case QEvent::MouseTrackingChange: + return new QEvent(*e); + + case QEvent::WindowBlocked: + return new QEvent(*e); + case QEvent::WindowUnblocked: + return new QEvent(*e); + case QEvent::WindowStateChange: + return new QWindowStateChangeEvent(*static_cast(e)); + + case QEvent::ToolTip: + return new QHelpEvent(*static_cast(e)); + case QEvent::WhatsThis: + return new QHelpEvent(*static_cast(e)); + +#ifndef QT_NO_ACTION + case QEvent::ActionChanged: + case QEvent::ActionAdded: + case QEvent::ActionRemoved: + return new QActionEvent(*static_cast(e)); +#endif + case QEvent::FileOpen: + return new QFileOpenEvent(*static_cast(e)); + +#ifndef QT_NO_SHORTCUT + case QEvent::Shortcut: + return new QShortcutEvent(*static_cast(e)); +#endif //QT_NO_SHORTCUT + case QEvent::ShortcutOverride: + return new QKeyEvent(*static_cast(e)); + +#if QT_CONFIG(whatsthis) + case QEvent::WhatsThisClicked: + return new QWhatsThisClickedEvent(*static_cast(e)); +#endif // QT_CONFIG(whatsthis) + + case QEvent::ApplicationActivate: + return new QEvent(*e); + case QEvent::ApplicationDeactivate: + return new QEvent(*e); + + case QEvent::QueryWhatsThis: + return new QHelpEvent(*static_cast(e)); + case QEvent::EnterWhatsThisMode: + return new QEvent(*e); + case QEvent::LeaveWhatsThisMode: + return new QEvent(*e); + + case QEvent::ZOrderChange: + return new QEvent(*e); + + case QEvent::HoverEnter: + case QEvent::HoverLeave: + case QEvent::HoverMove: + return new QHoverEvent(*static_cast(e)); + +#ifdef QT_KEYPAD_NAVIGATION + case QEvent::EnterEditFocus: + return new QEvent(*e); + case QEvent::LeaveEditFocus: + return new QEvent(*e); +#endif + case QEvent::AcceptDropsChange: + return new QEvent(*e); + + case QEvent::ZeroTimerEvent: + Q_ASSERT_X(false, "cloneEvent()", "not implemented"); + break; + + case QEvent::KeyboardLayoutChange: + return new QEvent(*e); + + case QEvent::DynamicPropertyChange: + return new QDynamicPropertyChangeEvent(*static_cast(e)); + +#if QT_CONFIG(tabletevent) + case QEvent::TabletEnterProximity: + case QEvent::TabletLeaveProximity: + return new QTabletEvent(*static_cast(e)); +#endif // QT_CONFIG(tabletevent) + + case QEvent::NonClientAreaMouseMove: + case QEvent::NonClientAreaMouseButtonPress: + case QEvent::NonClientAreaMouseButtonRelease: + case QEvent::NonClientAreaMouseButtonDblClick: + return new QMouseEvent(*static_cast(e)); + + case QEvent::MacSizeChange: + return new QEvent(*e); + + case QEvent::ContentsRectChange: + return new QEvent(*e); + + case QEvent::MacGLWindowChange: + return new QEvent(*e); + + case QEvent::FutureCallOut: + Q_ASSERT_X(false, "cloneEvent()", "not implemented"); + break; + case QEvent::CursorChange: + return new QEvent(*e); + case QEvent::ToolTipChange: + return new QEvent(*e); + + case QEvent::NetworkReplyUpdated: + Q_ASSERT_X(false, "cloneEvent()", "not implemented"); + break; + + case QEvent::GrabMouse: + case QEvent::UngrabMouse: + case QEvent::GrabKeyboard: + case QEvent::UngrabKeyboard: + return new QEvent(*e); + + case QEvent::TouchBegin: + case QEvent::TouchUpdate: + case QEvent::TouchEnd: + return new QTouchEvent(*static_cast(e)); + +#ifndef QT_NO_GESTURES + case QEvent::NativeGesture: + Q_ASSERT_X(false, "cloneEvent()", "not implemented"); + break; +#endif + + case QEvent::User: + case QEvent::MaxUser: + Q_ASSERT_X(false, "cloneEvent()", "not implemented"); + break; + default: + ; + } + return QCoreApplicationPrivate::cloneEvent(e); +} + +QT_END_NAMESPACE -- cgit v1.2.3