CR for Job #20769 - Touchscreen camera input for Interface
Showing the changes to interface/src/Application.cpp (1 of 15 files). Show all
Unified · Split
| @@ -957,8 +957,12 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 956 unmodified lines | ||
| 957 | 957 | return DependencyManager::get<OffscreenUi>()->navigationFocused() ? 1 : 0; |
| 958 | 958 | }); |
| 959 | 959 | |
| 960 | − // Setup the keyboardMouseDevice and the user input mapper with the default bindings | |
| 960 | + // Setup the _keyboardMouseDevice, _touchscreenDevice and the user input mapper with the default bindings | |
| 961 | 961 | userInputMapper->registerDevice(_keyboardMouseDevice->getInputDevice()); |
| 962 | + // if the _touchscreenDevice is not supported it will not be registered | |
| 963 | + if (_touchscreenDevice) { | |
| 964 | + userInputMapper->registerDevice(_touchscreenDevice->getInputDevice()); | |
| 965 | + } | |
| 962 | 966 | |
| 963 | 967 | // force the model the look at the correct directory (weird order of operations issue) |
| 964 | 968 | scriptEngines->setScriptsLocation(scriptEngines->getScriptsLocation()); |
| @@ -1600,6 +1604,9 @@ void Application::initializeUi() { · 635 unmodified lines | ||
| 1600 | 1604 | if (KeyboardMouseDevice::NAME == inputPlugin->getName()) { |
| 1601 | 1605 | _keyboardMouseDevice = std::dynamic_pointer_cast<KeyboardMouseDevice>(inputPlugin); |
| 1602 | 1606 | } |
| 1607 | + if (TouchscreenDevice::NAME == inputPlugin->getName()) { | |
| 1608 | + _touchscreenDevice = std::dynamic_pointer_cast<TouchscreenDevice>(inputPlugin); | |
| 1609 | + } | |
| 1603 | 1610 | } |
| 1604 | 1611 | _window->setMenuBar(new Menu()); |
| 1605 | 1612 | |
| @@ -2096,6 +2103,9 @@ bool Application::event(QEvent* event) { · 490 unmodified lines | ||
| 2096 | 2103 | case QEvent::TouchUpdate: |
| 2097 | 2104 | touchUpdateEvent(static_cast<QTouchEvent*>(event)); |
| 2098 | 2105 | return true; |
| 2106 | + case QEvent::Gesture: | |
| 2107 | + touchGestureEvent((QGestureEvent*)event); | |
| 2108 | + return true; | |
| 2099 | 2109 | case QEvent::Wheel: |
| 2100 | 2110 | wheelEvent(static_cast<QWheelEvent*>(event)); |
| 2101 | 2111 | return true; |
| @@ -2727,6 +2737,9 @@ void Application::touchUpdateEvent(QTouchEvent* event) { · 625 unmodified lines | ||
| 2727 | 2737 | if (_keyboardMouseDevice->isActive()) { |
| 2728 | 2738 | _keyboardMouseDevice->touchUpdateEvent(event); |
| 2729 | 2739 | } |
| 2740 | + if (_touchscreenDevice->isActive()) { | |
| 2741 | + _touchscreenDevice->touchUpdateEvent(event); | |
| 2742 | + } | |
| 2730 | 2743 | } |
| 2731 | 2744 | |
| 2732 | 2745 | void Application::touchBeginEvent(QTouchEvent* event) { |
| @@ -2745,6 +2758,9 @@ void Application::touchBeginEvent(QTouchEvent* event) { · 12 unmodified lines | ||
| 2745 | 2758 | if (_keyboardMouseDevice->isActive()) { |
| 2746 | 2759 | _keyboardMouseDevice->touchBeginEvent(event); |
| 2747 | 2760 | } |
| 2761 | + if (_touchscreenDevice->isActive()) { | |
| 2762 | + _touchscreenDevice->touchBeginEvent(event); | |
| 2763 | + } | |
| 2748 | 2764 | |
| 2749 | 2765 | } |
| 2750 | 2766 | |
| @@ -2762,10 +2778,19 @@ void Application::touchEndEvent(QTouchEvent* event) { · 11 unmodified lines | ||
| 2762 | 2778 | if (_keyboardMouseDevice->isActive()) { |
| 2763 | 2779 | _keyboardMouseDevice->touchEndEvent(event); |
| 2764 | 2780 | } |
| 2781 | + if (_touchscreenDevice->isActive()) { | |
| 2782 | + _touchscreenDevice->touchEndEvent(event); | |
| 2783 | + } | |
| 2765 | 2784 | |
| 2766 | 2785 | // put any application specific touch behavior below here.. |
| 2767 | 2786 | } |
| 2768 | 2787 | |
| 2788 | +void Application::touchGestureEvent(QGestureEvent* event) { | |
| 2789 | + if (_touchscreenDevice->isActive()) { | |
| 2790 | + _touchscreenDevice->touchGestureEvent(event); | |
| 2791 | + } | |
| 2792 | +} | |
| 2793 | + | |
| 2769 | 2794 | void Application::wheelEvent(QWheelEvent* event) const { |
| 2770 | 2795 | _altPressed = false; |
| 2771 | 2796 | _controllerScriptingInterface->emitWheelEvent(event); // send events to any registered scripts |