2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2020 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2019-11-13 11:16:55 +01:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2020-02-11 11:33:25 +02:00
|
|
|
#include <QtCore/qmetatype.h>
|
|
|
|
|
#include <QtCore/qdatastream.h>
|
|
|
|
|
#include <QtGui/qevent.h>
|
|
|
|
|
|
|
|
|
|
#include "instancecontainer.h"
|
2019-11-13 11:16:55 +01:00
|
|
|
|
|
|
|
|
namespace QmlDesigner {
|
|
|
|
|
|
2020-02-11 11:33:25 +02:00
|
|
|
class InputEventCommand
|
2019-11-13 11:16:55 +01:00
|
|
|
{
|
2020-02-11 11:33:25 +02:00
|
|
|
friend QDataStream &operator>>(QDataStream &in, InputEventCommand &command);
|
|
|
|
|
friend QDebug operator <<(QDebug debug, const InputEventCommand &command);
|
2019-11-13 11:16:55 +01:00
|
|
|
|
|
|
|
|
public:
|
2020-02-11 11:33:25 +02:00
|
|
|
InputEventCommand();
|
|
|
|
|
explicit InputEventCommand(QInputEvent *e);
|
2019-11-13 11:16:55 +01:00
|
|
|
|
2020-02-11 11:33:25 +02:00
|
|
|
QEvent::Type type() const { return m_type; }
|
|
|
|
|
QPoint pos() const { return m_pos; }
|
|
|
|
|
Qt::MouseButton button() const { return m_button; }
|
|
|
|
|
Qt::MouseButtons buttons() const { return m_buttons; }
|
|
|
|
|
Qt::KeyboardModifiers modifiers() const { return m_modifiers; }
|
|
|
|
|
int angleDelta() const { return m_angleDelta; }
|
2022-01-10 16:40:35 +02:00
|
|
|
int key() const { return m_key; }
|
|
|
|
|
int count() const { return m_count; }
|
|
|
|
|
bool autoRepeat() const { return m_autoRepeat; }
|
2019-11-13 11:16:55 +01:00
|
|
|
|
|
|
|
|
private:
|
2020-03-02 11:04:20 +01:00
|
|
|
QEvent::Type m_type = QEvent::None;
|
2022-01-10 16:40:35 +02:00
|
|
|
Qt::KeyboardModifiers m_modifiers = Qt::NoModifier;
|
|
|
|
|
|
|
|
|
|
// Mouse events
|
2020-02-11 11:33:25 +02:00
|
|
|
QPoint m_pos;
|
|
|
|
|
Qt::MouseButton m_button = Qt::NoButton;
|
|
|
|
|
Qt::MouseButtons m_buttons = Qt::NoButton;
|
2022-01-10 16:40:35 +02:00
|
|
|
|
|
|
|
|
// Wheel events
|
2020-02-11 11:33:25 +02:00
|
|
|
int m_angleDelta = 0;
|
2022-01-10 16:40:35 +02:00
|
|
|
|
|
|
|
|
// Key events
|
|
|
|
|
int m_key = 0;
|
|
|
|
|
int m_count = 1;
|
|
|
|
|
bool m_autoRepeat = false;
|
2019-11-13 11:16:55 +01:00
|
|
|
};
|
|
|
|
|
|
2020-02-11 11:33:25 +02:00
|
|
|
QDataStream &operator<<(QDataStream &out, const InputEventCommand &command);
|
|
|
|
|
QDataStream &operator>>(QDataStream &in, InputEventCommand &command);
|
2019-11-13 11:16:55 +01:00
|
|
|
|
2020-02-11 11:33:25 +02:00
|
|
|
QDebug operator <<(QDebug debug, const InputEventCommand &command);
|
2019-11-13 11:16:55 +01:00
|
|
|
|
|
|
|
|
} // namespace QmlDesigner
|
|
|
|
|
|
2020-02-11 11:33:25 +02:00
|
|
|
Q_DECLARE_METATYPE(QmlDesigner::InputEventCommand)
|