Use QTDesigner to compile a Linux GUI Program

Source: Internet
Author: User
Use QTDesigner to compile the Linux graphic interface program-general Linux technology-Linux programming and kernel information. The following is a detailed description. I used to see dansin. They used QtDesigner to write an application. But I really didn't expect that I had to figure it out for several days when I used it to write a program, I really regret that I didn't study with them for a while.

At the beginning, when I needed to use QT to write a program, I bought a book about it, called the Tsinghua University Press, I am writing this book here not to advertise it, but to scold the author! This book talks about everything. What is X Windows Programming introduction? KDE programming design doesn't work the same way. There are many examples, that is, all of them are written in VI, abnormal! Even the Makefile of more than 500 rows is typed by VI, which is not abnormal. Kdevelop and Qtdesigner don't even mention it all at once! Sorry, I am so excited that I bought a book.

Next, I will briefly introduce the steps for programming with QtDesigner. Here I would like to thank my good friend dansin for introducing me to the basic concepts of Qt, so that I don't have to worry about the basic knowledge at this time.

Before I started, I went to trolltech on the company homepage to read the flash tutorials on the tool and briefly understood how to use the tool. however, this tutorial is for windows. It is still unclear how to implement it in linux.

My Linux is federo, that is, the previous red hat. The installed QT is in version 3.1 with Qtdesigner. I used this tool to draw a simple interface according to the above example. After saving it, I generated form1.ui, and then I don't know how to do it.

I talked about uic on the internet, moc, qmake, and tmake. I turned dizzy. I tried to use uic and moc and edited the pro file, edit the pro file and use qmake to create the makefile, which is the ones generated by the ui file. h ,. cpp and moc files do not know how to do this. I think dansin was not that complicated in the past.

Later I saw an article using qmake to generate makefile, which mentioned that I could add my ui file to FORMS in the pro file, which will automatically generate a call to uic and moc, and then I suddenly became enlightened, I know that qmake-project can automatically generate a pro File Based on the files in the current directory. That is to say, as long as I have created my main function file, I can. after reading the information, I wrote the main function file:
CODE: # include main (int argc, char * argv []) {QApplication app (argc, argv); Form1 * fr = new Form1; fr-> show (); app. setMainWidget (fr); return app.exe c ();}

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.