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 Updated to NodeBB v4.3 + New Features

Unable to read from QSerialPort using MSVC compiler

Scheduled Pinned Locked Moved Solved General and Desktop
qserialportmingwmsvcread serial
25 Posts 5 Posters 4.4k Views 1 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.
  • T Turi
    24 Nov 2021, 13:59

    @jsulm
    I removed QThread::msleep(50) and added a connect to the readyRead signal but I'm still unable to read the serial, the connect is never called. Also with the connect, it is solicited if I use MinGW compiler but not with MSVC.

    J Offline
    J Offline
    jsulm
    Lifetime Qt Champion
    wrote on 24 Nov 2021, 14:06 last edited by
    #8

    @Turi And also please do what @J-Hilk suggested.

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

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Turi
      wrote on 24 Nov 2021, 14:09 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.

      J 1 Reply Last reply 24 Nov 2021, 14:11
      0
      • T Turi
        24 Nov 2021, 14:09

        @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.

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 24 Nov 2021, 14:11 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 24 Nov 2021, 14:26
        0
        • J jsulm
          24 Nov 2021, 14:11

          @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 24 Nov 2021, 14:26 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.

          J J 2 Replies Last reply 24 Nov 2021, 14:28
          0
          • T Turi
            24 Nov 2021, 14:26

            @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 Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 24 Nov 2021, 14:28 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 24 Nov 2021, 14:36
            0
            • T Turi
              24 Nov 2021, 14:26

              @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 Offline
              J Offline
              J.Hilk
              Moderators
              wrote on 24 Nov 2021, 14:30 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 24 Nov 2021, 14:46
              0
              • J jsulm
                24 Nov 2021, 14:28

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

                T Offline
                T Offline
                Turi
                wrote on 24 Nov 2021, 14:36 last edited by
                #14

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

                1 Reply Last reply
                0
                • J J.Hilk
                  24 Nov 2021, 14:30

                  @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 24 Nov 2021, 14:46 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.

                  J 1 Reply Last reply 24 Nov 2021, 14:48
                  0
                  • T Turi
                    24 Nov 2021, 14:46

                    @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.

                    J Offline
                    J Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 24 Nov 2021, 14:48 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 24 Nov 2021, 14:57 last edited by
                      #17

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

                      J 1 Reply Last reply 24 Nov 2021, 14:59
                      0
                      • T Turi
                        24 Nov 2021, 14:57

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

                        J Offline
                        J Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 24 Nov 2021, 14:59 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 24 Nov 2021, 15:10
                        0
                        • J jsulm
                          24 Nov 2021, 14:59

                          @Turi Can you try with 5.15.2?

                          T Offline
                          T Offline
                          Turi
                          wrote on 24 Nov 2021, 15:10 last edited by
                          #19

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

                          J 1 Reply Last reply 24 Nov 2021, 15:56
                          0
                          • T Offline
                            T Offline
                            Turi
                            wrote on 24 Nov 2021, 15:53 last edited by
                            #20

                            I tried with Qt 5.12.2 but not work.

                            J 1 Reply Last reply 24 Nov 2021, 15:56
                            0
                            • T Turi
                              24 Nov 2021, 15:10

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

                              J Offline
                              J Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on 24 Nov 2021, 15:56 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
                                24 Nov 2021, 15:53

                                I tried with Qt 5.12.2 but not work.

                                J Offline
                                J Offline
                                jsulm
                                Lifetime Qt Champion
                                wrote on 24 Nov 2021, 15:56 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 24 Nov 2021, 16:38
                                0
                                • J jsulm
                                  24 Nov 2021, 15:56

                                  @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 24 Nov 2021, 16:38 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
                                  • S Offline
                                    S Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on 24 Nov 2021, 19:18 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
                                    • C Offline
                                      C Offline
                                      Christian Ehrlicher
                                      Lifetime Qt Champion
                                      wrote on 25 Nov 2021, 06:09 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

                                      17/25

                                      24 Nov 2021, 14:57

                                      • Login

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