How does the Qt application process Chinese parameters during drag-and-drop, and qt drag-and-drop Chinese parameters?

Source: Internet
Author: User

How does the Qt application process Chinese parameters during drag-and-drop, and qt drag-and-drop Chinese parameters?

You have developed an application using Qt. When you drag and drop a file to your exe and start your application, the main () function may receive Chinese parameters. How can this problem be solved correctly? The Code is as follows:

QTextCodec * codec = QTextCodec: codecForLocale (); QString arg = codec-> toUnicode (argv [I]);

The parameters passed to the application during drag and drop are encoded according to the local encoding format of the system. CodecForLocale () of QTextCodec will return the local codec of the system, and then the toUnicode () method can be converted to QString ......



Simple QT programming problems how to access components dragged and dropped by QT in QT Creator, such as dragging PushButton to the editor, how can I come in the code?

You can use the ui
For example, ui-> PushButton
You can also use a series of functions, such as signal functions, to bring them in QtCreator,
We recommend that you read this book. It is a wonderful example of linux window Program Design for beginners.

For QT drag

Implement mousePressEvent and mouseMoveEvent.

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.