summaryrefslogtreecommitdiffstats
path: root/src/input
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2015-06-21 14:57:33 +0100
committerSean Harmer <sean.harmer@kdab.com>2015-06-21 14:57:33 +0100
commit099f466847039954c581030c2a5aa2bfce08e0eb (patch)
tree194a94d15a68b0c38d2d45c12275afb2c91b9831 /src/input
parent7bbd402770fa27f944840c95b6a3c6121883bc58 (diff)
parentb71f09d143002f15abfd4a407651544942a75c44 (diff)
Merge branch '5.5.0' into 5.5
Conflicts: src/input/qkeyboardcontroller.cpp Change-Id: Ifb0b5af165fb11dbe07849f34d3b93d9cc78eeaa
Diffstat (limited to 'src/input')
-rw-r--r--src/input/q3dkeyevent.cpp91
-rw-r--r--src/input/q3dkeyevent.h2
-rw-r--r--src/input/qinputaspect.cpp6
-rw-r--r--src/input/qkeyboardcontroller.cpp18
-rw-r--r--src/input/qkeyboardcontroller.h2
-rw-r--r--src/input/qkeyboardinput.cpp186
-rw-r--r--src/input/qkeyboardinput.h86
7 files changed, 344 insertions, 47 deletions
diff --git a/src/input/q3dkeyevent.cpp b/src/input/q3dkeyevent.cpp
index c0de3a293..bb1990955 100644
--- a/src/input/q3dkeyevent.cpp
+++ b/src/input/q3dkeyevent.cpp
@@ -42,6 +42,22 @@ namespace Qt3D {
//Qt6: Move this into a QtQmlGui module and merge it with QQuickKeyEvent
+/*!
+ \class Qt3D::Q3DKeyEvent
+ \inmodule Qt3DInput
+ \since 5.5
+*/
+
+/*!
+ \qmltype KeyEvent
+ \inqmlmodule Qt3D.Input
+ \instantiates Qt3D::Q3DKeyEvent
+ \since 5.5
+
+ The KeyEvent QML type cannot be directly created. Objects of this type
+ are used as signal parameters in KeyboardInput.
+*/
+
Q3DKeyEvent::Q3DKeyEvent(QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, const QString &text, bool autorep, ushort count)
: QObject()
, m_event(type, key, modifiers, text, autorep, count)
@@ -56,6 +72,81 @@ Q3DKeyEvent::Q3DKeyEvent(const QKeyEvent &ke)
m_event.setAccepted(false);
}
+/*!
+ \qmlproperty int Qt3D.Input::KeyEvent::key
+ \readonly
+
+ This property holds the code of the key that was pressed or released.
+
+ See \l [CPP] {Qt::Key}{Qt.Key} for the list of keyboard codes.
+
+ \sa {QtQuick::KeyEvent::key}{KeyEvent.key}
+*/
+
+/*!
+ \qmlproperty string Qt3D.Input::KeyEvent::text
+ \readonly
+
+ This property holds the Unicode text that the key generated. The text
+ returned can be an empty string in cases where modifier keys, such as
+ Shift, Control, Alt, and Meta, are being pressed or released. In such
+ cases \l key will contain a valid value.
+*/
+
+/*!
+ \qmlproperty int Qt3D.Input::KeyEvent::modifiers
+ \readonly
+
+ This property holds the keyboard modifier flags that existed immediately
+ before the event occurred.
+
+ \sa {QtQuick::KeyEvent::modifiers}{KeyEvent.modifiers}
+*/
+
+/*!
+ \qmlproperty bool Qt3D.Input::KeyEvent::isAutoRepeat
+ \readonly
+
+ Holds whether this event comes from an auto-repeating key.
+*/
+
+/*!
+ \qmlproperty int Qt3D.Input::KeyEvent::count
+ \readonly
+
+ Holds the number of keys involved in this event. If \l text is not empty,
+ this is simply the length of the string.
+*/
+
+/*!
+ \qmlproperty quint32 Qt3D.Input::KeyEvent::nativeScanCodei
+ \readonly
+
+ This property contains the native scan code of the key that was pressed.
+ It is passed through from QKeyEvent unchanged.
+
+ \sa QKeyEvent::nativeScanCode()
+*/
+
+/*!
+ \qmlproperty bool Qt3D.Input::KeyEvent::accepted
+
+ Setting \e accepted to \c true prevents the key event from being propagated
+ to the item's parent.
+
+ Generally, if the item acts on the key event then it should be accepted so
+ that ancestor items do not also respond to the same event.
+*/
+
+/*!
+ \qmlmethod bool Qt3D.Input::KeyEvent::matches(StandardKey key)
+
+ Returns \c true if the key event matches the given standard key; otherwise
+ returns \c false.
+
+ \sa QKeySequence::StandardKey
+*/
+
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/input/q3dkeyevent.h b/src/input/q3dkeyevent.h
index 21f3e4b3c..9f66d26c5 100644
--- a/src/input/q3dkeyevent.h
+++ b/src/input/q3dkeyevent.h
@@ -84,6 +84,4 @@ private:
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(Qt3D::Q3DKeyEvent*)
-
#endif // QT3D_Q3DKEYEVENT_H
diff --git a/src/input/qinputaspect.cpp b/src/input/qinputaspect.cpp
index 5b8c35abc..901152bd4 100644
--- a/src/input/qinputaspect.cpp
+++ b/src/input/qinputaspect.cpp
@@ -62,6 +62,12 @@ QInputAspectPrivate::QInputAspectPrivate()
m_aspectType = QAbstractAspect::AspectOther;
}
+/*!
+ \class Qt3D::QInputAspect
+ \inmodule Qt3DInput
+ \since 5.5
+*/
+
QInputAspect::QInputAspect(QObject *parent)
: QAbstractAspect(*new QInputAspectPrivate, parent)
{
diff --git a/src/input/qkeyboardcontroller.cpp b/src/input/qkeyboardcontroller.cpp
index 0e984dd8c..c8b97971c 100644
--- a/src/input/qkeyboardcontroller.cpp
+++ b/src/input/qkeyboardcontroller.cpp
@@ -53,6 +53,20 @@ QKeyboardControllerPrivate::QKeyboardControllerPrivate()
{
}
+/*!
+ \class Qt3D::QKeyboardController
+ \inmodule Qt3DInput
+ \since 5.5
+*/
+
+/*!
+ \qmltype KeyboardController
+ \inqmlmodule Qt3D.Input
+ \since 5.5
+ \instantiates Qt3D::QKeyboardController
+ \inherits Node
+*/
+
QKeyboardController::QKeyboardController(QNode *parent)
: QNode(*new QKeyboardControllerPrivate, parent)
{
@@ -63,6 +77,10 @@ QKeyboardController::~QKeyboardController()
QNode::cleanup();
}
+/*!
+ \qmlproperty KeyboardInput Qt3D.Input::KeyboardController::activeInput
+ \readonly
+*/
QKeyboardInput *QKeyboardController::activeInput() const
{
Q_D(const QKeyboardController);
diff --git a/src/input/qkeyboardcontroller.h b/src/input/qkeyboardcontroller.h
index b2543192e..d447ba3dc 100644
--- a/src/input/qkeyboardcontroller.h
+++ b/src/input/qkeyboardcontroller.h
@@ -75,6 +75,4 @@ private:
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(Qt3D::QKeyboardController *)
-
#endif // QT3D_INPUT_QKEYBOARDCONTROLLER_H
diff --git a/src/input/qkeyboardinput.cpp b/src/input/qkeyboardinput.cpp
index 8866ef94c..9d707ec49 100644
--- a/src/input/qkeyboardinput.cpp
+++ b/src/input/qkeyboardinput.cpp
@@ -56,6 +56,20 @@ QKeyboardInputPrivate::QKeyboardInputPrivate()
}
/*!
+ \class Qt3D::QKeyboardInput
+ \inmodule Qt3DInput
+ \since 5.5
+*/
+
+/*!
+ \qmltype KeyboardInput
+ \inqmlmodule Qt3D.Input
+ \instantiates Qt3D::QKeyboardInput
+ \inherits Component3D
+ \since 5.5
+*/
+
+/*!
Constructs a new QKeyboardInput instance with parent \a parent.
*/
QKeyboardInput::QKeyboardInput(QNode *parent)
@@ -172,6 +186,10 @@ void QKeyboardInput::keyEvent(Q3DKeyEvent *event)
}
/*!
+ \qmlproperty KeyboardController Qt3D.Input::KeyboardInput::controller
+*/
+
+/*!
Sets the keyboard controller to \a controller. Without a valid controller,
the QKeyboardInput won't receive any event.
*/
@@ -198,6 +216,10 @@ QKeyboardController *QKeyboardInput::controller() const
}
/*!
+ \qmlproperty bool Qt3D.Input::KeyboardInput::focus
+*/
+
+/*!
\returns the current focus.
*/
bool QKeyboardInput::focus() const
@@ -218,6 +240,170 @@ void QKeyboardInput::setFocus(bool focus)
}
}
+/*!
+ \qmlsignal Qt3D.Input::KeyboardInput::digit0Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardInput::digit1Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardInput::digit2Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardInput::digit3Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardInput::digit4Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardInput::digit5Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardInput::digit6Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardInput::digit7Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardInput::digit8Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardInput::digit9Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardInput::leftPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardInput::rightPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardInput::upPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardInput::downPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardInput::tabPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardInput::backtabPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardInput::asteriskPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardInput::numberSignPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardInput::backtabPressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::escapePressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::returnPressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::enterPressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::deletePressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::spacePressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::backPressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::cancelPressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::selectPressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::yesPressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::noPressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::context1Pressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::context2Pressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::context3Pressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::context4Pressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::callPressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::hangupPressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::flipPressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::menuPressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::volumeUpPressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::volumeDownPressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::pressed(KeyEvent event)
+*/
+
+/*!
+ qmlsignal Qt3D.Input::KeyboardInput::released(KeyEvent event)
+*/
+
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/input/qkeyboardinput.h b/src/input/qkeyboardinput.h
index 19e0d8ea9..683a4c38b 100644
--- a/src/input/qkeyboardinput.h
+++ b/src/input/qkeyboardinput.h
@@ -66,49 +66,49 @@ Q_SIGNALS:
void controllerChanged();
void focusChanged();
- void digit0Pressed(Q3DKeyEvent *event);
- void digit1Pressed(Q3DKeyEvent *event);
- void digit2Pressed(Q3DKeyEvent *event);
- void digit3Pressed(Q3DKeyEvent *event);
- void digit4Pressed(Q3DKeyEvent *event);
- void digit5Pressed(Q3DKeyEvent *event);
- void digit6Pressed(Q3DKeyEvent *event);
- void digit7Pressed(Q3DKeyEvent *event);
- void digit8Pressed(Q3DKeyEvent *event);
- void digit9Pressed(Q3DKeyEvent *event);
-
- void leftPressed(Q3DKeyEvent *event);
- void rightPressed(Q3DKeyEvent *event);
- void upPressed(Q3DKeyEvent *event);
- void downPressed(Q3DKeyEvent *event);
- void tabPressed(Q3DKeyEvent *event);
- void backtabPressed(Q3DKeyEvent *event);
-
- void asteriskPressed(Q3DKeyEvent *event);
- void numberSignPressed(Q3DKeyEvent *event);
- void escapePressed(Q3DKeyEvent *event);
- void returnPressed(Q3DKeyEvent *event);
- void enterPressed(Q3DKeyEvent *event);
- void deletePressed(Q3DKeyEvent *event);
- void spacePressed(Q3DKeyEvent *event);
- void backPressed(Q3DKeyEvent *event);
- void cancelPressed(Q3DKeyEvent *event);
- void selectPressed(Q3DKeyEvent *event);
- void yesPressed(Q3DKeyEvent *event);
- void noPressed(Q3DKeyEvent *event);
- void context1Pressed(Q3DKeyEvent *event);
- void context2Pressed(Q3DKeyEvent *event);
- void context3Pressed(Q3DKeyEvent *event);
- void context4Pressed(Q3DKeyEvent *event);
- void callPressed(Q3DKeyEvent *event);
- void hangupPressed(Q3DKeyEvent *event);
- void flipPressed(Q3DKeyEvent *event);
- void menuPressed(Q3DKeyEvent *event);
- void volumeUpPressed(Q3DKeyEvent *event);
- void volumeDownPressed(Q3DKeyEvent *event);
-
- void pressed(Q3DKeyEvent *event);
- void released(Q3DKeyEvent *event);
+ void digit0Pressed(Qt3D::Q3DKeyEvent *event);
+ void digit1Pressed(Qt3D::Q3DKeyEvent *event);
+ void digit2Pressed(Qt3D::Q3DKeyEvent *event);
+ void digit3Pressed(Qt3D::Q3DKeyEvent *event);
+ void digit4Pressed(Qt3D::Q3DKeyEvent *event);
+ void digit5Pressed(Qt3D::Q3DKeyEvent *event);
+ void digit6Pressed(Qt3D::Q3DKeyEvent *event);
+ void digit7Pressed(Qt3D::Q3DKeyEvent *event);
+ void digit8Pressed(Qt3D::Q3DKeyEvent *event);
+ void digit9Pressed(Qt3D::Q3DKeyEvent *event);
+
+ void leftPressed(Qt3D::Q3DKeyEvent *event);
+ void rightPressed(Qt3D::Q3DKeyEvent *event);
+ void upPressed(Qt3D::Q3DKeyEvent *event);
+ void downPressed(Qt3D::Q3DKeyEvent *event);
+ void tabPressed(Qt3D::Q3DKeyEvent *event);
+ void backtabPressed(Qt3D::Q3DKeyEvent *event);
+
+ void asteriskPressed(Qt3D::Q3DKeyEvent *event);
+ void numberSignPressed(Qt3D::Q3DKeyEvent *event);
+ void escapePressed(Qt3D::Q3DKeyEvent *event);
+ void returnPressed(Qt3D::Q3DKeyEvent *event);
+ void enterPressed(Qt3D::Q3DKeyEvent *event);
+ void deletePressed(Qt3D::Q3DKeyEvent *event);
+ void spacePressed(Qt3D::Q3DKeyEvent *event);
+ void backPressed(Qt3D::Q3DKeyEvent *event);
+ void cancelPressed(Qt3D::Q3DKeyEvent *event);
+ void selectPressed(Qt3D::Q3DKeyEvent *event);
+ void yesPressed(Qt3D::Q3DKeyEvent *event);
+ void noPressed(Qt3D::Q3DKeyEvent *event);
+ void context1Pressed(Qt3D::Q3DKeyEvent *event);
+ void context2Pressed(Qt3D::Q3DKeyEvent *event);
+ void context3Pressed(Qt3D::Q3DKeyEvent *event);
+ void context4Pressed(Qt3D::Q3DKeyEvent *event);
+ void callPressed(Qt3D::Q3DKeyEvent *event);
+ void hangupPressed(Qt3D::Q3DKeyEvent *event);
+ void flipPressed(Qt3D::Q3DKeyEvent *event);
+ void menuPressed(Qt3D::Q3DKeyEvent *event);
+ void volumeUpPressed(Qt3D::Q3DKeyEvent *event);
+ void volumeDownPressed(Qt3D::Q3DKeyEvent *event);
+
+ void pressed(Qt3D::Q3DKeyEvent *event);
+ void released(Qt3D::Q3DKeyEvent *event);
protected:
QKeyboardInput(QKeyboardInputPrivate &dd, QNode *parent = 0);