[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

### 4.18.7 Using QT Designer To Create AWS Definition Files

On many platforms TrollTech's Designer is available: a tool that lets you create graphical user interfaces like dialogs, forms, etc. It saves the interface description in an easy to read format (XML--even though i was not able to locate a formal document type description (DTD) for it, it's format is pretty obvious).

You should be aware that not all features the Designer is capable of can be translated into AWS, simply because they are not available in AWS. The same is true for features available in AWS but not in Designer.

#### What You Need

Since Designer saves its interface description in XML writing an extensible stylesheet to transform it into AWS format was an obvious choice. So you will need a XSLT stylesheet processor. You can either choose a commercial product or the excellent Xalan which is part of the Apache project. You can get it for free here:

http://xml.apache.org

For development, I used the Xalan Java 2 version at:

http://xml.apache.org/xalan-j/index.html

#### How To Use It

Design your dialog or widget in Designer and save it somewhere. To process the stylesheet with the Java version of Xalan you invoke:

    java org.apache.xalan.xslt.Process \
        -IN path/to/the/saved/designer/file.ui \
        -XSL path/to/CS/scripts/aws/qt2aws.xsl

If you use Designer 1.1 (that comes with QT2), use the style sheet ``qt2aws.xsl'`. The new Designer version 2.0 (which comes with QT3) changed its ``.ui'` DTD slightly. In case you use Designer2.0 specify ``qt3aws.xsl'`.

Append the output to a file containing skin definitions.

#### What Controls Are Converted?

QT Class |  | AWS Class
QPushButton | => | Command Button
QRadioButton | => | Radio Button
QSlider | => | Scroll Bar
QButtonGroup | => | Group Frame
QGroupBox | => | Group Frame
QFrame | => | Group Frame
QCheckBox | => | Check Box
QLineEdit | => | Text Box
QTextView | => | Multiline Edit
QLabel | => | Label
QLabel with Pixmap | => | Image View
QListBox | => | List Box
QListView | => | List Box
QDialog | => | Window
QWidget | => | Window
QTabWidget | => | Notebook

### Special Notes

#### AWS Signals and Special Properties

You can place special information in the control's ``whatsThis'` property. The content will be broken into tokens separated by the pipe (``|'`) character or vertical bar. A token consist of a token identifier, a colon ``:'` and token text. The following tokens are recognized:

- connect token
  - token identifier: c
  - token text: a list of comma separated items
  - example:

        c:signalClicked,mySink::OnClick,signalBreak,mySink::ByeBye

    This will be translated into

        connect
        {
          signalClicked -> mySink::OnClick
          signalBreak -> mySink::ByeBye
        }

- literal token

Both examples from above would be concatenated and placed in the ``whatsThis'` property, and would look like this:

    c:signalClicked,mySink::OnClick,signalBreak,
        mySink::ByeBye|l:LeftEye: "Blue"

#### How to Handle Your Own AWS Controls

If you coded your own AWS control you can still use QT to layout the control (at least the common parameters like size and position). For this to work simply choose one of the supported controls and use it as a placeholder. Additionally you use the token identifier ``t'` in the ``whatsThis'` property of that control to name your control class.

As an example, I have created my own push button control. The name of the control class is ``awsMyFancyPushButtonControl'`. Since it uses all the properties of the standard AWS command button, I cleverly use ``QPushButton'` as my placeholder and set all the properties I need and which ``QPushButton'` already offers, such size, position, button text and others. Additionally I set the ``t'` token identifier in property ``whatsThis'` to ``awsMyFancyPushButtonControl'`.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ]

This document was generated using texi2html 1.76.