A
A
AlexSer2019-11-08 10:23:55
Qt
AlexSer, 2019-11-08 10:23:55

Explain the interaction of windows in QT C++ with an example?

Hello! The task was to program the reception of data in the Com port and write it to a file. And since I'm new. I still don’t understand how to link two windows (everything is clear in one window version), namely, I wanted to display the connection settings in a separate window:
5dc51618d6ddf538875775.png
Now there are 2 questions:
1) How to link my mainwindow.cpp and dialogsettingscom.cpp.
2) And where is it more correct to make a connection when clicking "Connect" in dialogsettings.cpp or catch the signal of pressing "Connect" and connect to the com port in mainwindow.cpp.
I still think that it is better to do everything in mainwindow.cpp, but the question arises how to get the settings fields from another window.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Antony, 2019-11-08
@AlexSer

1) How to link my mainwindow.cpp and dialogsettingscom.cpp.

Signals, the most obvious option. Google examples of modal windows in Qt. (settings, by logic, modal window)
Each object has its own task.
Ideally, GUI classes (widgets) should not contain business logic at all. Take out all the actions in a separate (separate classes). Widgets should only be used as a form for entering and displaying data... well, for control.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question