Preface
QT is a cross-platform C + + graphical user Interface application Development framework developed by caused by parity technology in 1991. It can either develop GUI programs or be used to develop non-GUI programs, such as console tools and servers. QT is an object-oriented framework that uses special code generation extensions (called Meta Object Compiler, MOC) and some macros that are easy to extend and allow for component programming. In 2008, the technology was acquired by Nokia, and Qt became a programming language tool for Nokia. In 2012, QT was acquired by Digia. April 2014, cross-Platform integrated development environment QT Creator 3.1.0 officially released, to achieve full support for iOS, add plugins such as WINRT, Beautifier, discard gdb debugging support without Python interface, integrated with clang-C + + code module, and the Android support has been adjusted to achieve full support for iOS, Android, WP.
QT is a cross-platform C + + graphical user interface application framework developed by the 1991 technology. It provides all the functionality that application developers need to build an art-level graphical user interface. QT is easy to scale and allows for real component programming. Basically, Qt is the same type of thing as the MOTIF,OPENWIN,GTK on the X Window and the Mfc,owl,vcl,atl on the Windows platform.
To put it simply, QT can write programs that are easily ported to other platforms, basically recompiling the program.
install qt on Raspberry Pi
Install using the following command
sudo apt-get install Qt4-dev-tools
sudo apt-get install Qtcreator
Since the installation of QT needs to download about 200 m of files from the network, so first Raspberry Pi access network, second installation time may be longer, please wait patiently ...
After installation, click menu in the top left corner of the desktop to see the QT program icon as shown, the QT installation is successful.
<ignore_js_op>
QT Configuration
The first use of QT requires the tool chain to be configured to enter the menu Tools->options->build&run
<ignore_js_op>
<ignore_js_op>
Click the Add button in the top right corner to select GCC
<ignore_js_op>
Follow the path to the selection compiler and debugger
<ignore_js_op>
<ignore_js_op>
New QT test Project
<ignore_js_op>
<ignore_js_op>
<ignore_js_op>
<ignore_js_op>
<ignore_js_op>
<ignore_js_op>
<ignore_js_op>
After the new project, the entire framework of the program has been set up, we directly compile the program to try
<ignore_js_op>
Compile no problem, below we expand the left side of the forms file directory, double-click the Mainwindow.ui file, and then we add two buttons on this interface, two buttons respectively control the Raspberry Pi one pin output high and low level, as shown in:
<ignore_js_op>
<ignore_js_op>
Modify the name of the button control on the right, modify the file displayed by the button, select a button control, right-click, select Go to slot in the popup dialog box, and select the clicked () function, and QT will automatically connect a signal and slot, The slot function is added automatically in the Mainwindow.cpp file, and we write the button click event.
<ignore_js_op>
<ignore_js_op>
We now complete the initialization of the Gpio in the constructor, then complete the Gpio high and low level output control in each button click event function, and then compile the program again, the following problem occurs:
<ignore_js_op>
As a hint, we know that it's because we didn't find the WIRINGPI correlation function at the time of the link, so we need to introduce this library at the time of the connection, it's simple to do, just add the library to the. Pro file, as shown in:
<ignore_js_op>
And then compile again, under normal circumstances will be compiled successfully, into the project directory, we will find a very long name of the folder, which is the QT in the compilation of the time produced by some intermediate files, of course, we compile the generated executable is also in the inside, the name and work name, open the console, Enter the directory with the CD command. and then use
sudo./gpio_led
To run the program, the program works as shown in the following:
<ignore_js_op>
21.png (172.18 KB, download number: 0)
Download attachments
2015-4-10 16:52 Upload
Click on the next two buttons to see if the Raspberry Pi gpio.0 pin output high and low level?
Engineering and source code download:
<ignore_js_op> gpio_led.zip (24.13 KB, download times:)
Reprint please indicate the source, this article link address: http://www.embed-net.com/thread-142-1-1.html
Raspberry Pi Getting Started Tutorial--using QT to develop interface program