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. QSerialPort open
Qt 6.11 is out! See what's new in the release blog

QSerialPort open

Scheduled Pinned Locked Moved General and Desktop
12 Posts 4 Posters 4.1k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #3

    i tried, but failed. Could U give a simple example ? Thank you

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #4

      i tried, but failed. Could U give a simple example ? Thank you
      [quote author="raven-worx" date="1386321238"]first uncomment line 1 in your main() ;)
      on the return do app.exec() instead of returning 0

      Also you need to move the implementation of your serial port to an object which lives in the Qt event loop. If you use a gui simply add it into a widget. If not just use an QObject which does the work instead doing all in the main function.[/quote]

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

        Hi,

        What did fail ?

        Since you are not using any GUI element you can use a QCoreApplication

        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
        0
        • K Offline
          K Offline
          kuzulis
          Qt Champions 2020
          wrote on last edited by
          #6

          BTW: This is not the QSerialPort issue.. :)

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #7

            Does it work without Qt event loop environment?
            [quote author="SGaist" date="1386331898"]Hi,

            What did fail ?

            Since you are not using any GUI element you can use a QCoreApplication[/quote]

            1 Reply Last reply
            0
            • raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by
              #8

              it works without an event loop when you only use the blocking methods (all waitXXX() methods).
              Maybe in your case it's enough to just instantiate the Q(Core)Application?

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #9

                yes, you are right.
                [quote author="SGaist" date="1386331898"]Hi,

                What did fail ?

                Since you are not using any GUI element you can use a QCoreApplication[/quote]

                1 Reply Last reply
                0
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #10

                  Atfer 2 places modified, it's ok now. But i've a new problem.
                  The following is the response, and the first line "ls" is the sent data.
                  Now i don't want the first line to be displayed, then how?

                  ls
                  bin lib mnt root tmp
                  dev linuxrc opt sbin usr
                  etc lost+found proc sys

                  [quote author="raven-worx" date="1386339040"]it works without an event loop when you only use the blocking methods (all waitXXX() methods).
                  Maybe in your case it's enough to just instantiate the Q(Core)Application?[/quote]

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

                    Isn't that your device that echoes what it has received ?

                    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
                    0
                    • ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by
                      #12

                      Ah, maybe, i'll check
                      [quote author="SGaist" date="1386578714"]Isn't that your device that echoes what it has received ?[/quote]

                      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