Qt Graphical Effects in Qt Labs
The Qt Graphical Effects project is on its way to offer a set of design neutral visual effects for Qt Quick 2.0.
Over twenty ready-made QML graphical effect elements are currently available. The effects include code for blending, masking, blurring, coloring, and much more. There are still areas to improve and extend — all ideas, feedback, proposals and even concrete contributions are welcome!
The Effects Using the effectsUsing the graphical effect elements should be straightforward for developers and technically oriented designers as you only need to know basic Qt Quick/QML to get started.
Any QMLÂ item can be used as a source item for an effect. You can add a drop shadow to an image, for instance, as follows:
import QtQuick 2.0
import QtGraphicalEffects 1.0
Item {
width: 300
height: 300
Rectangle {
id: background
anchors.fill: parent
}
Image {
id: butterfly
source: "images/butterfly.png"
sourceSize: Qt.size(parent.width, parent.height)
smooth: true
visible: false
}
DropShadow {
anchors.fill: butterfly
horizontalOffset: 3
verticalOffset: 3
radius: 8.0
samples: 16
color: "#80000000"
source: butterfly
}
}
Getting started
Get and build Qt5:Â http://developer.qt.nokia.com/wiki/Building_Qt_5_from_Git
Make sure that qtbase/bin is in your path and QTDIR points to /qtbase
Get and build Qt Graphical Effects module:Â https://qt.gitorious.org/qt-labs/qtgraphicaleffects
git clone git@gitorious.org:qt-labs/qtgraphicaleffects.git cd qtgraphicaleffects qmake make install
To see the effects in action, run the code examples from the graphical effects doc/src/snippets folder:
qmlscene doc/src/snippets/DropShadow-example.qml
or launch the Testbed application:
qmlscene tests/manual/testbed/testBed.qml
The Testbed application is a convenient way to browse the effects and their properties as well as to visualise the results. Select an effect from the left, adjust its properties on the right, and see the result in the center in realtime:
API and documentationThe API for each effect is a set of QML properties. The effect properties can be animated just like any other QML properties. The documention contains property descriptions and basic usage examples. To generate the documentation, execute the following commands in the qtgraphicaleffects projects folder:
qmake make docs
Open the generated doc/html/qml-graphicaleffects-index.html in a browser to view the documentation.
Implementation details
QML ShaderEffect is a built-in element in Qt Quick 2.0. This powerful QML element allows combining OpenGL Shading Language (GLSL) and QML, and makes it easy to implement visually impressive custom effects. Under the hood, all the effects in this project are based on ShaderEffect elements. Only QML and GLSL have been used, and there are no additional C++ APIs. If you are familiar with GLSL, you can easily study how the existing effects have been implemented. You can then create custom effects by modifying and combining the basic effects.
Links to related blog posts and specifications
- The convenient power of QML Scene Graph
- QML Scene Graph in Master
- OpenGL Shading Language specification
- OpenGL ES Shading Language specification
Qt SDK 1.2 Released
We are happy to announce that a new important update for Qt SDK is published.
This Qt SDK 1.2 update sets a new baseline for the developers for a longer perspective. Some of the features have already been available as online updates, but Qt SDK 1.2 now integrates the very latest tools, most recent mobile build targets for Symbian and Nokia N9, and the still fresh Qt 4.8 for desktops. We have also introduced some improvements to the SDK and its maintenance tool.
As a summary, this is what is new in the Qt SDK:
- Â Â Â Fixes for Qt Creator 2.4 in a new 2.4.1 patch update
- Â Â Â Qt 4.8 for desktops delivering Qt Quick 1.1, Qt platform abstraction, Qt WebKit 2.2, and threaded OpenGL. See Sinan’s blog post for more details.
- Â Â Â More Qt Mobility examples for Nokia N9 and Symbian devices
- Â Â Â Ability to specify network proxy setting in the SDK Maintenance Tool
- Â Â Â Update to the Symbian Complementary Package introducing Analyze Tool plugin and new CODA 1.0.6 installation package
- Â Â Â An update to Notifications API improving the end user experience and fixing issues in the Nokia N9 implementation of the API.
If you already have Qt SDK installed, you can update to the latest version by running Update Qt SDK from the Qt SDK application folder on your computer. If you first time are getting started with Qt SDK, you can download 1.2 from our download page.
If you encounter problems, please file a bug report at http://bugreports.qt-project.org.
Qt Creator 2.4.1 released
Today we publish a patch release of Qt Creator 2.4, that is also included in a bigger Qt SDK 1.2 update.
Qt Creator 2.4.1 contains no new features, but fixes a few issues, most notably
- finding the QMLViewer.app on case sensitive Mac file systems
- building debugging helpers for universal builds, and tool chain / mkspec setting in some configurations (Mac)
- automatic proxy detection on Windows systems
Also see the 2.4.1 change log.
Get the new version from our download page, or through the updated SDK here.
Raspberry PI: A case study in deploying Qt apps to generic Linux devices
Overview
This is an awfully dry post; dry due to the sheer logistic nature of it. This functionality exists and is quite straight forwards to stumble upon. This blog exists in order to draw your attention to it and hopefully minimize the stumble time.
You have a device:
1) Running an ssh server
2) With gdbserver
You also have:
1) A functional tool chain for the target (Code Sourcery is the traditional goto)
2) A Qt build for your target
3) A Linux box you are deploying from (My convenience, instructions should be readily repurposeable for Mac based developers)
4) Qt Creator (Qt Creator 2.4.0 (as shipped with the QtSDK) was used at the time of filming/documenting this process)
Qt Creator has various merits which basically speak for themselves.
Integrated documentation
Convenient remote visual debugging/profiling
Convenient (single click) deployment
You grow accustomed to this functionality if you target any of the officially/unofficially supported targets tightly integrated into Creator in its various distributions. (Official SDK, Necessitas, Meego SDK). It would be lovely if it were more commonly perceived as a generic end to end solution for deployment to generic Linux targets, and it is readily achievable if you avoid a couple of snags.
Initial configuration
Launch Creator
Menu -> Tools -> Options
Build & Run -> Qt Versions
Add your Raspberry PI Qt build: /opt/dev/qt-qpa-5-rasp-pi/bin/qmake
Creator indicates “Qt version 5.0.0 for Desktop”, this can be safely ignored.
Build & Run -> Tool Chains
Add your cross compiler: /opt/toolchains/arm-2010q1/bin/arm-none-linux-gnueabi-gcc
in my case. Adjust the ABI in the unlikely event it is incorrect.
Linux Devices -> Device Configurations
Add configuration with correct ssh details, deploy a public key and establish this works.
Per project configuration
1) Open an existing Qt application (example suffices)
2) Select a desktop build
Once this is done:
Projects -> Targets -> Build
Specify your target’s Qt version
Specify the toolchain from the drop down below
Projects -> Targets -> Run
Deployment
Method: Deploy to Remote Linux Host
Device Configuration: Select your “Linux Device” added in the Device Configurations step above
Run
Run Configuration: foo (on Remote Device)
Arguments: -platform eglfs
This should suffice, you should now be able to deploy, run and debug applications on the Raspberry PI (or any other similarly capable Linux based target)
A screen grab demonstrating the logistics is available here
A video where I talk through the steps is also available for those willing to weather my accent
Caveats
1) If you select a QtQuick UI project from the project wizard you will not be able to deploy to the target (will be grayed out). If you select a Qt Quick application you will get a QDeclarativeView based viewer/launch pad. If you want to dabble with Qt 5 (who doesn’t) at present, one has to ride to war with one’s own QQuickView based runtime/viewer (read: pony)
2) Qt must already be deployed on the target. We clearly handle this for our own devices, but when you are winging it as documented here, Qt has to have been (manually) installed to the configured prefix. (Needless to say, it is best to sanity check the Qt install prior to attempting IDE based deployment).
Qt 4 moved to open governance
Since we released Qt under open governance on qt-project.org, there was always one piece missing. The Qt 4 repository was so far still handled in the old system. This was done as a simple prioritization, to get the parts of Qt that we considered most relevant for the development community out first.
The main problem has been the additional work required to integrate Qt 4 with the continuous integration (CI) system used on qt-project. Thanks to the efforts of Sergio, Rohan and others this has now been (mostly) solved. We run the full CI setup (that includes both compilation and running the test suite) on both Linux and Mac OS X for Qt 4.8. On Windows we currently only run compile tests, running the automated tests on Windows is coming soon.
You can now find the Qt 4.x repository on codereview. Pushing and reviewing changes works the same way as for Qt 5.
Approvers and Maintainers are the same as for the respective areas in Qt 5, but it should be noted that I don’t expect a lot of further development to happen in Qt 4.8. The focus here should be on bug fixes, and patches should be reviewed with this in mind.
The Qt 4.6 and 4.7 branches are not CI tested, so extreme care should be taken when submitting to these branches, and I’d like to see a review from a Maintainer for any change going in there. Changes in these branches should be limited to security issues and severe bugs that can’t be worked around in user code.
Any pending merge requests in gitorious should be resubmitted through gerrit, as we’ll close merge requests on gitorious and turn the repository there into a readonly copy.
Enjoy!
