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. Open the selected port
Forum Update on Monday, May 27th 2025

Open the selected port

Scheduled Pinned Locked Moved Unsolved General and Desktop
serial portqt5combobox
5 Posts 3 Posters 729 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.
  • D Offline
    D Offline
    deleted286
    wrote on 8 Mar 2021, 11:07 last edited by
    #1

    How can i get the current ports on a combo box and then open the choosen port?
    I want to open it when i run the program

    void MainWindow::open_Serial()
    {
        serial->setPortName("/dev/ttyUSB0");
        serial->setBaudRate(QSerialPort::Baud115200);
        serial->setDataBits(QSerialPort::Data8);
        serial->setParity(QSerialPort::NoParity);
        serial->setStopBits(QSerialPort::OneStop);
        serial->setFlowControl(QSerialPort::NoFlowControl);
    
        if (serial->open(QIODevice::ReadWrite))
        {
            qDebug() << "ttyUSB0  is Open ";
            serial->clear();
            write_Json();
            connect(serial, &QSerialPort::readyRead, this, &MainWindow::on_Serial_Read);
        }
    
        if(serial->isOpen())
        {
            ui->Open->setChecked(true);
        }
        else
        {
            ui->Close->setChecked(true);
         }
    }
    
    1 Reply Last reply
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 8 Mar 2021, 11:18 last edited by
      #2

      Do you think posting a question after it has answered already 1 week ago will give you another answer?
      https://forum.qt.io/topic/124316/find-the-current-port-and-open-it

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

      D 1 Reply Last reply 8 Mar 2021, 11:49
      3
      • C Christian Ehrlicher
        8 Mar 2021, 11:18

        Do you think posting a question after it has answered already 1 week ago will give you another answer?
        https://forum.qt.io/topic/124316/find-the-current-port-and-open-it

        D Offline
        D Offline
        deleted286
        wrote on 8 Mar 2021, 11:49 last edited by
        #3

        @Christian-Ehrlicher what will change if i think it?
        Im just searching a solution to my problem. I solved it, you can delete my post.

        P 1 Reply Last reply 8 Mar 2021, 12:29
        0
        • C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 8 Mar 2021, 11:56 last edited by
          #4

          @suslucoder said in Open the selected port:

          you can delete my post.

          Why should I delete your post? I just asked why you open a new thread for a question which was answered for you one week ago.

          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
          1
          • D deleted286
            8 Mar 2021, 11:49

            @Christian-Ehrlicher what will change if i think it?
            Im just searching a solution to my problem. I solved it, you can delete my post.

            P Offline
            P Offline
            Pablo J. Rogina
            wrote on 8 Mar 2021, 12:29 last edited by
            #5

            @suslucoder said in Open the selected port:

            I solved it, you can delete my post.

            No, the solved posts don't get deleted. They remain for the benefit of other forum users having same/similar issues.
            It's a community driven approach, opposite to a "my problem only" driven approach

            Upvote the answer(s) that helped you solve the issue
            Use "Topic Tools" button to mark your post as Solved
            Add screenshots via postimage.org
            Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            3

            4/5

            8 Mar 2021, 11:56

            • Login

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