How to auto connect serial port without any clicking on button ?



  • Hello everyone, I have a question .
    I wonder if Qt can auto connect a device through serial by itself ?
    I mean when i run program, qt looks for a serial port - just one port as the same time, and auto connect it without any clicking on button.
    Please help me answer this question. Thank you !


  • Moderators

    @huythy Not sure what the problem is. When your app starts then just connect the serial port - there is no need for any buttons, you can use serial port even in command line apps without any GUI.



  • You need to write a code for this. During the startup of the program you can call function which connects to SerialPort. By looking at your explanation, you are clicking on button and this click must be connected a slot(function) which does connections to serial port. In scenario call the slot directly. Slot is like any other member function. No special treatment!!! for slot.



  • I understood that issue, my code is running well. Thank you all of you very much.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.