diff options
Diffstat (limited to 'src/input/frontend')
-rw-r--r-- | src/input/frontend/qinputsettings.cpp | 56 | ||||
-rw-r--r-- | src/input/frontend/qmousedevice.cpp | 78 | ||||
-rw-r--r-- | src/input/frontend/qmousedevice.h | 4 |
3 files changed, 76 insertions, 62 deletions
diff --git a/src/input/frontend/qinputsettings.cpp b/src/input/frontend/qinputsettings.cpp index 08e3ce300..34ed3b438 100644 --- a/src/input/frontend/qinputsettings.cpp +++ b/src/input/frontend/qinputsettings.cpp @@ -48,10 +48,15 @@ namespace Qt3DInput { /*! \class Qt3DInput::QInputSettings \inmodule Qt3DInput - \inherits Qt3DCore::QComponant - \brief QInputSettings stores settings for the specified eventSource. - + \inherits Qt3DCore::QComponent + \brief QInputSettings class holds the pointer to an input event source object. \since 5.7 + + The QInputSettings component must be set as a component of the scene root entity. + It stores a pointer to the object that acts as the source of input events to be handled + by various input classes. For example, a QWindow instance can be an event source. + + \sa QMouseDevice, QKeyboardDevice */ /*! @@ -59,10 +64,14 @@ namespace Qt3DInput { \inqmlmodule Qt3D.Input \inherits Component3D \instantiates Qt3DInput::QInputSettings - \brief QML frontend for the Qt3DInput::QInputSettings C++ class. - - Stores settings the specified eventSource + \brief InputSettings holds the pointer to an input event source object. \since 5.7 + + The InputSettings component must be set as a component of the scene root entity. + It stores a pointer to the object that acts as the source of input events to be handled + by various input classes. For example, a Window instance can be an event source. + + \sa MouseDevice, KeyboardDevice */ QInputSettingsPrivate::QInputSettingsPrivate() @@ -71,15 +80,11 @@ QInputSettingsPrivate::QInputSettingsPrivate() { } -/*! - Constructs a new QInputSettings instance with \a parent. - */ QInputSettings::QInputSettings(Qt3DCore::QNode *parent) : Qt3DCore::QComponent(*new QInputSettingsPrivate(), parent) { } -/*! \internal */ QInputSettings::~QInputSettings() { } @@ -87,41 +92,24 @@ QInputSettings::~QInputSettings() /*! \property QInputSettings::eventSource - Holds the source for the QInputSettings. + Holds the current event source. An event source is an object that is capable + of receiving various input events, such as mouse or keyboard events. + Typically it is a QWindow instance. */ -/*! - \fn QInputSettings::eventSourceChanged(QObject *) - - This signal is emitted when the even source associated with the input setting is changed. -*/ /*! - \qmlproperty QObject Qt3D.Input::InputSettings::eventSource + \qmlproperty Object InputSettings::eventSource - The current event source of the InputSettings object + Holds the current event source. An event source is an object that is capable + of receiving various input events, such as mouse or keyboard events. + Typically it is a Window instance. */ - -/*! - \qmlsignal Qt3D.Input::InputSettings::ventSourceChanged(QObject *) - - This signal is emitted when the even source associated with the input setting is changed. - - The corresponding handler is \c onEventSourceChanged -*/ - -/*! - * \brief QInputSettings::eventSource - * \return the current event source of the QInputSettings instance. - */ QObject *QInputSettings::eventSource() const { Q_D(const QInputSettings); return d->m_eventSource; } -/*! - Set the current event source of the QInputSettings instance to \a eventSource. - */ void QInputSettings::setEventSource(QObject *eventSource) { Q_D(QInputSettings); diff --git a/src/input/frontend/qmousedevice.cpp b/src/input/frontend/qmousedevice.cpp index d0ae0317d..56d3731ce 100644 --- a/src/input/frontend/qmousedevice.cpp +++ b/src/input/frontend/qmousedevice.cpp @@ -45,35 +45,43 @@ QT_BEGIN_NAMESPACE namespace Qt3DInput { + /*! \internal */ QMouseDevicePrivate::QMouseDevicePrivate() : QAbstractPhysicalDevicePrivate() , m_sensitivity(0.1f) { } -/*! - * \qmltype MouseDevice - * \instantiates Qt3DInput::QMouseDevice - * \inqmlmodule Qt3D.Input - * \since 5.5 - * \brief Delegates mouse events to the attached MouseHandler objects. - * \TODO - * \sa MouseHandler - */ /*! - * \class Qt3DInput::QMouseDevice - * \inmodule Qt3DInput - * - * \brief QMouseDevice is in charge of dispatching mouse events to - * attached QMouseHandler objects. - * - * \since 5.5 - * \sa QMouseHandler + \qmltype MouseDevice + \instantiates Qt3DInput::QMouseDevice + \inqmlmodule Qt3D.Input + \since 5.5 + \brief Delegates mouse events to the attached MouseHandler objects. + + A MouseDevice delegates mouse events from physical mouse device to + MouseHandler objects. The sensitivity of the mouse can be controlled + with the \l MouseDevice::sensitivity property, which specifies the rate + in which the logical mouse coordinates change in response to physical + movement of the mouse. + + \sa MouseHandler */ /*! - \qmlproperty real MouseDevice::sensitivity + \class Qt3DInput::QMouseDevice + \inmodule Qt3DInput + \since 5.5 + \brief Delegates mouse events to the attached MouseHandler objects. + + A QMouseDevice delegates mouse events from physical mouse device to + QMouseHandler objects. The sensitivity of the mouse can be controlled + with the \l QMouseDevice::sensitivity property, which specifies the rate + in which the logical mouse coordinates change in response to physical + movement of the mouse. + + \sa QMouseHandler */ /*! @@ -83,11 +91,27 @@ QMouseDevicePrivate::QMouseDevicePrivate() \value X \value Y + \value WheelX + \value WheelY \sa Qt3DInput::QAnalogAxisInput::setAxis */ /*! + \qmlproperty real MouseDevice::sensitivity + + Holds the current sensitivity of the mouse device. + Default is 0.1. + */ + +/*! + \property Qt3DInput::QMouseDevice::sensitivity + + Holds the sensitivity of the mouse device. + Default is 0.1. + */ + +/*! Constructs a new QMouseDevice instance with parent \a parent. */ QMouseDevice::QMouseDevice(QNode *parent) @@ -103,12 +127,11 @@ QMouseDevice::~QMouseDevice() /*! \return the axis count. - \note Currently always returns 2. + \note Currently always returns 4. */ int QMouseDevice::axisCount() const { - // TO DO: we could have mouse wheel later on - return 2; + return 4; } /*! @@ -130,7 +153,9 @@ QStringList QMouseDevice::axisNames() const { return QStringList() << QStringLiteral("X") - << QStringLiteral("Y"); + << QStringLiteral("Y") + << QStringLiteral("WheelX") + << QStringLiteral("WheelY"); } /*! @@ -155,14 +180,13 @@ int QMouseDevice::axisIdentifier(const QString &name) const return X; else if (name == QLatin1String("Y")) return Y; + else if (name == QLatin1String("WheelX")) + return WheelX; + else if (name == QLatin1String("WheelY")) + return WheelY; return -1; } -/*! - \property Qt3DInput::QMouseDevice::sensitivity - - The sensitivity of the device. - */ float QMouseDevice::sensitivity() const { Q_D(const QMouseDevice); diff --git a/src/input/frontend/qmousedevice.h b/src/input/frontend/qmousedevice.h index fe43c6c84..7a1f6332a 100644 --- a/src/input/frontend/qmousedevice.h +++ b/src/input/frontend/qmousedevice.h @@ -63,7 +63,9 @@ public: enum Axis { X, - Y + Y, + WheelX, + WheelY }; Q_ENUM(Axis) |