Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to share Serial port opened in Main Window class with Dialog box class
saurabh162 last edited by
In my Qt project I have two C++ classes named "MainWindow" and "DialogBox"
I used serial port class object of QT to open a serial port in MainWindow class and now I want to send and receive data from "DialogBox" class using same serial port opened in MainWindow class.
Please tell me what is correct approach to share same serial port object between MainWindow and DialogBox Class.
Kindly inform me if you need any other information from me.
Thank and Regards
@saurabh162 You could simply pass the pointer to the QSerialPort instance to the constructor of your dialog class...
Isn't this same question as here: https://forum.qt.io/topic/93183/how-to-share-serial-port-object-between-two-classes
Why do you ask same question two times?
@jsulm is right, one question is enough.
Closing this one, please continue at https://forum.qt.io/topic/93183/how-to-share-serial-port-object-between-two-classes