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

problem using QSerialPort

Scheduled Pinned Locked Moved Solved General and Desktop
21 Posts 8 Posters 2.6k Views 4 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.
  • mzimmersM mzimmers

    @jsulm I'm not using a thread exclusively for the serial port work; my worker thread essentially does all my non-UI stuff(encoding/decoding messages, etc.)
    @kshegunov sorry; I was engaging in a bit of shorthand. m_serialPort is a member variable of SerialPort. The connect is correct, though.
    @J-Hilk I'm currently using (non-static) 5.12.5.

    Last night it occurred to me that long ago, I'd come across a problem with transferring objects to new threads, in which some sub-objects don't get transferred properly.

    I might try Dorfman's idea, though I'd prefer not to have to do that.

    Thanks...

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

    @mzimmers said in problem using QSerialPort:

    @J-Hilk I'm currently using (non-static) 5.12.5.

    And there is your problem
    https://bugreports.qt.io/browse/QTBUG-78086

    please update


    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.

    mzimmersM 1 Reply Last reply
    3
    • J.HilkJ J.Hilk

      @mzimmers said in problem using QSerialPort:

      @J-Hilk I'm currently using (non-static) 5.12.5.

      And there is your problem
      https://bugreports.qt.io/browse/QTBUG-78086

      please update

      mzimmersM Offline
      mzimmersM Offline
      mzimmers
      wrote on last edited by
      #10

      @J-Hilk bang! Good eye. Thanks for catching that. I'll update immediately.

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

        Hi,

        IIRC, your QSerialPort object won't get moved if your don't parent it.

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

        mzimmersM 1 Reply Last reply
        1
        • mzimmersM mzimmers

          @J-Hilk bang! Good eye. Thanks for catching that. I'll update immediately.

          KroMignonK Offline
          KroMignonK Offline
          KroMignon
          wrote on last edited by KroMignon
          #12

          @mzimmers said in problem using QSerialPort:

          Good eye. Thanks for catching that. I'll update immediately.

          Any way, your initialization seems not correct to me:

          SerialPort::SerialPort(QObject *parent) : QObject (parent)
          {
              QSerialPort m_serialPort;
              connect(&m_serialPort, &QSerialPort::readyRead, this, &SerialPort::readSerial);
          ...
          }
          

          should be, I think:

          SerialPort::SerialPort(QObject *parent)
               : QObject (parent)
               , m_serialPort(new QSerialPort(this))
          {
              connect(m_serialPort, &QSerialPort::readyRead, this, &SerialPort::readSerial);
          ...
          }
          

          It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

          1 Reply Last reply
          1
          • SGaistS SGaist

            Hi,

            IIRC, your QSerialPort object won't get moved if your don't parent it.

            mzimmersM Offline
            mzimmersM Offline
            mzimmers
            wrote on last edited by mzimmers
            #13

            @SGaist ah yes, that's what it was. Thanks for refreshing my memory.

            Edit:

            Which member variables does this apply to? For example, I also have a member QByteArray; does that need to be parented too?

            Thanks...

            KroMignonK 1 Reply Last reply
            0
            • mzimmersM mzimmers

              @SGaist ah yes, that's what it was. Thanks for refreshing my memory.

              Edit:

              Which member variables does this apply to? For example, I also have a member QByteArray; does that need to be parented too?

              Thanks...

              KroMignonK Offline
              KroMignonK Offline
              KroMignon
              wrote on last edited by
              #14

              @mzimmers said in problem using QSerialPort:

              Which member variables does this apply to?

              Each member which base class is QObject.

              It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

              mzimmersM 1 Reply Last reply
              2
              • KroMignonK KroMignon

                @mzimmers said in problem using QSerialPort:

                Which member variables does this apply to?

                Each member which base class is QObject.

                mzimmersM Offline
                mzimmersM Offline
                mzimmers
                wrote on last edited by mzimmers
                #15

                @KroMignon thanks...so a QByteArray object wouldn't be affected then.

                It looks like the mechanics of updating have changed since I last used them. Is there a pre-built 5.14 for Windows available somewhere on github? EDIT: looks like the answer is "no;" I guess everyone builds their own now. Given my recent troubles trying to build a static Qt, I hope the directions in the 5.14 README are accurate.

                I'm going to mark this solved, in anticipation that when I get a new Qt built, it'll work. Thanks for everyone's input on this.

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

                  You need now to use your Qt account to access the pre-built binaries (the same you use to post here)

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

                  mzimmersM 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    You need now to use your Qt account to access the pre-built binaries (the same you use to post here)

                    mzimmersM Offline
                    mzimmersM Offline
                    mzimmers
                    wrote on last edited by
                    #17

                    @SGaist thanks. Good thing they still exist, because I'm continuing to have nothing but trouble in my attempts to build the libraries. I really should report my problems with this to someone; any suggestions?

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

                      The bug tracker is your friend :-)

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

                      mzimmersM 1 Reply Last reply
                      1
                      • SGaistS SGaist

                        The bug tracker is your friend :-)

                        mzimmersM Offline
                        mzimmersM Offline
                        mzimmers
                        wrote on last edited by
                        #19

                        @SGaist done. Thanks.

                        aha_1980A 1 Reply Last reply
                        0
                        • mzimmersM mzimmers

                          @SGaist done. Thanks.

                          aha_1980A Offline
                          aha_1980A Offline
                          aha_1980
                          Lifetime Qt Champion
                          wrote on last edited by
                          #20

                          Hi @mzimmers,

                          would you mind letting us know, where?

                          Thanks and regards

                          Qt has to stay free or it will die.

                          mzimmersM 1 Reply Last reply
                          1
                          • aha_1980A aha_1980

                            Hi @mzimmers,

                            would you mind letting us know, where?

                            Thanks and regards

                            mzimmersM Offline
                            mzimmersM Offline
                            mzimmers
                            wrote on last edited by
                            #21

                            Hi @aha_1980 - if you're referring to my bug report, it's here.

                            1 Reply Last reply
                            2

                            • Login

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