Results 1 to 3 of 3

Thread: Passing synthetic keyboard events to the QQuickWindow

  1. #1
    Join Date
    Dec 2015
    Posts
    5
    Thanked 1 Time in 1 Post

    Question Passing synthetic keyboard events to the QQuickWindow

    QQuickWindow is created from QQuickRenderControl and used as GUI overlay for an application. Input event loop is outside of Qt, so the events are sent manually through QCoreApplication::sendEvent.

    Injecting mouse with QCoreApplication::instance()->sendEvent(quickWindow, event) works for push/release/move: can click buttons and select text in TextFields.

    But I can't get the keyboard to work: it's not possible to edit the text in the TextField, cursor doesn't appear.

    I've tried sending QFocusEvent, but it does nothing.

    Also tried to setFocus and send QFocusEvent to the window and specific TextField. That got TextField into focus, but I'm not going to reimplement the focus rules.

    How it's supposed to work?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,419
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Passing synthetic keyboard events to the QQuickWindow

    Well, usually events are not injected that way, e.g. the platform integration publishes them to the Qt event system which then distributes them.

    But if you must tack this on like this then check if there is a focusObject: QGuiApplication::focusObject().

    Cheers,
    _

  3. #3
    Join Date
    Dec 2015
    Posts
    5
    Thanked 1 Time in 1 Post

    Default Re: Passing synthetic keyboard events to the QQuickWindow

    Quote Originally Posted by anda_skoa View Post
    Well, if the QQuickWindow::activeFocusItem isn't getting it then there'll be nothing in QGuiApplication::focusObject() either.

Similar Threads

  1. Replies: 6
    Last Post: 30th December 2015, 11:36
  2. Ignoring keyboard events in QwtPlotPicker
    By frankiefrank in forum Qwt
    Replies: 4
    Last Post: 23rd January 2012, 11:45
  3. Filtering all mouse/keyboard events
    By maverick_pol in forum Qt Programming
    Replies: 9
    Last Post: 27th November 2008, 17:03
  4. Grab keyboard events in Windows
    By durbrak in forum Qt Programming
    Replies: 1
    Last Post: 4th February 2007, 19:56
  5. handling keyboard events from a console app
    By g.cavallin in forum Qt Programming
    Replies: 1
    Last Post: 18th December 2006, 22:31

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.