Difference between revisions of "ECE497 Notes on Qt"

From eLinux.org
Jump to: navigation, search
m (Installs: Added uic ln)
(Added Introduction to Qt)
Line 1: Line 1:
 
[[Category:ECE497]]
 
[[Category:ECE497]]
  
Here are some notes on using Qt on the Beagle.
+
[http://qt.nokia.com/ Qt] is one of the many UI frameworks that runs on the Beagle.  It also runs on many other platforms such as Microsoft Windows, Mac OS X, and Linux, and it appears to be one of the more popular choices for the Beagle. It even runs on [http://qt.nokia.com/products/qt-for-mobile-platforms dumb cell phones]. We'll be using it with X11, however there is an [http://developer.qt.nokia.com/wiki/Support_for_Embedded_Linux embedded version] that doesn't need X.
  
== Useful Links ==
+
== Installation ==
 +
 
 +
Qt can be developed solely on the Beagle, but I suggest you install it on both your host and the Beagle. Compilations on the Beagle many only take 20 or 30 seconds, but run much faster on the host.
 +
 
 +
=== Installing on the host ===
  
* The [http://qt.nokia.com/ Qt site]
+
I think this is all I did on the hostThis assumes you have oe installed.
* It looks like the best way to get going is use bitbakeI'm trying
 
 
<pre>
 
<pre>
 
$ source ~/.oe/environment-2008
 
$ source ~/.oe/environment-2008
 
$ bitbake qt4-x11-free-gles
 
$ bitbake qt4-x11-free-gles
 
</pre>
 
</pre>
 +
 +
=== Installing on the Beagle ===
 +
 +
Here's what I've installed on the Beagle
 +
<pre>
 +
$ opkg update
 +
$ opkg install qt4-demos
 +
$ opkg install linuxtag-ics
 +
$ opkg install qt4-examples
 +
$ opkg install qt4-x11-free qt4-x11-free-doc qt4-x11-free-dev
 +
$ opkg install qmake2
 +
</pre>
 +
 +
I had to hack a couple of things before running qmake.
 +
<pre>
 +
$ cd /usr/bin
 +
$ ln -s moc moc-qt4
 +
$ ln -s uic uic-qt4
 +
$ ln -s qmake-qt4 qmake
 +
 +
$ source /usr/share/qt4/environment-setup
 +
</pre>
 +
Be sure to source the setup file before running qmake for the first time.
 +
 +
== Qt Tutorials ==
 +
 +
There are several nice Qt Tutorials [http://doc.qt.nokia.com/4.7/tutorials.html here].  I suggest you start with the [http://doc.qt.nokia.com/4.7/widgets-tutorial.html Widgets Tutorial]. Here's how you can run the examples on the Beagle.
 +
 +
# Go to the [http://doc.qt.nokia.com/4.7/tutorials-widgets-toplevel.html Creating a Window] tutorial and download the '''main.cpp''' and '''toplevel.pro''' files. Put them in their own directory.
 +
# Run '''qmake'''.  (Be sure you have sourced the file noted above.) This will create a Makefile.
 +
# Run '''make'''.  This should compile the program.  It takes about 30 seconds for the first make.
 +
# Do an '''ls''' to see what files were created. You should see '''toplevel'''.  Run it.
 +
# Congratulations, you've just compiled and run your first Qt program.
 +
 +
== Useful Links ==
 +
 +
* The [http://qt.nokia.com/ Qt site]
 +
  
 
* [http://doc.trolltech.com/4.6/index.html This] looks like a nice reference.
 
* [http://doc.trolltech.com/4.6/index.html This] looks like a nice reference.
Line 46: Line 87:
 
<pre>
 
<pre>
 
export CPLUS_INCLUDE_PATH=/usr/include/qt4/Qt
 
export CPLUS_INCLUDE_PATH=/usr/include/qt4/Qt
</pre>
 
 
== Installs ==
 
 
Here's what I've installed on the Beagle
 
<pre>
 
opkg install qt4-demos
 
opkg install linuxtag-ics
 
opkg install qt4-examples
 
opkg install qt4-x11-free qt4-x11-free-doc qt4-x11-free-dev
 
opkg install qmake2
 
</pre>
 
 
I think you need to do this before running qmake.
 
 
<pre>
 
$ cd /usr/bin
 
$ ln -s moc moc-qt4
 
$ ln -s uic uic-qt4
 
$ ln -s qmake-qt4 qmake
 
 
$ source /usr/share/qt4/environment-setup
 
 
</pre>
 
</pre>

Revision as of 10:47, 10 August 2011


Qt is one of the many UI frameworks that runs on the Beagle. It also runs on many other platforms such as Microsoft Windows, Mac OS X, and Linux, and it appears to be one of the more popular choices for the Beagle. It even runs on dumb cell phones. We'll be using it with X11, however there is an embedded version that doesn't need X.

Installation

Qt can be developed solely on the Beagle, but I suggest you install it on both your host and the Beagle. Compilations on the Beagle many only take 20 or 30 seconds, but run much faster on the host.

Installing on the host

I think this is all I did on the host. This assumes you have oe installed.

$ source ~/.oe/environment-2008
$ bitbake qt4-x11-free-gles

Installing on the Beagle

Here's what I've installed on the Beagle

$ opkg update
$ opkg install qt4-demos
$ opkg install linuxtag-ics
$ opkg install qt4-examples
$ opkg install qt4-x11-free qt4-x11-free-doc qt4-x11-free-dev
$ opkg install qmake2

I had to hack a couple of things before running qmake.

$ cd /usr/bin
$ ln -s moc moc-qt4
$ ln -s uic uic-qt4
$ ln -s qmake-qt4 qmake

$ source /usr/share/qt4/environment-setup

Be sure to source the setup file before running qmake for the first time.

Qt Tutorials

There are several nice Qt Tutorials here. I suggest you start with the Widgets Tutorial. Here's how you can run the examples on the Beagle.

  1. Go to the Creating a Window tutorial and download the main.cpp and toplevel.pro files. Put them in their own directory.
  2. Run qmake. (Be sure you have sourced the file noted above.) This will create a Makefile.
  3. Run make. This should compile the program. It takes about 30 seconds for the first make.
  4. Do an ls to see what files were created. You should see toplevel. Run it.
  5. Congratulations, you've just compiled and run your first Qt program.

Useful Links


./configure -opensource -confirm-license -prefix /opt/qt-arm -no-qt3support -x11 -little-endian -xplatform qws/linux-DM3730-g++ -qtlibinfix E

I'm working through this example. I can't change mousearea1 to MouseArea to match the figure. I think something is missing in the instructions.

The Transitions section has some details missing:


   transitions: [
        Transition {
            from: "*"; to: "State1"
            NumberAnimation {
                properties: "x,y";
                duration: 1000
            }
        }
    ]

QWT

QWT is short for Qt Widgets for Technical Applications. It is a collection of widgets and support classes for creating technical applications such as those created using, for example, LabView or Test Point.

Here is some info on QWT. I think it might be able to plot data as it comes in.

I'm trying to fix the include path with:

export CPLUS_INCLUDE_PATH=/usr/include/qt4/Qt