[Interest] [Qt3D] QAbstractCameraController & escape key

Andy asmaloney at gmail.com
Tue Aug 7 14:02:32 CEST 2018


I filed a bug report:

   https://bugreports.qt.io/browse/QTBUG-69802

I couldn't figure out how to turn it off through the public API, but I did
come up with a fragile hack to turn it off.

In your inherited camera controller (or, subclass one of the existing ones):

// Find and delete the escape key QActionInput.

// This is a workaround for the change to QAbstractCameraController in Qt 5.11

// which added an escape key handler that performs a "view all" on the scene.

//   https://codereview.qt-project.org/#/c/226879/

//   https://bugreports.qt.io/browse/QTBUG-69802
void inheritedCameraController::_deleteEscapeHandler()

{

   QList<Qt3DInput::QActionInput *>   list =
findChildren<Qt3DInput::QActionInput *>();


   for ( auto actionInput : list )

   {

      if ( actionInput->buttons().count() != 1 )

      {

         continue;

      }


      if ( actionInput->buttons().at( 0 ) == Qt::Key_Escape )

      {

         delete actionInput;

      }

   }

}


---
Andy Maloney  //  https://asmaloney.com
twitter ~ @asmaloney <https://twitter.com/asmaloney>



On Wed, Aug 1, 2018 at 6:10 PM Andy <asmaloney at gmail.com> wrote:

> Back in April, a commit added the functionality that the escape key does a
> "view all" on the scene.
>
>  https://codereview.qt-project.org/#/c/226879/
>
> How do I prevent this? I can't figure out a way to turn it off/override it
> in my derived camera controller.
>
> I have a ground plane and a model in the middle of it and when the user
> hits escape it zooms the camera way out and it looks terrible (and it's
> confusing).
>
> This feels like an application-specific functionality that doesn't belong
> in this abstract base class.
>
> ---
> Andy Maloney  //  https://asmaloney.com
> twitter ~ @asmaloney <https://twitter.com/asmaloney>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180807/4407d478/attachment.html>


More information about the Interest mailing list