Slitaz -- Qt / aqp / browserwindow

Advanced Qt Programming by Mark Summerfield
ISBN: 978-0321635907

QWebInspector: QSettings couldn't read configuration setting [debuggerEnabled].
QWebInspector: QSettings couldn't read configuration setting [profilerEnabled].
QWebInspector: QSettings couldn't read configuration setting [frontendSettings].
QWebInspector: QSettings couldn't persist configuration setting [lastActivePanel].
QWebInspector: QSettings couldn't persist configuration setting [lastActivePanel].
QWebInspector: QSettings couldn't persist configuration setting [frontendSettings].
QWebInspector: QSettings couldn't persist configuration setting [frontendSettings].

#ifdef DEBUG

QWebSettings::DeveloperExtrasEnabled 7

Enables extra tools for Web developers. Currently this enables the "Inspect" element in the context menu as well as the use of QWebInspector which controls the web inspector for web site debugging. This is disabled by default.

#ifdef DEBUG
actions << webView->pageAction(QWebPage::InspectElement);

QWebPage::InspectElement 49
Show the Web Inspector with the currently highlighted HTML element.

QWebInspector Class Reference
The QWebInspector class allows the placement and control of a QWebPage's inspector. The inspector can display a page's hierarchy, its loading statistics and the current state of its individual elements. It is mostly used by web developers. More...

Detailed Description
The QWebInspector class allows the placement and control of a QWebPage's inspector. The inspector can display a page's hierarchy, its loading statistics and the current state of its individual elements. It is mostly used by web developers.
The QWebPage to be inspected must be specified using the setPage() method.
A typical use of QWebInspector follows:
// ...
QWebPage *page = new QWebPage;
// ...

QWebInspector *inspector = new QWebInspector;
A QWebInspector can be made visible either programmatically using setVisible(), or by the user through the attached QWebPage's context menu.

Note: A QWebInspector will display a blank widget if either:
page() is null
QWebSettings::DeveloperExtrasEnabled is false

This class acts mostly as a container and a controller for the inspector. Most of the resources needed by the inspector are owned by the associated QWebPage and are allocated the first time that:
an element is inspected
the QWebInspector is shown.

Inspector configuration persistence
The inspector allows the user to configure some options through its user interface (e.g. the resource tracking "Always enable" option). These settings will be persisted automatically by QtWebKit only if your application previously called QCoreApplication::setOrganizationName() and QCoreApplication::setApplicationName(). See QSettings's default constructor documentation for an explanation of why this is necessary.

Slitaz -- Qt / aqp / weathertrayicon

Advanced Qt Programming by Mark Summerfield
ISBN: 978-0321635907

void WeatherTrayIcon::createContextMenu()
QStringList airports;
airports << "Austin-Bergstrom International Airport (KAUS)"
<< "Chicago/Ohare (KORD)"
<< "Dallas / Fort Worth International Airport (KDFW)"
<< "Detroit City Airport (KDET)"
<< "Houston Intercontinental Airport (KIAH)"
<< "Indianapolis International Airport (KIND)"
<< "Jacksonville International Airport (KJAX)"
<< "Los Angeles Intl Airport (KLAX)"
<< "New York/John F. Kennedy Intl Airport (KJFK)"
<< "Philadelphia International Airport (KPHL)"
<< "Phoenix/Sky Harbor (KPHX)"
<< "Port Columbus International Airport (KCMH)"
<< "San Antonio International Airport (KSAT)"
<< "San Diego/Brown Fld (KSDM)"
<< "San Francisco Intl Airport (KSFO)"
<< "San Jose International Airport (KSJC)";
QSettings settings;
airport = settings.value("airport", QVariant(airports.at(0)))

QActionGroup *group = new QActionGroup(this);
foreach (const QString &anAirport, airports) {
QAction *action = menu.addAction(anAirport);
action->setChecked(anAirport == airport);
connect(group, SIGNAL(triggered(QAction*)),
this, SLOT(setAirport(QAction*)));
menu.addAction(QIcon(":/exit.png"), tr("E&xit"), qApp,


void WeatherTrayIcon::requestXml()
#ifdef NO_REGEX
QString airportId = airport.right(6);
if (airportId.startsWith("(") && airportId.endsWith(")")) {
QString url = QString("http://www.weather.gov/xml/"
"current_obs/%1.xml").arg(airportId.mid(1, 4));
QRegExp airportIdRx("^.*[(]([A-Z]{4})[)]$");
if (airportIdRx.exactMatch(airport)) {
QString url = QString("http://www.weather.gov/xml/"
setToolTip(tr("Failed to connect to network.\n"
"A proxy can be set on the command line:\n"
"weathertrayicon --help"));


Slitaz -- Qt / aqp



Advanced Qt Programming by Mark Summerfield

ISBN: 978-0321635907

Chapter 1: Hybrid Desktop/Internet Applications

Chapter 2: Audio and Video

Chapter 3: Model/View Table Models

Chapter 4: Model/View Tree Models

Chapter 5: Model/View Delegates

Chapter 6: Model/View Views

Chapter 7: Threading with QtConcurrent

Chapter 8: Threading with QThread

Chapter 9: Creating Rich Text Editors

Chapter 10: Creating Rich Text Documents

Chapter 11: Creating Graphics/View Windows

Chapter 12: Creating Graphics/View Scenes

Chapter 13: The Animation and State Machine Frameworks

The program makes it straightforward for developers to find the right characters to use as accelerators for menu option texts and for dialog labels. This helps make GUI programs more usable by catering for users who can't use the mouse and for fast typists who don't want to use the mouse.


Slitaz -- arm / mips / powerpc / sh4 / sparc



changeset 5987:8da46cc14f57
Add uclibc-cross-compiler
author Pascal Bellard
date Sat Aug 14 14:20:45 2010 +0200 (3 days ago)
parents f71157a571d0
children 8ee0c3ca610f
files uclibc-cross-compiler-armv4eb/receipt uclibc-cross-compiler-armv4l/receipt uclibc-cross-compiler-armv4tl/receipt uclibc-cross-compiler-armv5l/receipt uclibc-cross-compiler-armv6l/receipt uclibc-cross-compiler-i486/receipt uclibc-cross-compiler-mips/receipt uclibc-cross-compiler-mips64/receipt uclibc-cross-compiler-mipsel/receipt uclibc-cross-compiler-powerpc-440fp/receipt uclibc-cross-compiler-powerpc/receipt uclibc-cross-compiler-sh4/receipt uclibc-cross-compiler-sparc/receipt


Aboriginal Linux: We cross compile so you don't have to.

--- What is it?

Aboriginal Linux provides virtual Linux images you can boot under QEMU,
within which you can compile and test any software you like.

The build scripts automatically create cross compilers and bootable system
images for various targets, such as arm, mips, powerpc, and x86. You can
download the resulting binaries from the website if you don't want to bother
compiling them yourself.

The system images provide minimal native development environments which you
can boot under an emulator (or on real hardware if you have it) to compile
code natively. This includes a full native compiler (for both C and C++),
and the (optional) ability to run the cross compiler on the host (via distcc)
to speed up the build without reqiring the packages you're building to
know anything about cross compiling.

Slitaz -- Qt / qconfig



The qconfig tool's interface displays all of Qt's functionality, and allows the user to both disable and enable features. The user can open and edit any custom configuration file located in the src/corelib/global directory. When creating a custom configuration file manually, a description of the currently available Qt features can be found in the src/corelib/global/qfeatures.txt file.
Note that some features depend on others; disabling any feature will automatically disable all features depending on it. The feature dependencies can be explored using the qconfig tool, but they are also described in the src/corelib/global/qfeatures.h file.
To be able to apply the custom configuration, it must be saved in a file called qconfig-myfile.h in the src/corelib/global directory. Then use the configure tool's -qconfig option and pass the configuration's file name without the qconfig- prefix and .h extension, as argument. The following examples show how this is invoked on each of the embedded platforms for a file called qconfig-myfile.h:

Embedded Linux:
./configure -qconfig myfile

root@slitaz:/opt/qt-470# ./configure --help
Usage: configure [-h] [-prefix <:dir>] [-prefix-install] [-bindir <:dir>] [-libdir <:dir>]
[-docdir <:dir>] [-headerdir <:dir>] [-plugindir <:dir> ] [-importdir <:dir>] [-datadir <:dir>]
[-translationdir <:dir>] [-sysconfdir <:dir>] [-examplesdir <:dir>]
[-demosdir <:dir>] [-buildkey <:key>] [-release] [-debug]
[-debug-and-release] [-developer-build] [-shared] [-static] [-no-fast] [-fast] [-no-largefile]
[-largefile] [-no-exceptions] [-exceptions] [-no-accessibility]
[-accessibility] [-no-stl] [-stl] [-no-sql-<:driver>] [-sql-<:driver>]
[-plugin-sql-<:driver>] [-system-sqlite] [-no-qt3support] [-qt3support]
[-platform] [-D <:string>] [-I <:string>] [-L <:string>] [-help]
[-qt-zlib] [-system-zlib] [-no-gif] [-qt-gif] [-no-libtiff] [-qt-libtiff] [-system-libtiff]
[-no-libpng] [-qt-libpng] [-system-libpng] [-no-libmng] [-qt-libmng]
[-system-libmng] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg] [-make <:part>]
[-nomake <:part>] [-R <:string>] [-l <:string>] [-no-rpath] [-rpath] [-continue]
[-verbose] [-v] [-silent] [-no-nis] [-nis] [-no-cups] [-cups] [-no-iconv]
[-iconv] [-no-pch] [-pch] [-no-dbus] [-dbus] [-dbus-linked] [-no-gui]
[-no-separate-debug-info] [-no-mmx] [-no-3dnow] [-no-sse] [-no-sse2]
[-qtnamespace <:namespace>] [-qtlibinfix <:infix>] [-separate-debug-info] [-armfpa]
[-no-optimized-qmake] [-optimized-qmake] [-no-xmlpatterns] [-xmlpatterns]
[-no-multimedia] [-multimedia] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend]
[-no-media-backend] [-media-backend] [-no-audio-backend] [-audio-backend]
[-no-openssl] [-openssl] [-openssl-linked]
[-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit] [-no-javascript-jit] [-javascript-jit]
[-no-script] [-script] [-no-scripttools] [-scripttools] [-no-declarative] [-declarative]

[additional platform specific options (see below)]

Installation options:

These are optional, but you may specify install directories.

-prefix <:dir> ...... This will install everything relative to <:dir>
(default /usr/local/Trolltech/Qt-4.7.0)

* -prefix-install .... Force a sandboxed "local" installation of
Qt. This will install into
/usr/local/Trolltech/Qt-4.7.0, if this option is
disabled then some platforms will attempt a
"system" install by placing default values to
be placed in a system location other than

You may use these to separate different parts of the install:

-bindir <:dir> ......... Executables will be installed to <:dir>
(default PREFIX/bin)
-libdir <:dir> ......... Libraries will be installed to <:dir>
(default PREFIX/lib)
-docdir <:dir> ......... Documentation will be installed to <:dir>
(default PREFIX/doc)
-headerdir <:dir> ...... Headers will be installed to <:dir>
(default PREFIX/include)
-plugindir <:dir> ...... Plugins will be installed to <:dir>
(default PREFIX/plugins)
-importdir <:dir> ...... Imports for QML will be installed to <:dir>
(default PREFIX/imports)
-datadir <:dir> ........ Data used by Qt programs will be installed to <:dir>
(default PREFIX)
-translationdir <:dir> . Translations of Qt programs will be installed to <:dir>
(default PREFIX/translations)
-sysconfdir <:dir> ..... Settings used by Qt programs will be looked for in <:dir>
(default PREFIX/etc/settings)
-examplesdir <:dir> .... Examples will be installed to <:dir>
(default PREFIX/examples)
-demosdir <:dir> ....... Demos will be installed to <:dir>
(default PREFIX/demos)

You may use these options to turn on strict plugin loading.

-buildkey <:key> .... Build the Qt library and plugins using the specified
<:key>. When the library loads plugins, it will only
load those that have a matching key.

Configure options:

The defaults (*) are usually acceptable. A plus (+) denotes a default value
that needs to be evaluated. If the evaluation succeeds, the feature is
included. Here is a short explanation of each option:

* -release ........... Compile and link Qt with debugging turned off.
-debug ............. Compile and link Qt with debugging turned on.
-debug-and-release . Compile and link two versions of Qt, with and without
debugging turned on (Mac only).

-developer-build ... Compile and link Qt with Qt developer options (including auto-tests exporting)

-opensource ........ Compile and link the Open-Source Edition of Qt.
-commercial ........ Compile and link the Commercial Edition of Qt.

* -shared ............ Create and use shared Qt libraries.
-static ............ Create and use static Qt libraries.

* -no-fast ........... Configure Qt normally by generating Makefiles for all
project files.
-fast .............. Configure Qt quickly by generating Makefiles only for
library and subdirectory targets. All other Makefiles
are created as wrappers, which will in turn run qmake.

-no-largefile ...... Disables large file support.
+ -largefile ......... Enables Qt to access files larger than 4 GB.

-no-exceptions ..... Disable exceptions on compilers that support it.
* -exceptions ........ Enable exceptions on compilers that support it.

-no-accessibility .. Do not compile Accessibility support.
* -accessibility ..... Compile Accessibility support.

-no-stl ............ Do not compile STL support.
* -stl ............... Compile STL support.

-no-sql-<:driver> ... Disable SQL <:driver> entirely.
-qt-sql-<:driver> ... Enable a SQL <:driver> in the QtSql library, by default
none are turned on.
-plugin-sql-<:driver> Enable SQL <:driver> as a plugin to be linked to
at run time.

Possible values for <:driver>:
[ db2 ibase mysql oci odbc psql sqlite sqlite2 sqlite_symbian tds ]

-system-sqlite ..... Use sqlite from the operating system.

-no-qt3support ..... Disables the Qt 3 support functionality.
* -qt3support ........ Enables the Qt 3 support functionality.

-no-xmlpatterns .... Do not build the QtXmlPatterns module.
+ -xmlpatterns ....... Build the QtXmlPatterns module.
QtXmlPatterns is built if a decent C++ compiler
is used and exceptions are enabled.

-no-multimedia ..... Do not build the QtMultimedia module.
+ -multimedia ........ Build the QtMultimedia module.

-no-audio-backend .. Do not build the platform audio backend into QtMultimedia.
+ -audio-backend ..... Build the platform audio backend into QtMultimedia if available.

-no-phonon ......... Do not build the Phonon module.
+ -phonon ............ Build the Phonon module.
Phonon is built if a decent C++ compiler is used.
-no-phonon-backend.. Do not build the platform phonon plugin.
+ -phonon-backend..... Build the platform phonon plugin.

-no-svg ............ Do not build the SVG module.
+ -svg ............... Build the SVG module.

-no-webkit ......... Do not build the WebKit module.
+ -webkit ............ Build the WebKit module.
WebKit is built if a decent C++ compiler is used.

-no-javascript-jit . Do not build the JavaScriptCore JIT compiler.
+ -javascript-jit .... Build the JavaScriptCore JIT compiler.

-no-script ......... Do not build the QtScript module.
+ -script ............ Build the QtScript module.

-no-scripttools .... Do not build the QtScriptTools module.
+ -scripttools ....... Build the QtScriptTools module.

+ -no-declarative .....Do not build the declarative module.
-declarative ....... Build the declarative module.

-platform target ... The operating system and compiler you are building
on (linux-g++).

See the README file for a list of supported
operating systems and compilers.
-graphicssystem <:sys> Sets an alternate graphics system. Available options are:
raster - Software rasterizer
opengl - Rendering via OpenGL, Experimental!

-no-mmx ............ Do not compile with use of MMX instructions.
-no-3dnow .......... Do not compile with use of 3DNOW instructions.
-no-sse ............ Do not compile with use of SSE instructions.
-no-sse2 ........... Do not compile with use of SSE2 instructions.

-qtnamespace <:name> Wraps all Qt library code in 'namespace <:name> {...}'.
-qtlibinfix <:infix> Renames all libQt*.so to libQt*<:infix>.so.

-D <:string> ........ Add an explicit define to the preprocessor.
-I <:string> ........ Add an explicit include path.
-L <:string> ........ Add an explicit library path.

-help, -h .......... Display this information.

Third Party Libraries:

-qt-zlib ........... Use the zlib bundled with Qt.
+ -system-zlib ....... Use zlib from the operating system.
See http://www.gzip.org/zlib

-no-gif ............ Do not compile the plugin for GIF reading support.
* -qt-gif ............ Compile the plugin for GIF reading support.
See also src/plugins/imageformats/gif/qgifhandler.h

-no-libtiff ........ Do not compile the plugin for TIFF support.
-qt-libtiff ........ Use the libtiff bundled with Qt.
+ -system-libtiff .... Use libtiff from the operating system.
See http://www.libtiff.org

-no-libpng ......... Do not compile in PNG support.
-qt-libpng ......... Use the libpng bundled with Qt.
+ -system-libpng ..... Use libpng from the operating system.
See http://www.libpng.org/pub/png

-no-libmng ......... Do not compile the plugin for MNG support.
-qt-libmng ......... Use the libmng bundled with Qt.
+ -system-libmng ..... Use libmng from the operating system.
See http://www.libmng.com

-no-libjpeg ........ Do not compile the plugin for JPEG support.
-qt-libjpeg ........ Use the libjpeg bundled with Qt.
+ -system-libjpeg .... Use libjpeg from the operating system.
See http://www.ijg.org

-no-openssl ........ Do not compile support for OpenSSL.
+ -openssl ........... Enable run-time OpenSSL support.
-openssl-linked .... Enabled linked OpenSSL support.

-ptmalloc .......... Override the system memory allocator with ptmalloc.

Additional options:

-make <:part> ....... Add part to the list of parts to be built at make time.
(libs tools examples demos docs translations)
-nomake <:part> ..... Exclude part from the list of parts to be built.

-R <:string> ........ Add an explicit runtime library path to the Qt
-l <:string> ........ Add an explicit library.

-no-rpath .......... Do not use the library install path as a runtime
library path.
+ -rpath ............. Link Qt libraries and executables using the library
install path as a runtime library path. Equivalent
to -R install_libpath

-continue .......... Continue as far as possible if an error occurs.

-verbose, -v ....... Print verbose information about each step of the
configure process.

-silent ............ Reduce the build output so that warnings and errors
can be seen more easily.

* -no-optimized-qmake ... Do not build qmake optimized.
-optimized-qmake ...... Build qmake optimized.

-no-gui ............ Don't build the Qt GUI library

-no-nis ............ Do not compile NIS support.
* -nis ............... Compile NIS support.

-no-cups ........... Do not compile CUPS support.
* -cups .............. Compile CUPS support.
Requires cups/cups.h and libcups.so.2.

-no-iconv .......... Do not compile support for iconv(3).
* -iconv ............. Compile support for iconv(3).

-no-pch ............ Do not use precompiled header support.
* -pch ............... Use precompiled header support.

-no-dbus ........... Do not compile the QtDBus module.
+ -dbus .............. Compile the QtDBus module and dynamically load libdbus-1.
-dbus-linked ....... Compile the QtDBus module and link to libdbus-1.

-reduce-relocations ..... Reduce relocations in the libraries through extra
linker optimizations (Qt/X11 and Qt for Embedded Linux only;
experimental; needs GNU ld >= 2.18).

-no-separate-debug-info . Do not store debug information in a separate file.
* -separate-debug-info .... Strip debug information into a separate .debug file.

Qt/X11 only:

-no-gtkstyle ....... Do not build the GTK theme integration.
+ -gtkstyle .......... Build the GTK theme integration.

* -no-nas-sound ...... Do not compile in NAS sound support.
-system-nas-sound .. Use NAS libaudio from the operating system.
See http://radscan.com/nas.html

-egl ............... Use EGL instead of GLX to manage contexts.
When building for desktop OpenGL, this option will
make Qt use EGL to manage contexts rather than the
GLX, which is the default. Note: For OpenGL ES, EGL
is always used.

-no-opengl ......... Do not support OpenGL.
+ -opengl <:api> ...... Enable OpenGL support.
With no parameter, this will auto-detect the "best"
OpenGL API to use. If desktop OpenGL is available, it
will be used. Use desktop, es1, or es2 for <:api>
to force the use of the Desktop (OpenGL 1.x or 2.x),
OpenGL ES 1.x Common profile, or 2.x APIs instead.

-no-openvg ........ Do not support OpenVG.
+ -openvg ........... Enable OpenVG support.
Requires EGL support, typically supplied by an OpenGL
or other graphics implementation.

-no-sm ............. Do not support X Session Management.
* -sm ................ Support X Session Management, links in -lSM -lICE.

-no-xshape ......... Do not compile XShape support.
* -xshape ............ Compile XShape support.
Requires X11/extensions/shape.h.

-no-xvideo ......... Do not compile XVideo support.
* -xvideo ............ Compile XVideo support.
Requires X11/extensions/Xv.h & Xvlib.h.

-no-xsync .......... Do not compile XSync support.
* -xsync ............. Compile XSync support.
Requires X11/extensions/sync.h.

-no-xinerama ....... Do not compile Xinerama (multihead) support.
* -xinerama .......... Compile Xinerama support.
Requires X11/extensions/Xinerama.h and libXinerama.
By default, Xinerama support will be compiled if
available and the shared libraries are dynamically
loaded at runtime.

-no-xcursor ........ Do not compile Xcursor support.
* -xcursor ........... Compile Xcursor support.
Requires X11/Xcursor/Xcursor.h and libXcursor.
By default, Xcursor support will be compiled if
available and the shared libraries are dynamically
loaded at runtime.

-no-xfixes ......... Do not compile Xfixes support.
* -xfixes ............ Compile Xfixes support.
Requires X11/extensions/Xfixes.h and libXfixes.
By default, Xfixes support will be compiled if
available and the shared libraries are dynamically
loaded at runtime.

-no-xrandr ......... Do not compile Xrandr (resize and rotate) support.
* -xrandr ............ Compile Xrandr support.
Requires X11/extensions/Xrandr.h and libXrandr.

-no-xrender ........ Do not compile Xrender support.
* -xrender ........... Compile Xrender support.
Requires X11/extensions/Xrender.h and libXrender.

-no-mitshm ......... Do not compile MIT-SHM support.
* -mitshm ............ Compile MIT-SHM support.
Requires sys/ipc.h, sys/shm.h and X11/extensions/XShm.h

-no-fontconfig ..... Do not compile FontConfig (anti-aliased font) support.
* -fontconfig ........ Compile FontConfig support.
Requires fontconfig/fontconfig.h, libfontconfig,
freetype.h and libfreetype.

-no-xinput ......... Do not compile Xinput support.
* -xinput ............ Compile Xinput support. This also enabled tablet support
which requires IRIX with wacom.h and libXi or
XFree86 with X11/extensions/XInput.h and libXi.

-no-xkb ............ Do not compile XKB (X KeyBoard extension) support.
* -xkb ............... Compile XKB support.

-no-glib ........... Do not compile Glib support.
+ -glib .............. Compile Glib support.


Slitaz -- Qt Quick / qml-i18n

root@slitaz:~# ls -R /usr/local/Trolltech/Qt-4.7.0/examples/declarative/i18n
i18n i18n.qmlproject.user snapshot1-zh.png
i18n.qml snapshot1-en.png
i18n.qmlproject snapshot1-fr.png

base.ts qml_en_AU.ts qml_fr.ts qml_zh.ts
qml_en_AU.qm qml_fr.qm qml_zh.qm
root@slitaz:~# cat /usr/local/Trolltech/Qt-4.7.0/examples/declarative/i18n/i
<?xml version="1.0" encoding="utf-8"?>
<TS version="2.0" language="zh" sourcelanguage="en">
<location filename="../i18n.qml" line="30"/>


import Qt 4.7

// The QML runtime automatically loads a translation from the i18n subdirectory of the root
// QML file, based on the system language.
// The files are created/updated by running:
// lupdate i18n.qml -ts i18n/base.ts
// Translations for new languages are created by copying i18n/base.ts to i18n/qml_<lang>.ts
// The .ts files can then be edited with Linguist:
// linguist i18n/qml_fr.ts
// The run-time translation files are then generaeted by running:
// lrelease i18n/*.ts

Rectangle {
//width: 640; height: 480
width: 480; height: 240

Column {
anchors.fill: parent; spacing: 20

Text {
text: "If a translation is available for the system language (eg. French) then the string below will translated (eg. 'Bonjour'). Otherwise is will show 'Hello'."
width: parent.width; wrapMode: Text.WordWrap

Text {
text: qsTr("Hello")
font.pointSize: 25; anchors.horizontalCenter: parent.horizontalCenter

Slitaz -- Qt Quick / qml

Qt Quick examples

Slitaz -- Qt Quick / webview

paris - taipei
taipei - taichung

import Qt 4.7
import QtWebKit 1.0
import "content/Mapping"

root@slitaz:~# /opt/qtcreator-2.0.81/bin/qtcreator -version

Qt Creator 2.0.81 based on Qt 4.7.0

BinEditor 2.0.81 Binary editor component.
Bookmarks 2.0.81 Bookmarks in text editors.
CMakeProjectManager 2.0.81 CMake support
CVS 2.0.81 CVS integration.
CodePaster 2.0.81 Codepaster plugin for pushing/fetching diff from server
Core 2.0.81 The core plugin for the Qt IDE.
CppEditor 2.0.81 C/C++ editor component.
CppTools 2.0.81 Tools for analyzing C/C++ code.
Debugger 2.0.81 Debugger integration.
Designer 2.0.81 Qt Designer integration.
FakeVim 2.0.81 VI-style keyboard navigation.
Find 2.0.81 Provides the find widget and the hooks for find implementations.
GenericProjectManager 2.0.81 Generic support
Help 2.0.81 Help system.
Locator 2.0.81 Provides the Locator widget and the hooks for Locator filter implementations.
Mercurial 2.0.81 Mercurial integration.
Perforce 2.0.81 Perforce integration.
ProjectExplorer 2.0.81 ProjectExplorer framework that can be extended with different kind of project types.
QmlDesigner 2.0.81 Visual Designer for QML files.
QmlInspector 2.0.81 Debugger for QML files
QmlJSEditor 2.0.81 Editor for QML and JavaScript.
QmlProjectManager 2.0.81 Qt Quick support

Qt4ProjectManager 2.0.81 Provides project type for Qt 4 pro files and tools.
ResourceEditor 2.0.81 Editor for qrc files.
ScmGit 2.0.81 Git integration.
Subversion 2.0.81 Subversion integration.
TextEditor 2.0.81 Text editor framework and the implementation of the basic text editor.
VCSBase 2.0.81 Version Control System Base Plugin
Welcome 2.0.81 Default Welcome Screen Plugin

(C) 2010 Nokia Corporation



Slitaz -- Qt Quick

Env: WinXP
Qt Quick

The key new feature of the Qt 4.7 and Qt Creator 2.1 releases is Qt Quick (Qt User Interface Creation Kit): a high-level UI technology that allows developers and UI designers to work together to create animated, touch-enabled UIs and lightweight applications. It includes:

1. QML (Qt Meta-Object Language): an easy to use, declarative language
2. New Tools in the Qt Creator IDE: including a preview visual editor that allows UI designers and developers to cooperate, working on the same code in an iterative approach. (Coming in Qt Creator 2.1)
3. QtDeclarative: a new module in the Qt library that enables a new declarative programming approach

And while no C++ programming skills are needed to use Qt Quick, it is 100% based on Qt and can be extended from C++, limited only by your creativity.

// This example demonstrates how Web services such as Google Maps can be
// abstracted as QML types. Here we have a "Mapping" module with a "Map"
// type. The Map type has an address property. Setting that property moves
// the map. The underlying implementation uses WebView and the Google Maps
// API, but users from QML don't need to understand the implementation in
// order to create a Map.

import Qt 4.7
import org.webkit 1.0
import "content/Mapping"

Map {
id: map
width: 300
height: 300
address: "Taipei"

Rectangle {
x: 70
width: input.width + 20
height: input.height + 4
anchors.bottom: parent.bottom; anchors.bottomMargin: 5
radius: 5
opacity: map.status == "Ready" ? 1 : 0

TextInput {
id: input
text: map.address
anchors.centerIn: parent
Keys.onReturnPressed: map.address = input.text

Text {
id: loading
anchors.centerIn: parent
text: map.status == "Error" ? "Error" : "Loading"
opacity: map.status == "Ready" ? 0 : 1
font.pixelSize: 30

Behavior on opacity { NumberAnimation{} }


Slitaz -- QTextEdit

The QTextEdit widget is an advanced editor that supports formatted rich text. It can be used to display HTML and other rich document formats. Internally, QTextEdit uses the QTextDocument class to describe both the high-level structure of each document and the low-level formatting of paragraphs.
If you are viewing this document in the textedit demo, you can edit this document to explore Qt's rich text editing features. We have included some comments in each of the following sections to encourage you to experiment.

Slitaz -- Qt / pathstrok

Slitaz -Qt / robot

Slitaz -- Qt / canvas

Slitaz -- Q7z / P7Zip GUI





#7Z is a 7-Zip GUI for Windows; Q7Z is a P7Zip GUI for Linux. #7Z and Q7Z attempt to simplify data compression and backup.

7-Zip is a file archiver for Windows with a high compression ratio; P7Zip is a port of 7-Zip from Windows to Linux.

Use Q7Z or #7Z if you want to:

* Update existing archives quickly
* Backup multiple folders to a storage location
* Create or extract protected archives
* Lessen effort by using archiving profiles and lists

Additional product information, including installation instructions, is available on the above Wiki tab.

root@slitaz:~# tazpkg info q7z

Tazpkg information
Package : q7z
Version : 0.8.0
Category : misc
Short desc : P7Zip GUI
Maintainer : nobody@slitaz.org
Depends : PyQt-x11-gpl p7zip-full tar make
Web site : http://code.google.com/p/k7z/



Slitaz -- Qt / coverflow

#include <qdiriterator>
#include <qimagereader>
#include <qthreadpool>
#include <qpaintevent>
#include <qfileinfo>
#include <qpainter>
#include <qcache>

#include "coverflow_p.h"
#include "coverflow.h"


/* ============================================================================
* PRIVATE Methods
static QImage *mirrorImage (const QImage *image) {
QImage *tmpImage = new QImage(image->mirrored(false, true));

QPoint p1, p2;

QLinearGradient gradient(p1, p2);
gradient.setColorAt(0, QColor(0, 0, 0, 100));
gradient.setColorAt(1, Qt::transparent);

QPainter p(tmpImage);
p.fillRect(0, 0, tmpImage->width(), tmpImage->height(), gradient);


Slitaz -- Qt / pictureflow


#include <qwidget.h>

class PictureFlowPrivate;


Class PictureFlow implements an image show widget with animation effect
like Apple's CoverFlow (in iTunes and iPod). Images are arranged in form
of slides, one main slide is shown at the center with few slides on
the left and right sides of the center slide. When the next or previous
slide is brought to the front, the whole slides flow to the right or
the right with smooth animation effect; until the new slide is finally
placed at the center.

class PictureFlow : public QWidget

Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
Q_PROPERTY(QSize slideSize READ slideSize WRITE setSlideSize)
Q_PROPERTY(int slideCount READ slideCount)
Q_PROPERTY(int centerIndex READ centerIndex WRITE setCenterIndex)


Slitaz -- tazdev

root@slitaz:~# tazdev

SliTaz developers and build host tool

Usage: tazdev [command] [user] [stable|cooking|path]

usage Print this short usage and command list.
projects-stats Display statistics about your projects (-ps).
cmplog Log 'tazwok cmp' result (or use tazbb).
update-wok Update Hg wok and copy it to the chroot wok.
update-www Update SliTaz Website repo from Hg.
chroot Mount virtual fs if needed and chroot into the build env.
gen-chroot Generate a chroot using the last cooking base rootfs.
clean-chroot Clean a chroot environment (skip root/ and home/).
purge Remove obsolete packages and obsolete source tarballs.
dry-purge Show obsolete packages and obsolete source tarballs.
push Upload new packages to the main mirror (-p).
dry-push Show what will be uploaded to the mirror. Does nothing (-dp).
pull Download new packages from the main mirror.
dry-pull Show what will be downloaded from the mirror. Does nothing.
relpkg Archive and upload new package/project version.

root@slitaz:~# tazpkg info slitaz-dev-pkgs

Tazpkg information
Package : slitaz-dev-pkgs
Version : 1.2
Category : meta
Short desc : Meta-package to install a complet set of devel packages.
Maintainer : pankso@slitaz.org
Depends :
Web site : http://www.slitaz.org/

root@slitaz:~# tazpkg info slitaz-dev-tools

Tazpkg information
Package : slitaz-dev-tools
Version : 1.2
Category : development
Short desc : SliTaz developers and build host tools.
Maintainer : pankso@slitaz.org
Depends : tazwok
Web site : http://www.slitaz.org/



Slitaz -- Qt Creator-2.0 / i18n







The Internationalization (I18N) example demonstrates Qt's support for translated text. Developers can write the initial application text in one language, and translations can be provided later without any modifications to the code.


<!DOCTYPE RCC><RCC version="1.0">



Slitaz -- Qt Creator 2.0 / Qt-4.6.2

Env: slitaz-3.0
gcc-4.4.1 / g++-4.4.1
qt4.6.2 (cooking)


1.# tazpkg get-install qt4
2.# tazpkg get-install-list qt-pkg.list
3.# ./qt-creator-linux-x86-opensource-2.0.0.bin

Qt Creator: Cross-Platform Qt IDE
Qt Creator is a cross-platform integrated development environment (IDE) tailored to the needs of Qt developers. It includes:

* An advanced C++ code editor
* Integrated GUI layout and forms designer
* Project and build management tools
* Integrated, context-sensitive help system
* Visual debugger
* Rapid code navigation tools
* Supports multiple platforms

root@slitaz:~# cat qt-pkg.list

root@slitaz:~# qtcreator.bin -version

Qt Creator 2.0.0 based on Qt 4.7.0

BinEditor 2.0.0 Binary editor component.
Bookmarks 2.0.0 Bookmarks in text editors.
CMakeProjectManager 2.0.0 CMake support
CVS 2.0.0 CVS integration.
CodePaster 2.0.0 Codepaster plugin for pushing/fetching diff from server
Core 2.0.0 The core plugin for the Qt IDE.
CppEditor 2.0.0 C/C++ editor component.
CppTools 2.0.0 Tools for analyzing C/C++ code.
Debugger 2.0.0 Debugger integration.
Designer 2.0.0 Qt Designer integration.
FakeVim 2.0.0 VI-style keyboard navigation.
Find 2.0.0 Provides the find widget and the hooks for find implementations.
GenericProjectManager 2.0.0 Generic support
Help 2.0.0 Help system.
Locator 2.0.0 Provides the Locator widget and the hooks for Locator filter implementations.
Mercurial 2.0.0 Mercurial integration.
Perforce 2.0.0 Perforce integration.
ProjectExplorer 2.0.0 ProjectExplorer framework that can be extended with different kind of project types.
QmlJSEditor 2.0.0 Editor for QML and JavaScript.
QmlProjectManager 2.0.0 Qt Quick support
Qt4ProjectManager 2.0.0 Provides project type for Qt 4 pro files and tools.
ResourceEditor 2.0.0 Editor for qrc files.
ScmGit 2.0.0 Git integration.
Subversion 2.0.0 Subversion integration.
TextEditor 2.0.0 Text editor framework and the implementation of the basic text editor.
VCSBase 2.0.0 Version Control System Base Plugin
Welcome 2.0.0 Default Welcome Screen Plugin

(C) 2010 Nokia Corporation



Slitaz -- glx / ati


X700 / X1300 / X1400 / X1600

root@slitaz:~# glxinfo | grep render
direct rendering: Yes
OpenGL renderer string: Mesa DRI R300 20060815 x86/MMX/SSE2 TCL

root@slitaz:~# glxgears
Running synchronized to the vertical refresh. The framerate should be
approximately the same as the monitor refresh rate.
8811 frames in 5.0 seconds = 1762.070 FPS
9123 frames in 5.0 seconds = 1824.461 FPS
9058 frames in 5.0 seconds = 1811.539 FPS
9169 frames in 5.0 seconds = 1833.587 FPS

Summary - System information
Processor : Intel(R) Pentium(R) M processor 1.73GHz
Memory : 2074MB (60MB used)
Operating System : Slitaz GNU/Linux 3.0
User Name : root (Root Administrator)
Date/Time : Fri 16 Jul 2010 09:05:44 PM UTC
Resolution : 1280x768 pixels
OpenGL Renderer : Mesa DRI R300 20060815 x86/MMX/SSE2 TCL
X11 Vendor : (null)
Audio Adapter : HDA-Intel - HDA Intel
-Input Devices-
PC Speaker
BTC USB Multimedia Cordless Keyboard
SynPS/2 Synaptics TouchPad
BTC USB Multimedia Cordless Keyboard
AT Translated Set 2 keyboard
CUPS libraries cannot be found
-IDE Disks-
-SCSI Disks-
ATA IC25N060ATMR04-0

root@slitaz:~# lsmod | head -7
Module Size Used by Not tainted
lib80211_crypt_wep 3172 1
radeon 341348 2
drm 121736 3 radeon
i2c_core 17468 1 drm
intel_agp 23032 0
agpgart 25980 2 drm,intel_agp


* ASUS W3V ATI X600/M24


Extract from

KernelModeSetting (KMS)



KMS with a Radeon card

Note that radeon KMS is work in progress, so installing the newest possible kernel is recommended. If you use Karmic, you may want to install the Lucid kernel.

Add radeon.modeset=1 to your BootOptions to enable KMS (and DRI2) with the ati/radeon driver.

For Grub2 on Ubuntu 9.10 and later:

* sudo nano /etc/default/grub.
* Add radeon.modeset=1 to the end of the line GRUB_CMDLINE_LINUX_DEFAULT=.
* Then sudo update-grub

You can also try out KMS without rebooting, by logging out, switching to a virtual console, then

sudo stop gdm
sudo modprobe -r radeon drm
sudo modprobe radeon modeset=1
sudo start gdm

With the module loading issues (see below), this method is actually safer.

If needed, also remove the splash option from your boot options since usplash can cause some issues.

Module loading issues on ATI

If you get "RADEONDRIGetVersion failed" in Xorg.0.log it is because of a race issue. The radeon module is not initialized in time before X is starting, and X will falsely believe that there is no KMS support and do its own modesetting...

To make sure the radeon modules is initialized before gdm (and X) is starting, insert "modprobe radeon" into your /etc/init/gdm.conf just before the gdm-binary is executed:

initctl emit starting-dm DM=gdm

modprobe radeon
exec gdm-binary $CONFIG_FILE
end script

Missing firmware issue on ATI

If your /var/log/syslog has the line Cannot find firmware file 'radeon/R600_rlc.bin' you should download it.

sudo wget -O /var/lib/firmware/`uname -r`/radeon/R600_rlc.bin http://people.freedesktop.org/~agd5f/radeon_ucode/R600_rlc.bin

ATI KMS Results

Some benchmarking KMS/DRI2 versus non-KMS/DRI

Does DRI2 suck? No! According to the developers, DRI2 makes simple operations less efficient, like these "benchmarks" below. On the other hand, more complex operations (which will be used in a 3D-intensive application like games) should be more efficient with DRI2.



Slitaz -- Qtopia-2.2.0 / Doc

root@slitaz-3:~# cat /home/slitaz/wok/qtopia/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/image/root/Documents/text/plain/uname.desktop
[Desktop Entry]
Categories =
File = uname.txt
Name = uname
Type = text/plain
root@slitaz-3:~# ls -l /home/slitaz/wok/qtopia/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/image/root/Documents/text/plain/

-rw-r--r-- 1 root root 92 Jul 15 06:13 linux-kernel.desktop
-rw-r--r-- 1 root root 317376 Jul 15 06:14 linux-kernel.txt
-rw-r--r-- 1 root root 78 Jul 14 00:47 uname.desktop
-rw-r--r-- 1 root root 1254 Jul 15 2010 uname.txt

Slitaz -- Qtopia-2.2.0 / i18n





root@slitaz-3:~# cat /home/slitaz/wok/qtopia/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/image/opt/Qtopia/i18n/zh_CN/.directory
Context=Simplified Chinese
[Desktop Entry]
Name[]=Simplified Chinese
root@slitaz-3:~# ls -a /home/slitaz/wok/qtopia/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/image/opt/Qtopia/i18n/zh_CN
.                            libqpe.qm
..                           libqpickboard.qm
addressbook.qm               libqtopia2.qm
appearance.qm                libqtopiacalc.qm
appservices.qm               libqtopia.qm
backuprestore.qm             libqunikeyboard.qm
buttoneditor.qm              libscientific.qm
CalcAreaConv.qm              libsimple8.qm
CalcDistConv.qm              libsimple.qm
calculator.qm                libtodoplugin.qm
CalcVolConv.qm               libvolumeapplet.qm
CalcWeightConv.qm            libwavrecord.qm
camera.qm                    light-and-power.qm
Categories-camera.qm         mediarecorder.qm
Categories-mediarecorder.qm  mindbreaker.qm
Categories-qtopia.qm         minesweep.qm
clock.qm                     music.qm
datebook.qm                  netsetup.qm
.directory                   parashoot.qm
embeddedkonsole.qm           photoedit.qm
fifteen.qm                   pluginmanager.qm
helpbrowser.qm               qasteroids.qm
hwsettings.qm                qipkg.qm
keypebble.qm                 qpe.qm
language.qm                  qtmail.qm
launchersettings.qm          QtopiaApplications.qm
libamrrecordplugin.qm        QtopiaApps.qm
libbatteryapplet.qm          QtopiaBeaming.qm
libbrightnessapplet.qm       QtopiaColorSchemes.qm
libcardmon.qm                QtopiaDefaults.qm
libclipboardapplet.qm        QtopiaGames.qm
libclockapplet.qm            QtopiaHandwriting.qm
libconversion.qm             QtopiaI18N.qm
libdatebookplugin.qm         QtopiaMediaPlayerSkins.qm
libdialup.qm                 QtopiaNetworkServices.qm
libemailplugin.qm            QtopiaPlugins.qm
libffmpegplugin.qm           QtopiaRingTones.qm
libflat.qm                   QtopiaServices.qm
libflatstyle.qm              QtopiaSettings.qm
libfraction.qm               QtopiaThemes.qm
libfreshstyle.qm             qt.qm
libirreceiverapplet.qm       rotation.qm
liblan.qm                    security.qm
libmediaplayer.qm            snake.qm
libmountmonapplet.qm         solitaire.qm
libnetmonapplet.qm           sound.qm
libpkim.qm                   sysinfo.qm
libpolished.qm               systemtime.qm
libqfshandwriting.qm         textedit.qm
libqhandwriting.qm           timezone.qm
libqkeyboard.qm              today.qm
libqmstroke.qm               todolist.qm
libqobex.qm                  videos.qm
libqpepim1.qm                words.qm
libqpepim.qm                 worldtime.qm


Slitaz -- Qtopia-x86/arm



qtopia-arm http://www.arm9.net/mini2440-linux.asp

# X86 Qtopia-2.2.0 [2010-01-13] - 內含編譯腳本build-all
# ARM Qtopia-2.2.0 [2010-01-13] - 包含所有移植好並改進的源代碼,和編譯腳本build-all

Extract from:


Qtopia Overview

* Introduction
* Software Stack
* Qtopia's Qt/Embedded Configuration
* Qtopia, Qt Versions and Binary Compatibility
* Qtopia Platform
o Qtopia PIM Access Library


Qtopia is a platform for embedded Linux devices that provides the end-user with a set of core applications such as PIM applications (Address Book, Calendar and Todo) and a Media Player.

Qtopia provides the developer with a clean object-oriented API to write applications for an embedded device. Most of the API presented to the developer is the same API offered by Trolltech for cross-platform development between Windows, Mac and the UNIX/Linux. The same code can be shared and reused on all of these desktop platforms and now Qtopia is just another platform to run Qt applications.

The Qtopia platform encompasses both the software that runs on an embedded device and the software that runs on a end-user desktop. The software that runs on the desktop, called Qtopia Desktop, allows the user to synchronize their data between the embedded device and the desktop. Qtopia Desktop has built-in versions of the PIM application found in Qtopia. Qtopia Desktop allows developers to write plug-ins to synchronize their information. Please refer to the Qtopia Desktop documentation for more information.


Slitaz -- Qtopia-2.2.0




Env: slitaz-3.0
root@slitaz-3:~# gcc -v
Using built-in specs.
Target: i486-pc-linux-gnu
Configured with: ../gcc-4.4.1/configure --prefix=/usr --libexecdir=/usr/lib --infodir=/usr/share/info --mandir=/usr/share/man --enable-nls --enable-languages=c,c++,java --enable-shared --with-system-zlib --enable-clocale=gnu --enable-objc-gc --enable-__cxa_atexit --enable-threads=posix --with-tune=i486 --enable-java-home --with-arch-directory=i386 --with-jvm-root-dir=/usr/lib/jvm/java-gcj --with-jvm-jar-dir=/usr/lib/jvm-exports/java-gcj --with-python-dir=/lib/python2.5/site-packages --with-x --enable-java-awt=gtk --enable-gtk-cairo --build=i486-pc-linux-gnu --host=i486-pc-linux-gnu i486-pc-linux-gnu
Thread model: posix
gcc version 4.4.1 (GCC)

1. x86-qtopia-2.2.0_20100108.tgz

2. # tazpkg get-install jpeg-dev
# tazpkg get-install zlib-dev
# tazpkg get-install xorg-libX11-dev
# tazpkg get-install xorg-xextproto

3. edit x86-qtopia-2.2.0/qtopia/src/libraries/qtopia/backend/vobject.cpp
line #419

char *dot = strrchr(g,'.');
char *dot = (char*)strrchr(g,'.');

4. edit x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/src/plugins/codecs/wavplugin/wavplugin.cpp
line #435

char *ext = strrchr( path.latin1(), '.' );
char *ext = (char*)strrchr( path.latin1(), '.' );

5. REF x86-qtopia/build

6. Doc



root@slitaz-3:/home/slitaz/wok/qtopia/x86-qtopia# ./run &
[1] 1404
root@slitaz-3:/home/slitaz/wok/qtopia/x86-qtopia# Using display 0
Warning: QSocket::writeBlock: Socket is not open
Warning: Unable to open /usr/share/zoneinfo/zone.tab
Warning: Timezone data must be installed at /usr/share/zoneinfo/
Warning: could not register server
Warning: Unable to open /usr/share/zoneinfo/zone.tab
Warning: Timezone data must be installed at /usr/share/zoneinfo/

root@slitaz-3:/home/slitaz/wok/qtopia/x86-qtopia# pwd
root@slitaz-3:/home/slitaz/wok/qtopia/x86-qtopia# ps ax | tail -7
1404 root /bin/sh ./run
1405 root qtopia-2.2.0-FriendlyARM/qt2/bin/qvfb -width 240 -height 320 -depth 16
1408 root qpe
1413 root /home/slitaz/wok/qtopia/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/image/opt/Qtopia/bin/qss -systemvolume 50
1414 root /home/slitaz/wok/qtopia/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/image/opt/Qtopia/bin/quicklauncher
1426 root ps ax
1427 root tail -7
root@slitaz-3:/home/slitaz/wok/qtopia/x86-qtopia# ls -l /usr/share/zoneinfo
drwxr-xr-x 2 root root 4096 Apr 23 11:15 America
-rw-r--r-- 1 root root 2102 Sep 19 2009 CET
drwxr-xr-x 2 root root 4096 Apr 23 11:15 Europe
-rw-r--r-- 1 root root 118 Sep 19 2009 UTC