Embedded Linux QT Development (iii)--gui principle analysis

Source: Internet
Author: User
Tags message queue

embedded linux QT Development (III.)--GUI principle Analysis First, command-line programs

command-line programs are process-oriented programming.

Features of the command-line program:

A. Execution based on sequential structure

B, the program execution process does not need to interact with the user

C, program execution end gives the final running result

Command-line Application occasions:

A, single-task occasions

B, no interaction, simple interaction occasions

C, server applications

Second, GUI Program

Features of GUI programs:

A, a message-driven model-based program

B, program execution relies on user interaction process

C, real-time response to user actions during program execution

D, the general program will not be actively exited after implementation

GUI program for the occasion:

A, multi-tasking occasions

B, strong user interaction occasions

C, non-professional computer users

GUI program run mode:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/88/49/wKioL1ft7r2iDH26AABpkgB3ps4387.png "title=" Picture 1.png "alt=" Wkiol1ft7r2idh26aabpkgb3ps4387.png "/>

GUI program Message processing model:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/88/4C/wKiom1ft7tuRz6KpAABxeDFvUoE344.png "title=" Picture 2.png "alt=" Wkiom1ft7turz6kpaabxedfvuoe344.png "/>

First, GUI Program Development principle

modern operating systems are supported GUI program development, features are as follows:

A, the operating system provides native SDK support GUI program development

B, GUI program development is the mainstream technology of modern operating system

C, the same principle of GUI development on different operating systems

D. Different GUI SDKs on different operating systems

GUI Program Development principle:

A, the GUI program creates a message queue at run time

B, The system kernel translates user actions into corresponding program messages

C, The program needs to process messages in the message queue in real time during Operation

D, The program is stuck when there is no message in the queue

GUI Program development process:

A, create window, window element GUI interface

B, in the message processing function according to the program message to make different corresponding

Iv. The nature of QT 1. Object-oriented GUI programming

The operating system provides the functions required to create interface elements, and in turn calls functions of different functions to create interface elements, but the native functions provided by the operating system cannot be directly mapped to interface elements. Based on object-oriented programming, the interface elements are abstracted into classes, andthe process of creating GUI interfaces is the process of combining different interface elements.

2. The nature of QT

QT is a set of GUI component libraries developed using object-oriented programming, QT encapsulates the GUI details of different operating systems in the class, and provides a set of cross-platform classes for GUI program development.

QT follows the classic GUI program development model.

Five, QT Instance 1. Example Source

#include <QApplication>

#include <QMainWindow>

#include <QPushButton>

int main (int argc, char* argv[])

{

Qapplication A (argc, argv);

Qmainwindow W;

Qpushbutton b (&w);

B.settext ("Hello qt!");

W.show ();

return A.exec ();

}

2. QT Development Environment Command-line compilation

A. Enter the QT development environment command line

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/88/4C/wKiom1ft7wLQCgFHAABBriUAdQs869.png "title=" Picture 3.png "alt=" Wkiom1ft7wlqcgfhaabbriuadqs869.png "/>

Click qt 4.7.4 command prompt into the QT development environment.

B. Enter the directory where the source program is located

C. Generate engineering documents according to source code

Qmake-project

build process file Xxxxx.pro

D. Generate makefile Files according to engineering documents

Qmake

Build Makefile, Makefile.debug, makefile.release files and release, Debug directories

E, compiling

Make

compile and build the executable file Xxx.exe

3. QT IDE development environment

Qt Creator is a visual integrated development environment for QT.

How to debug the QT creator environment:

A, Log Debug Method

Add a certain print statement to the code to print out the program state and the value of the key variable

Log printing needs to add # include <QDebug>

Qdebug () << "Hello";

B, breakpoint Debugging method

in the QT Creator Development environment when you open a project, you can set a breakpoint on the appropriate line of code, and when the program runs to a breakpoint, it pauses to run, and when the conditional breakpoint is set, the program pauses to run when the condition is met.






This article from "Life is endless, struggle not only" blog, declined reprint!

Embedded Linux QT Development (iii)--gui principle analysis

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.