QtEmbedded is directly dependent on Framebuffer and does not require X-Window. Therefore, you must enable Framebuffer for Linux. To enable this function, use BootLoader to pass parameters to the kernel: for grub, add vga = 0x311fb: on after the kernel command in the grub. conf file. For lilo, add vga = 0x311 to the lilo. conf file. 0x311 indicates the resolution is 640*480,
Qt Embedded is directly dependent on Framebuffer and does not require X-Window. Therefore, you must enable Framebuffer for Linux. You can use BootLoader to pass parameters to the kernel:
For grub, add vga = 0x311 fb: on after the kernel command in the grub. conf file.
For lilo, add vga = 0x311 to the lilo. conf file.
0x311 indicates that the resolution is 640*480 and 16dpp.
Compile and install
First download the Qt/E-4.4.0 source code, and then decompress in the root directory:
Cd/root
Tar-xvjf qt-embedded-linux-opensource-src-4.4.0.tar.bz2
Cd qt-embedded-linux-opensource-src-4.4.0
The source code contains documents and routines. These will occupy a lot of space and compilation time. If you don't need it, modify configure and remove it:
Change QT_DEFAULT_BUILD_PARTS = "libs tools examples demos doc"
QT_DEFAULT_BUILD_PARTS = "libs tools"
You can use the configure option to disable many unnecessary modules. Use./configure-help to view details.
For the embedded version, you can also use-no-feature- Disable the corresponding features. By default, all features are compiled. The available feature is described in the src/corelib/global/qfeatures.txt file. However, this method is inconvenient. Generally, a configuration file is specified through the-qconfig parameter. There are several typical configuration files in the src/corelib/global/directory:
Qconfig-large.h # contains most of the features.
Qconfig-small.h # closes many features.
Qconfig-minimal.h # minimal configuration, close almost all features.
You can manually edit and modify the configuration. However, dependencies between various features are complex. All Qt provides a graphical tool qconfig to help generate configurations. This tool needs to be compiled. Install Qt/E before introducing it.
Run:
. /Configure-prefix/usr/qt-release-no-largefile-no-qt3support-no-xmlpatterns-no-phonon-no-svg-no-webkit-no-mmx-no-3dnow-no -sse-no-sse2-no-gif-no-libtiff-no-libmng-qt-libpng-qt-libjpeg-no-openssl-no-nis-no-cups-no-iconv -no-opengl-no-embedded-qt-freetype-depths 16-embedded x86-qt-decoration-default-qt-gfx-linuxfb-qt-kbd-tty-qt-kbd -usb-qt-mouse-pc-qt-mouse-bus-no-glib-qconfig src/corelib/global/qconfig-small.h
Make
Make install
It takes several hours to compile the project. All files will be installed in the/usr/qt/directory. Www.linuxidc.com:
Add the following content to the/etc/profile file:
PATH = $ PATH:/usr/qt/bin
Add the following content to the/etc/ld. so. conf file:
/Usr/qt/lib
Then run ldconf-v
After the system is restarted, Qt/E can be used.
Test
- // Demo. cpp
- # Include
- # Include
- # Include
- # Include
- IntMain (IntArgc,Char* Argv [])
- {
- QApplication app (argc, argv );
- QTextCodec * codec = QTextCodec: codecForName ("GB18030");
- QTextCodec: setCodecForLocale (codec );
- QTextCodec: setCodecForCStrings (codec );
- QTextCodec: setCodecForTr (codec );
- QPushButton hello ("Hello world! ");
- Hello. show ();
- ReturnApp.exe c ();
- }