Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Why nativeEvent can not receive WM_CHAR message?
Qt 6.11 is out! See what's new in the release blog

Why nativeEvent can not receive WM_CHAR message?

Scheduled Pinned Locked Moved Unsolved General and Desktop
13 Posts 4 Posters 2.6k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • vilasV Offline
    vilasV Offline
    vilas
    wrote on last edited by
    #1

    Qt version : 5.5.1; Os: window 7
    when i press a key, the focus widget only can receive WM_KEYDOWN and WM_KEYUP message in nativeEvent(),
    but in mfc app, it will WM_CHAR message also. What can i do if i want to receive WM_CHAR message in qt app?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Why do you need that ? Does Qt's QKeyEvent provide the information you need ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      vilasV 1 Reply Last reply
      1
      • vilasV Offline
        vilasV Offline
        vilas
        wrote on last edited by vilas
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          Why do you need that ? Does Qt's QKeyEvent provide the information you need ?

          vilasV Offline
          vilasV Offline
          vilas
          wrote on last edited by
          #4

          @SGaist Hi,
          Because I want to combine qt widget with cef under cef off-screen mode. My project must be compatible with windows xp, so I can not use QWebEngineView. Cef needs MSG struct, but I don't know how to transfer QKeyEvent* to MSG*, so QKeyEvent seems to be useless.

          JonBJ 1 Reply Last reply
          0
          • vilasV vilas

            @SGaist Hi,
            Because I want to combine qt widget with cef under cef off-screen mode. My project must be compatible with windows xp, so I can not use QWebEngineView. Cef needs MSG struct, but I don't know how to transfer QKeyEvent* to MSG*, so QKeyEvent seems to be useless.

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #5

            @vilas

            but I don't know how to transfer QKeyEvent* to MSG*, so QKeyEvent seems to be useless.

            If you're saying that would solve your need, why can you not do that? IIRC a MSG struct has only about 4 fields, are they not equatable to what you can have in a QKeyEvent?

            vilasV 1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              You'll need a native event filter. But first take a look at this Qt bug report.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              vilasV 1 Reply Last reply
              0
              • JonBJ JonB

                @vilas

                but I don't know how to transfer QKeyEvent* to MSG*, so QKeyEvent seems to be useless.

                If you're saying that would solve your need, why can you not do that? IIRC a MSG struct has only about 4 fields, are they not equatable to what you can have in a QKeyEvent?

                vilasV Offline
                vilasV Offline
                vilas
                wrote on last edited by
                #7

                @JonB
                I find the fields in a MSG struct are not equatable to what I can have in a QKeyEvent.

                JonBJ 1 Reply Last reply
                0
                • vilasV vilas

                  @JonB
                  I find the fields in a MSG struct are not equatable to what I can have in a QKeyEvent.

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by
                  #8

                  @vilas
                  Oh! Why not? If you are saying it would solve your issue if you could populate a MSG from a QKeyEvent, what is it that you cannot successfully copy across?

                  1 Reply Last reply
                  0
                  • SGaistS SGaist

                    You'll need a native event filter. But first take a look at this Qt bug report.

                    vilasV Offline
                    vilasV Offline
                    vilas
                    wrote on last edited by
                    #9

                    @SGaist I have install the native event filter, but it also only receive WM_KEYDOWN and WM_KEYUP message in nativeEventFilter(), without WM_CHAR message.

                    JonBJ mrjjM 2 Replies Last reply
                    0
                    • vilasV vilas

                      @SGaist I have install the native event filter, but it also only receive WM_KEYDOWN and WM_KEYUP message in nativeEventFilter(), without WM_CHAR message.

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by
                      #10

                      @vilas
                      How does your situation compare to the Qt bug report @SGaist gave you, which says "no WM_CHAR messages"?

                      vilasV 1 Reply Last reply
                      1
                      • vilasV vilas

                        @SGaist I have install the native event filter, but it also only receive WM_KEYDOWN and WM_KEYUP message in nativeEventFilter(), without WM_CHAR message.

                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        @vilas
                        Seems it was fixed in
                        Qt 5.11.1

                        vilasV 1 Reply Last reply
                        0
                        • mrjjM mrjj

                          @vilas
                          Seems it was fixed in
                          Qt 5.11.1

                          vilasV Offline
                          vilasV Offline
                          vilas
                          wrote on last edited by
                          #12

                          @mrjj

                          After trying, I find that Qt5.11.1 can receive WM_CHAR message in nativeEventFilter() , but can't receive WM_IME_CHAR message.

                          1 Reply Last reply
                          0
                          • JonBJ JonB

                            @vilas
                            How does your situation compare to the Qt bug report @SGaist gave you, which says "no WM_CHAR messages"?

                            vilasV Offline
                            vilasV Offline
                            vilas
                            wrote on last edited by
                            #13

                            @JonB said in Why nativeEvent can not receive WM_CHAR message?:

                            your situation compare to the Qt bug report @SGaist gave you

                            Yes, my situation is similar to the Qt bug report @SGaist gave.But I also want to support the input method in my project.

                            1 Reply Last reply
                            0

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved