📄 qt_library.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head> <title></title> <link rel="stylesheet" media="screen" type="text/css" href="./style.css" /> <link rel="stylesheet" media="screen" type="text/css" href="./design.css" /> <link rel="stylesheet" media="print" type="text/css" href="./print.css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body><a href=start.html>start</a></br><div class="toc"><div class="tocheader toctoggle" id="toc__header">Table of Contents</div><div id="toc__inside"><ul class="toc"><li class="level1"><div class="li"><span class="li"><a href="#qt_embedded_library_free_version_on_blackfin_uclinux" class="toc">QT Embedded Library Free version on blackfin/uClinux</a></span></div><ul class="toc"><li class="level2"><div class="li"><span class="li"><a href="#build_qt_embedded_free_library" class="toc">Build QT embedded free library</a></span></div></li><li class="level2"><div class="li"><span class="li"><a href="#an_sample_user_application_based_on_qt_embedded_free_library" class="toc">An sample user application based on QT embedded free library</a></span></div></li><li class="level2"><div class="li"><span class="li"><a href="#changes_to_the_qt_embedded_library" class="toc">Changes to the QT embedded library</a></span></div></li></ul></li></ul></div></div><h1><a name="qt_embedded_library_free_version_on_blackfin_uclinux" id="qt_embedded_library_free_version_on_blackfin_uclinux">QT Embedded Library Free version on blackfin/uClinux</a></h1><div class="level1"><p>Qt is a multiplatform C++ <acronym title="Graphical User Interface">GUI</acronym> toolkit created and maintained by Trolltech. It provides application developers with all the functionality needed to build applications with graphical user interfaces. Qt is fully object-oriented, easily extensible. There are 2 versions of the QT embedded library. One is the commercial version. Look at <a href="http://www.trolltech.com/products/qt3/embedded/index.html" class="urlextern" title="http://www.trolltech.com/products/qt3/embedded/index.html" rel="nofollow"> QT embedded overview</a> for more details. You can buy it <a href="http://www.trolltech.com/purchase/alternative.html" class="urlextern" title="http://www.trolltech.com/purchase/alternative.html" rel="nofollow">here</a>. The other is the free version. The latest stable release is 3.5.5. Only the free version is enabled on blackfin/uCLinux.</p></div><!-- SECTION [1-702] --><h2><a name="build_qt_embedded_free_library" id="build_qt_embedded_free_library">Build QT embedded free library</a></h2><div class="level2"><p>To build the QT embedded free library for your development, you need a cross compilation tool chain for blackfin on your host platform. In addition, you should check out the uClinux-dist source code in advance.</p><ol><li class="level1"><div class="li"> Download QT embedded source tarball from <a href="ftp://ftp.trolltech.com/qt/source/qt-embedded-free-3.3.5.tar.bz2" class="urlextern" title="ftp://ftp.trolltech.com/qt/source/qt-embedded-free-3.3.5.tar.bz2" rel="nofollow">ftp://ftp.trolltech.com/qt/source/qt-embedded-free-3.3.5.tar.bz2</a>.</div></li><li class="level1"><div class="li"> Extract QT embedded source tarball. <pre class="code"> ~> tar xvfj qt-embedded-free-3.3.5.tar.bz2 ~> cd qt-embedded-free-3.3.5</pre></div></li><li class="level1"><div class="li"> Set QT source directory environment variable. <pre class="code"> ~> export QTDIR=~/your_qt_dir/ </pre></div></li><li class="level1"><div class="li"> Apply patch qt-embedded-free-bfin-3.3.5.patch into the QT source code. <pre class="code"> ~/your_qt_dir> patch -p1 < ~/your_uClinux_dir/bfin_patch/qt_embedded_patch/qt-embedded-free-bfin-3.5.5.patch </pre></div></li><li class="level1"><div class="li"> Config and build for your host machine fist.<pre class="code">~/your_qt_dir> ./configure~/your_qt_dir> make</pre></div></li><li class="level1"><div class="li"> Config for static library and build for blackfin/uClinux<pre class="code">~/your_qt_dir> cp mkspecs/qws/linux-bfin-g++/qmake.static.conf mkspecs/qws/linux-bfin-g++/qmake.conf~/your_qt_dir> ./configure -static -depths 4,16,24,32 -no-ipv6 -embedded bfin -little-endian -thread~/your_qt_dir> make</pre></div></li><li class="level1"><div class="li"> Config for dynamic loadable shared library and build for blackfin/uClinux<pre class="code">~/your_qt_dir> cp mkspecs/qws/linux-bfin-g++/qmake.dynamic.conf mkspecs/qws/linux-bfin-g++/qmake.conf~/your_qt_dir> ./configure -shared -depths 4,16,24,32 -no-ipv6 -embedded bfin -little-endian -thread~/your_qt_dir> make</pre></div></li><li class="level1"><div class="li"> Configure kernel with frame buffer driver and run QT examples.<pre class="code">~/your_uclinux_dir> make menuconfigSelect [Kernel/Library/Defaults Selection] ---> [Customize Kernel Settings]Select [Graphics support] ---> [Support for frame buffer devices] and [Blackfin ADI7171 video encoder on uClinux]Save and exit.Change the filesystem image size to at least 12288 in file ~/your_uclinux_dir/vendors/AnalogDevice/BF53x/Makefile~/your_uclinux_dir> make - Configure serial mouse on UART1 of bf537 and run a QT sample application.~/your_uclinux_dir> cp ../your_qt_dir/examples/drawline/drawline romfs~/your_uclinux_dir> cp ../your_qt_dir/lib/libqte-mt.so.3.3.5 romfs/lib~/your_uclinux_dir> ln -s romfs/lib/libqte-mt.so.3.3.5 romfs/lib/libqte-mt.so.3.3~/your_uclinux_dir> ln -s romfs/lib/libqte-mt.so.3.3.5 romfs/lib/libqte-mt.so.3~/your_uclinux_dir> ln -s romfs/lib/libqte-mt.so.3.3.5 romfs/lib/libqte-mt.so~/your_uclinux_dir> cp ../your_qt_dir/lib/fonts/fontdir romfs/usr/local/qt-embedded/lib/font/~/your_uclinux_dir> make~/your_uclinux_dir> cp image/linux /tftpboot/boot kernel on your blackfin boardbf53x:/> stty -F /dev/ttyS1 ispeed 1200 cs7 -icanonbf53x:/> export QWS_MOUSE_PROTO=Microsoft:/dev/ttyS1bf53x:/> export QTDIR=/usr/local/qt-embedded/bf53x:/> ./drawline -qws</pre></div></li></ol><p> ’ <a href="setup_serial_mouse.html" class="wikilink1" title="setup_serial_mouse.html">setup_serial_mouse</a></p></div><!-- SECTION [703-3991] --><h2><a name="an_sample_user_application_based_on_qt_embedded_free_library" id="an_sample_user_application_based_on_qt_embedded_free_library">An sample user application based on QT embedded free library</a></h2><div class="level2"><ul><li class="level1"><div class="li"> The source code<pre class="code">#include <qapplication.h>#include <qpushbutton.h>#include <qlcdnumber.h>#include <qfont.h>#include <qlayout.h>#include "lcdrange.h"#include "cannon.h"class MyWidget: public QWidget{public: MyWidget( QWidget *parent=0, const char *name=0 );};MyWidget::MyWidget( QWidget *parent, const char *name ) : QWidget( parent, name ){ QPushButton *quit = new QPushButton( "&Quit", this, "quit" ); quit->setFont( QFont( "Times", 18, QFont::Bold ) ); connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) ); LCDRange *angle = new LCDRange( this, "angle" ); angle->setRange( 5, 70 ); LCDRange *force = new LCDRange( this, "force" ); force->setRange( 10, 50 ); CannonField *cannonField = new CannonField( this, "cannonField" ); connect( angle, SIGNAL(valueChanged(int)), cannonField, SLOT(setAngle(int)) ); connect( cannonField, SIGNAL(angleChanged(int)), angle, SLOT(setValue(int)) ); connect( force, SIGNAL(valueChanged(int)), cannonField, SLOT(setForce(int)) ); connect( cannonField, SIGNAL(forceChanged(int)), force, SLOT(setValue(int)) ); QGridLayout *grid = new QGridLayout( this, 2, 2, 10 ); grid->addWidget( quit, 0, 0 ); grid->addWidget( cannonField, 1, 1 ); grid->setColStretch( 1, 10 ); QVBoxLayout *leftBox = new QVBoxLayout; grid->addLayout( leftBox, 1, 0 ); leftBox->addWidget( angle ); leftBox->addWidget( force ); angle->setValue( 60 ); force->setValue( 25 ); angle->setFocus();}int main( int argc, char **argv ){ QApplication::setColorSpec( QApplication::CustomColor ); QApplication a( argc, argv ); MyWidget w; w.setGeometry( 100, 100, 500, 355 ); a.setMainWidget( &w ); w.show(); return a.exec();}</pre></div></li><li class="level1"><div class="li"> Build this application <pre class="code">Create a folder "qttest" under ~/your_qt_dir/example/ and save the source as qttest.cpp.Edit ~/your_qt_dir/example/example.pro, put subfolder name under SUBDIR.~/your_qt_dir> ./configure -static -depths 4,16,24,32 -no-ipv6 -embedded bfin -little-endian~/your_qt_dir> make </pre></div></li></ul></div><!-- SECTION [3992-6206] --><h2><a name="changes_to_the_qt_embedded_library" id="changes_to_the_qt_embedded_library">Changes to the QT embedded library</a></h2><div class="level2"><ol><li class="level1"><div class="li"> Add a configuration file qmake.conf for blackfin/uClinux.</div></li><li class="level1"><div class="li"> MAP_SHARED to MAP_PRIVATE in mmap().</div></li><li class="level1"><div class="li"> fork to vfork</div></li><li class="level1"><div class="li"> disable dynamic loadable library.</div></li><li class="level1"><div class="li"> disable IPC semachpone.</div></li><li class="level1"><div class="li"> disable SHM</div></li><li class="level1"><div class="li"> disable QT multiprocess. (QT multiprocess depends on SHM, which is not supported by NOMMU kernel.)</div></li><li class="level1"><div class="li"> set optimization mode O instead of O2. (Walk arround a compiler bug.)</div></li></ol></div><!-- SECTION [6207-] --></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -