Why QT becomes the first choice for C + + interface programming

Source: Internet
Author: User
Tags qt designer

Why Qt becomes the first choice for C + + interface programming First, PrefaceWhy now QT more and more become the first choice of interface programming, the author of the QT Interface programming has been nearly 8 years, before this I do C + + interface is based on MFC, also done about 5 years. At that time why the transfer from MFC to QT, the main reason is that MFC development interface to do a good look some very difficult, referring to the third-party MFC-based Interface library code is also relatively confusing, at that time, mainly to see Qt has QSS style design This function, decided to try. When the project migrated to QT, I think MFC really can be discarded, MFC is too many shortcomings compared to QT. Of course, MFC also has a fatal flaw that cannot cross the platform. Of course, some students may say why not directly using C # WPF interface, some of our projects and tools are really done in C #, C # and C + + can really call each other, and can be breakpoint debugging. But there are still a lot of losses in performance. We do have an impact on our audio and video and three-dimensional simulation projects, so we only use C # in some projects that have no extreme performance requirements. Second, QT HistoryHaving said a few things about our project, let us briefly introduce the history of QT, knowing that the purpose of history is to determine whether the use of this library is risky, whether it will stop updating, and that many open-source libraries are not commercialized and end up being stopped. L QT caused by Parity Technology Co., Ltd. developed L 2008 Nokia acquired QT from the curious technology company and increased the LGPL licensing mode L 2011 Finland's Digia acquired QT's commercial copyrights from Nokia, from which Nokia is responsible for QT on Mobile, QT Commercial by Digia the peak of the development of QT is in the heyday of Nokia smartphones, when Nokia Symbian system mobile phone applications are based on QT, with the popularity of Apple and Android, Saipan exits the historical stage. QT's mobile-phone development needs are also largely replaced. However, QT application in embedded, power system, military system has not been replaced. Third, QT now use caseTo understand his current situation, the main consideration is whether the application scenario is many, whether the employment is wide, talent is good recruitment. QT is widely used in embedded, power systems, military systems and other hardware interface systems to interact with, and a large number of professional cross-platform application software is also the use of QT development. Digia took over QT and developed the Android and iOS versions of QT, enabling the development of a program to run on a full platform. However, it is not recommended to use QT to develop Android and iOS apps, but the pits are more but surely more perfect. We list the software developed by QT: 1.  Autodesk may Avatar and Kung Fu Panda's 3D animation maker Software 2. In the WPS directory, you can see the DLL library for QT 3. 4. Google Earth 5. Microsoft's Skype6. VirtualBox (Oracle's virtual machine software) (too many are not listed) Four, QT the tools providedLooking at what QT offers, QT not only provides a feature-rich SDK development package, but also provides a powerful tool, which is one of the reasons we chose him. 1. based on VS the plugin Qt-vs-addinThe latest version is available in versions 2013 and 2015, and the old version is currently unavailable, but now the basic mainstream of C + + development is at least vs2013. 2. Qt Assistant ( Brochures )The QT manual is still quite complete and contains many examples of source code. 3. based on XML the interface designer Qt DesignerConvenient decoding design, it should be the most convenient interface designer in C + + domain. 4. Cross-platform development tools QtcreatorCross-platform C + + development tools, should be the most convenient C + + development debugging Tools on Linux, even without the QT library, you can use it to develop cross-platform C + + projects. v. QT Framework BenefitsFinally, let's see what the specific advantages of QT are. 1. Tools RichThis has been introduced in front of the tool. 2. feature RichOut of the provided interface library, but also provides audio library, 3d library, database sdk,webengine, network library, etc., let us do cross-platform program becomes easy. 3. Open source and cross-platformOut of the QT source can be their own transplant, QT official has provided a re-windows,android,ios,linux run in the SDK. 4. Benefits of ArchitectureThere are a lot of advantages to this, and we've listed some examples to see the benefits. interface source code and user source isolation, QT strategy is that no interface will generate a corresponding source code, such as having an interface design file Xps.ui It will parse the XML generated a corresponding ui_xps.h file, this file you do not need to modify, if you want to invoke the interface control directly through the Ui::xpsclass UI; This object definition is also written in Ui_xps.h. That is, your business logic is isolated from the creation and setup of interface control objects. Convenient event handling (flexible signal slot mechanism), QT provides a signal slot mechanism, which can reduce coupling and improve the reusability of code. For example, there is a need for one of my Xmov class specialized in video processing, but to the processing progress to inform the external interface Xslider object, I handle the method, can Xmov provide an interface to external access to progress, or actively call the external interface to refresh the display progress, the first method of real-time is not guaranteed, and the interface end program also needs to introduce the Xmov class header file, that is, to do the correlation. The second method makes the Xmov class more coupled, and the Xmov class needs to be modified when the interface is changed. QT in the signal slot mechanism can be associated with two classes Xmov and Xslider, in Xmov directly define a signal function void SetPos (int), directly bound to the Xslider object of the void SetPos (int) slot function, they do not know each other, Reduce coupling. Only the signal slots of each module are associated in the unified portal class. Xmov::run () {while (!sexit) {//handles video int pos = Dealmove ();//signals that if there is no binding, the cadence will not be problematic setpos (POS);}} Bind method Connect (Xmov, SIGNAL (SetPos (int)), Xslider,slot (SetPos (int))) This is an advantage of the signal slots, and of course the signal slots are also custom events for handling various types of controls. 5. and its convenient style design (like the development Web design the interface as a program)can easily make a rounded border, and have a gradient effect, the mouse moved up also changed, you can refer to the following style sheet, QSS Basic and CSS similar, including CSS-enabled selectors, can be set by the class name, object name, and the parent class name. qpushbutton:!hover{border-radius:5px;} Qpushbutton:hover/* Hover mouse hover */{border-radius:5px;/* Rounded border */}
There will be a succession of QT related articles, this article mainly to do a brief introduction, the following will be divided into detailed explanation.

http://edu.csdn.net/course/detail/6417

Why QT becomes the first choice for C + + interface programming

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.