Some Tips and Tricks about Qt

Source: Internet
Author: User

Just contact QT and Qt Quick, meet some small ideas, small traps to share and learn with you. CSDN has qt great god An Xiaohui, I also dare not swim, just with everybody progress together, share.

what is QT quick
Qt Quick is a collection of technologies designed to help developers design an intuitive, modern, and fluid user interface that has been used in mobile phones, media players, set-top boxes and other portable devices in recent years. QT Quick contains a number of user interface elements, as well as a declarative (declarative) language describing these user interfaces, and a language runtime. In a typical QT application, there is a series of C + + APIs that integrate with these high-level features. Integrated development environment for QT Creator2.1 (IDE) contains the tools necessary to develop a QT quick application.

qdebug Output Formatting
You can output debug information:

#include <QDebug>#include <QString>int main(){    "Hello";    int1234;    "foo=""x=" << x;    "foo="" x=" << x;}

c++11 Support
C++11 can be supported and added in the. Pro file:

CONFIG += c++11

The same approach can support c++14, but it is important to note whether your compiler supports C++14.

Turning Compile Warnings into Errors
Google code style tells us to treat warnings as error handling, QT can convert compile warnings to errors, but also need to include some definitions in the. Pro file, note that for different compilers, the definitions added to the. Pro are different:

g++:

 QMAKE_CXXFLAGS += -Werror

Msvc

QMAKE_CXXFLAGS += /WX

Making run-time Warnings Fatal
If you do not want to ignore the warning during run time, you can qt_fatal_warningsan environment variable.
Once defined, if the program encounters a warning, it will abort.

Spying on signals
Signal Spy, which is very useful for us to test:
The Qsignalspy class allows you to connect to any signal from any Qt object and record when it is emitted.

Finally, about the. Pro file:

Some Tips and Tricks about Qt

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.