Programming of QT serial communication software

Source: Internet
Author: User

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

    1. : 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.