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. Unable to read from QSerialPort using MSVC compiler
Forum Update on Monday, May 27th 2025

Unable to read from QSerialPort using MSVC compiler

Scheduled Pinned Locked Moved Solved General and Desktop
qserialportmingwmsvcread serial
25 Posts 5 Posters 3.7k Views
  • 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.
  • T Offline
    T Offline
    Turi
    wrote on last edited by Turi
    #9

    @jsulm
    I have already followed the suggestions of @J-Hilk .
    This is my connect:

    bool ok = connect(serial, SIGNAL(readyRead()), this, SLOT(onReadyRead()));
    

    After that the value of' ok' is true, but the SLOT is never called.

    jsulmJ 1 Reply Last reply
    0
    • T Turi

      @jsulm
      I have already followed the suggestions of @J-Hilk .
      This is my connect:

      bool ok = connect(serial, SIGNAL(readyRead()), this, SLOT(onReadyRead()));
      

      After that the value of' ok' is true, but the SLOT is never called.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by jsulm
      #10

      @Turi said in Unable to read from QSerialPort using MSVC compiler:

      I have already followed the suggestions of @J-Hilk

      No, I was refering to this:
      "also connect to the error signal errorOccured
      https://doc.qt.io/qt-5/qserialport.html#errorOccurred"

      And you should use the Qt5 connect syntax: https://doc.qt.io/qt-5/signalsandslots.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      T 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Turi said in Unable to read from QSerialPort using MSVC compiler:

        I have already followed the suggestions of @J-Hilk

        No, I was refering to this:
        "also connect to the error signal errorOccured
        https://doc.qt.io/qt-5/qserialport.html#errorOccurred"

        And you should use the Qt5 connect syntax: https://doc.qt.io/qt-5/signalsandslots.html

        T Offline
        T Offline
        Turi
        wrote on last edited by
        #11

        @jsulm
        I have already tried all this and all seem work fine, without any error. But my application still does not read from the serial only if I use the MSVC compiler.

        jsulmJ J.HilkJ 2 Replies Last reply
        0
        • T Turi

          @jsulm
          I have already tried all this and all seem work fine, without any error. But my application still does not read from the serial only if I use the MSVC compiler.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #12

          @Turi Did you verify that the other side sends something?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          T 1 Reply Last reply
          0
          • T Turi

            @jsulm
            I have already tried all this and all seem work fine, without any error. But my application still does not read from the serial only if I use the MSVC compiler.

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #13

            @Turi what versions are we actually talking here ?

            Qt(from the kit), msvc, windows etc.

            and can you show more of your actually class that does the serial communication?


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            T 1 Reply Last reply
            0
            • jsulmJ jsulm

              @Turi Did you verify that the other side sends something?

              T Offline
              T Offline
              Turi
              wrote on last edited by
              #14

              @jsulm
              Yes, the other side reveives and sends messages.

              1 Reply Last reply
              0
              • J.HilkJ J.Hilk

                @Turi what versions are we actually talking here ?

                Qt(from the kit), msvc, windows etc.

                and can you show more of your actually class that does the serial communication?

                T Offline
                T Offline
                Turi
                wrote on last edited by
                #15

                @J-Hilk
                I'm using:

                • Qt Creator 4.9.0
                • Based on Qt 5.12.2 (MSVC 2017, 32 bit)
                • Windows 10 Enterprise

                Unfortunately I can't show more of my actually class due to the fact that is reserved code.

                jsulmJ 1 Reply Last reply
                0
                • T Turi

                  @J-Hilk
                  I'm using:

                  • Qt Creator 4.9.0
                  • Based on Qt 5.12.2 (MSVC 2017, 32 bit)
                  • Windows 10 Enterprise

                  Unfortunately I can't show more of my actually class due to the fact that is reserved code.

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #16

                  @Turi said in Unable to read from QSerialPort using MSVC compiler:

                  Based on Qt 5.12.2 (MSVC 2017, 32 bit)

                  This is the Qt version which was used to build QtCreator.
                  What Qt version do you use?

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    Turi
                    wrote on last edited by
                    #17

                    Qt 5.12.3
                    MinGW 7.3.0 32-bit
                    MSVC 2017 32-bit

                    jsulmJ 1 Reply Last reply
                    0
                    • T Turi

                      Qt 5.12.3
                      MinGW 7.3.0 32-bit
                      MSVC 2017 32-bit

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #18

                      @Turi Can you try with 5.15.2?

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      T 1 Reply Last reply
                      0
                      • jsulmJ jsulm

                        @Turi Can you try with 5.15.2?

                        T Offline
                        T Offline
                        Turi
                        wrote on last edited by
                        #19

                        @jsulm
                        Can you pass me a link where I can download this version?

                        jsulmJ 1 Reply Last reply
                        0
                        • T Offline
                          T Offline
                          Turi
                          wrote on last edited by
                          #20

                          I tried with Qt 5.12.2 but not work.

                          jsulmJ 1 Reply Last reply
                          0
                          • T Turi

                            @jsulm
                            Can you pass me a link where I can download this version?

                            jsulmJ Offline
                            jsulmJ Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on last edited by
                            #21

                            @Turi said in Unable to read from QSerialPort using MSVC compiler:

                            Can you pass me a link where I can download this version?

                            Use the Qt Maintenance Tool to add that Qt version to your installation.

                            https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            0
                            • T Turi

                              I tried with Qt 5.12.2 but not work.

                              jsulmJ Offline
                              jsulmJ Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by
                              #22

                              @Turi said in Unable to read from QSerialPort using MSVC compiler:

                              I tried with Qt 5.12.2 but not work.

                              I seggested 5.15.2, not 5.12.2

                              https://forum.qt.io/topic/113070/qt-code-of-conduct

                              T 1 Reply Last reply
                              0
                              • jsulmJ jsulm

                                @Turi said in Unable to read from QSerialPort using MSVC compiler:

                                I tried with Qt 5.12.2 but not work.

                                I seggested 5.15.2, not 5.12.2

                                T Offline
                                T Offline
                                Turi
                                wrote on last edited by
                                #23

                                @jsulm Sorry, my bad. With Qt 5.15.2 my application works fine. Thank you.
                                So, is this a bug of older versions?

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

                                  There was a bug with QSerialPort on Windows but IIRC it has been also fixed for the 5.12 series if you really need it. But you have to update to the latest release of that series.

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

                                  1 Reply Last reply
                                  3
                                  • Christian EhrlicherC Online
                                    Christian EhrlicherC Online
                                    Christian Ehrlicher
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #25

                                    Here the bug report for this issue: https://bugreports.qt.io/browse/QTBUG-78086

                                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                                    Visit the Qt Academy at https://academy.qt.io/catalog

                                    1 Reply Last reply
                                    3

                                    • Login

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