Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. Tags
    3. qkeyevent
    Log in to post

    • SOLVED QKeyPress - Simulating key press
      General and Desktop • qt 5.7 qkeyevent • • sayan275  

      4
      0
      Votes
      4
      Posts
      785
      Views

      @sayan275 Dear Sayan I think you may know the answer to my problem. I'm struggling to send a self-defined event from main.cpp to the ui->boardView in mainwindow.cpp, as the ui->boardView is only defined in mainwindow.cpp. Yet the eventfilter can only be installed on the ui->boardView. It seems you've done similar sth similar. Could you please tell me how to realize such feature? (there are also detailed code about this which I put on stackoverflow https://stackoverflow.com/questions/60424216/how-to-use-eventfilter-under-child-widget-to-catch-self-define-event)
    • SOLVED handle KeyEvent in C++
      QML and Qt Quick • qkeyevent keyevent • • BePie  

      3
      0
      Votes
      3
      Posts
      924
      Views

      thanks, I missed it because I usually used QQmlEngine or something alike and not a QQuickView.
    • UNSOLVED QKeyEvent and child
      General and Desktop • qkeyevent • • VincentB  

      8
      0
      Votes
      8
      Posts
      1395
      Views

      Hi @Vincent, I use a barcode scanner for my app, too. All works without problem for me. Did you try to input the "key events" in a simple text editor of you OS. Which characters compared to the editor are missing in Qt ?
    • UNSOLVED Strategies for dealing with focus in qwidget project with custom input device
      Mobile and Embedded • focus qt4.8 qkeyevent • • dannas  

      4
      0
      Votes
      4
      Posts
      1782
      Views

      The Keyboard Focus in Widgets chapter from Qt's documentation already give some hints on how to handle that. If you build your focus chain properly you can then use nextInFocusChain and previousInFocusChain to avoid hardcoding stuff.
    • SOLVED Keyboard key emulation from C++ to QML
      General and Desktop • qml qkeyevent • • RiteshPanchal  

      6
      0
      Votes
      6
      Posts
      2905
      Views

      Thanks for the Reply. I get everything working from below changes. UART.cpp UART::UART(QObject *parent) : QObject(parent) { m_engine = (QQmlApplicationEngine *)parent; } void UART::readRequest() { QKeyEvent key_press(QKeyEvent::KeyPress, Qt::Key_P, Qt::NoModifier); QCoreApplication::sendEvent(m_engine->rootObjects().first(), &key_press); } UART.h class UART : public QObject { Q_OBJECT public: explicit UART(QObject *parent = 0); signals: protected: public slots: void UARTInit(); private: QQmlApplicationEngine *m_engine; private slots: void readRequest(); }; And main.cpp without any change as per your previous reply. Thanks ... :)
    • UNSOLVED Could you explain me the QKeyEvent::nativeModifiers() and key() methods ?
      General and Desktop • qkeyevent key nativemodifiers • • Folco  

      1
      0
      Votes
      1
      Posts
      574
      Views

      No one has replied

    • UNSOLVED Problem with QKeyEvent isAutoRepeat function?
      General and Desktop • c++ event qkeyevent qkeypressevent • • faisal.tum  

      6
      0
      Votes
      6
      Posts
      3120
      Views

      Anyway solved it. I needed to call grabKeyboard function from the MainWindow class, so this->grabKeyboard() is the line I needed to add when key_0 button is pressed so that MainWindow doesn't lose the keyboard focus, and then when released I needed to add the line this->releaseKeyboard() to resume normal behaviour, that is, other widgets can have the keyboard focus.
    • UNSOLVED not able to sendevent from keyboard notification
      Mobile and Embedded • embedded arm qkeyevent • • IL  

      2
      0
      Votes
      2
      Posts
      1088
      Views

      Hi, Because usually, it's the central widget of a QMainWindow that will have the keyboard focus thus get the keyPress/Release etc. events. You can put an event filter on that widget to do what you want. Hope it helps
    • UNSOLVED Selective keyPressEvent, filter for dedicated sender QLineEdit
      General and Desktop • qlineedit qkeyevent qkeypressevent • • Ralf  

      2
      0
      Votes
      2
      Posts
      1022
      Views

      You need to accept the event so the parent knows that the event has been handled. Otherwise the event will go all children until someone accepts it or if none do, it will be ignored. so keyEv->accept() should do the trick.