Because the project needs to write a host computer software, the previous period of time to contact QT, that the Framework class library will be better than MFC, and has cross-platform features, so the use of Qt5.2 wrote a serial communication based debugging host computer.
Major problems encountered:
1, the serial port can receive data, but the reception speed is very slow, not working properly?
Problem: The program only sets the COM port and parameters at the beginning, but if the pre-installed COM port does not exist, then the new COM port is not initialized again, so it will cause the serial port to work abnormally.
2. How does the window layout change as the size of the main window follows the space?
First sizepolicy to adopt "expanding" mode;
Secondly, the use of GridLayout spacer GroupBox and other space, first from the overall layout, and then focus on the details, a layer of layout can be. It is also important to note that some control sizes need to be set to fixed length.
3, Chinese display problem?
Two methods have been tried at present
- : qstringliteral
Setwindowtitle (Qstringliteral (" I am Chinese "));
- :
Qtextcodec *codec = Qtextcodec::codecforname ("GB18030"); Setwindowtitle (Codec- >tounicode (" I am Chinese ");
The interface is as follows:
Programming of QT serial communication software