summaryrefslogtreecommitdiffstats
path: root/tools/designer/examples
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-07-10 15:24:15 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-07-10 15:24:15 -0500
commitbd0f3345a938b35ce6a12f6150373b0955b8dd12 (patch)
tree7a520322212d48ebcb9fbe1087e7fca28b76185c /tools/designer/examples
downloadqt3-bd0f3345a938b35ce6a12f6150373b0955b8dd12.tar.gz
qt3-bd0f3345a938b35ce6a12f6150373b0955b8dd12.zip
Add Qt3 development HEAD version
Diffstat (limited to 'tools/designer/examples')
-rw-r--r--tools/designer/examples/addressbook/addressbook.pro14
-rw-r--r--tools/designer/examples/addressbook/addressbook.ui324
-rw-r--r--tools/designer/examples/addressbook/addressbook.ui.h137
-rw-r--r--tools/designer/examples/addressbook/addressdetails.ui243
-rw-r--r--tools/designer/examples/addressbook/addressdetails.ui.h24
-rw-r--r--tools/designer/examples/addressbook/images/editcut.pngbin0 -> 163 bytes
-rw-r--r--tools/designer/examples/addressbook/images/filenew.pngbin0 -> 150 bytes
-rw-r--r--tools/designer/examples/addressbook/images/fileopen.pngbin0 -> 179 bytes
-rw-r--r--tools/designer/examples/addressbook/images/filesave.pngbin0 -> 157 bytes
-rw-r--r--tools/designer/examples/addressbook/images/searchfind.pngbin0 -> 587 bytes
-rw-r--r--tools/designer/examples/addressbook/main.cpp11
-rw-r--r--tools/designer/examples/addressbook/search.ui136
-rw-r--r--tools/designer/examples/addressbook/search.ui.h13
-rw-r--r--tools/designer/examples/book/book.sql42
-rw-r--r--tools/designer/examples/book/book1/book.ui71
-rw-r--r--tools/designer/examples/book/book1/book.ui.h5
-rw-r--r--tools/designer/examples/book/book1/book1.pro8
-rw-r--r--tools/designer/examples/book/book1/main.cpp27
-rw-r--r--tools/designer/examples/book/book2/book.ui77
-rw-r--r--tools/designer/examples/book/book2/book.ui.h10
-rw-r--r--tools/designer/examples/book/book2/book2.pro8
-rw-r--r--tools/designer/examples/book/book2/main.cpp27
-rw-r--r--tools/designer/examples/book/book3/book.ui141
-rw-r--r--tools/designer/examples/book/book3/book.ui.h16
-rw-r--r--tools/designer/examples/book/book3/book3.pro8
-rw-r--r--tools/designer/examples/book/book3/main.cpp27
-rw-r--r--tools/designer/examples/book/book4/book.ui179
-rw-r--r--tools/designer/examples/book/book4/book.ui.h16
-rw-r--r--tools/designer/examples/book/book4/book4.pro8
-rw-r--r--tools/designer/examples/book/book4/main.cpp29
-rw-r--r--tools/designer/examples/book/book5/book.ui188
-rw-r--r--tools/designer/examples/book/book5/book.ui.h23
-rw-r--r--tools/designer/examples/book/book5/book5.pro8
-rw-r--r--tools/designer/examples/book/book5/editbook.ui291
-rw-r--r--tools/designer/examples/book/book5/editbook.ui.h10
-rw-r--r--tools/designer/examples/book/book5/main.cpp27
-rw-r--r--tools/designer/examples/book/book6/book.ui189
-rw-r--r--tools/designer/examples/book/book6/book.ui.h33
-rw-r--r--tools/designer/examples/book/book6/book6.pro8
-rw-r--r--tools/designer/examples/book/book6/editbook.ui300
-rw-r--r--tools/designer/examples/book/book6/editbook.ui.h10
-rw-r--r--tools/designer/examples/book/book6/main.cpp27
-rw-r--r--tools/designer/examples/book/book7/book.ui189
-rw-r--r--tools/designer/examples/book/book7/book.ui.h33
-rw-r--r--tools/designer/examples/book/book7/book7.pro7
-rw-r--r--tools/designer/examples/book/book7/editbook.ui384
-rw-r--r--tools/designer/examples/book/book7/editbook.ui.h42
-rw-r--r--tools/designer/examples/book/book7/main.cpp27
-rw-r--r--tools/designer/examples/book/book8/book.ui189
-rw-r--r--tools/designer/examples/book/book8/book.ui.h33
-rw-r--r--tools/designer/examples/book/book8/book8.pro7
-rw-r--r--tools/designer/examples/book/book8/editbook.ui386
-rw-r--r--tools/designer/examples/book/book8/editbook.ui.h47
-rw-r--r--tools/designer/examples/book/book8/main.cpp27
-rw-r--r--tools/designer/examples/book/connection.cpp52
-rw-r--r--tools/designer/examples/book/connection.h18
-rw-r--r--tools/designer/examples/colortool/colornameform.ui168
-rw-r--r--tools/designer/examples/colortool/colornameform.ui.h27
-rw-r--r--tools/designer/examples/colortool/colortool.pro27
-rw-r--r--tools/designer/examples/colortool/findform.ui141
-rw-r--r--tools/designer/examples/colortool/findform.ui.h18
-rw-r--r--tools/designer/examples/colortool/images/editcopy.pngbin0 -> 187 bytes
-rw-r--r--tools/designer/examples/colortool/images/editcut.pngbin0 -> 163 bytes
-rw-r--r--tools/designer/examples/colortool/images/editraise.pngbin0 -> 489 bytes
-rw-r--r--tools/designer/examples/colortool/images/filenew.pngbin0 -> 127 bytes
-rw-r--r--tools/designer/examples/colortool/images/fileopen.pngbin0 -> 178 bytes
-rw-r--r--tools/designer/examples/colortool/images/filesave.pngbin0 -> 158 bytes
-rw-r--r--tools/designer/examples/colortool/images/iconview.pngbin0 -> 898 bytes
-rw-r--r--tools/designer/examples/colortool/images/richtextedit.pngbin0 -> 878 bytes
-rw-r--r--tools/designer/examples/colortool/images/searchfind.pngbin0 -> 554 bytes
-rw-r--r--tools/designer/examples/colortool/images/table.pngbin0 -> 371 bytes
-rw-r--r--tools/designer/examples/colortool/images/tabwidget.pngbin0 -> 545 bytes
-rw-r--r--tools/designer/examples/colortool/images/widgetstack.pngbin0 -> 662 bytes
-rw-r--r--tools/designer/examples/colortool/main.cpp10
-rw-r--r--tools/designer/examples/colortool/mainform.ui601
-rw-r--r--tools/designer/examples/colortool/mainform.ui.h585
-rw-r--r--tools/designer/examples/colortool/optionsform.ui153
-rw-r--r--tools/designer/examples/colortool/optionsform.ui.h7
-rw-r--r--tools/designer/examples/credit/credit.pro11
-rw-r--r--tools/designer/examples/credit/creditform.cpp20
-rw-r--r--tools/designer/examples/credit/creditform.h12
-rw-r--r--tools/designer/examples/credit/creditformbase.cpp122
-rw-r--r--tools/designer/examples/credit/creditformbase.h48
-rw-r--r--tools/designer/examples/credit/creditformbase.ui212
-rw-r--r--tools/designer/examples/credit/creditformbase.ui.h5
-rw-r--r--tools/designer/examples/credit/main.cpp25
-rw-r--r--tools/designer/examples/filechooser/plugin/plugin.cpp95
-rw-r--r--tools/designer/examples/filechooser/plugin/plugin.h16
-rw-r--r--tools/designer/examples/filechooser/plugin/plugin.pro14
-rw-r--r--tools/designer/examples/filechooser/widget/filechooser.cpp62
-rw-r--r--tools/designer/examples/filechooser/widget/filechooser.h48
-rw-r--r--tools/designer/examples/filechooser/widget/filechooser.pro9
-rw-r--r--tools/designer/examples/filechooser/widget/main.cpp10
-rw-r--r--tools/designer/examples/metric/main.cpp12
-rw-r--r--tools/designer/examples/metric/metric.pro12
-rw-r--r--tools/designer/examples/metric/metric.ui366
-rw-r--r--tools/designer/examples/metric/metric.ui.h72
-rw-r--r--tools/designer/examples/multiclip/main.cpp25
-rw-r--r--tools/designer/examples/multiclip/multiclip.pro9
-rw-r--r--tools/designer/examples/multiclip/multiclip.ui206
-rw-r--r--tools/designer/examples/multiclip/multiclip.ui.h70
-rw-r--r--tools/designer/examples/opengl/glwidget.cpp170
-rw-r--r--tools/designer/examples/opengl/glwidget.h75
-rw-r--r--tools/designer/examples/opengl/main.cpp305
-rw-r--r--tools/designer/examples/opengl/opengl.pro11
-rw-r--r--tools/designer/examples/receiver1/main.cpp24
-rw-r--r--tools/designer/examples/receiver1/mainform.ui87
-rw-r--r--tools/designer/examples/receiver1/mainform.ui.h25
-rw-r--r--tools/designer/examples/receiver1/receiver.pro11
-rw-r--r--tools/designer/examples/receiver2/main.cpp25
-rw-r--r--tools/designer/examples/receiver2/mainform.ui82
-rw-r--r--tools/designer/examples/receiver2/mainform.ui.h20
-rw-r--r--tools/designer/examples/receiver2/receiver.cpp29
-rw-r--r--tools/designer/examples/receiver2/receiver.h13
-rw-r--r--tools/designer/examples/receiver2/receiver.pro12
-rw-r--r--tools/designer/examples/richedit/images/editcopy.pngbin0 -> 187 bytes
-rw-r--r--tools/designer/examples/richedit/images/editcut.pngbin0 -> 163 bytes
-rw-r--r--tools/designer/examples/richedit/images/editpaste.pngbin0 -> 209 bytes
-rw-r--r--tools/designer/examples/richedit/images/filenew.pngbin0 -> 127 bytes
-rw-r--r--tools/designer/examples/richedit/images/fileopen.pngbin0 -> 178 bytes
-rw-r--r--tools/designer/examples/richedit/images/filesave.pngbin0 -> 158 bytes
-rw-r--r--tools/designer/examples/richedit/images/redo.pngbin0 -> 149 bytes
-rw-r--r--tools/designer/examples/richedit/images/textbold.pngbin0 -> 119 bytes
-rw-r--r--tools/designer/examples/richedit/images/textcenter.pngbin0 -> 92 bytes
-rw-r--r--tools/designer/examples/richedit/images/textitalic.pngbin0 -> 102 bytes
-rw-r--r--tools/designer/examples/richedit/images/textleft.pngbin0 -> 90 bytes
-rw-r--r--tools/designer/examples/richedit/images/textright.pngbin0 -> 93 bytes
-rw-r--r--tools/designer/examples/richedit/images/textunder.pngbin0 -> 115 bytes
-rw-r--r--tools/designer/examples/richedit/images/undo.pngbin0 -> 150 bytes
-rw-r--r--tools/designer/examples/richedit/main.cpp25
-rw-r--r--tools/designer/examples/richedit/richedit.pro10
-rw-r--r--tools/designer/examples/richedit/richedit.ui612
-rw-r--r--tools/designer/examples/richedit/richedit.ui.h120
-rw-r--r--tools/designer/examples/sizeaware/main.cpp11
-rw-r--r--tools/designer/examples/sizeaware/sizeaware.cpp38
-rw-r--r--tools/designer/examples/sizeaware/sizeaware.h23
-rw-r--r--tools/designer/examples/sizeaware/sizeaware.pro6
-rw-r--r--tools/designer/examples/vcr/main.cpp10
-rw-r--r--tools/designer/examples/vcr/play.xpm23
-rw-r--r--tools/designer/examples/vcr/vcr.cpp117
-rw-r--r--tools/designer/examples/vcr/vcr.h17
-rw-r--r--tools/designer/examples/vcr/vcr.pro8
142 files changed, 9283 insertions, 0 deletions
diff --git a/tools/designer/examples/addressbook/addressbook.pro b/tools/designer/examples/addressbook/addressbook.pro
new file mode 100644
index 0000000..70b805a
--- /dev/null
+++ b/tools/designer/examples/addressbook/addressbook.pro
@@ -0,0 +1,14 @@
+TEMPLATE = app
+LANGUAGE = C++
+
+CONFIG += qt warn_on release
+unix {
+ UI_DIR = .ui
+ MOC_DIR = .moc
+ OBJECTS_DIR = .obj
+}
+
+SOURCES += main.cpp
+FORMS = addressbook.ui addressdetails.ui search.ui
+IMAGES = images/filenew.png images/fileopen.png images/filesave.png images/searchfind.png images/editcut.png
+DBFILE = addressbook.db
diff --git a/tools/designer/examples/addressbook/addressbook.ui b/tools/designer/examples/addressbook/addressbook.ui
new file mode 100644
index 0000000..54a4303
--- /dev/null
+++ b/tools/designer/examples/addressbook/addressbook.ui
@@ -0,0 +1,324 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>AddressBook</class>
+<widget class="QMainWindow">
+ <property name="name">
+ <cstring>AddressBook</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Address Book</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QListView">
+ <column>
+ <property name="text">
+ <string>Last Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizeable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>First Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizeable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Phone Number</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizeable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Street </string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizeable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>City</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizeable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Country</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizeable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Zip Code</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizeable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>addressView</cstring>
+ </property>
+ <property name="selectionMode">
+ <enum>Extended</enum>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+</widget>
+<menubar>
+ <property name="name">
+ <cstring>menubar</cstring>
+ </property>
+ <item text="&amp;File" name="fileMenu">
+ <action name="fileNewAction"/>
+ <action name="fileOpenAction"/>
+ <action name="fileSaveAction"/>
+ <action name="fileSaveAsAction"/>
+ <separator/>
+ <action name="fileExitAction"/>
+ </item>
+ <item text="&amp;Edit" name="editMenu">
+ <action name="actionDeleteAddress"/>
+ <separator/>
+ <action name="editFindAction"/>
+ </item>
+</menubar>
+<toolbars>
+ <toolbar dock="2">
+ <property name="name">
+ <cstring>toolBar</cstring>
+ </property>
+ <property name="label">
+ <string>Tools</string>
+ </property>
+ <action name="fileNewAction"/>
+ <action name="fileOpenAction"/>
+ <action name="fileSaveAction"/>
+ <separator/>
+ <action name="actionDeleteAddress"/>
+ <action name="editFindAction"/>
+ </toolbar>
+</toolbars>
+<actions>
+ <action>
+ <property name="name">
+ <cstring>fileNewAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>filenew.png</iconset>
+ </property>
+ <property name="text">
+ <string>New</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;New</string>
+ </property>
+ <property name="accel">
+ <number>4194382</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileOpenAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>fileopen.png</iconset>
+ </property>
+ <property name="text">
+ <string>Open</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Open...</string>
+ </property>
+ <property name="accel">
+ <number>4194383</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileSaveAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>filesave.png</iconset>
+ </property>
+ <property name="text">
+ <string>Save</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Save</string>
+ </property>
+ <property name="accel">
+ <number>4194387</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileSaveAsAction</cstring>
+ </property>
+ <property name="text">
+ <string>Save As</string>
+ </property>
+ <property name="menuText">
+ <string>Save &amp;As...</string>
+ </property>
+ <property name="accel">
+ <number>0</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileExitAction</cstring>
+ </property>
+ <property name="text">
+ <string>Exit</string>
+ </property>
+ <property name="menuText">
+ <string>E&amp;xit</string>
+ </property>
+ <property name="accel">
+ <number>0</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editFindAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>searchfind.png</iconset>
+ </property>
+ <property name="text">
+ <string>Find</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Find...</string>
+ </property>
+ <property name="accel">
+ <number>4194374</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>actionDeleteAddress</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>editcut.png</iconset>
+ </property>
+ <property name="text">
+ <string>Delete</string>
+ </property>
+ </action>
+</actions>
+<connections>
+ <connection>
+ <sender>fileNewAction</sender>
+ <signal>activated()</signal>
+ <receiver>AddressBook</receiver>
+ <slot>fileNew()</slot>
+ </connection>
+ <connection>
+ <sender>fileOpenAction</sender>
+ <signal>activated()</signal>
+ <receiver>AddressBook</receiver>
+ <slot>fileOpen()</slot>
+ </connection>
+ <connection>
+ <sender>fileSaveAction</sender>
+ <signal>activated()</signal>
+ <receiver>AddressBook</receiver>
+ <slot>fileSave()</slot>
+ </connection>
+ <connection>
+ <sender>fileSaveAsAction</sender>
+ <signal>activated()</signal>
+ <receiver>AddressBook</receiver>
+ <slot>fileSaveAs()</slot>
+ </connection>
+ <connection>
+ <sender>fileExitAction</sender>
+ <signal>activated()</signal>
+ <receiver>AddressBook</receiver>
+ <slot>fileExit()</slot>
+ </connection>
+ <connection>
+ <sender>editFindAction</sender>
+ <signal>activated()</signal>
+ <receiver>AddressBook</receiver>
+ <slot>editFind()</slot>
+ </connection>
+ <connection>
+ <sender>actionDeleteAddress</sender>
+ <signal>activated()</signal>
+ <receiver>AddressBook</receiver>
+ <slot>deleteAddress()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in implementation">addressbook.ui.h</include>
+</includes>
+<variables>
+ <variable>QString currentFileName;</variable>
+</variables>
+<slots>
+ <slot>fileNew()</slot>
+ <slot>insertAddress( const QString &amp; firstName, const QString &amp; lastName, const QString &amp; phoneNumber, const QString &amp; street, const QString &amp; city, const QString &amp; country, const QString &amp; zipCode )</slot>
+ <slot>deleteAddress()</slot>
+ <slot>fileOpen()</slot>
+ <slot>fileSave()</slot>
+ <slot>fileSaveAs()</slot>
+ <slot>fileExit()</slot>
+ <slot>editFind()</slot>
+ <slot>searchAddress( const QString &amp; expr )</slot>
+</slots>
+<pixmapinproject/>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/tools/designer/examples/addressbook/addressbook.ui.h b/tools/designer/examples/addressbook/addressbook.ui.h
new file mode 100644
index 0000000..0d4bd88
--- /dev/null
+++ b/tools/designer/examples/addressbook/addressbook.ui.h
@@ -0,0 +1,137 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename slots use Qt Designer which will
+** update this file, preserving your code. Create an init() slot in place of
+** a constructor, and a destroy() slot in place of a destructor.
+*****************************************************************************/
+
+#include "addressdetails.h"
+#include "search.h"
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qfiledialog.h>
+#include <qapplication.h>
+
+void AddressBook::fileNew()
+{
+ AddressDetails dia( this, 0, TRUE );
+ connect( &dia, SIGNAL( newAddress( const QString &,
+ const QString &,
+ const QString &,
+ const QString &,
+ const QString &,
+ const QString &,
+ const QString & ) ),
+ this, SLOT( insertAddress( const QString &,
+ const QString &,
+ const QString &,
+ const QString &,
+ const QString &,
+ const QString &,
+ const QString & ) ) );
+ dia.exec();
+}
+
+void AddressBook::insertAddress( const QString &firstName,
+ const QString &lastName,
+ const QString &phoneNumber,
+ const QString &street,
+ const QString &city,
+ const QString &country,
+ const QString &zipCode )
+{
+ QListViewItem *i = new QListViewItem( addressView );
+ i->setText( 0, firstName );
+ i->setText( 1, lastName );
+ i->setText( 2, phoneNumber );
+ i->setText( 3, street );
+ i->setText( 4, city );
+ i->setText( 5, country );
+ i->setText( 6, zipCode );
+}
+
+void AddressBook::deleteAddress()
+{
+ QListViewItemIterator it( addressView );
+ while ( it.current() ) {
+ QListViewItem *i = it.current();
+ ++it;
+ if ( i->isSelected() )
+ delete i;
+ }
+}
+
+void AddressBook::fileOpen()
+{
+ addressView->clear();
+ QString fn = QFileDialog::getOpenFileName();
+ if ( fn.isEmpty() )
+ return;
+ currentFileName = fn;
+ QFile f( currentFileName );
+ if ( !f.open( IO_ReadOnly ) )
+ return;
+ QTextStream ts( &f );
+
+ while ( !ts.eof() ) {
+ QListViewItem *item = new QListViewItem( addressView );
+ for ( int i = 0; i < 7; ++i )
+ item->setText( i, ts.readLine() );
+ }
+
+}
+
+void AddressBook::fileSave()
+{
+ if ( currentFileName.isEmpty() )
+ fileSaveAs();
+ QFile f( currentFileName );
+ if ( !f.open( IO_WriteOnly ) )
+ return;
+ QTextStream ts( &f );
+
+ QListViewItemIterator it( addressView );
+ while ( it.current() ) {
+ for ( int i = 0; i < 7; ++i )
+ ts << it.current()->text( i ) << endl;
+ ++it;
+ }
+
+ f.close();
+}
+
+void AddressBook::fileSaveAs()
+{
+ QString fn = QFileDialog::getSaveFileName();
+ if ( fn.isEmpty() )
+ return;
+ currentFileName = fn;
+ fileSave();
+}
+
+void AddressBook::fileExit()
+{
+ qApp->exit();
+}
+
+void AddressBook::editFind()
+{
+ SearchDialog dia( this, 0, TRUE );
+ connect( &dia, SIGNAL( searchAddress( const QString & ) ),
+ this, SLOT( searchAddress( const QString & ) ) );
+ dia.exec();
+}
+
+void AddressBook::searchAddress( const QString &expr )
+{
+ addressView->clearSelection();
+ QListViewItemIterator it( addressView );
+ while ( it.current() ) {
+ for ( int i = 0; i < 7; ++i ) {
+ if ( it.current()->text( i ).find( expr ) != -1 )
+ addressView->setSelected( it.current(), TRUE );
+ }
+ ++it;
+ }
+} \ No newline at end of file
diff --git a/tools/designer/examples/addressbook/addressdetails.ui b/tools/designer/examples/addressbook/addressdetails.ui
new file mode 100644
index 0000000..d321a0c
--- /dev/null
+++ b/tools/designer/examples/addressbook/addressdetails.ui
@@ -0,0 +1,243 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>AddressDetails</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>AddressDetails</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>216</width>
+ <height>252</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Enter Address</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout2</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>TextLabel8</cstring>
+ </property>
+ <property name="text">
+ <string>Street</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>editStreet</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>editPhoneNumber</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>TextLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>City</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Last Name</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Phone Number</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="5" column="1">
+ <property name="name">
+ <cstring>editCountry</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="6" column="0">
+ <property name="name">
+ <cstring>TextLabel10</cstring>
+ </property>
+ <property name="text">
+ <string>Zip Code</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>editLastName</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="6" column="1">
+ <property name="name">
+ <cstring>editZipCode</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>First Name</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="4" column="1">
+ <property name="name">
+ <cstring>editCity</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>TextLabel9</cstring>
+ </property>
+ <property name="text">
+ <string>Country</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>editFirstName</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name" stdset="0">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name" stdset="0">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButton2</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButton3</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>PushButton2</sender>
+ <signal>clicked()</signal>
+ <receiver>AddressDetails</receiver>
+ <slot>okClicked()</slot>
+ </connection>
+ <connection>
+ <sender>PushButton3</sender>
+ <signal>clicked()</signal>
+ <receiver>AddressDetails</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>editLastName</tabstop>
+ <tabstop>editFirstName</tabstop>
+ <tabstop>editPhoneNumber</tabstop>
+ <tabstop>editStreet</tabstop>
+ <tabstop>editCity</tabstop>
+ <tabstop>editCountry</tabstop>
+ <tabstop>editZipCode</tabstop>
+ <tabstop>PushButton2</tabstop>
+ <tabstop>PushButton3</tabstop>
+</tabstops>
+<includes>
+ <include location="local" impldecl="in implementation">addressdetails.ui.h</include>
+</includes>
+<signals>
+ <signal>newAddress( const QString &amp;, const QString &amp;, const QString &amp;, const QString &amp;, const QString &amp;, const QString &amp;, const QString &amp; );</signal>
+</signals>
+<slots>
+ <slot>init()</slot>
+ <slot>okClicked()</slot>
+</slots>
+<pixmapinproject/>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/tools/designer/examples/addressbook/addressdetails.ui.h b/tools/designer/examples/addressbook/addressdetails.ui.h
new file mode 100644
index 0000000..e6c1ff5
--- /dev/null
+++ b/tools/designer/examples/addressbook/addressdetails.ui.h
@@ -0,0 +1,24 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename slots use Qt Designer which will
+** update this file, preserving your code. Create an init() slot in place of
+** a constructor, and a destroy() slot in place of a destructor.
+*****************************************************************************/
+
+void AddressDetails::init()
+{
+ editLastName->setFocus();
+}
+
+void AddressDetails::okClicked()
+{
+ emit newAddress( editLastName->text(),
+ editFirstName->text(),
+ editPhoneNumber->text(),
+ editStreet->text(),
+ editCity->text(),
+ editCountry->text(),
+ editZipCode->text() );
+ close();
+} \ No newline at end of file
diff --git a/tools/designer/examples/addressbook/images/editcut.png b/tools/designer/examples/addressbook/images/editcut.png
new file mode 100644
index 0000000..9c7fb3c
--- /dev/null
+++ b/tools/designer/examples/addressbook/images/editcut.png
Binary files differ
diff --git a/tools/designer/examples/addressbook/images/filenew.png b/tools/designer/examples/addressbook/images/filenew.png
new file mode 100644
index 0000000..d898107
--- /dev/null
+++ b/tools/designer/examples/addressbook/images/filenew.png
Binary files differ
diff --git a/tools/designer/examples/addressbook/images/fileopen.png b/tools/designer/examples/addressbook/images/fileopen.png
new file mode 100644
index 0000000..7e49adb
--- /dev/null
+++ b/tools/designer/examples/addressbook/images/fileopen.png
Binary files differ
diff --git a/tools/designer/examples/addressbook/images/filesave.png b/tools/designer/examples/addressbook/images/filesave.png
new file mode 100644
index 0000000..77d9f50
--- /dev/null
+++ b/tools/designer/examples/addressbook/images/filesave.png
Binary files differ
diff --git a/tools/designer/examples/addressbook/images/searchfind.png b/tools/designer/examples/addressbook/images/searchfind.png
new file mode 100644
index 0000000..f18b029
--- /dev/null
+++ b/tools/designer/examples/addressbook/images/searchfind.png
Binary files differ
diff --git a/tools/designer/examples/addressbook/main.cpp b/tools/designer/examples/addressbook/main.cpp
new file mode 100644
index 0000000..9a58f60
--- /dev/null
+++ b/tools/designer/examples/addressbook/main.cpp
@@ -0,0 +1,11 @@
+#include <qapplication.h>
+#include "addressbook.h"
+
+int main( int argc, char ** argv )
+{
+ QApplication a( argc, argv );
+ AddressBook *w = new AddressBook;
+ w->show();
+ a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
+ return a.exec();
+}
diff --git a/tools/designer/examples/addressbook/search.ui b/tools/designer/examples/addressbook/search.ui
new file mode 100644
index 0000000..4329048
--- /dev/null
+++ b/tools/designer/examples/addressbook/search.ui
@@ -0,0 +1,136 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>SearchDialog</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>SearchDialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>216</width>
+ <height>76</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Search</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel12</cstring>
+ </property>
+ <property name="text">
+ <string>Search</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>editSearch</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name" stdset="0">
+ <cstring>Spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButton4</cstring>
+ </property>
+ <property name="text">
+ <string>Search</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButton5</cstring>
+ </property>
+ <property name="text">
+ <string>Close</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>PushButton5</sender>
+ <signal>clicked()</signal>
+ <receiver>SearchDialog</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>PushButton4</sender>
+ <signal>clicked()</signal>
+ <receiver>SearchDialog</receiver>
+ <slot>search()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in implementation">search.ui.h</include>
+</includes>
+<signals>
+ <signal>searchAddress( const QString &amp; )</signal>
+</signals>
+<slots>
+ <slot>search()</slot>
+</slots>
+<pixmapinproject/>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/tools/designer/examples/addressbook/search.ui.h b/tools/designer/examples/addressbook/search.ui.h
new file mode 100644
index 0000000..8b3a8d5
--- /dev/null
+++ b/tools/designer/examples/addressbook/search.ui.h
@@ -0,0 +1,13 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename slots use Qt Designer which will
+** update this file, preserving your code. Create an init() slot in place of
+** a constructor, and a destroy() slot in place of a destructor.
+*****************************************************************************/
+
+void SearchDialog::search()
+{
+ emit searchAddress( editSearch->text() );
+ close();
+} \ No newline at end of file
diff --git a/tools/designer/examples/book/book.sql b/tools/designer/examples/book/book.sql
new file mode 100644
index 0000000..417ef43
--- /dev/null
+++ b/tools/designer/examples/book/book.sql
@@ -0,0 +1,42 @@
+-- The following SQL generates the database
+-- used by the 'book' example programs
+-- Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+--
+-- This file is part of an example program for Qt. This example
+-- program may be used, distributed and modified without limitation.
+
+DROP TABLE author;
+DROP TABLE book;
+DROP TABLE sequence;
+
+CREATE TABLE author
+( id integer primary key,
+forename varchar(40),
+surname varchar(40) );
+
+CREATE TABLE book
+( id integer primary key,
+title varchar(40),
+price numeric(10,2),
+authorid integer,
+notes varchar(255) );
+
+create index book_authorid_idx on book( authorid );
+
+CREATE TABLE sequence
+( tablename varchar(10),
+sequence numeric);
+
+INSERT INTO author VALUES ( 0, 'Philip K', 'Dick' );
+INSERT INTO author VALUES ( 1, 'Robert', 'Heinlein' );
+INSERT INTO author VALUES ( 2, 'Sarah', 'Paretsky' );
+
+INSERT INTO book VALUES ( 0, 'The Man Who Japed', 6.99, 0, 'A good book' );
+INSERT INTO book VALUES ( 1, 'The Man in the High Castle', 9.99, 0, 'Worth reading' );
+INSERT INTO book VALUES ( 2, 'The Number of the Beast', 8.99, 1, 'Get this!' );
+INSERT INTO book VALUES ( 3, 'Indemnity Only', 9.99, 2, 'Cool' );
+INSERT INTO book VALUES ( 4, 'Burn Marks', 9.99, 2, 'Need to make notes' );
+INSERT INTO book VALUES ( 5, 'Deadlock', 9.99, 2, 'Hmmm..' );
+
+INSERT INTO sequence VALUES ( 'author', 2 );
+INSERT INTO sequence VALUES ( 'book', 5 );
diff --git a/tools/designer/examples/book/book1/book.ui b/tools/designer/examples/book/book1/book.ui
new file mode 100644
index 0000000..615b3d5
--- /dev/null
+++ b/tools/designer/examples/book/book1/book.ui
@@ -0,0 +1,71 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>BookForm</class>
+<include location="local" implDecl="in declaration">book.ui.h</include>
+<layoutdefaults spacing="6" margin="11"/>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>BookForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>584</width>
+ <height>472</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Book</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QDataTable">
+ <column>
+ <property name="text">
+ <string>Surname</string>
+ </property>
+ <property name="field">
+ <string>surname</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Forename</string>
+ </property>
+ <property name="field">
+ <string>forename</string>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>AuthorcDataTable</cstring>
+ </property>
+ <property name="confirmDelete">
+ <bool>true</bool>
+ </property>
+ <property name="sort">
+ <stringlist>
+ <string>surname ASC</string>
+ <string>forename ASC</string>
+ </stringlist>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>author</string>
+ </stringlist>
+ </property>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">primeInsertAuthor( QSqlRecord * )</slot>
+</connections>
+</UI>
diff --git a/tools/designer/examples/book/book1/book.ui.h b/tools/designer/examples/book/book1/book.ui.h
new file mode 100644
index 0000000..e658278
--- /dev/null
+++ b/tools/designer/examples/book/book1/book.ui.h
@@ -0,0 +1,5 @@
+void BookForm::primeInsertAuthor( QSqlRecord * )
+{
+
+}
+
diff --git a/tools/designer/examples/book/book1/book1.pro b/tools/designer/examples/book/book1/book1.pro
new file mode 100644
index 0000000..a7e1f7b
--- /dev/null
+++ b/tools/designer/examples/book/book1/book1.pro
@@ -0,0 +1,8 @@
+TEMPLATE = app
+LANGUAGE = C++
+
+CONFIG += qt warn_on release
+
+SOURCES += main.cpp ../connection.cpp
+FORMS = book.ui
+DBFILE = book.db
diff --git a/tools/designer/examples/book/book1/main.cpp b/tools/designer/examples/book/book1/main.cpp
new file mode 100644
index 0000000..464ed42
--- /dev/null
+++ b/tools/designer/examples/book/book1/main.cpp
@@ -0,0 +1,27 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#include <qapplication.h>
+#include <qsqldatabase.h>
+#include "book.h"
+#include "../connection.h"
+
+int main( int argc, char *argv[] )
+{
+ QApplication app( argc, argv );
+
+ if ( ! createConnections() )
+ return 1;
+
+ BookForm bookForm;
+ app.setMainWidget( &bookForm );
+ bookForm.show();
+
+ return app.exec();
+}
diff --git a/tools/designer/examples/book/book2/book.ui b/tools/designer/examples/book/book2/book.ui
new file mode 100644
index 0000000..c66dfae
--- /dev/null
+++ b/tools/designer/examples/book/book2/book.ui
@@ -0,0 +1,77 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>BookForm</class>
+<include location="local" implDecl="in declaration">book.ui.h</include>
+<layoutdefaults spacing="6" margin="11"/>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>BookForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>576</width>
+ <height>468</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Book</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QDataTable">
+ <column>
+ <property name="text">
+ <string>Surname</string>
+ </property>
+ <property name="field">
+ <string>surname</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Forename</string>
+ </property>
+ <property name="field">
+ <string>forename</string>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>AuthorcDataTable</cstring>
+ </property>
+ <property name="confirmDelete">
+ <bool>true</bool>
+ </property>
+ <property name="sort">
+ <stringlist>
+ <string>surname ASC</string>
+ <string>forename ASC</string>
+ </stringlist>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>author</string>
+ </stringlist>
+ </property>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection language="C++">
+ <sender>AuthorcDataTable</sender>
+ <signal>primeInsert(QSqlRecord*)</signal>
+ <receiver>BookForm</receiver>
+ <slot>primeInsertAuthor(QSqlRecord*)</slot>
+ </connection>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">primeInsertAuthor( QSqlRecord * buffer )</slot>
+</connections>
+</UI>
diff --git a/tools/designer/examples/book/book2/book.ui.h b/tools/designer/examples/book/book2/book.ui.h
new file mode 100644
index 0000000..40b1143
--- /dev/null
+++ b/tools/designer/examples/book/book2/book.ui.h
@@ -0,0 +1,10 @@
+void BookForm::primeInsertAuthor( QSqlRecord * buffer )
+{
+ QSqlQuery query;
+ query.exec( "UPDATE sequence SET sequence = sequence + 1 WHERE tablename='author';" );
+ query.exec( "SELECT sequence FROM sequence WHERE tablename='author';" );
+ if ( query.next() ) {
+ buffer->setValue( "id", query.value( 0 ) );
+ }
+}
+
diff --git a/tools/designer/examples/book/book2/book2.pro b/tools/designer/examples/book/book2/book2.pro
new file mode 100644
index 0000000..a7e1f7b
--- /dev/null
+++ b/tools/designer/examples/book/book2/book2.pro
@@ -0,0 +1,8 @@
+TEMPLATE = app
+LANGUAGE = C++
+
+CONFIG += qt warn_on release
+
+SOURCES += main.cpp ../connection.cpp
+FORMS = book.ui
+DBFILE = book.db
diff --git a/tools/designer/examples/book/book2/main.cpp b/tools/designer/examples/book/book2/main.cpp
new file mode 100644
index 0000000..464ed42
--- /dev/null
+++ b/tools/designer/examples/book/book2/main.cpp
@@ -0,0 +1,27 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#include <qapplication.h>
+#include <qsqldatabase.h>
+#include "book.h"
+#include "../connection.h"
+
+int main( int argc, char *argv[] )
+{
+ QApplication app( argc, argv );
+
+ if ( ! createConnections() )
+ return 1;
+
+ BookForm bookForm;
+ app.setMainWidget( &bookForm );
+ bookForm.show();
+
+ return app.exec();
+}
diff --git a/tools/designer/examples/book/book3/book.ui b/tools/designer/examples/book/book3/book.ui
new file mode 100644
index 0000000..91e2c04
--- /dev/null
+++ b/tools/designer/examples/book/book3/book.ui
@@ -0,0 +1,141 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>BookForm</class>
+<include location="local" implDecl="in declaration">book.ui.h</include>
+<layoutdefaults spacing="6" margin="11"/>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>BookForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>566</width>
+ <height>464</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Book</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>Splitter1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>MShape</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>MShadow</enum>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <widget class="QDataTable">
+ <column>
+ <property name="text">
+ <string>Surname</string>
+ </property>
+ <property name="field">
+ <string>surname</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Forename</string>
+ </property>
+ <property name="field">
+ <string>forename</string>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>AuthorDataTable</cstring>
+ </property>
+ <property name="confirmDelete">
+ <bool>true</bool>
+ </property>
+ <property name="sort">
+ <stringlist>
+ <string>surname ASC</string>
+ <string>forename ASC</string>
+ </stringlist>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>author</string>
+ </stringlist>
+ </property>
+ </widget>
+ <widget class="QDataTable">
+ <column>
+ <property name="text">
+ <string>Title</string>
+ </property>
+ <property name="field">
+ <string>title</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Price</string>
+ </property>
+ <property name="field">
+ <string>price</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Notes</string>
+ </property>
+ <property name="field">
+ <string>notes</string>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>BookDataTable</cstring>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="sort">
+ <stringlist>
+ <string>title ASC</string>
+ </stringlist>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>book</string>
+ </stringlist>
+ </property>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection language="C++">
+ <sender>AuthorDataTable</sender>
+ <signal>currentChanged(QSqlRecord*)</signal>
+ <receiver>BookForm</receiver>
+ <slot>newCurrentAuthor(QSqlRecord*)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>AuthorDataTable</sender>
+ <signal>primeInsert(QSqlRecord*)</signal>
+ <receiver>BookForm</receiver>
+ <slot>primeInsertAuthor(QSqlRecord*)</slot>
+ </connection>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">newCurrentAuthor( QSqlRecord * author )</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">primeInsertAuthor( QSqlRecord * buffer )</slot>
+</connections>
+</UI>
diff --git a/tools/designer/examples/book/book3/book.ui.h b/tools/designer/examples/book/book3/book.ui.h
new file mode 100644
index 0000000..b027d01
--- /dev/null
+++ b/tools/designer/examples/book/book3/book.ui.h
@@ -0,0 +1,16 @@
+void BookForm::newCurrentAuthor( QSqlRecord *author )
+{
+ BookDataTable->setFilter( "authorid=" + author->value( "id" ).toString() );
+ BookDataTable->refresh();
+}
+
+void BookForm::primeInsertAuthor( QSqlRecord *buffer )
+{
+ QSqlQuery query;
+ query.exec( "UPDATE sequence SET sequence = sequence + 1 WHERE tablename='author';" );
+ query.exec( "SELECT sequence FROM sequence WHERE tablename='author';" );
+ if ( query.next() ) {
+ buffer->setValue( "id", query.value( 0 ) );
+ }
+}
+
diff --git a/tools/designer/examples/book/book3/book3.pro b/tools/designer/examples/book/book3/book3.pro
new file mode 100644
index 0000000..a7e1f7b
--- /dev/null
+++ b/tools/designer/examples/book/book3/book3.pro
@@ -0,0 +1,8 @@
+TEMPLATE = app
+LANGUAGE = C++
+
+CONFIG += qt warn_on release
+
+SOURCES += main.cpp ../connection.cpp
+FORMS = book.ui
+DBFILE = book.db
diff --git a/tools/designer/examples/book/book3/main.cpp b/tools/designer/examples/book/book3/main.cpp
new file mode 100644
index 0000000..89911b1
--- /dev/null
+++ b/tools/designer/examples/book/book3/main.cpp
@@ -0,0 +1,27 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#include <qapplication.h>
+#include <qsqldatabase.h>
+#include "book.h"
+#include "../connection.h"
+
+int main( int argc, char *argv[] )
+{
+ QApplication app( argc, argv );
+
+ if ( ! createConnections() )
+ return 1;
+
+ BookForm bookForm;
+ app.setMainWidget( &bookForm );
+ bookForm.show();
+
+ return app.exec();
+}
diff --git a/tools/designer/examples/book/book4/book.ui b/tools/designer/examples/book/book4/book.ui
new file mode 100644
index 0000000..f24818c
--- /dev/null
+++ b/tools/designer/examples/book/book4/book.ui
@@ -0,0 +1,179 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>BookForm</class>
+<include location="local" implDecl="in declaration">book.ui.h</include>
+<layoutdefaults spacing="6" margin="11"/>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>BookForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>546</width>
+ <height>532</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Book</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>Splitter1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>MShape</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>MShadow</enum>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <widget class="QDataTable">
+ <column>
+ <property name="text">
+ <string>Surname</string>
+ </property>
+ <property name="field">
+ <string>surname</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Forename</string>
+ </property>
+ <property name="field">
+ <string>forename</string>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>AuthorDataTable</cstring>
+ </property>
+ <property name="confirmDelete">
+ <bool>true</bool>
+ </property>
+ <property name="sort">
+ <stringlist>
+ <string>surname ASC</string>
+ <string>forename ASC</string>
+ </stringlist>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>author</string>
+ </stringlist>
+ </property>
+ </widget>
+ <widget class="QDataTable">
+ <column>
+ <property name="text">
+ <string>Title</string>
+ </property>
+ <property name="field">
+ <string>title</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Price</string>
+ </property>
+ <property name="field">
+ <string>price</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Notes</string>
+ </property>
+ <property name="field">
+ <string>notes</string>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>BookDataTable</cstring>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="sort">
+ <stringlist>
+ <string>title ASC</string>
+ </stringlist>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>book</string>
+ </stringlist>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>EditPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Edit Books</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>QuitPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Quit</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection language="C++">
+ <sender>AuthorDataTable</sender>
+ <signal>currentChanged(QSqlRecord*)</signal>
+ <receiver>BookForm</receiver>
+ <slot>newCurrentAuthor(QSqlRecord*)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>AuthorDataTable</sender>
+ <signal>primeInsert(QSqlRecord*)</signal>
+ <receiver>BookForm</receiver>
+ <slot>primeInsertAuthor(QSqlRecord*)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>QuitPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>BookForm</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">newCurrentAuthor( QSqlRecord * author )</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">primeInsertAuthor( QSqlRecord * buffer )</slot>
+</connections>
+</UI>
diff --git a/tools/designer/examples/book/book4/book.ui.h b/tools/designer/examples/book/book4/book.ui.h
new file mode 100644
index 0000000..a8754e9
--- /dev/null
+++ b/tools/designer/examples/book/book4/book.ui.h
@@ -0,0 +1,16 @@
+void BookForm::newCurrentAuthor( QSqlRecord * author )
+{
+ BookDataTable->setFilter( "authorid=" + author->value( "id" ).toString() );
+ BookDataTable->refresh();
+}
+
+void BookForm::primeInsertAuthor( QSqlRecord * buffer )
+{
+ QSqlQuery query;
+ query.exec( "UPDATE sequence SET sequence = sequence + 1 WHERE tablename='author';" );
+ query.exec( "SELECT sequence FROM sequence WHERE tablename='author';" );
+ if ( query.next() ) {
+ buffer->setValue( "id", query.value( 0 ) );
+ }
+}
+
diff --git a/tools/designer/examples/book/book4/book4.pro b/tools/designer/examples/book/book4/book4.pro
new file mode 100644
index 0000000..a7e1f7b
--- /dev/null
+++ b/tools/designer/examples/book/book4/book4.pro
@@ -0,0 +1,8 @@
+TEMPLATE = app
+LANGUAGE = C++
+
+CONFIG += qt warn_on release
+
+SOURCES += main.cpp ../connection.cpp
+FORMS = book.ui
+DBFILE = book.db
diff --git a/tools/designer/examples/book/book4/main.cpp b/tools/designer/examples/book/book4/main.cpp
new file mode 100644
index 0000000..2688b18
--- /dev/null
+++ b/tools/designer/examples/book/book4/main.cpp
@@ -0,0 +1,29 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#include <qapplication.h>
+#include <qsqldatabase.h>
+#include "book.h"
+#include "../connection.h"
+
+int main( int argc, char *argv[] )
+{
+ QApplication app( argc, argv );
+
+ if ( ! createConnections() )
+ return 1;
+
+ BookForm bookForm;
+ app.setMainWidget( &bookForm );
+ bookForm.show();
+
+ return app.exec();
+}
+
+
diff --git a/tools/designer/examples/book/book5/book.ui b/tools/designer/examples/book/book5/book.ui
new file mode 100644
index 0000000..b27cb94
--- /dev/null
+++ b/tools/designer/examples/book/book5/book.ui
@@ -0,0 +1,188 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>BookForm</class>
+<include location="local" impldecl="in declaration">qdatabrowser.h</include>
+<include location="local" impldecl="in declaration">editbook.h</include>
+<include location="local" implDecl="in declaration">book.ui.h</include>
+<layoutdefaults spacing="6" margin="11"/>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>BookForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>530</width>
+ <height>524</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Book</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>Splitter1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>MShape</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>MShadow</enum>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <widget class="QDataTable">
+ <column>
+ <property name="text">
+ <string>Surname</string>
+ </property>
+ <property name="field">
+ <string>surname</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Forename</string>
+ </property>
+ <property name="field">
+ <string>forename</string>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>AuthorDataTable</cstring>
+ </property>
+ <property name="confirmDelete">
+ <bool>true</bool>
+ </property>
+ <property name="sort">
+ <stringlist>
+ <string>surname ASC</string>
+ <string>forename ASC</string>
+ </stringlist>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>author</string>
+ </stringlist>
+ </property>
+ </widget>
+ <widget class="QDataTable">
+ <column>
+ <property name="text">
+ <string>Title</string>
+ </property>
+ <property name="field">
+ <string>title</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Price</string>
+ </property>
+ <property name="field">
+ <string>price</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Notes</string>
+ </property>
+ <property name="field">
+ <string>notes</string>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>BookDataTable</cstring>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="sort">
+ <stringlist>
+ <string>title ASC</string>
+ </stringlist>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>book</string>
+ </stringlist>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>EditPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Edit Books</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>QuitPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Quit</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection language="C++">
+ <sender>QuitPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>BookForm</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>EditPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>BookForm</receiver>
+ <slot>editClicked()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>AuthorDataTable</sender>
+ <signal>primeInsert(QSqlRecord*)</signal>
+ <receiver>BookForm</receiver>
+ <slot>primeInsertAuthor(QSqlRecord*)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>AuthorDataTable</sender>
+ <signal>currentChanged(QSqlRecord*)</signal>
+ <receiver>BookForm</receiver>
+ <slot>newCurrentAuthor(QSqlRecord*)</slot>
+ </connection>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">editClicked()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">newCurrentAuthor( QSqlRecord * author )</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">primeInsertAuthor( QSqlRecord * buffer )</slot>
+</connections>
+</UI>
diff --git a/tools/designer/examples/book/book5/book.ui.h b/tools/designer/examples/book/book5/book.ui.h
new file mode 100644
index 0000000..576af61
--- /dev/null
+++ b/tools/designer/examples/book/book5/book.ui.h
@@ -0,0 +1,23 @@
+void BookForm::editClicked()
+{
+ EditBookForm *dialog = new EditBookForm( this, "Edit Book Form", TRUE );
+ dialog->exec();
+ delete dialog;
+}
+
+void BookForm::newCurrentAuthor( QSqlRecord *author )
+{
+ BookDataTable->setFilter( "authorid=" + author->value( "id" ).toString() );
+ BookDataTable->refresh();
+}
+
+void BookForm::primeInsertAuthor( QSqlRecord *buffer )
+{
+ QSqlQuery query;
+ query.exec( "UPDATE sequence SET sequence = sequence + 1 WHERE tablename='author';" );
+ query.exec( "SELECT sequence FROM sequence WHERE tablename='author';" );
+ if ( query.next() ) {
+ buffer->setValue( "id", query.value( 0 ) );
+ }
+}
+
diff --git a/tools/designer/examples/book/book5/book5.pro b/tools/designer/examples/book/book5/book5.pro
new file mode 100644
index 0000000..030db5f
--- /dev/null
+++ b/tools/designer/examples/book/book5/book5.pro
@@ -0,0 +1,8 @@
+TEMPLATE = app
+LANGUAGE = C++
+
+CONFIG += qt warn_on release
+
+SOURCES += main.cpp ../connection.cpp
+FORMS = book.ui editbook.ui
+DBFILE = book.db
diff --git a/tools/designer/examples/book/book5/editbook.ui b/tools/designer/examples/book/book5/editbook.ui
new file mode 100644
index 0000000..088b3a3
--- /dev/null
+++ b/tools/designer/examples/book/book5/editbook.ui
@@ -0,0 +1,291 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>EditBookForm</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>EditBookForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>568</width>
+ <height>301</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Edit Books</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QDataBrowser">
+ <property name="name">
+ <cstring>BookDataBrowser</cstring>
+ </property>
+ <property name="sort">
+ <stringlist>
+ <string>title ASC</string>
+ </stringlist>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>book</string>
+ </stringlist>
+ </property>
+ <property name="frameworkCode" stdset="0">
+ <bool>false</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>Layout2</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>labelPrice</cstring>
+ </property>
+ <property name="text">
+ <string>Price</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>labelTitle</cstring>
+ </property>
+ <property name="text">
+ <string>Title</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>QLineEditTitle</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>book</string>
+ <string>title</string>
+ </stringlist>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>QLineEditPrice</cstring>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>book</string>
+ <string>price</string>
+ </stringlist>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonFirst</cstring>
+ </property>
+ <property name="text">
+ <string>|&lt; &amp;First</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonPrev</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;&lt; &amp;Prev</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonNext</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Next &gt;&gt;</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonLast</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Last &gt;|</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="0">
+ <property name="name">
+ <cstring>Layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonInsert</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Insert</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonUpdate</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Update</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonDelete</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Delete</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonClose</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Close</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>PushButtonFirst</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>first()</slot>
+ </connection>
+ <connection>
+ <sender>BookDataBrowser</sender>
+ <signal>firstRecordAvailable( bool )</signal>
+ <receiver>PushButtonFirst</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>PushButtonPrev</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>prev()</slot>
+ </connection>
+ <connection>
+ <sender>BookDataBrowser</sender>
+ <signal>prevRecordAvailable( bool )</signal>
+ <receiver>PushButtonPrev</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>PushButtonNext</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>next()</slot>
+ </connection>
+ <connection>
+ <sender>BookDataBrowser</sender>
+ <signal>nextRecordAvailable( bool )</signal>
+ <receiver>PushButtonNext</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>PushButtonLast</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>last()</slot>
+ </connection>
+ <connection>
+ <sender>BookDataBrowser</sender>
+ <signal>lastRecordAvailable( bool )</signal>
+ <receiver>PushButtonLast</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>PushButtonInsert</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>insert()</slot>
+ </connection>
+ <connection>
+ <sender>PushButtonUpdate</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>update()</slot>
+ </connection>
+ <connection>
+ <sender>PushButtonDelete</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>del()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in implementation">editbook.ui.h</include>
+</includes>
+<slots>
+ <slot>init()</slot>
+ <slot>destroy()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/tools/designer/examples/book/book5/editbook.ui.h b/tools/designer/examples/book/book5/editbook.ui.h
new file mode 100644
index 0000000..4a8a636
--- /dev/null
+++ b/tools/designer/examples/book/book5/editbook.ui.h
@@ -0,0 +1,10 @@
+void EditBookForm::init()
+{
+
+}
+
+void EditBookForm::destroy()
+{
+
+}
+
diff --git a/tools/designer/examples/book/book5/main.cpp b/tools/designer/examples/book/book5/main.cpp
new file mode 100644
index 0000000..464ed42
--- /dev/null
+++ b/tools/designer/examples/book/book5/main.cpp
@@ -0,0 +1,27 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#include <qapplication.h>
+#include <qsqldatabase.h>
+#include "book.h"
+#include "../connection.h"
+
+int main( int argc, char *argv[] )
+{
+ QApplication app( argc, argv );
+
+ if ( ! createConnections() )
+ return 1;
+
+ BookForm bookForm;
+ app.setMainWidget( &bookForm );
+ bookForm.show();
+
+ return app.exec();
+}
diff --git a/tools/designer/examples/book/book6/book.ui b/tools/designer/examples/book/book6/book.ui
new file mode 100644
index 0000000..e3ede50
--- /dev/null
+++ b/tools/designer/examples/book/book6/book.ui
@@ -0,0 +1,189 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>BookForm</class>
+<include location="global" impldecl="in declaration">qsqlrecord.h</include>
+<include location="local" impldecl="in declaration">editbook.h</include>
+<include location="global" impldecl="in declaration">qdatabrowser.h</include>
+<include location="local" implDecl="in declaration">book.ui.h</include>
+<layoutdefaults spacing="6" margin="11"/>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>BookForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>494</width>
+ <height>506</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Book</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>Splitter1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>MShape</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>MShadow</enum>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <widget class="QDataTable">
+ <column>
+ <property name="text">
+ <string>Surname</string>
+ </property>
+ <property name="field">
+ <string>surname</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Forename</string>
+ </property>
+ <property name="field">
+ <string>forename</string>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>AuthorDataTable</cstring>
+ </property>
+ <property name="confirmDelete">
+ <bool>true</bool>
+ </property>
+ <property name="sort">
+ <stringlist>
+ <string>surname ASC</string>
+ <string>forename ASC</string>
+ </stringlist>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>author</string>
+ </stringlist>
+ </property>
+ </widget>
+ <widget class="QDataTable">
+ <column>
+ <property name="text">
+ <string>Title</string>
+ </property>
+ <property name="field">
+ <string>title</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Price</string>
+ </property>
+ <property name="field">
+ <string>price</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Notes</string>
+ </property>
+ <property name="field">
+ <string>notes</string>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>BookDataTable</cstring>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="sort">
+ <stringlist>
+ <string>title ASC</string>
+ </stringlist>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>book</string>
+ </stringlist>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>EditPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Edit Books</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>QuitPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Quit</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection language="C++">
+ <sender>QuitPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>BookForm</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>EditPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>BookForm</receiver>
+ <slot>editClicked()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>AuthorDataTable</sender>
+ <signal>primeInsert(QSqlRecord*)</signal>
+ <receiver>BookForm</receiver>
+ <slot>primeInsertAuthor(QSqlRecord*)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>AuthorDataTable</sender>
+ <signal>currentChanged(QSqlRecord*)</signal>
+ <receiver>BookForm</receiver>
+ <slot>newCurrentAuthor(QSqlRecord*)</slot>
+ </connection>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">editClicked()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">newCurrentAuthor( QSqlRecord * author )</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">primeInsertAuthor( QSqlRecord * buffer )</slot>
+</connections>
+</UI>
diff --git a/tools/designer/examples/book/book6/book.ui.h b/tools/designer/examples/book/book6/book.ui.h
new file mode 100644
index 0000000..f41103d
--- /dev/null
+++ b/tools/designer/examples/book/book6/book.ui.h
@@ -0,0 +1,33 @@
+void BookForm::editClicked()
+{
+ EditBookForm *dialog = new EditBookForm( this, "Edit Book Form", TRUE );
+ QSqlCursor cur( "book" );
+ dialog->BookDataBrowser->setSqlCursor( &cur );
+ dialog->BookDataBrowser->setFilter( BookDataTable->filter() );
+ dialog->BookDataBrowser->setSort(QSqlIndex::fromStringList(
+ BookDataTable->sort(), &cur ) );
+ dialog->BookDataBrowser->refresh();
+ int i = BookDataTable->currentRow();
+ if ( i == -1 ) i = 0; // Always use the first row
+ dialog->BookDataBrowser->seek( i );
+ dialog->exec();
+ delete dialog;
+ BookDataTable->refresh();
+}
+
+void BookForm::newCurrentAuthor( QSqlRecord * author )
+{
+ BookDataTable->setFilter( "authorid=" + author->value( "id" ).toString() );
+ BookDataTable->refresh();
+}
+
+void BookForm::primeInsertAuthor( QSqlRecord * buffer )
+{
+ QSqlQuery query;
+ query.exec( "UPDATE sequence SET sequence = sequence + 1 WHERE tablename='author';" );
+ query.exec( "SELECT sequence FROM sequence WHERE tablename='author';" );
+ if ( query.next() ) {
+ buffer->setValue( "id", query.value( 0 ) );
+ }
+}
+
diff --git a/tools/designer/examples/book/book6/book6.pro b/tools/designer/examples/book/book6/book6.pro
new file mode 100644
index 0000000..030db5f
--- /dev/null
+++ b/tools/designer/examples/book/book6/book6.pro
@@ -0,0 +1,8 @@
+TEMPLATE = app
+LANGUAGE = C++
+
+CONFIG += qt warn_on release
+
+SOURCES += main.cpp ../connection.cpp
+FORMS = book.ui editbook.ui
+DBFILE = book.db
diff --git a/tools/designer/examples/book/book6/editbook.ui b/tools/designer/examples/book/book6/editbook.ui
new file mode 100644
index 0000000..2f7acd1
--- /dev/null
+++ b/tools/designer/examples/book/book6/editbook.ui
@@ -0,0 +1,300 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>EditBookForm</class>
+<include location="global" impldecl="in declaration">qsqlrecord.h</include>
+<include location="local" implDecl="in declaration">editbook.ui.h</include>
+<forward>class QSqlRecord;</forward>
+<layoutdefaults spacing="6" margin="11"/>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>EditBookForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>536</width>
+ <height>285</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Edit Books</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QDataBrowser">
+ <property name="name">
+ <cstring>BookDataBrowser</cstring>
+ </property>
+ <property name="sort">
+ <stringlist>
+ <string>title ASC</string>
+ </stringlist>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>book</string>
+ </stringlist>
+ </property>
+ <property name="frameworkCode" stdset="0">
+ <bool>false</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>Layout2</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>labelPrice</cstring>
+ </property>
+ <property name="text">
+ <string>Price</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>labelTitle</cstring>
+ </property>
+ <property name="text">
+ <string>Title</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>QLineEditTitle</cstring>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>book</string>
+ <string>title</string>
+ </stringlist>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>QLineEditPrice</cstring>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>book</string>
+ <string>price</string>
+ </stringlist>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonFirst</cstring>
+ </property>
+ <property name="text">
+ <string>|&lt; &amp;First</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonPrev</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;&lt; &amp;Prev</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonNext</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Next &gt;&gt;</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonLast</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Last &gt;|</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="0">
+ <property name="name">
+ <cstring>Layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonInsert</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Insert</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonUpdate</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Update</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonDelete</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Delete</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonClose</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Close</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection language="C++">
+ <sender>PushButtonFirst</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>first()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>firstRecordAvailable( bool )</signal>
+ <receiver>PushButtonFirst</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonPrev</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>prev()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>prevRecordAvailable( bool )</signal>
+ <receiver>PushButtonPrev</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonNext</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>next()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>nextRecordAvailable( bool )</signal>
+ <receiver>PushButtonNext</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonLast</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>last()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>lastRecordAvailable( bool )</signal>
+ <receiver>PushButtonLast</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonInsert</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>insert()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonUpdate</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>update()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonDelete</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>del()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>primeInsert(QSqlRecord*)</signal>
+ <receiver>EditBookForm</receiver>
+ <slot>primeInsertBook(QSqlRecord*)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonClose</sender>
+ <signal>clicked()</signal>
+ <receiver>EditBookForm</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">primeInsertBook( QSqlRecord * buffer )</slot>
+</connections>
+</UI>
diff --git a/tools/designer/examples/book/book6/editbook.ui.h b/tools/designer/examples/book/book6/editbook.ui.h
new file mode 100644
index 0000000..eb76ac3
--- /dev/null
+++ b/tools/designer/examples/book/book6/editbook.ui.h
@@ -0,0 +1,10 @@
+void EditBookForm::primeInsertBook( QSqlRecord * buffer )
+{
+ QSqlQuery query;
+ query.exec( "UPDATE sequence SET sequence = sequence + 1 WHERE tablename='book';" );
+ query.exec( "SELECT sequence FROM sequence WHERE tablename='book';" );
+ if ( query.next() ) {
+ buffer->setValue( "id", query.value( 0 ) );
+ }
+}
+
diff --git a/tools/designer/examples/book/book6/main.cpp b/tools/designer/examples/book/book6/main.cpp
new file mode 100644
index 0000000..464ed42
--- /dev/null
+++ b/tools/designer/examples/book/book6/main.cpp
@@ -0,0 +1,27 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#include <qapplication.h>
+#include <qsqldatabase.h>
+#include "book.h"
+#include "../connection.h"
+
+int main( int argc, char *argv[] )
+{
+ QApplication app( argc, argv );
+
+ if ( ! createConnections() )
+ return 1;
+
+ BookForm bookForm;
+ app.setMainWidget( &bookForm );
+ bookForm.show();
+
+ return app.exec();
+}
diff --git a/tools/designer/examples/book/book7/book.ui b/tools/designer/examples/book/book7/book.ui
new file mode 100644
index 0000000..b3c2869
--- /dev/null
+++ b/tools/designer/examples/book/book7/book.ui
@@ -0,0 +1,189 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>BookForm</class>
+<include location="global" impldecl="in declaration">qsqlrecord.h</include>
+<include location="local" impldecl="in declaration">editbook.h</include>
+<include location="global" impldecl="in declaration">qdatabrowser.h</include>
+<include location="local" implDecl="in declaration">book.ui.h</include>
+<layoutdefaults spacing="6" margin="11"/>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>BookForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>490</width>
+ <height>504</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Book</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>Splitter1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>MShape</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>MShadow</enum>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <widget class="QDataTable">
+ <column>
+ <property name="text">
+ <string>Surname</string>
+ </property>
+ <property name="field">
+ <string>surname</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Forename</string>
+ </property>
+ <property name="field">
+ <string>forename</string>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>AuthorDataTable</cstring>
+ </property>
+ <property name="confirmDelete">
+ <bool>true</bool>
+ </property>
+ <property name="sort">
+ <stringlist>
+ <string>surname ASC</string>
+ <string>forename ASC</string>
+ </stringlist>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>author</string>
+ </stringlist>
+ </property>
+ </widget>
+ <widget class="QDataTable">
+ <column>
+ <property name="text">
+ <string>Title</string>
+ </property>
+ <property name="field">
+ <string>title</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Price</string>
+ </property>
+ <property name="field">
+ <string>price</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Notes</string>
+ </property>
+ <property name="field">
+ <string>notes</string>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>BookDataTable</cstring>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="sort">
+ <stringlist>
+ <string>title ASC</string>
+ </stringlist>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>book</string>
+ </stringlist>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>EditPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Edit Books</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>QuitPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Quit</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection language="C++">
+ <sender>QuitPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>BookForm</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>EditPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>BookForm</receiver>
+ <slot>editClicked()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>AuthorDataTable</sender>
+ <signal>primeInsert(QSqlRecord*)</signal>
+ <receiver>BookForm</receiver>
+ <slot>primeInsertAuthor(QSqlRecord*)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>AuthorDataTable</sender>
+ <signal>currentChanged(QSqlRecord*)</signal>
+ <receiver>BookForm</receiver>
+ <slot>newCurrentAuthor(QSqlRecord*)</slot>
+ </connection>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">editClicked()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">newCurrentAuthor( QSqlRecord * author )</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">primeInsertAuthor( QSqlRecord * buffer )</slot>
+</connections>
+</UI>
diff --git a/tools/designer/examples/book/book7/book.ui.h b/tools/designer/examples/book/book7/book.ui.h
new file mode 100644
index 0000000..de754b1
--- /dev/null
+++ b/tools/designer/examples/book/book7/book.ui.h
@@ -0,0 +1,33 @@
+void BookForm::editClicked()
+{
+ EditBookForm *dialog = new EditBookForm( this, "Edit Book Form", TRUE );
+ QSqlCursor cur( "book" );
+ dialog->BookDataBrowser->setSqlCursor( &cur );
+ dialog->BookDataBrowser->setFilter( BookDataTable->filter() );
+ dialog->BookDataBrowser->setSort(QSqlIndex::fromStringList(
+ BookDataTable->sort(), &cur ) );
+ dialog->BookDataBrowser->refresh();
+ int i = BookDataTable->currentRow();
+ if ( i == -1 ) i = 0; // Always use the first row
+ dialog->BookDataBrowser->seek( i );
+ dialog->exec();
+ delete dialog;
+ BookDataTable->refresh();
+}
+
+void BookForm::newCurrentAuthor( QSqlRecord *author )
+{
+ BookDataTable->setFilter( "authorid=" + author->value( "id" ).toString() );
+ BookDataTable->refresh();
+}
+
+void BookForm::primeInsertAuthor( QSqlRecord *buffer )
+{
+ QSqlQuery query;
+ query.exec( "UPDATE sequence SET sequence = sequence + 1 WHERE tablename='author';" );
+ query.exec( "SELECT sequence FROM sequence WHERE tablename='author';" );
+ if ( query.next() ) {
+ buffer->setValue( "id", query.value( 0 ) );
+ }
+}
+
diff --git a/tools/designer/examples/book/book7/book7.pro b/tools/designer/examples/book/book7/book7.pro
new file mode 100644
index 0000000..22c7e9b
--- /dev/null
+++ b/tools/designer/examples/book/book7/book7.pro
@@ -0,0 +1,7 @@
+TEMPLATE = app
+LANGUAGE = C++
+
+CONFIG += qt warn_on release
+SOURCES += main.cpp ../connection.cpp
+FORMS = book.ui editbook.ui
+DBFILE = book.db
diff --git a/tools/designer/examples/book/book7/editbook.ui b/tools/designer/examples/book/book7/editbook.ui
new file mode 100644
index 0000000..85df2ba
--- /dev/null
+++ b/tools/designer/examples/book/book7/editbook.ui
@@ -0,0 +1,384 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>EditBookForm</class>
+<include location="global" impldecl="in declaration">qsqlrecord.h</include>
+<include location="local" implDecl="in declaration">editbook.ui.h</include>
+<forward>class QSqlRecord;</forward>
+<layoutdefaults spacing="6" margin="11"/>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>EditBookForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>528</width>
+ <height>305</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Edit Books</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QDataBrowser">
+ <property name="name">
+ <cstring>BookDataBrowser</cstring>
+ </property>
+ <property name="sort">
+ <stringlist>
+ <string>title ASC</string>
+ </stringlist>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>book</string>
+ </stringlist>
+ </property>
+ <property name="frameworkCode" stdset="0">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>Layout2</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>labelPrice</cstring>
+ </property>
+ <property name="text">
+ <string>Price</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>labelTitle</cstring>
+ </property>
+ <property name="text">
+ <string>Title</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>QLineEditTitle</cstring>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>book</string>
+ <string>title</string>
+ </stringlist>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>QLineEditPrice</cstring>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>book</string>
+ <string>price</string>
+ </stringlist>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget" row="3" column="0">
+ <property name="name">
+ <cstring>Layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonInsert</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Insert</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonUpdate</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Update</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonDelete</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Delete</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonClose</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Close</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="0">
+ <property name="name">
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonFirst</cstring>
+ </property>
+ <property name="text">
+ <string>|&lt; &amp;First</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonPrev</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;&lt; &amp;Prev</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonNext</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Next &gt;&gt;</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonLast</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Last &gt;|</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>Layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Author</string>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>ComboBoxAuthor</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>author_view</string>
+ <string>name</string>
+ </stringlist>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection language="C++">
+ <sender>PushButtonFirst</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>first()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>firstRecordAvailable( bool )</signal>
+ <receiver>PushButtonFirst</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonPrev</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>prev()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>prevRecordAvailable( bool )</signal>
+ <receiver>PushButtonPrev</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonNext</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>next()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>nextRecordAvailable( bool )</signal>
+ <receiver>PushButtonNext</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonLast</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>last()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>lastRecordAvailable( bool )</signal>
+ <receiver>PushButtonLast</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonInsert</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>insert()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonUpdate</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>update()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonDelete</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>del()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonClose</sender>
+ <signal>clicked()</signal>
+ <receiver>EditBookForm</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>primeUpdate(QSqlRecord*)</signal>
+ <receiver>EditBookForm</receiver>
+ <slot>primeUpdateBook(QSqlRecord*)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>beforeUpdate(QSqlRecord*)</signal>
+ <receiver>EditBookForm</receiver>
+ <slot>beforeUpdateBook(QSqlRecord*)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>beforeInsert(QSqlRecord*)</signal>
+ <receiver>EditBookForm</receiver>
+ <slot>beforeUpdateBook(QSqlRecord*)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>primeInsert(QSqlRecord*)</signal>
+ <receiver>EditBookForm</receiver>
+ <slot>primeInsertBook(QSqlRecord*)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>primeInsert(QSqlRecord*)</signal>
+ <receiver>EditBookForm</receiver>
+ <slot>primeInsertBook(QSqlRecord*)</slot>
+ </connection>
+ <slot access="protected" specifier="virtual" language="C++" returnType="void">init()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">beforeUpdateBook( QSqlRecord * buffer )</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">primeInsertBook( QSqlRecord * buffer )</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">primeUpdateBook( QSqlRecord * buffer )</slot>
+</connections>
+<tabstops>
+ <tabstop>QLineEditTitle</tabstop>
+ <tabstop>QLineEditPrice</tabstop>
+ <tabstop>ComboBoxAuthor</tabstop>
+ <tabstop>PushButtonFirst</tabstop>
+ <tabstop>PushButtonPrev</tabstop>
+ <tabstop>PushButtonNext</tabstop>
+ <tabstop>PushButtonLast</tabstop>
+ <tabstop>PushButtonInsert</tabstop>
+ <tabstop>PushButtonUpdate</tabstop>
+ <tabstop>PushButtonDelete</tabstop>
+ <tabstop>PushButtonClose</tabstop>
+</tabstops>
+</UI>
diff --git a/tools/designer/examples/book/book7/editbook.ui.h b/tools/designer/examples/book/book7/editbook.ui.h
new file mode 100644
index 0000000..f955312
--- /dev/null
+++ b/tools/designer/examples/book/book7/editbook.ui.h
@@ -0,0 +1,42 @@
+void EditBookForm::init()
+{
+ QSqlQuery query( "SELECT surname FROM author ORDER BY surname;" );
+ while ( query.next() )
+ ComboBoxAuthor->insertItem( query.value( 0 ).toString());
+}
+
+void EditBookForm::beforeUpdateBook( QSqlRecord * buffer )
+{
+ QSqlQuery query( "SELECT id FROM author WHERE surname ='" +
+ ComboBoxAuthor->currentText() + "';" );
+ if ( query.next() )
+ buffer->setValue( "authorid", query.value( 0 ) );
+}
+
+void EditBookForm::primeInsertBook( QSqlRecord * buffer )
+{
+ QSqlQuery query;
+ query.exec( "UPDATE sequence SET sequence = sequence + 1 WHERE tablename='book';" );
+ query.exec( "SELECT sequence FROM sequence WHERE tablename='book';" );
+ if ( query.next() ) {
+ buffer->setValue( "id", query.value( 0 ) );
+ }
+}
+
+void EditBookForm::primeUpdateBook( QSqlRecord * buffer )
+{
+ // Who is this book's author?
+ QSqlQuery query( "SELECT surname FROM author WHERE id='" +
+ buffer->value( "authorid" ).toString() + "';" );
+ QString author = "";
+ if ( query.next() )
+ author = query.value( 0 ).toString();
+ // Set the ComboBox to the right author
+ for ( int i = 0; i < ComboBoxAuthor->count(); i++ ) {
+ if ( ComboBoxAuthor->text( i ) == author ) {
+ ComboBoxAuthor->setCurrentItem( i ) ;
+ break;
+ }
+ }
+}
+
diff --git a/tools/designer/examples/book/book7/main.cpp b/tools/designer/examples/book/book7/main.cpp
new file mode 100644
index 0000000..464ed42
--- /dev/null
+++ b/tools/designer/examples/book/book7/main.cpp
@@ -0,0 +1,27 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#include <qapplication.h>
+#include <qsqldatabase.h>
+#include "book.h"
+#include "../connection.h"
+
+int main( int argc, char *argv[] )
+{
+ QApplication app( argc, argv );
+
+ if ( ! createConnections() )
+ return 1;
+
+ BookForm bookForm;
+ app.setMainWidget( &bookForm );
+ bookForm.show();
+
+ return app.exec();
+}
diff --git a/tools/designer/examples/book/book8/book.ui b/tools/designer/examples/book/book8/book.ui
new file mode 100644
index 0000000..b3c2869
--- /dev/null
+++ b/tools/designer/examples/book/book8/book.ui
@@ -0,0 +1,189 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>BookForm</class>
+<include location="global" impldecl="in declaration">qsqlrecord.h</include>
+<include location="local" impldecl="in declaration">editbook.h</include>
+<include location="global" impldecl="in declaration">qdatabrowser.h</include>
+<include location="local" implDecl="in declaration">book.ui.h</include>
+<layoutdefaults spacing="6" margin="11"/>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>BookForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>490</width>
+ <height>504</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Book</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>Splitter1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>MShape</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>MShadow</enum>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <widget class="QDataTable">
+ <column>
+ <property name="text">
+ <string>Surname</string>
+ </property>
+ <property name="field">
+ <string>surname</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Forename</string>
+ </property>
+ <property name="field">
+ <string>forename</string>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>AuthorDataTable</cstring>
+ </property>
+ <property name="confirmDelete">
+ <bool>true</bool>
+ </property>
+ <property name="sort">
+ <stringlist>
+ <string>surname ASC</string>
+ <string>forename ASC</string>
+ </stringlist>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>author</string>
+ </stringlist>
+ </property>
+ </widget>
+ <widget class="QDataTable">
+ <column>
+ <property name="text">
+ <string>Title</string>
+ </property>
+ <property name="field">
+ <string>title</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Price</string>
+ </property>
+ <property name="field">
+ <string>price</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Notes</string>
+ </property>
+ <property name="field">
+ <string>notes</string>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>BookDataTable</cstring>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="sort">
+ <stringlist>
+ <string>title ASC</string>
+ </stringlist>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>book</string>
+ </stringlist>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>EditPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Edit Books</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>QuitPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Quit</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection language="C++">
+ <sender>QuitPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>BookForm</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>EditPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>BookForm</receiver>
+ <slot>editClicked()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>AuthorDataTable</sender>
+ <signal>primeInsert(QSqlRecord*)</signal>
+ <receiver>BookForm</receiver>
+ <slot>primeInsertAuthor(QSqlRecord*)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>AuthorDataTable</sender>
+ <signal>currentChanged(QSqlRecord*)</signal>
+ <receiver>BookForm</receiver>
+ <slot>newCurrentAuthor(QSqlRecord*)</slot>
+ </connection>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">editClicked()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">newCurrentAuthor( QSqlRecord * author )</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">primeInsertAuthor( QSqlRecord * buffer )</slot>
+</connections>
+</UI>
diff --git a/tools/designer/examples/book/book8/book.ui.h b/tools/designer/examples/book/book8/book.ui.h
new file mode 100644
index 0000000..6c8a2b5
--- /dev/null
+++ b/tools/designer/examples/book/book8/book.ui.h
@@ -0,0 +1,33 @@
+void BookForm::editClicked()
+{
+ EditBookForm *dialog = new EditBookForm( this, "Edit Book Form", TRUE );
+ QSqlCursor cur( "book" );
+ dialog->BookDataBrowser->setSqlCursor( &cur );
+ dialog->BookDataBrowser->setFilter( BookDataTable->filter() );
+ dialog->BookDataBrowser->setSort(QSqlIndex::fromStringList(
+ BookDataTable->sort(), &cur ) );
+ dialog->BookDataBrowser->refresh();
+ int i = BookDataTable->currentRow();
+ if ( i == -1 ) i = 0; // Always use the first row
+ dialog->BookDataBrowser->seek( i );
+ dialog->exec();
+ delete dialog;
+ BookDataTable->refresh();
+}
+
+void BookForm::newCurrentAuthor( QSqlRecord *author )
+{
+ BookDataTable->setFilter( "authorid=" + author->value( "id" ).toString() );
+ BookDataTable->refresh();
+}
+
+void BookForm::primeInsertAuthor( QSqlRecord *buffer )
+{
+ QSqlQuery q;
+ q.exec( "UPDATE sequence SET sequence = sequence + 1 WHERE tablename='author';" );
+ q.exec( "SELECT sequence FROM sequence WHERE tablename='author';" );
+ if ( q.next() ) {
+ buffer->setValue( "id", q.value( 0 ) );
+ }
+}
+
diff --git a/tools/designer/examples/book/book8/book8.pro b/tools/designer/examples/book/book8/book8.pro
new file mode 100644
index 0000000..e4bdf75
--- /dev/null
+++ b/tools/designer/examples/book/book8/book8.pro
@@ -0,0 +1,7 @@
+TEMPLATE = app
+LANGUAGE = C++
+
+SOURCES += main.cpp ../connection.cpp
+FORMS = book.ui editbook.ui
+CONFIG += qt warn_on release
+DBFILE = book.db
diff --git a/tools/designer/examples/book/book8/editbook.ui b/tools/designer/examples/book/book8/editbook.ui
new file mode 100644
index 0000000..17d378b
--- /dev/null
+++ b/tools/designer/examples/book/book8/editbook.ui
@@ -0,0 +1,386 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>EditBookForm</class>
+<include location="global" impldecl="in declaration">qsqlrecord.h</include>
+<include location="local" implDecl="in declaration">editbook.ui.h</include>
+<forward>class QSqlRecord;</forward>
+<variable>QMap&lt;QString,int&gt; authorMap;</variable>
+<layoutdefaults spacing="6" margin="11"/>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>EditBookForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>520</width>
+ <height>369</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Edit Books</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QDataBrowser">
+ <property name="name">
+ <cstring>BookDataBrowser</cstring>
+ </property>
+ <property name="sort">
+ <stringlist>
+ <string>title ASC</string>
+ </stringlist>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>book</string>
+ </stringlist>
+ </property>
+ <property name="frameworkCode" stdset="0">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>Layout2</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>labelPrice</cstring>
+ </property>
+ <property name="text">
+ <string>Price</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>labelTitle</cstring>
+ </property>
+ <property name="text">
+ <string>Title</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>QLineEditTitle</cstring>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>book</string>
+ <string>title</string>
+ </stringlist>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>QLineEditPrice</cstring>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>book</string>
+ <string>price</string>
+ </stringlist>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget" row="3" column="0">
+ <property name="name">
+ <cstring>Layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonInsert</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Insert</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonUpdate</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Update</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonDelete</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Delete</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonClose</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Close</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="0">
+ <property name="name">
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonFirst</cstring>
+ </property>
+ <property name="text">
+ <string>|&lt; &amp;First</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonPrev</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;&lt; &amp;Prev</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonNext</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Next &gt;&gt;</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButtonLast</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Last &gt;|</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>Layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Author</string>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>ComboBoxAuthor</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="database" stdset="0">
+ <stringlist>
+ <string>(default)</string>
+ <string>author_view</string>
+ <string>name</string>
+ </stringlist>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection language="C++">
+ <sender>PushButtonFirst</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>first()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>firstRecordAvailable( bool )</signal>
+ <receiver>PushButtonFirst</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonPrev</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>prev()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>prevRecordAvailable( bool )</signal>
+ <receiver>PushButtonPrev</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonNext</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>next()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>nextRecordAvailable( bool )</signal>
+ <receiver>PushButtonNext</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonLast</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>last()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>lastRecordAvailable( bool )</signal>
+ <receiver>PushButtonLast</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonInsert</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>insert()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonUpdate</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>update()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonDelete</sender>
+ <signal>clicked()</signal>
+ <receiver>BookDataBrowser</receiver>
+ <slot>del()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>PushButtonClose</sender>
+ <signal>clicked()</signal>
+ <receiver>EditBookForm</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>primeUpdate(QSqlRecord*)</signal>
+ <receiver>EditBookForm</receiver>
+ <slot>primeUpdateBook(QSqlRecord*)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>beforeUpdate(QSqlRecord*)</signal>
+ <receiver>EditBookForm</receiver>
+ <slot>beforeUpdateBook(QSqlRecord*)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>beforeInsert(QSqlRecord*)</signal>
+ <receiver>EditBookForm</receiver>
+ <slot>beforeUpdateBook(QSqlRecord*)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>primeInsert(QSqlRecord*)</signal>
+ <receiver>EditBookForm</receiver>
+ <slot>primeInsertBook(QSqlRecord*)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>BookDataBrowser</sender>
+ <signal>primeInsert(QSqlRecord*)</signal>
+ <receiver>EditBookForm</receiver>
+ <slot>primeInsertBook(QSqlRecord*)</slot>
+ </connection>
+ <slot access="protected" specifier="virtual" language="C++" returnType="void">init()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">beforeUpdateBook( QSqlRecord * buffer )</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">mapAuthor( const QString &amp; name, int &amp; id, bool populate )</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">primeInsertBook( QSqlRecord * buffer )</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">primeUpdateBook( QSqlRecord * buffer )</slot>
+</connections>
+<tabstops>
+ <tabstop>QLineEditTitle</tabstop>
+ <tabstop>QLineEditPrice</tabstop>
+ <tabstop>ComboBoxAuthor</tabstop>
+ <tabstop>PushButtonFirst</tabstop>
+ <tabstop>PushButtonPrev</tabstop>
+ <tabstop>PushButtonNext</tabstop>
+ <tabstop>PushButtonLast</tabstop>
+ <tabstop>PushButtonInsert</tabstop>
+ <tabstop>PushButtonUpdate</tabstop>
+ <tabstop>PushButtonDelete</tabstop>
+ <tabstop>PushButtonClose</tabstop>
+</tabstops>
+</UI>
diff --git a/tools/designer/examples/book/book8/editbook.ui.h b/tools/designer/examples/book/book8/editbook.ui.h
new file mode 100644
index 0000000..1bac1a8
--- /dev/null
+++ b/tools/designer/examples/book/book8/editbook.ui.h
@@ -0,0 +1,47 @@
+void EditBookForm::init()
+{
+ QSqlQuery query( "SELECT surname, id FROM author ORDER BY surname;" );
+ while ( query.next() ) {
+ ComboBoxAuthor->insertItem( query.value( 0 ).toString() );
+ int id = query.value( 1 ).toInt();
+ mapAuthor( query.value( 0 ).toString(), id, TRUE );
+ }
+}
+
+void EditBookForm::beforeUpdateBook( QSqlRecord * buffer )
+{
+ int id;
+ mapAuthor( ComboBoxAuthor->currentText(), id, FALSE );
+ buffer->setValue( "authorid", id );
+}
+
+void EditBookForm::mapAuthor( const QString & name, int & id, bool populate )
+{
+ if ( populate )
+ authorMap[ name ] = id;
+ else
+ id = authorMap[ name ];
+}
+
+void EditBookForm::primeInsertBook( QSqlRecord * buffer )
+{
+ QSqlQuery q;
+ q.exec( "UPDATE sequence SET sequence = sequence + 1 WHERE tablename='book';" );
+ q.exec( "SELECT sequence FROM sequence WHERE tablename='book';" );
+ if ( q.next() ) {
+ buffer->setValue( "id", q.value( 0 ) );
+ }
+}
+
+void EditBookForm::primeUpdateBook( QSqlRecord * buffer )
+{
+ int id = buffer->value( "authorid" ).toInt();
+ for ( int i = 0; i < ComboBoxAuthor->count(); i++ ) {
+ QString author = ComboBoxAuthor->text( i );
+ if ( authorMap.contains( author ) && authorMap[author] == id ) {
+ ComboBoxAuthor->setCurrentItem( i ) ;
+ break;
+ }
+ }
+}
+
diff --git a/tools/designer/examples/book/book8/main.cpp b/tools/designer/examples/book/book8/main.cpp
new file mode 100644
index 0000000..464ed42
--- /dev/null
+++ b/tools/designer/examples/book/book8/main.cpp
@@ -0,0 +1,27 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#include <qapplication.h>
+#include <qsqldatabase.h>
+#include "book.h"
+#include "../connection.h"
+
+int main( int argc, char *argv[] )
+{
+ QApplication app( argc, argv );
+
+ if ( ! createConnections() )
+ return 1;
+
+ BookForm bookForm;
+ app.setMainWidget( &bookForm );
+ bookForm.show();
+
+ return app.exec();
+}
diff --git a/tools/designer/examples/book/connection.cpp b/tools/designer/examples/book/connection.cpp
new file mode 100644
index 0000000..710f50c
--- /dev/null
+++ b/tools/designer/examples/book/connection.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+#include <qsqldatabase.h>
+#include "connection.h"
+
+bool createConnections()
+{
+ // create the default database connection
+ QSqlDatabase *defaultDB = QSqlDatabase::addDatabase( DB_BOOKS_DRIVER );
+ defaultDB->setDatabaseName( DB_BOOKS );
+ defaultDB->setUserName( DB_BOOKS_USER );
+ defaultDB->setPassword( DB_BOOKS_PASSWD );
+ defaultDB->setHostName( DB_BOOKS_HOST );
+ if ( ! defaultDB->open() ) {
+ qWarning( "Failed to open books database: " +
+ defaultDB->lastError().driverText() );
+ qWarning( defaultDB->lastError().databaseText() );
+ return FALSE;
+ }
+
+ QSqlQuery q(QString::null, defaultDB);
+ q.exec("CREATE TABLE author ( id integer primary key, "
+ "forename varchar(40), surname varchar(40) )");
+ q.exec("CREATE TABLE book ( id integer primary key, "
+ "title varchar(40), price numeric(10,2), authorid integer, notes varchar(255) )");
+
+ q.exec("CREATE TABLE sequence ( tablename varchar(10), sequence numeric)");
+
+ q.exec("INSERT INTO author VALUES ( 0, 'Philip K', 'Dick' )");
+ q.exec("INSERT INTO author VALUES ( 1, 'Robert', 'Heinlein' )");
+ q.exec("INSERT INTO author VALUES ( 2, 'Sarah', 'Paretsky' )");
+
+ q.exec("INSERT INTO book VALUES (0, 'The Man Who Japed', 6.99, 0, 'A good book' )");
+ q.exec("INSERT INTO book VALUES (1, 'The Man in the High Castle', 9.99, 0, 'Worth reading' )");
+ q.exec("INSERT INTO book VALUES ( 2, 'The Number of the Beast', 8.99, 1, 'Get this!' )");
+ q.exec("INSERT INTO book VALUES ( 3, 'Indemnity Only', 9.99, 2, 'Cool' )");
+ q.exec("INSERT INTO book VALUES ( 4, 'Burn Marks', 9.99, 2, 'Need to make notes' )");
+ q.exec("INSERT INTO book VALUES ( 5, 'Deadlock', 9.99, 2, 'Hmmm..' )");
+
+ q.exec("INSERT INTO sequence VALUES ( 'author', 2 )");
+ q.exec("INSERT INTO sequence VALUES ( 'book', 5 )");
+
+ return TRUE;
+}
+
+
diff --git a/tools/designer/examples/book/connection.h b/tools/designer/examples/book/connection.h
new file mode 100644
index 0000000..9768c73
--- /dev/null
+++ b/tools/designer/examples/book/connection.h
@@ -0,0 +1,18 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+// Add your own connection parameters here
+#define DB_BOOKS_DRIVER "QSQLITE"
+#define DB_BOOKS ":memory:"
+#define DB_BOOKS_USER ""
+#define DB_BOOKS_PASSWD ""
+#define DB_BOOKS_HOST ""
+
+bool createConnections();
+
diff --git a/tools/designer/examples/colortool/colornameform.ui b/tools/designer/examples/colortool/colornameform.ui
new file mode 100644
index 0000000..566cd8d
--- /dev/null
+++ b/tools/designer/examples/colortool/colornameform.ui
@@ -0,0 +1,168 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>ColorNameForm</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>ColorNameForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>348</width>
+ <height>105</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Color Tool -- Color Name</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>colorLabel</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>80</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="pixmap">
+ <pixmap>editraise.png</pixmap>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout4</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Name</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>colorLineEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>colorLineEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>11</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>okPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+</widget>
+<connections>
+ <connection>
+ <sender>cancelPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>ColorNameForm</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>okPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>ColorNameForm</receiver>
+ <slot>validate()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in implementation">colornameform.ui.h</include>
+</includes>
+<slots>
+ <slot>validate()</slot>
+</slots>
+<functions>
+ <function>setColors( const QMap&lt;QString, QColor&gt; &amp; colors )</function>
+</functions>
+<pixmapinproject/>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/tools/designer/examples/colortool/colornameform.ui.h b/tools/designer/examples/colortool/colornameform.ui.h
new file mode 100644
index 0000000..24c9d71
--- /dev/null
+++ b/tools/designer/examples/colortool/colornameform.ui.h
@@ -0,0 +1,27 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions use Qt Designer which will
+** update this file, preserving your code. Create an init() function in place
+** of a constructor, and a destroy() function in place of a destructor.
+*****************************************************************************/
+#include <qcolor.h>
+#include <qmap.h>
+#include <qstring.h>
+
+QMap<QString,QColor> m_colors;
+
+void ColorNameForm::setColors( const QMap<QString,QColor>& colors )
+{
+ m_colors = colors;
+}
+
+void ColorNameForm::validate()
+{
+ QString name = colorLineEdit->text();
+ if ( ! name.isEmpty() &&
+ ( m_colors.isEmpty() || ! m_colors.contains( name ) ) )
+ accept();
+ else
+ colorLineEdit->selectAll();
+}
diff --git a/tools/designer/examples/colortool/colortool.pro b/tools/designer/examples/colortool/colortool.pro
new file mode 100644
index 0000000..af22965
--- /dev/null
+++ b/tools/designer/examples/colortool/colortool.pro
@@ -0,0 +1,27 @@
+TEMPLATE = app
+LANGUAGE = C++
+
+SOURCES += main.cpp
+unix {
+ UI_DIR = .ui
+ MOC_DIR = .moc
+ OBJECTS_DIR = .obj
+}
+FORMS = mainform.ui \
+ colornameform.ui \
+ findform.ui \
+ optionsform.ui
+IMAGES = images/filenew.png \
+ images/fileopen.png \
+ images/filesave.png \
+ images/editcut.png \
+ images/editcopy.png \
+ images/searchfind.png \
+ images/tabwidget.png \
+ images/table.png \
+ images/iconview.png \
+ images/richtextedit.png \
+ images/widgetstack.png \
+ images/editraise.png
+CONFIG += qt warn_on release
+DBFILE = colortool.db
diff --git a/tools/designer/examples/colortool/findform.ui b/tools/designer/examples/colortool/findform.ui
new file mode 100644
index 0000000..aaf7ca9
--- /dev/null
+++ b/tools/designer/examples/colortool/findform.ui
@@ -0,0 +1,141 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>FindForm</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>FindForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>301</width>
+ <height>99</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Color Tool -- Find Color</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout11</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Look for</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>findLineEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>findLineEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout10</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>9</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>findPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Find</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>closePushButton</cstring>
+ </property>
+ <property name="text">
+ <string>Close</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>closePushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>FindForm</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>findPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>FindForm</receiver>
+ <slot>find()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in implementation">findform.ui.h</include>
+</includes>
+<signals>
+ <signal>lookfor(const QString&amp;)</signal>
+</signals>
+<slots>
+ <slot>find()</slot>
+</slots>
+<functions>
+ <function>notfound()</function>
+</functions>
+<pixmapinproject/>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/tools/designer/examples/colortool/findform.ui.h b/tools/designer/examples/colortool/findform.ui.h
new file mode 100644
index 0000000..87eafae
--- /dev/null
+++ b/tools/designer/examples/colortool/findform.ui.h
@@ -0,0 +1,18 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions use Qt Designer which will
+** update this file, preserving your code. Create an init() function in place
+** of a constructor, and a destroy() function in place of a destructor.
+*****************************************************************************/
+
+
+void FindForm::find()
+{
+ emit lookfor( findLineEdit->text() );
+}
+
+void FindForm::notfound()
+{
+ findLineEdit->selectAll();
+}
diff --git a/tools/designer/examples/colortool/images/editcopy.png b/tools/designer/examples/colortool/images/editcopy.png
new file mode 100644
index 0000000..abfe86e
--- /dev/null
+++ b/tools/designer/examples/colortool/images/editcopy.png
Binary files differ
diff --git a/tools/designer/examples/colortool/images/editcut.png b/tools/designer/examples/colortool/images/editcut.png
new file mode 100644
index 0000000..2d179bc
--- /dev/null
+++ b/tools/designer/examples/colortool/images/editcut.png
Binary files differ
diff --git a/tools/designer/examples/colortool/images/editraise.png b/tools/designer/examples/colortool/images/editraise.png
new file mode 100644
index 0000000..0241568
--- /dev/null
+++ b/tools/designer/examples/colortool/images/editraise.png
Binary files differ
diff --git a/tools/designer/examples/colortool/images/filenew.png b/tools/designer/examples/colortool/images/filenew.png
new file mode 100644
index 0000000..9853d97
--- /dev/null
+++ b/tools/designer/examples/colortool/images/filenew.png
Binary files differ
diff --git a/tools/designer/examples/colortool/images/fileopen.png b/tools/designer/examples/colortool/images/fileopen.png
new file mode 100644
index 0000000..85dab43
--- /dev/null
+++ b/tools/designer/examples/colortool/images/fileopen.png
Binary files differ
diff --git a/tools/designer/examples/colortool/images/filesave.png b/tools/designer/examples/colortool/images/filesave.png
new file mode 100644
index 0000000..21309aa
--- /dev/null
+++ b/tools/designer/examples/colortool/images/filesave.png
Binary files differ
diff --git a/tools/designer/examples/colortool/images/iconview.png b/tools/designer/examples/colortool/images/iconview.png
new file mode 100644
index 0000000..d755399
--- /dev/null
+++ b/tools/designer/examples/colortool/images/iconview.png
Binary files differ
diff --git a/tools/designer/examples/colortool/images/richtextedit.png b/tools/designer/examples/colortool/images/richtextedit.png
new file mode 100644
index 0000000..9f75c25
--- /dev/null
+++ b/tools/designer/examples/colortool/images/richtextedit.png
Binary files differ
diff --git a/tools/designer/examples/colortool/images/searchfind.png b/tools/designer/examples/colortool/images/searchfind.png
new file mode 100644
index 0000000..8f7d8ad
--- /dev/null
+++ b/tools/designer/examples/colortool/images/searchfind.png
Binary files differ
diff --git a/tools/designer/examples/colortool/images/table.png b/tools/designer/examples/colortool/images/table.png
new file mode 100644
index 0000000..4491b6e
--- /dev/null
+++ b/tools/designer/examples/colortool/images/table.png
Binary files differ
diff --git a/tools/designer/examples/colortool/images/tabwidget.png b/tools/designer/examples/colortool/images/tabwidget.png
new file mode 100644
index 0000000..3a16044
--- /dev/null
+++ b/tools/designer/examples/colortool/images/tabwidget.png
Binary files differ
diff --git a/tools/designer/examples/colortool/images/widgetstack.png b/tools/designer/examples/colortool/images/widgetstack.png
new file mode 100644
index 0000000..7b5f234
--- /dev/null
+++ b/tools/designer/examples/colortool/images/widgetstack.png
Binary files differ
diff --git a/tools/designer/examples/colortool/main.cpp b/tools/designer/examples/colortool/main.cpp
new file mode 100644
index 0000000..31b2586
--- /dev/null
+++ b/tools/designer/examples/colortool/main.cpp
@@ -0,0 +1,10 @@
+#include <qapplication.h>
+#include "mainform.h"
+
+int main( int argc, char ** argv )
+{
+ QApplication a( argc, argv );
+ MainForm *w = new MainForm;
+ w->show();
+ return a.exec();
+}
diff --git a/tools/designer/examples/colortool/mainform.ui b/tools/designer/examples/colortool/mainform.ui
new file mode 100644
index 0000000..6c89bac
--- /dev/null
+++ b/tools/designer/examples/colortool/mainform.ui
@@ -0,0 +1,601 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>MainForm</class>
+<widget class="QMainWindow">
+ <property name="name">
+ <cstring>MainForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Color Tool</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QWidgetStack">
+ <property name="name">
+ <cstring>colorWidgetStack</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tablePage</cstring>
+ </property>
+ <attribute name="id">
+ <number>0</number>
+ </attribute>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTable">
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Hex</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Web</string>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>colorTable</cstring>
+ </property>
+ <property name="numRows">
+ <number>0</number>
+ </property>
+ <property name="numCols">
+ <number>3</number>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>iconsPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>1</number>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QIconView">
+ <property name="name">
+ <cstring>colorIconView</cstring>
+ </property>
+ <property name="gridX">
+ <number>100</number>
+ </property>
+ <property name="resizeMode">
+ <enum>Adjust</enum>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </widget>
+ </hbox>
+</widget>
+<menubar>
+ <property name="name">
+ <cstring>menubar</cstring>
+ </property>
+ <item text="&amp;File" name="fileMenu">
+ <action name="fileNewAction"/>
+ <action name="fileOpenAction"/>
+ <action name="fileSaveAction"/>
+ <action name="fileSaveAsAction"/>
+ <separator/>
+ <action name="fileExitAction"/>
+ </item>
+ <item text="&amp;Edit" name="editMenu">
+ <action name="editAddAction"/>
+ <action name="editCutAction"/>
+ <action name="editCopyAction"/>
+ <separator/>
+ <action name="editFindAction"/>
+ <separator/>
+ <action name="optionsAction"/>
+ </item>
+ <item text="&amp;View" name="viewMenu">
+ <action name="viewTableAction"/>
+ <action name="viewIconsAction"/>
+ </item>
+ <item text="&amp;Help" name="helpMenu">
+ <action name="helpContentsAction"/>
+ <action name="helpIndexAction"/>
+ <separator/>
+ <action name="helpAboutAction"/>
+ </item>
+</menubar>
+<toolbars>
+ <toolbar dock="2">
+ <property name="name">
+ <cstring>toolBar</cstring>
+ </property>
+ <property name="label">
+ <string>Tools</string>
+ </property>
+ <action name="fileNewAction"/>
+ <action name="fileOpenAction"/>
+ <action name="fileSaveAction"/>
+ <separator/>
+ <action name="editAddAction"/>
+ <action name="editCutAction"/>
+ <action name="editCopyAction"/>
+ <action name="editFindAction"/>
+ <separator/>
+ <action name="optionsAction"/>
+ <separator/>
+ <action name="viewTableAction"/>
+ <action name="viewIconsAction"/>
+ </toolbar>
+</toolbars>
+<actions>
+ <action>
+ <property name="name">
+ <cstring>fileNewAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>filenew.png</iconset>
+ </property>
+ <property name="text">
+ <string>New</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;New</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+N</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileOpenAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>fileopen.png</iconset>
+ </property>
+ <property name="text">
+ <string>Open</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Open...</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+O</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileSaveAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>filesave.png</iconset>
+ </property>
+ <property name="text">
+ <string>Save</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Save</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+S</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileSaveAsAction</cstring>
+ </property>
+ <property name="text">
+ <string>Save As</string>
+ </property>
+ <property name="menuText">
+ <string>Save &amp;As...</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileExitAction</cstring>
+ </property>
+ <property name="text">
+ <string>Exit</string>
+ </property>
+ <property name="menuText">
+ <string>E&amp;xit</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editCutAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>editcut.png</iconset>
+ </property>
+ <property name="text">
+ <string>Delete</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Delete</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+X</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editCopyAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>editcopy.png</iconset>
+ </property>
+ <property name="text">
+ <string>Copy</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Copy</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+C</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editFindAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>searchfind.png</iconset>
+ </property>
+ <property name="text">
+ <string>Find</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Find...</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+F</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>helpContentsAction</cstring>
+ </property>
+ <property name="text">
+ <string>Contents</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Contents...</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>helpIndexAction</cstring>
+ </property>
+ <property name="text">
+ <string>Index</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Index...</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>helpAboutAction</cstring>
+ </property>
+ <property name="text">
+ <string>About</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;About</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>optionsAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>tabwidget.png</iconset>
+ </property>
+ <property name="text">
+ <string>Options</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Options...</string>
+ </property>
+ </action>
+ <actiongroup>
+ <property name="name">
+ <cstring>viewActionGroup</cstring>
+ </property>
+ <property name="text">
+ <string>View</string>
+ </property>
+ <property name="menuText">
+ <string>View</string>
+ </property>
+ <property name="usesDropDown">
+ <bool>false</bool>
+ </property>
+ <action>
+ <property name="name">
+ <cstring>viewTableAction</cstring>
+ </property>
+ <property name="toggleAction">
+ <bool>true</bool>
+ </property>
+ <property name="on">
+ <bool>true</bool>
+ </property>
+ <property name="iconSet">
+ <iconset>table.png</iconset>
+ </property>
+ <property name="text">
+ <string>View Table</string>
+ </property>
+ <property name="menuText">
+ <string>View &amp;Table</string>
+ </property>
+ <property name="toolTip">
+ <string>View Table (Ctrl+T)</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+T</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>viewIconsAction</cstring>
+ </property>
+ <property name="toggleAction">
+ <bool>true</bool>
+ </property>
+ <property name="iconSet">
+ <iconset>iconview.png</iconset>
+ </property>
+ <property name="text">
+ <string>View Icons</string>
+ </property>
+ <property name="menuText">
+ <string>View &amp;Icons</string>
+ </property>
+ <property name="toolTip">
+ <string>View Icons (Ctrl+I)</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+I</string>
+ </property>
+ </action>
+ </actiongroup>
+ <action>
+ <property name="name">
+ <cstring>editAddAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>widgetstack.png</iconset>
+ </property>
+ <property name="text">
+ <string>Add</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Add...</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+A</string>
+ </property>
+ </action>
+</actions>
+<connections>
+ <connection>
+ <sender>fileNewAction</sender>
+ <signal>activated()</signal>
+ <receiver>MainForm</receiver>
+ <slot>fileNew()</slot>
+ </connection>
+ <connection>
+ <sender>fileOpenAction</sender>
+ <signal>activated()</signal>
+ <receiver>MainForm</receiver>
+ <slot>fileOpen()</slot>
+ </connection>
+ <connection>
+ <sender>fileSaveAction</sender>
+ <signal>activated()</signal>
+ <receiver>MainForm</receiver>
+ <slot>fileSave()</slot>
+ </connection>
+ <connection>
+ <sender>fileSaveAsAction</sender>
+ <signal>activated()</signal>
+ <receiver>MainForm</receiver>
+ <slot>fileSaveAs()</slot>
+ </connection>
+ <connection>
+ <sender>fileExitAction</sender>
+ <signal>activated()</signal>
+ <receiver>MainForm</receiver>
+ <slot>fileExit()</slot>
+ </connection>
+ <connection>
+ <sender>editCutAction</sender>
+ <signal>activated()</signal>
+ <receiver>MainForm</receiver>
+ <slot>editCut()</slot>
+ </connection>
+ <connection>
+ <sender>editCopyAction</sender>
+ <signal>activated()</signal>
+ <receiver>MainForm</receiver>
+ <slot>editCopy()</slot>
+ </connection>
+ <connection>
+ <sender>editFindAction</sender>
+ <signal>activated()</signal>
+ <receiver>MainForm</receiver>
+ <slot>editFind()</slot>
+ </connection>
+ <connection>
+ <sender>helpIndexAction</sender>
+ <signal>activated()</signal>
+ <receiver>MainForm</receiver>
+ <slot>helpIndex()</slot>
+ </connection>
+ <connection>
+ <sender>helpContentsAction</sender>
+ <signal>activated()</signal>
+ <receiver>MainForm</receiver>
+ <slot>helpContents()</slot>
+ </connection>
+ <connection>
+ <sender>helpAboutAction</sender>
+ <signal>activated()</signal>
+ <receiver>MainForm</receiver>
+ <slot>helpAbout()</slot>
+ </connection>
+ <connection>
+ <sender>colorTable</sender>
+ <signal>currentChanged(int,int)</signal>
+ <receiver>MainForm</receiver>
+ <slot>changedTableColor(int,int)</slot>
+ </connection>
+ <connection>
+ <sender>colorIconView</sender>
+ <signal>currentChanged(QIconViewItem*)</signal>
+ <receiver>MainForm</receiver>
+ <slot>changedIconColor(QIconViewItem*)</slot>
+ </connection>
+ <connection>
+ <sender>viewActionGroup</sender>
+ <signal>selected(QAction*)</signal>
+ <receiver>MainForm</receiver>
+ <slot>changeView(QAction*)</slot>
+ </connection>
+ <connection>
+ <sender>editAddAction</sender>
+ <signal>activated()</signal>
+ <receiver>MainForm</receiver>
+ <slot>editAdd()</slot>
+ </connection>
+ <connection>
+ <sender>optionsAction</sender>
+ <signal>activated()</signal>
+ <receiver>MainForm</receiver>
+ <slot>editOptions()</slot>
+ </connection>
+ <connection>
+ <sender>colorWidgetStack</sender>
+ <signal>aboutToShow(int)</signal>
+ <receiver>MainForm</receiver>
+ <slot>aboutToShow()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in declaration">findform.h</include>
+ <include location="local" impldecl="in implementation">qsettings.h</include>
+ <include location="local" impldecl="in implementation">qradiobutton.h</include>
+ <include location="local" impldecl="in implementation">qcheckbox.h</include>
+ <include location="local" impldecl="in implementation">colornameform.h</include>
+ <include location="local" impldecl="in implementation">qcolordialog.h</include>
+ <include location="local" impldecl="in implementation">qregexp.h</include>
+ <include location="local" impldecl="in implementation">qfile.h</include>
+ <include location="local" impldecl="in implementation">qfiledialog.h</include>
+ <include location="local" impldecl="in implementation">qapplication.h</include>
+ <include location="local" impldecl="in implementation">qcolor.h</include>
+ <include location="local" impldecl="in implementation">qstring.h</include>
+ <include location="local" impldecl="in implementation">qpainter.h</include>
+ <include location="local" impldecl="in implementation">qstatusbar.h</include>
+ <include location="local" impldecl="in implementation">qmessagebox.h</include>
+ <include location="local" impldecl="in implementation">qclipboard.h</include>
+ <include location="local" impldecl="in implementation">qlabel.h</include>
+ <include location="local" impldecl="in implementation">qlineedit.h</include>
+ <include location="local" impldecl="in implementation">optionsform.h</include>
+ <include location="local" impldecl="in implementation">mainform.ui.h</include>
+</includes>
+<forwards>
+ <forward>class QString;</forward>
+ <forward>class QColor;</forward>
+</forwards>
+<variables>
+ <variable>QStringList m_comments;</variable>
+ <variable>QString m_filename;</variable>
+ <variable>bool m_changed;</variable>
+ <variable>bool m_table_dirty;</variable>
+ <variable>bool m_icons_dirty;</variable>
+ <variable>int m_clip_as;</variable>
+ <variable>bool m_show_web;</variable>
+ <variable>QClipboard *clipboard;</variable>
+ <variable>FindForm *findForm;</variable>
+ <variable>QMap&lt;QString,QColor&gt; m_colors;</variable>
+</variables>
+<slots>
+ <slot>fileNew()</slot>
+ <slot>fileOpen()</slot>
+ <slot>fileSave()</slot>
+ <slot>fileSaveAs()</slot>
+ <slot>closeEvent( QCloseEvent * )</slot>
+ <slot>fileExit()</slot>
+ <slot>editCut()</slot>
+ <slot>editCopy()</slot>
+ <slot>editFind()</slot>
+ <slot>lookfor( const QString &amp; text )</slot>
+ <slot>helpIndex()</slot>
+ <slot>helpContents()</slot>
+ <slot>helpAbout()</slot>
+ <slot>changedTableColor( int row, int )</slot>
+ <slot>changedIconColor( QIconViewItem * item )</slot>
+ <slot>changeView( QAction * action )</slot>
+ <slot>editAdd()</slot>
+ <slot>editOptions()</slot>
+ <slot>aboutToShow()</slot>
+</slots>
+<functions>
+ <function access="private">init()</function>
+ <function>clearData( bool fillWithDefaults )</function>
+ <function>populate()</function>
+ <function returnType="QPixmap">colorSwatch( const QColor color )</function>
+ <function>load( const QString &amp; filename )</function>
+ <function returnType="bool">okToClear()</function>
+ <function>changedColor( const QString &amp; name )</function>
+ <function returnType="bool">isWebColor( QColor color )</function>
+ <function>loadSettings()</function>
+ <function>saveSettings()</function>
+</functions>
+<pixmapinproject/>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/tools/designer/examples/colortool/mainform.ui.h b/tools/designer/examples/colortool/mainform.ui.h
new file mode 100644
index 0000000..1ed2622
--- /dev/null
+++ b/tools/designer/examples/colortool/mainform.ui.h
@@ -0,0 +1,585 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions use Qt Designer which will
+** update this file, preserving your code. Create an init() function in place
+** of a constructor, and a destroy() function in place of a destructor.
+*****************************************************************************/
+
+
+const int CLIP_AS_HEX = 0;
+const int CLIP_AS_NAME = 1;
+const int CLIP_AS_RGB = 2;
+const int COL_NAME = 0;
+const int COL_HEX = 1;
+const int COL_WEB = 2;
+const QString WINDOWS_REGISTRY = "/QtExamples";
+const QString APP_KEY = "/ColorTool/";
+
+void MainForm::init()
+{
+ clipboard = QApplication::clipboard();
+ if ( clipboard->supportsSelection() )
+ clipboard->setSelectionMode( TRUE );
+
+ findForm = 0;
+ loadSettings();
+ m_filename = "";
+ m_changed = FALSE;
+ m_table_dirty = TRUE;
+ m_icons_dirty = TRUE;
+ clearData( TRUE );
+}
+
+void MainForm::clearData( bool fillWithDefaults )
+{
+ setCaption( "Color Tool" );
+
+ m_colors.clear();
+ m_comments.clear();
+
+ if ( fillWithDefaults ) {
+ m_colors["black"] = Qt::black;
+ m_colors["blue"] = Qt::blue;
+ m_colors["cyan"] = Qt::cyan;
+ m_colors["darkblue"] = Qt::darkBlue;
+ m_colors["darkcyan"] = Qt::darkCyan;
+ m_colors["darkgray"] = Qt::darkGray;
+ m_colors["darkgreen"] = Qt::darkGreen;
+ m_colors["darkmagenta"] = Qt::darkMagenta;
+ m_colors["darkred"] = Qt::darkRed;
+ m_colors["darkyellow"] = Qt::darkYellow;
+ m_colors["gray"] = Qt::gray;
+ m_colors["green"] = Qt::green;
+ m_colors["lightgray"] = Qt::lightGray;
+ m_colors["magenta"] = Qt::magenta;
+ m_colors["red"] = Qt::red;
+ m_colors["white"] = Qt::white;
+ m_colors["yellow"] = Qt::yellow;
+ }
+
+ populate();
+}
+
+void MainForm::populate()
+{
+ if ( m_table_dirty ) {
+ for ( int r = 0; r < colorTable->numRows(); ++r ) {
+ for ( int c = 0; c < colorTable->numCols(); ++c ) {
+ colorTable->clearCell( r, c );
+ }
+ }
+
+ colorTable->setNumRows( m_colors.count() );
+ if ( ! m_colors.isEmpty() ) {
+ QPixmap pixmap( 22, 22 );
+ int row = 0;
+ QMap<QString,QColor>::ConstIterator it;
+ for ( it = m_colors.constBegin(); it != m_colors.constEnd(); ++it ) {
+ QColor color = it.data();
+ pixmap.fill( color );
+ colorTable->setText( row, COL_NAME, it.key() );
+ colorTable->setPixmap( row, COL_NAME, pixmap );
+ colorTable->setText( row, COL_HEX, color.name().upper() );
+ if ( m_show_web ) {
+ QCheckTableItem *item = new QCheckTableItem( colorTable, "" );
+ item->setChecked( isWebColor( color ) );
+ colorTable->setItem( row, COL_WEB, item );
+ }
+ row++;
+ }
+ colorTable->setCurrentCell( 0, 0 );
+ }
+ colorTable->adjustColumn( COL_NAME );
+ colorTable->adjustColumn( COL_HEX );
+ if ( m_show_web ) {
+ colorTable->showColumn( COL_WEB );
+ colorTable->adjustColumn( COL_WEB );
+ }
+ else
+ colorTable->hideColumn( COL_WEB );
+ m_table_dirty = FALSE;
+ }
+
+ if ( m_icons_dirty ) {
+ colorIconView->clear();
+
+ QMap<QString,QColor>::ConstIterator it;
+ for ( it = m_colors.constBegin(); it != m_colors.constEnd(); ++it )
+ (void) new QIconViewItem( colorIconView, it.key(),
+ colorSwatch( it.data() ) );
+ m_icons_dirty = FALSE;
+ }
+}
+
+QPixmap MainForm::colorSwatch( const QColor color )
+{
+ QPixmap pixmap( 80, 80 );
+ pixmap.fill( white );
+ QPainter painter;
+ painter.begin( &pixmap );
+ painter.setPen( NoPen );
+ painter.setBrush( color );
+ painter.drawEllipse( 0, 0, 80, 80 );
+ painter.end();
+ return pixmap;
+}
+
+void MainForm::fileNew()
+{
+ if ( okToClear() ) {
+ m_filename = "";
+ m_changed = FALSE;
+ m_table_dirty = TRUE;
+ m_icons_dirty = TRUE;
+ clearData( FALSE );
+ }
+}
+
+void MainForm::fileOpen()
+{
+ if ( ! okToClear() )
+ return;
+
+ QString filename = QFileDialog::getOpenFileName(
+ QString::null, "Colors (*.txt)", this,
+ "file open", "Color Tool -- File Open" );
+ if ( ! filename.isEmpty() )
+ load( filename );
+ else
+ statusBar()->message( "File Open abandoned", 2000 );
+}
+
+void MainForm::fileSave()
+{
+ if ( m_filename.isEmpty() ) {
+ fileSaveAs();
+ return;
+ }
+
+ QFile file( m_filename );
+ if ( file.open( IO_WriteOnly ) ) {
+ QTextStream stream( &file );
+ if ( ! m_comments.isEmpty() )
+ stream << m_comments.join( "\n" ) << "\n";
+ QMap<QString,QColor>::ConstIterator it;
+ for ( it = m_colors.constBegin(); it != m_colors.constEnd(); ++it ) {
+ QColor color = it.data();
+ stream << QString( "%1 %2 %3\t\t%4" ).
+ arg( color.red(), 3 ).
+ arg( color.green(), 3 ).
+ arg( color.blue(), 3 ).
+ arg( it.key() ) << "\n";
+ }
+ file.close();
+ setCaption( QString( "Color Tool -- %1" ).arg( m_filename ) );
+ statusBar()->message( QString( "Saved %1 colors to '%2'" ).
+ arg( m_colors.count() ).
+ arg( m_filename ), 3000 );
+ m_changed = FALSE;
+ }
+ else
+ statusBar()->message( QString( "Failed to save '%1'" ).
+ arg( m_filename ), 3000 );
+
+}
+
+void MainForm::fileSaveAs()
+{
+ QString filename = QFileDialog::getSaveFileName(
+ QString::null, "Colors (*.txt)", this,
+ "file save as", "Color Tool -- File Save As" );
+ if ( ! filename.isEmpty() ) {
+ int ans = 0;
+ if ( QFile::exists( filename ) )
+ ans = QMessageBox::warning(
+ this, "Color Tool -- Overwrite File",
+ QString( "Overwrite\n'%1'?" ).
+ arg( filename ),
+ "&Yes", "&No", QString::null, 1, 1 );
+ if ( ans == 0 ) {
+ m_filename = filename;
+ fileSave();
+ return;
+ }
+ }
+ statusBar()->message( "Saving abandoned", 2000 );
+}
+
+void MainForm::load( const QString& filename )
+{
+ clearData( FALSE );
+ m_filename = filename;
+ QRegExp regex( "^\\s*(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\S+.*)$" );
+ QFile file( filename );
+ if ( file.open( IO_ReadOnly ) ) {
+ statusBar()->message( QString( "Loading '%1'..." ).
+ arg( filename ) );
+ QTextStream stream( &file );
+ QString line;
+ while ( ! stream.eof() ) {
+ line = stream.readLine();
+ if ( regex.search( line ) == -1 )
+ m_comments += line;
+ else
+ m_colors[regex.cap( 4 )] = QColor(
+ regex.cap( 1 ).toInt(),
+ regex.cap( 2 ).toInt(),
+ regex.cap( 3 ).toInt() );
+ }
+ file.close();
+ m_filename = filename;
+ setCaption( QString( "Color Tool -- %1" ).arg( m_filename ) );
+ statusBar()->message( QString( "Loaded '%1'" ).
+ arg( m_filename ), 3000 );
+ QWidget *visible = colorWidgetStack->visibleWidget();
+ m_icons_dirty = ! ( m_table_dirty = ( visible == tablePage ) );
+ populate();
+ m_icons_dirty = ! ( m_table_dirty = ( visible != tablePage ) );
+ m_changed = FALSE;
+ }
+ else
+ statusBar()->message( QString( "Failed to load '%1'" ).
+ arg( m_filename ), 3000 );
+}
+
+
+bool MainForm::okToClear()
+{
+ if ( m_changed ) {
+ QString msg;
+ if ( m_filename.isEmpty() )
+ msg = "Unnamed colors ";
+ else
+ msg = QString( "Colors '%1'\n" ).arg( m_filename );
+ msg += QString( "has been changed." );
+ int ans = QMessageBox::information(
+ this,
+ "Color Tool -- Unsaved Changes",
+ msg, "&Save", "Cancel", "&Abandon",
+ 0, 1 );
+ if ( ans == 0 )
+ fileSave();
+ else if ( ans == 1 )
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+void MainForm::closeEvent( QCloseEvent * )
+{
+ fileExit();
+}
+
+void MainForm::fileExit()
+{
+ if ( okToClear() ) {
+ saveSettings();
+ QApplication::exit( 0 );
+ }
+}
+
+void MainForm::editCut()
+{
+ QString name;
+ QWidget *visible = colorWidgetStack->visibleWidget();
+ statusBar()->message( QString( "Deleting '%1'" ).arg( name ) );
+
+ if ( visible == tablePage && colorTable->numRows() ) {
+ int row = colorTable->currentRow();
+ name = colorTable->text( row, 0 );
+ colorTable->removeRow( colorTable->currentRow() );
+ if ( row < colorTable->numRows() )
+ colorTable->setCurrentCell( row, 0 );
+ else if ( colorTable->numRows() )
+ colorTable->setCurrentCell( colorTable->numRows() - 1, 0 );
+ m_icons_dirty = TRUE;
+ }
+ else if ( visible == iconsPage && colorIconView->currentItem() ) {
+ QIconViewItem *item = colorIconView->currentItem();
+ name = item->text();
+ if ( colorIconView->count() == 1 )
+ colorIconView->clear();
+ else {
+ QIconViewItem *current = item->nextItem();
+ if ( ! current )
+ current = item->prevItem();
+ delete item;
+ if ( current )
+ colorIconView->setCurrentItem( current );
+ colorIconView->arrangeItemsInGrid();
+ }
+ m_table_dirty = TRUE;
+ }
+
+ if ( ! name.isNull() ) {
+ m_colors.remove( name );
+ m_changed = TRUE;
+ statusBar()->message( QString( "Deleted '%1'" ).arg( name ), 5000 );
+ }
+ else
+ statusBar()->message( QString( "Failed to delete '%1'" ).arg( name ), 5000 );
+}
+
+void MainForm::editCopy()
+{
+ QString text;
+ QWidget *visible = colorWidgetStack->visibleWidget();
+
+ if ( visible == tablePage && colorTable->numRows() ) {
+ int row = colorTable->currentRow();
+ text = colorTable->text( row, 0 );
+ }
+ else if ( visible == iconsPage && colorIconView->currentItem() ) {
+ QIconViewItem *item = colorIconView->currentItem();
+ text = item->text();
+ }
+ if ( ! text.isNull() ) {
+ QColor color = m_colors[text];
+ switch ( m_clip_as ) {
+ case CLIP_AS_HEX: text = color.name(); break;
+ case CLIP_AS_NAME: break;
+ case CLIP_AS_RGB:
+ text = QString( "%1,%2,%3" ).
+ arg( color.red() ).
+ arg( color.green() ).
+ arg( color.blue() );
+ break;
+ }
+ clipboard->setText( text );
+ statusBar()->message( "Copied '" + text + "' to the clipboard" );
+ }
+}
+
+void MainForm::editFind()
+{
+ if ( ! findForm ) {
+ findForm = new FindForm( this );
+ connect( findForm, SIGNAL( lookfor(const QString&) ),
+ this, SLOT( lookfor(const QString&) ) );
+ }
+ findForm->show();
+}
+
+void MainForm::lookfor( const QString& text )
+{
+ if ( text.isEmpty() )
+ return;
+ QString ltext = text.lower();
+ QWidget *visible = colorWidgetStack->visibleWidget();
+ bool found = FALSE;
+
+ if ( visible == tablePage && colorTable->numRows() ) {
+ int row = colorTable->currentRow();
+ for ( int i = row + 1; i < colorTable->numRows(); ++i )
+ if ( colorTable->text( i, 0 ).lower().contains( ltext ) ) {
+ colorTable->setCurrentCell( i, 0 );
+ colorTable->clearSelection();
+ colorTable->selectRow( i );
+ found = TRUE;
+ break;
+ }
+ if ( ! found )
+ colorTable->setCurrentCell( row, 0 );
+
+ }
+ else if ( visible == iconsPage ) {
+ QIconViewItem *start = colorIconView->currentItem();
+ for ( QIconViewItem *item = start->nextItem(); item; item = item->nextItem() )
+ if ( item->text().lower().contains( ltext ) ) {
+ colorIconView->setCurrentItem( item );
+ colorIconView->ensureItemVisible( item );
+ found = TRUE;
+ break;
+ }
+ if ( ! found && start )
+ colorIconView->setCurrentItem( start );
+ }
+ if ( ! found ) {
+ statusBar()->message( QString( "Could not find '%1' after here" ).
+ arg( text ) );
+ findForm->notfound();
+ }
+}
+
+
+
+void MainForm::helpIndex()
+{
+
+}
+
+void MainForm::helpContents()
+{
+
+}
+
+void MainForm::helpAbout()
+{
+
+}
+
+
+void MainForm::changedTableColor( int row, int )
+{
+ changedColor( colorTable->text( row, COL_NAME ) );
+}
+
+void MainForm::changedIconColor( QIconViewItem *item )
+{
+ changedColor( item->text() );
+}
+
+void MainForm::changedColor( const QString& name )
+{
+ QColor color = m_colors[name];
+ int r = color.red();
+ int g = color.green();
+ int b = color.blue();
+ statusBar()->message( QString( "%1 \"%2\" (%3,%4,%5)%6 {%7 %8 %9}" ).
+ arg( name ).
+ arg( color.name().upper() ).
+ arg( r ).arg( g ).arg( b ).
+ arg( isWebColor( color ) ? " web" : "" ).
+ arg( r / 255.0, 1, 'f', 3 ).
+ arg( g / 255.0, 1, 'f', 3 ).
+ arg( b / 255.0, 1, 'f', 3 )
+ );
+}
+
+
+void MainForm::changeView(QAction* action)
+{
+ if ( action == viewTableAction )
+ colorWidgetStack->raiseWidget( tablePage );
+ else
+ colorWidgetStack->raiseWidget( iconsPage );
+}
+
+bool MainForm::isWebColor( QColor color )
+{
+ int r = color.red();
+ int g = color.green();
+ int b = color.blue();
+
+ return ( ( r == 0 || r == 51 || r == 102 ||
+ r == 153 || r == 204 || r == 255 ) &&
+ ( g == 0 || g == 51 || g == 102 ||
+ g == 153 || g == 204 || g == 255 ) &&
+ ( b == 0 || b == 51 || b == 102 ||
+ b == 153 || b == 204 || b == 255 ) );
+}
+
+
+void MainForm::editAdd()
+{
+ QColor color = white;
+ if ( ! m_colors.isEmpty() ) {
+ QWidget *visible = colorWidgetStack->visibleWidget();
+ if ( visible == tablePage )
+ color = colorTable->text( colorTable->currentRow(),
+ colorTable->currentColumn() );
+ else
+ color = colorIconView->currentItem()->text();
+ }
+ color = QColorDialog::getColor( color, this );
+ if ( color.isValid() ) {
+ QPixmap pixmap( 80, 10 );
+ pixmap.fill( color );
+ ColorNameForm *colorForm = new ColorNameForm( this, "color", TRUE );
+ colorForm->setColors( m_colors );
+ colorForm->colorLabel->setPixmap( pixmap );
+ if ( colorForm->exec() ) {
+ QString name = colorForm->colorLineEdit->text();
+ m_colors[name] = color;
+ QPixmap pixmap( 22, 22 );
+ pixmap.fill( color );
+ int row = colorTable->currentRow();
+ colorTable->insertRows( row, 1 );
+ colorTable->setText( row, COL_NAME, name );
+ colorTable->setPixmap( row, COL_NAME, pixmap );
+ colorTable->setText( row, COL_HEX, color.name().upper() );
+ if ( m_show_web ) {
+ QCheckTableItem *item = new QCheckTableItem( colorTable, "" );
+ item->setChecked( isWebColor( color ) );
+ colorTable->setItem( row, COL_WEB, item );
+ }
+ colorTable->setCurrentCell( row, 0 );
+
+ (void) new QIconViewItem( colorIconView, name,
+ colorSwatch( color ) );
+ m_changed = TRUE;
+ }
+ }
+}
+
+void MainForm::editOptions()
+{
+ OptionsForm *options = new OptionsForm( this, "options", TRUE );
+ switch ( m_clip_as ) {
+ case CLIP_AS_HEX:
+ options->hexRadioButton->setChecked( TRUE );
+ break;
+ case CLIP_AS_NAME:
+ options->nameRadioButton->setChecked( TRUE );
+ break;
+ case CLIP_AS_RGB:
+ options->rgbRadioButton->setChecked( TRUE );
+ break;
+ }
+ options->webCheckBox->setChecked( m_show_web );
+
+ if ( options->exec() ) {
+ if ( options->hexRadioButton->isChecked() )
+ m_clip_as = CLIP_AS_HEX;
+ else if ( options->nameRadioButton->isChecked() )
+ m_clip_as = CLIP_AS_NAME;
+ else if ( options->rgbRadioButton->isChecked() )
+ m_clip_as = CLIP_AS_RGB;
+ m_table_dirty = m_show_web !=
+ options->webCheckBox->isChecked();
+ m_show_web = options->webCheckBox->isChecked();
+
+ populate();
+ }
+}
+
+void MainForm::loadSettings()
+{
+ QSettings settings;
+ settings.insertSearchPath( QSettings::Windows, WINDOWS_REGISTRY );
+ int windowWidth = settings.readNumEntry( APP_KEY + "WindowWidth", 550 );
+ int windowHeight = settings.readNumEntry( APP_KEY + "WindowHeight", 500 );
+ int windowX = settings.readNumEntry( APP_KEY + "WindowX", 0 );
+ int windowY = settings.readNumEntry( APP_KEY + "WindowY", 0 );
+ m_clip_as = settings.readNumEntry( APP_KEY + "ClipAs", CLIP_AS_HEX );
+ m_show_web = settings.readBoolEntry( APP_KEY + "ShowWeb", TRUE );
+ if ( ! settings.readBoolEntry( APP_KEY + "View", TRUE ) ) {
+ colorWidgetStack->raiseWidget( iconsPage );
+ viewIconsAction->setOn( TRUE );
+ }
+
+ resize( windowWidth, windowHeight );
+ move( windowX, windowY );
+}
+
+void MainForm::saveSettings()
+{
+ QSettings settings;
+ settings.insertSearchPath( QSettings::Windows, WINDOWS_REGISTRY );
+ settings.writeEntry( APP_KEY + "WindowWidth", width() );
+ settings.writeEntry( APP_KEY + "WindowHeight", height() );
+ settings.writeEntry( APP_KEY + "WindowX", x() );
+ settings.writeEntry( APP_KEY + "WindowY", y() );
+ settings.writeEntry( APP_KEY + "ClipAs", m_clip_as );
+ settings.writeEntry( APP_KEY + "ShowWeb", m_show_web );
+ settings.writeEntry( APP_KEY + "View",
+ colorWidgetStack->visibleWidget() == tablePage );
+}
+
+
+void MainForm::aboutToShow()
+{
+ populate();
+}
diff --git a/tools/designer/examples/colortool/optionsform.ui b/tools/designer/examples/colortool/optionsform.ui
new file mode 100644
index 0000000..96d74dc
--- /dev/null
+++ b/tools/designer/examples/colortool/optionsform.ui
@@ -0,0 +1,153 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>OptionsForm</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>OptionsForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>306</width>
+ <height>226</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Color Tool -- Options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Table View</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>webCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>Indicate &amp;Web Colors</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>ButtonGroup1</cstring>
+ </property>
+ <property name="title">
+ <string>Copy to Clipboard As</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>hexRadioButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Hex, e.g. #AB347F</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>nameRadioButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Name, e.g. light blue</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>rgbRadioButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;RGB, e.g. 51,255,102</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>10</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>okPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>okPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>OptionsForm</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>cancelPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>OptionsForm</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in implementation">optionsform.ui.h</include>
+</includes>
+<pixmapinproject/>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/tools/designer/examples/colortool/optionsform.ui.h b/tools/designer/examples/colortool/optionsform.ui.h
new file mode 100644
index 0000000..f17a035
--- /dev/null
+++ b/tools/designer/examples/colortool/optionsform.ui.h
@@ -0,0 +1,7 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions use Qt Designer which will
+** update this file, preserving your code. Create an init() function in place
+** of a constructor, and a destroy() function in place of a destructor.
+*****************************************************************************/
diff --git a/tools/designer/examples/credit/credit.pro b/tools/designer/examples/credit/credit.pro
new file mode 100644
index 0000000..4dc246d
--- /dev/null
+++ b/tools/designer/examples/credit/credit.pro
@@ -0,0 +1,11 @@
+TEMPLATE = app
+LANGUAGE = C++
+TARGET = credit
+
+SOURCES += main.cpp
+HEADERS += creditform.h
+SOURCES += creditform.cpp
+FORMS = creditformbase.ui
+CONFIG += qt warn_on release
+DBFILE = credit.db
+IMAGEFILE = images.cpp
diff --git a/tools/designer/examples/credit/creditform.cpp b/tools/designer/examples/credit/creditform.cpp
new file mode 100644
index 0000000..e49fafb
--- /dev/null
+++ b/tools/designer/examples/credit/creditform.cpp
@@ -0,0 +1,20 @@
+#include <qradiobutton.h>
+#include <qspinbox.h>
+#include "creditform.h"
+
+CreditForm::CreditForm( QWidget* parent, const char* name,
+ bool modal, WFlags fl )
+ : CreditFormBase( parent, name, modal, fl )
+{
+ setAmount();
+}
+
+CreditForm::~CreditForm() { /* NOOP */ }
+
+void CreditForm::setAmount()
+{
+ if ( stdRadioButton->isChecked() )
+ amountSpinBox->setValue( amountSpinBox->maxValue() / 2 );
+ else if ( noneRadioButton->isChecked() )
+ amountSpinBox->setValue( amountSpinBox->minValue() );
+}
diff --git a/tools/designer/examples/credit/creditform.h b/tools/designer/examples/credit/creditform.h
new file mode 100644
index 0000000..ffcec14
--- /dev/null
+++ b/tools/designer/examples/credit/creditform.h
@@ -0,0 +1,12 @@
+#include "creditformbase.h"
+
+class CreditForm : public CreditFormBase
+{
+ Q_OBJECT
+public:
+ CreditForm( QWidget* parent = 0, const char* name = 0,
+ bool modal = FALSE, WFlags fl = 0 );
+ ~CreditForm();
+public slots:
+ void setAmount();
+};
diff --git a/tools/designer/examples/credit/creditformbase.cpp b/tools/designer/examples/credit/creditformbase.cpp
new file mode 100644
index 0000000..46d5adc
--- /dev/null
+++ b/tools/designer/examples/credit/creditformbase.cpp
@@ -0,0 +1,122 @@
+/****************************************************************************
+** Form implementation generated from reading ui file 'creditformbase.ui'
+**
+** Created: Fri Aug 10 09:48:16 2001
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#include "creditformbase.h"
+
+#include <qvariant.h> // first for gcc 2.7.2
+#include <qbuttongroup.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qspinbox.h>
+#include <qmime.h>
+#include <qdragobject.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include "creditformbase.ui.h"
+#include <qimage.h>
+#include <qpixmap.h>
+
+static QPixmap uic_load_pixmap_CreditFormBase( const QString &name )
+{
+ const QMimeSource *m = QMimeSourceFactory::defaultFactory()->data( name );
+ if ( !m )
+ return QPixmap();
+ QPixmap pix;
+ QImageDrag::decode( m, pix );
+ return pix;
+}
+/*
+ * Constructs a CreditFormBase which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ *
+ * The dialog will by default be modeless, unless you set 'modal' to
+ * TRUE to construct a modal dialog.
+ */
+CreditFormBase::CreditFormBase( QWidget* parent, const char* name, bool modal, WFlags fl )
+ : QDialog( parent, name, modal, fl )
+{
+ if ( !name )
+ setName( "CreditFormBase" );
+ resize( 276, 224 );
+ setCaption( trUtf8( "Credit Rating", "" ) );
+ CreditFormBaseLayout = new QVBoxLayout( this );
+ CreditFormBaseLayout->setSpacing( 6 );
+ CreditFormBaseLayout->setMargin( 11 );
+
+ creditButtonGroup = new QButtonGroup( this, "creditButtonGroup" );
+ creditButtonGroup->setTitle( trUtf8( "Credit Rating", "" ) );
+ creditButtonGroup->setColumnLayout(0, Qt::Vertical );
+ creditButtonGroup->layout()->setSpacing( 0 );
+ creditButtonGroup->layout()->setMargin( 0 );
+ creditButtonGroupLayout = new QVBoxLayout( creditButtonGroup->layout() );
+ creditButtonGroupLayout->setAlignment( Qt::AlignTop );
+ creditButtonGroupLayout->setSpacing( 6 );
+ creditButtonGroupLayout->setMargin( 11 );
+
+ stdRadioButton = new QRadioButton( creditButtonGroup, "stdRadioButton" );
+ stdRadioButton->setText( trUtf8( "&Standard", "" ) );
+ stdRadioButton->setChecked( TRUE );
+ creditButtonGroupLayout->addWidget( stdRadioButton );
+
+ noneRadioButton = new QRadioButton( creditButtonGroup, "noneRadioButton" );
+ noneRadioButton->setText( trUtf8( "&None", "" ) );
+ creditButtonGroupLayout->addWidget( noneRadioButton );
+
+ specialRadioButton = new QRadioButton( creditButtonGroup, "specialRadioButton" );
+ specialRadioButton->setText( trUtf8( "Sp&ecial", "" ) );
+ creditButtonGroupLayout->addWidget( specialRadioButton );
+ CreditFormBaseLayout->addWidget( creditButtonGroup );
+
+ amountSpinBox = new QSpinBox( this, "amountSpinBox" );
+ amountSpinBox->setEnabled( FALSE );
+ amountSpinBox->setPrefix( trUtf8( "$ ", "" ) );
+ amountSpinBox->setButtonSymbols( QSpinBox::UpDownArrows );
+ amountSpinBox->setMaxValue( 100000 );
+ amountSpinBox->setLineStep( 10000 );
+ CreditFormBaseLayout->addWidget( amountSpinBox );
+
+ Layout4 = new QHBoxLayout;
+ Layout4->setSpacing( 6 );
+ Layout4->setMargin( 0 );
+ QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ Layout4->addItem( spacer );
+
+ okPushButton = new QPushButton( this, "okPushButton" );
+ okPushButton->setText( trUtf8( "OK", "" ) );
+ okPushButton->setDefault( TRUE );
+ Layout4->addWidget( okPushButton );
+ QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ Layout4->addItem( spacer_2 );
+
+ cancelPushButton = new QPushButton( this, "cancelPushButton" );
+ cancelPushButton->setText( trUtf8( "Cancel", "" ) );
+ Layout4->addWidget( cancelPushButton );
+ QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ Layout4->addItem( spacer_3 );
+ CreditFormBaseLayout->addLayout( Layout4 );
+
+
+
+
+
+ // signals and slots connections
+ connect( okPushButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( cancelPushButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ connect( creditButtonGroup, SIGNAL( clicked(int) ), this, SLOT( setAmount() ) );
+ connect( specialRadioButton, SIGNAL( toggled(bool) ), amountSpinBox, SLOT( setEnabled(bool) ) );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+CreditFormBase::~CreditFormBase()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
diff --git a/tools/designer/examples/credit/creditformbase.h b/tools/designer/examples/credit/creditformbase.h
new file mode 100644
index 0000000..6d5e934
--- /dev/null
+++ b/tools/designer/examples/credit/creditformbase.h
@@ -0,0 +1,48 @@
+/****************************************************************************
+** Form interface generated from reading ui file 'creditformbase.ui'
+**
+** Created: Fri Aug 10 09:48:10 2001
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#ifndef CREDITFORMBASE_H
+#define CREDITFORMBASE_H
+
+#include <qvariant.h>
+#include <qdialog.h>
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QButtonGroup;
+class QPushButton;
+class QRadioButton;
+class QSpinBox;
+
+class CreditFormBase : public QDialog
+{
+ Q_OBJECT
+
+public:
+ CreditFormBase( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~CreditFormBase();
+
+ QButtonGroup* creditButtonGroup;
+ QRadioButton* stdRadioButton;
+ QRadioButton* noneRadioButton;
+ QRadioButton* specialRadioButton;
+ QSpinBox* amountSpinBox;
+ QPushButton* okPushButton;
+ QPushButton* cancelPushButton;
+
+
+public slots:
+ virtual void setAmount();
+
+protected:
+ QVBoxLayout* CreditFormBaseLayout;
+ QVBoxLayout* creditButtonGroupLayout;
+ QHBoxLayout* Layout4;
+};
+
+#endif // CREDITFORMBASE_H
diff --git a/tools/designer/examples/credit/creditformbase.ui b/tools/designer/examples/credit/creditformbase.ui
new file mode 100644
index 0000000..4421885
--- /dev/null
+++ b/tools/designer/examples/credit/creditformbase.ui
@@ -0,0 +1,212 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>CreditFormBase</class>
+<include location="local" implDecl="in declaration">creditformbase.ui.h</include>
+<pixmapinproject/>
+<layoutdefaults spacing="6" margin="11"/>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>CreditFormBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>276</width>
+ <height>224</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Credit Rating</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>creditButtonGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Credit Rating</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>stdRadioButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Standard</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>noneRadioButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;None</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>specialRadioButton</cstring>
+ </property>
+ <property name="text">
+ <string>Sp&amp;ecial</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>amountSpinBox</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="prefix">
+ <string>$ </string>
+ </property>
+ <property name="buttonSymbols">
+ <enum>UpDownArrows</enum>
+ </property>
+ <property name="maxValue">
+ <number>100000</number>
+ </property>
+ <property name="lineStep">
+ <number>10000</number>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>okPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1_3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection language="C++">
+ <sender>okPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>CreditFormBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>cancelPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>CreditFormBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>creditButtonGroup</sender>
+ <signal>clicked(int)</signal>
+ <receiver>CreditFormBase</receiver>
+ <slot>setAmount()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>specialRadioButton</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>amountSpinBox</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">setAmount()</slot>
+</connections>
+</UI>
diff --git a/tools/designer/examples/credit/creditformbase.ui.h b/tools/designer/examples/credit/creditformbase.ui.h
new file mode 100644
index 0000000..6cf4faa
--- /dev/null
+++ b/tools/designer/examples/credit/creditformbase.ui.h
@@ -0,0 +1,5 @@
+void CreditFormBase::setAmount()
+{
+
+}
+
diff --git a/tools/designer/examples/credit/main.cpp b/tools/designer/examples/credit/main.cpp
new file mode 100644
index 0000000..dde1daa
--- /dev/null
+++ b/tools/designer/examples/credit/main.cpp
@@ -0,0 +1,25 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#include <qapplication.h>
+#include "creditform.h"
+
+
+int main( int argc, char *argv[] )
+{
+ QApplication app( argc, argv );
+
+ CreditForm creditForm;
+ app.setMainWidget( &creditForm );
+ creditForm.show();
+
+ return app.exec();
+}
+
+
diff --git a/tools/designer/examples/filechooser/plugin/plugin.cpp b/tools/designer/examples/filechooser/plugin/plugin.cpp
new file mode 100644
index 0000000..9408cac
--- /dev/null
+++ b/tools/designer/examples/filechooser/plugin/plugin.cpp
@@ -0,0 +1,95 @@
+#include "plugin.h"
+#include "../widget/filechooser.h"
+
+static const char *filechooser_pixmap[] = {
+ "22 22 8 1",
+ " c Gray100",
+ ". c Gray97",
+ "X c #4f504f",
+ "o c #00007f",
+ "O c Gray0",
+ "+ c none",
+ "@ c Gray0",
+ "# c Gray0",
+ "++++++++++++++++++++++",
+ "++++++++++++++++++++++",
+ "++++++++++++++++++++++",
+ "++++++++++++++++++++++",
+ "+OOOOOOOOOOOOOOOOOOOO+",
+ "OOXXXXXXXXXXXXXXXXXXOO",
+ "OXX. OO OO O",
+ "OX. oo O O",
+ "OX. oo O .O",
+ "OX ooo oooo O O",
+ "OX oo oo oo O O",
+ "OX oooo oo oo O O",
+ "OX oo oo oo oo O O",
+ "OX oo oo oo oo O O",
+ "OX oooo oooo O O",
+ "OX OO OO O",
+ "OO..................OO",
+ "+OOOOOOOOOOOOOOOOOOOO+",
+ "++++++++++++++++++++++",
+ "++++++++++++++++++++++",
+ "++++++++++++++++++++++",
+ "++++++++++++++++++++++"
+};
+
+CustomWidgetPlugin::CustomWidgetPlugin()
+{
+}
+
+QStringList CustomWidgetPlugin::keys() const
+{
+ QStringList list;
+ list << "FileChooser";
+ return list;
+}
+
+QWidget* CustomWidgetPlugin::create( const QString &key, QWidget* parent, const char* name )
+{
+ if ( key == "FileChooser" )
+ return new FileChooser( parent, name );
+ return 0;
+}
+
+QString CustomWidgetPlugin::group( const QString& feature ) const
+{
+ if ( feature == "FileChooser" )
+ return "Input";
+ return QString::null;
+}
+
+QIconSet CustomWidgetPlugin::iconSet( const QString& ) const
+{
+ return QIconSet( QPixmap( filechooser_pixmap ) );
+}
+
+QString CustomWidgetPlugin::includeFile( const QString& feature ) const
+{
+ if ( feature == "FileChooser" )
+ return "filechooser.h";
+ return QString::null;
+}
+
+QString CustomWidgetPlugin::toolTip( const QString& feature ) const
+{
+ if ( feature == "FileChooser" )
+ return "File Chooser Widget";
+ return QString::null;
+}
+
+QString CustomWidgetPlugin::whatsThis( const QString& feature ) const
+{
+ if ( feature == "FileChooser" )
+ return "A widget to choose a file or directory";
+ return QString::null;
+}
+
+bool CustomWidgetPlugin::isContainer( const QString& ) const
+{
+ return FALSE;
+}
+
+
+Q_EXPORT_PLUGIN( CustomWidgetPlugin )
diff --git a/tools/designer/examples/filechooser/plugin/plugin.h b/tools/designer/examples/filechooser/plugin/plugin.h
new file mode 100644
index 0000000..a465c29
--- /dev/null
+++ b/tools/designer/examples/filechooser/plugin/plugin.h
@@ -0,0 +1,16 @@
+#include <qwidgetplugin.h>
+
+class CustomWidgetPlugin : public QWidgetPlugin
+{
+public:
+ CustomWidgetPlugin();
+
+ QStringList keys() const;
+ QWidget* create( const QString &classname, QWidget* parent = 0, const char* name = 0 );
+ QString group( const QString& ) const;
+ QIconSet iconSet( const QString& ) const;
+ QString includeFile( const QString& ) const;
+ QString toolTip( const QString& ) const;
+ QString whatsThis( const QString& ) const;
+ bool isContainer( const QString& ) const;
+};
diff --git a/tools/designer/examples/filechooser/plugin/plugin.pro b/tools/designer/examples/filechooser/plugin/plugin.pro
new file mode 100644
index 0000000..012f185
--- /dev/null
+++ b/tools/designer/examples/filechooser/plugin/plugin.pro
@@ -0,0 +1,14 @@
+TEMPLATE = lib
+LANGUAGE = C++
+TARGET = filechooser
+
+SOURCES += plugin.cpp ../widget/filechooser.cpp
+HEADERS += plugin.h ../widget/filechooser.h
+DESTDIR = ../../../../../plugins/designer
+
+target.path=$$plugins.path
+
+INSTALLS += target
+CONFIG += qt warn_on release plugin
+INCLUDEPATH += $$QT_SOURCE_TREE/tools/designer/interfaces
+DBFILE = plugin.db
diff --git a/tools/designer/examples/filechooser/widget/filechooser.cpp b/tools/designer/examples/filechooser/widget/filechooser.cpp
new file mode 100644
index 0000000..4575bd4
--- /dev/null
+++ b/tools/designer/examples/filechooser/widget/filechooser.cpp
@@ -0,0 +1,62 @@
+#include "filechooser.h"
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qfiledialog.h>
+#include <qlayout.h>
+
+FileChooser::FileChooser( QWidget *parent, const char *name )
+ : QWidget( parent, name ), md( File )
+{
+ QHBoxLayout *layout = new QHBoxLayout( this );
+ layout->setMargin( 0 );
+
+ lineEdit = new QLineEdit( this, "filechooser_lineedit" );
+ layout->addWidget( lineEdit );
+
+ connect( lineEdit, SIGNAL( textChanged( const QString & ) ),
+ this, SIGNAL( fileNameChanged( const QString & ) ) );
+
+ button = new QPushButton( "...", this, "filechooser_button" );
+ button->setFixedWidth( button->fontMetrics().width( " ... " ) );
+ layout->addWidget( button );
+
+ connect( button, SIGNAL( clicked() ),
+ this, SLOT( chooseFile() ) );
+
+ setFocusProxy( lineEdit );
+}
+
+void FileChooser::setMode( Mode m )
+{
+ md = m;
+}
+
+FileChooser::Mode FileChooser::mode() const
+{
+ return md;
+}
+
+void FileChooser::setFileName( const QString &fn )
+{
+ lineEdit->setText( fn );
+}
+
+QString FileChooser::fileName() const
+{
+ return lineEdit->text();
+}
+
+void FileChooser::chooseFile()
+{
+ QString fn;
+ if ( mode() == File )
+ fn = QFileDialog::getOpenFileName( lineEdit->text(), QString::null, this );
+ else
+ fn = QFileDialog::getExistingDirectory( lineEdit->text(),this );
+
+ if ( !fn.isEmpty() ) {
+ lineEdit->setText( fn );
+ emit fileNameChanged( fn );
+ }
+}
+
diff --git a/tools/designer/examples/filechooser/widget/filechooser.h b/tools/designer/examples/filechooser/widget/filechooser.h
new file mode 100644
index 0000000..23272c0
--- /dev/null
+++ b/tools/designer/examples/filechooser/widget/filechooser.h
@@ -0,0 +1,48 @@
+#ifndef FILECHOOSER_H
+#define FILECHOOSER_H
+
+#include <qwidget.h>
+#include <qwidgetplugin.h>
+
+class QLineEdit;
+class QPushButton;
+
+#ifdef FILECHOOSER_IS_WIDGET
+#undef QT_WIDGET_PLUGIN_EXPORT
+#define QT_WIDGET_PLUGIN_EXPORT
+#endif
+
+class QT_WIDGET_PLUGIN_EXPORT FileChooser : public QWidget
+{
+ Q_OBJECT
+
+ Q_ENUMS( Mode )
+ Q_PROPERTY( Mode mode READ mode WRITE setMode )
+ Q_PROPERTY( QString fileName READ fileName WRITE setFileName )
+
+public:
+ FileChooser( QWidget *parent = 0, const char *name = 0);
+
+ enum Mode { File, Directory };
+
+ QString fileName() const;
+ Mode mode() const;
+
+public slots:
+ void setFileName( const QString &fn );
+ void setMode( Mode m );
+
+signals:
+ void fileNameChanged( const QString & );
+
+private slots:
+ void chooseFile();
+
+private:
+ QLineEdit *lineEdit;
+ QPushButton *button;
+ Mode md;
+
+};
+
+#endif
diff --git a/tools/designer/examples/filechooser/widget/filechooser.pro b/tools/designer/examples/filechooser/widget/filechooser.pro
new file mode 100644
index 0000000..20ea787
--- /dev/null
+++ b/tools/designer/examples/filechooser/widget/filechooser.pro
@@ -0,0 +1,9 @@
+TEMPLATE = app
+LANGUAGE = C++
+TARGET = filechooser
+
+SOURCES += filechooser.cpp main.cpp
+HEADERS += filechooser.h
+CONFIG += qt warn_on release
+DBFILE = filechooser.db
+DEFINES += FILECHOOSER_IS_WIDGET
diff --git a/tools/designer/examples/filechooser/widget/main.cpp b/tools/designer/examples/filechooser/widget/main.cpp
new file mode 100644
index 0000000..cc39053
--- /dev/null
+++ b/tools/designer/examples/filechooser/widget/main.cpp
@@ -0,0 +1,10 @@
+#include <qapplication.h>
+#include "filechooser.h"
+
+int main( int argc, char ** argv )
+{
+ QApplication a( argc, argv );
+ FileChooser *fc = new FileChooser;
+ fc->show();
+ return a.exec();
+}
diff --git a/tools/designer/examples/metric/main.cpp b/tools/designer/examples/metric/main.cpp
new file mode 100644
index 0000000..6490b58
--- /dev/null
+++ b/tools/designer/examples/metric/main.cpp
@@ -0,0 +1,12 @@
+#include <qapplication.h>
+#include "metric.h"
+
+int main( int argc, char ** argv )
+{
+ QApplication a( argc, argv );
+ ConversionForm *w = new ConversionForm;
+ w->show();
+ a.setMainWidget( w );
+ a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
+ return a.exec();
+}
diff --git a/tools/designer/examples/metric/metric.pro b/tools/designer/examples/metric/metric.pro
new file mode 100644
index 0000000..3dfc3fd
--- /dev/null
+++ b/tools/designer/examples/metric/metric.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+LANGUAGE = C++
+
+SOURCES += main.cpp
+unix {
+ UI_DIR = .ui
+ MOC_DIR = .moc
+ OBJECTS_DIR = .obj
+}
+FORMS = metric.ui
+CONFIG += qt warn_on release
+DBFILE = metric.db
diff --git a/tools/designer/examples/metric/metric.ui b/tools/designer/examples/metric/metric.ui
new file mode 100644
index 0000000..b0c9166
--- /dev/null
+++ b/tools/designer/examples/metric/metric.ui
@@ -0,0 +1,366 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>ConversionForm</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>ConversionForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>320</width>
+ <height>217</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Metric Conversion</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout4</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="4" column="1">
+ <property name="name">
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>decimalsSpinBox</cstring>
+ </property>
+ <property name="maxValue">
+ <number>6</number>
+ </property>
+ <property name="value">
+ <number>3</number>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <item>
+ <property name="text">
+ <string>Kilometers</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Meters</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Centimeters</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Millimeters</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>fromComboBox</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Result:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Convert &amp;From:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>fromComboBox</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Convert &amp;To:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>toComboBox</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Decimals:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>decimalsSpinBox</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Enter &amp;Number:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>numberLineEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="1">
+ <property name="name">
+ <cstring>resultLineEdit</cstring>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>0</blue>
+ </color>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="frameShape">
+ <enum>WinPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>numberLineEdit</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="alignment">
+ <set>AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="2" column="1">
+ <item>
+ <property name="text">
+ <string>Miles</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Yards</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Feet</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Inches</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>toComboBox</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>clearButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Clear</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>calculateButton</cstring>
+ </property>
+ <property name="text">
+ <string>Calculate</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer27</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>quitButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Quit</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>clearButton</sender>
+ <signal>clicked()</signal>
+ <receiver>numberLineEdit</receiver>
+ <slot>clear()</slot>
+ </connection>
+ <connection>
+ <sender>quitButton</sender>
+ <signal>clicked()</signal>
+ <receiver>ConversionForm</receiver>
+ <slot>close()</slot>
+ </connection>
+ <connection>
+ <sender>calculateButton</sender>
+ <signal>clicked()</signal>
+ <receiver>ConversionForm</receiver>
+ <slot>convert()</slot>
+ </connection>
+ <connection>
+ <sender>clearButton</sender>
+ <signal>clicked()</signal>
+ <receiver>resultLineEdit</receiver>
+ <slot>clear()</slot>
+ </connection>
+ <connection>
+ <sender>decimalsSpinBox</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>ConversionForm</receiver>
+ <slot>convert()</slot>
+ </connection>
+ <connection>
+ <sender>fromComboBox</sender>
+ <signal>activated(int)</signal>
+ <receiver>ConversionForm</receiver>
+ <slot>convert()</slot>
+ </connection>
+ <connection>
+ <sender>toComboBox</sender>
+ <signal>activated(int)</signal>
+ <receiver>ConversionForm</receiver>
+ <slot>convert()</slot>
+ </connection>
+ <connection>
+ <sender>clearButton</sender>
+ <signal>released()</signal>
+ <receiver>numberLineEdit</receiver>
+ <slot>setFocus()</slot>
+ </connection>
+ <connection>
+ <sender>calculateButton</sender>
+ <signal>clicked()</signal>
+ <receiver>numberLineEdit</receiver>
+ <slot>setFocus()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>numberLineEdit</tabstop>
+ <tabstop>fromComboBox</tabstop>
+ <tabstop>toComboBox</tabstop>
+ <tabstop>decimalsSpinBox</tabstop>
+ <tabstop>clearButton</tabstop>
+ <tabstop>calculateButton</tabstop>
+ <tabstop>quitButton</tabstop>
+</tabstops>
+<includes>
+ <include location="local" impldecl="in implementation">metric.ui.h</include>
+</includes>
+<slots>
+ <slot>convert()</slot>
+</slots>
+<functions>
+ <function access="private">init()</function>
+</functions>
+<pixmapinproject/>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/tools/designer/examples/metric/metric.ui.h b/tools/designer/examples/metric/metric.ui.h
new file mode 100644
index 0000000..ba66022
--- /dev/null
+++ b/tools/designer/examples/metric/metric.ui.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions respectively slots use
+** Qt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+
+#include <qvalidator.h>
+
+void ConversionForm::init()
+{
+ numberLineEdit->setValidator( new QDoubleValidator( numberLineEdit ) );
+ numberLineEdit->setText( "10" );
+ convert();
+ numberLineEdit->selectAll();
+}
+
+void ConversionForm::convert()
+{
+ enum MetricUnits {
+ Kilometers,
+ Meters,
+ Centimeters,
+ Millimeters
+ };
+ enum OldUnits {
+ Miles,
+ Yards,
+ Feet,
+ Inches
+ };
+
+ // Retrieve the input
+ double input = numberLineEdit->text().toDouble();
+ double scaledInput = input;
+
+ // internally convert the input to millimeters
+ switch ( fromComboBox->currentItem() ) {
+ case Kilometers:
+ scaledInput *= 1000000;
+ break;
+ case Meters:
+ scaledInput *= 1000;
+ break;
+ case Centimeters:
+ scaledInput *= 10;
+ break;
+ }
+
+ //convert to inches
+ double result = scaledInput * 0.0393701;
+
+ switch ( toComboBox->currentItem() ) {
+ case Miles:
+ result /= 63360;
+ break;
+ case Yards:
+ result /= 36;
+ break;
+ case Feet:
+ result /= 12;
+ break;
+ }
+
+ // set the result
+ int decimals = decimalsSpinBox->value();
+ resultLineEdit->setText( QString::number( result, 'f', decimals ) );
+ numberLineEdit->setText( QString::number( input, 'f', decimals ) );
+}
+
diff --git a/tools/designer/examples/multiclip/main.cpp b/tools/designer/examples/multiclip/main.cpp
new file mode 100644
index 0000000..7f3aeb1
--- /dev/null
+++ b/tools/designer/examples/multiclip/main.cpp
@@ -0,0 +1,25 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#include <qapplication.h>
+#include "multiclip.h"
+
+
+int main( int argc, char *argv[] )
+{
+ QApplication app( argc, argv );
+
+ MulticlipForm clippingForm;
+ app.setMainWidget( &clippingForm );
+ clippingForm.show();
+
+ return app.exec();
+}
+
+
diff --git a/tools/designer/examples/multiclip/multiclip.pro b/tools/designer/examples/multiclip/multiclip.pro
new file mode 100644
index 0000000..f9391cb
--- /dev/null
+++ b/tools/designer/examples/multiclip/multiclip.pro
@@ -0,0 +1,9 @@
+TEMPLATE = app
+LANGUAGE = C++
+TARGET = multiclip
+
+SOURCES += main.cpp
+FORMS = multiclip.ui
+CONFIG += qt warn_on release
+DBFILE = multiclip.db
+IMAGEFILE = images.cpp
diff --git a/tools/designer/examples/multiclip/multiclip.ui b/tools/designer/examples/multiclip/multiclip.ui
new file mode 100644
index 0000000..47bbd2f
--- /dev/null
+++ b/tools/designer/examples/multiclip/multiclip.ui
@@ -0,0 +1,206 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>MulticlipForm</class>
+<include location="global" impldecl="in declaration">qclipboard.h</include>
+<include location="global" impldecl="in implementation">qapplication.h</include>
+<include location="local" implDecl="in declaration">multiclip.ui.h</include>
+<variable>QClipboard *cb;</variable>
+<pixmapinproject/>
+<layoutdefaults spacing="6" margin="11"/>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MulticlipForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>585</width>
+ <height>472</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Multiclip</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Current Clipping</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>currentLineEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout19</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton" row="4" column="1">
+ <property name="name">
+ <cstring>addPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add Clipping</string>
+ </property>
+ </widget>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton" row="7" column="1">
+ <property name="name">
+ <cstring>quitPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Quit</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Length</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Previous Clippings</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="1">
+ <property name="name">
+ <cstring>autoCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>A&amp;uto Add Clippings</string>
+ </property>
+ </widget>
+ <widget class="QLCDNumber" row="1" column="1">
+ <property name="name">
+ <cstring>lengthLCDNumber</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="6" column="1">
+ <property name="name">
+ <cstring>deletePushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Delete Clipping</string>
+ </property>
+ </widget>
+ <widget class="QListBox" row="1" column="0" rowspan="7" colspan="1">
+ <property name="name">
+ <cstring>clippingsListBox</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="5" column="1">
+ <property name="name">
+ <cstring>copyPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Copy Previous</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection language="C++">
+ <sender>quitPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>MulticlipForm</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>addPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>MulticlipForm</receiver>
+ <slot>addClipping()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>copyPushButton</sender>
+ <signal>pressed()</signal>
+ <receiver>MulticlipForm</receiver>
+ <slot>copyPrevious()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>deletePushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>MulticlipForm</receiver>
+ <slot>deleteClipping()</slot>
+ </connection>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">addClipping()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">dataChanged()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">deleteClipping()</slot>
+ <slot access="protected" specifier="virtual" language="C++" returnType="void">init()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">selectionChanged()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">copyPrevious()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">clippingChanged( const QString &amp; clipping )</slot>
+</connections>
+<tabstops>
+ <tabstop>currentLineEdit</tabstop>
+ <tabstop>clippingsListBox</tabstop>
+ <tabstop>autoCheckBox</tabstop>
+ <tabstop>addPushButton</tabstop>
+ <tabstop>copyPushButton</tabstop>
+ <tabstop>deletePushButton</tabstop>
+ <tabstop>quitPushButton</tabstop>
+</tabstops>
+</UI>
diff --git a/tools/designer/examples/multiclip/multiclip.ui.h b/tools/designer/examples/multiclip/multiclip.ui.h
new file mode 100644
index 0000000..e4d7fc1
--- /dev/null
+++ b/tools/designer/examples/multiclip/multiclip.ui.h
@@ -0,0 +1,70 @@
+void MulticlipForm::addClipping()
+{
+ QString text = currentLineEdit->text();
+ if ( ! text.isEmpty() ) {
+ lengthLCDNumber->display( (int)text.length() );
+ int i = 0;
+ for ( ; i < (int)clippingsListBox->count(); i++ ) {
+ if ( clippingsListBox->text( i ) == text ) {
+ i = -1; // Do not add duplicates
+ break;
+ }
+ }
+ if ( i != -1 )
+ clippingsListBox->insertItem( text, 0 );
+ }
+}
+
+void MulticlipForm::dataChanged()
+{
+ QString text;
+ text = cb->text();
+ clippingChanged( text );
+ if ( autoCheckBox->isChecked() )
+ addClipping();
+}
+
+void MulticlipForm::deleteClipping()
+{
+ clippingChanged( "" );
+ clippingsListBox->removeItem( clippingsListBox->currentItem() );
+}
+
+void MulticlipForm::init()
+{
+ lengthLCDNumber->setBackgroundColor( darkBlue );
+ currentLineEdit->setFocus();
+
+ cb = qApp->clipboard();
+ connect( cb, SIGNAL( dataChanged() ), SLOT( dataChanged() ) );
+ if ( cb->supportsSelection() )
+ connect( cb, SIGNAL( selectionChanged() ), SLOT( selectionChanged() ) );
+
+ dataChanged();
+}
+
+void MulticlipForm::selectionChanged()
+{
+ cb->setSelectionMode( TRUE );
+ dataChanged();
+ cb->setSelectionMode( FALSE );
+}
+
+void MulticlipForm::copyPrevious()
+{
+ if ( clippingsListBox->currentItem() != -1 ) {
+ cb->setText( clippingsListBox->currentText() );
+ if ( cb->supportsSelection() ) {
+ cb->setSelectionMode( TRUE );
+ cb->setText( clippingsListBox->currentText() );
+ cb->setSelectionMode( FALSE );
+ }
+ }
+}
+
+void MulticlipForm::clippingChanged( const QString & clipping )
+{
+ currentLineEdit->setText( clipping );
+ lengthLCDNumber->display( (int)clipping.length() );
+}
+
diff --git a/tools/designer/examples/opengl/glwidget.cpp b/tools/designer/examples/opengl/glwidget.cpp
new file mode 100644
index 0000000..72692a3
--- /dev/null
+++ b/tools/designer/examples/opengl/glwidget.cpp
@@ -0,0 +1,170 @@
+/**********************************************************************
+**
+** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of Qt Designer.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free Qt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with
+** the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+#include "glwidget.h"
+
+/*!
+ Create a GLWidget widget
+*/
+
+GLWidget::GLWidget( QWidget* parent, const char* name )
+ : QGLWidget( parent, name )
+{
+ xrot = yrot = zrot = 25; // default object rotation
+ scale_ = 1.25; // default object scale
+ object = 0;
+}
+
+/*!
+ Release allocated resources
+*/
+
+GLWidget::~GLWidget()
+{
+ glDeleteLists( object, 1 );
+}
+
+
+/*!
+ Paint the box. The actual openGL commands for drawing the box are
+ performed here.
+*/
+
+void GLWidget::paintGL()
+{
+ glClear( GL_COLOR_BUFFER_BIT );
+
+ glLoadIdentity();
+ glTranslatef( 0.0, 0.0, -10.0 );
+ glScalef( scale_, scale_, scale_ );
+
+ glRotatef( xrot, 1.0, 0.0, 0.0 );
+ glRotatef( yrot, 0.0, 1.0, 0.0 );
+ glRotatef( zrot, 0.0, 0.0, 1.0 );
+
+ glCallList( object );
+}
+
+/*!
+ Set up the OpenGL rendering state, and define display list
+*/
+
+void GLWidget::initializeGL()
+{
+ qglClearColor( black ); // Let OpenGL clear to black
+ object = makeObject(); // Generate an OpenGL display list
+ glShadeModel( GL_FLAT );
+}
+
+
+
+/*!
+ Set up the OpenGL view port, matrix mode, etc.
+*/
+
+void GLWidget::resizeGL( int w, int h )
+{
+ glViewport( 0, 0, (GLint)w, (GLint)h );
+ glMatrixMode( GL_PROJECTION );
+ glLoadIdentity();
+ glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 );
+ glMatrixMode( GL_MODELVIEW );
+}
+
+
+/*!
+ Generate an OpenGL display list for the object to be shown, i.e. the box
+*/
+
+GLuint GLWidget::makeObject()
+{
+ GLuint list;
+
+ list = glGenLists( 1 );
+
+ glNewList( list, GL_COMPILE );
+
+ qglColor( white ); // Shorthand for glColor3f or glIndex
+
+ glLineWidth( 2.0 );
+
+ glBegin( GL_LINE_LOOP );
+ glVertex3f( 1.0f, 0.5f, -0.4f );
+ glVertex3f( 1.0f, -0.5f, -0.4f );
+ glVertex3f( -1.0f, -0.5f, -0.4f );
+ glVertex3f( -1.0f, 0.5f, -0.4f );
+ glEnd();
+
+ glBegin( GL_LINE_LOOP );
+ glVertex3f( 1.0f, 0.5f, 0.4f );
+ glVertex3f( 1.0f, -0.5f, 0.4f );
+ glVertex3f( -1.0f, -0.5f, 0.4f );
+ glVertex3f( -1.0f, 0.5f, 0.4f );
+ glEnd();
+
+ glBegin( GL_LINES );
+ glVertex3f( 1.0f, 0.5f, -0.4f ); glVertex3f( 1.0f, 0.5f, 0.4f );
+ glVertex3f( 1.0f, -0.5f, -0.4f ); glVertex3f( 1.0f, -0.5f, 0.4f );
+ glVertex3f( -1.0f, -0.5f, -0.4f ); glVertex3f( -1.0f, -0.5f, 0.4f );
+ glVertex3f( -1.0f, 0.5f, -0.4f ); glVertex3f( -1.0f, 0.5f, 0.4f );
+ glEnd();
+
+ glEndList();
+
+ return list;
+}
+
+void GLWidget::setXRot( double x )
+{
+ xrot = x;
+ update();
+}
+
+void GLWidget::setYRot( double y )
+{
+ yrot = y;
+ update();
+}
+
+void GLWidget::setZRot( double z )
+{
+ zrot = z;
+ update();
+}
+
+void GLWidget::setScale( double s )
+{
+ scale_ = s;
+ update();
+}
diff --git a/tools/designer/examples/opengl/glwidget.h b/tools/designer/examples/opengl/glwidget.h
new file mode 100644
index 0000000..fd34d4a
--- /dev/null
+++ b/tools/designer/examples/opengl/glwidget.h
@@ -0,0 +1,75 @@
+/**********************************************************************
+**
+** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of Qt Designer.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free Qt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with
+** the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+#ifndef GLWIDGET_H
+#define GLWIDGET_H
+
+#include <qgl.h>
+
+class GLWidget : public QGLWidget
+{
+ Q_OBJECT
+ Q_PROPERTY( double xRot READ xRot WRITE setXRot )
+ Q_PROPERTY( double yRot READ yRot WRITE setYRot )
+ Q_PROPERTY( double zRot READ zRot WRITE setZRot )
+ Q_PROPERTY( double scale READ scale WRITE setScale )
+
+public:
+ GLWidget( QWidget* parent, const char* name );
+ ~GLWidget();
+
+ double xRot() const { return xrot; }
+ double yRot() const { return yrot; }
+ double zRot() const { return zrot; }
+ double scale() const { return scale_; }
+
+public slots:
+ void setXRot( double );
+ void setYRot( double );
+ void setZRot( double );
+ void setScale( double );
+
+protected:
+ void initializeGL();
+ void paintGL();
+ void resizeGL( int w, int h );
+
+ virtual GLuint makeObject();
+
+private:
+ GLuint object;
+ GLfloat xrot, yrot, zrot, scale_;
+};
+
+#endif
diff --git a/tools/designer/examples/opengl/main.cpp b/tools/designer/examples/opengl/main.cpp
new file mode 100644
index 0000000..3b6bd29
--- /dev/null
+++ b/tools/designer/examples/opengl/main.cpp
@@ -0,0 +1,305 @@
+/**********************************************************************
+**
+** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of Qt Designer.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free Qt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with
+** the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+#include <widgetinterface.h>
+
+#include <qobjectcleanuphandler.h>
+#include <qpixmap.h>
+
+#include "glwidget.h"
+
+/* XPM */
+static char * cube_xmp[] = {
+"48 48 104 2",
+" c None",
+". c #30C230C22081",
+"X c #30C230C230C2",
+"o c #30C2410330C2",
+"O c #410330C24103",
+"+ c #410341034103",
+"@ c #514451445144",
+"# c #514461855144",
+"$ c #618551446185",
+"% c #618561856185",
+"& c #71C671C671C6",
+"* c #71C6820771C6",
+"= c #965882078617",
+"- c #861792488617",
+"; c #965892489658",
+": c #9658A2899658",
+"> c #9E79A2899E79",
+", c #AEBAAEBA9E79",
+"< c #AEBAAEBAAEBA",
+"1 c #AEBABEFBAEBA",
+"2 c #BEFBBEFBBEFB",
+"3 c #CF3CBEFBCF3C",
+"4 c #CF3CCF3CCF3C",
+"5 c #DF7DCF3CCF3C",
+"6 c #DF7DDF7DCF3C",
+"7 c #DF7DDF7DDF7D",
+"8 c #EFBEDF7DDF7D",
+"9 c #DF7DEFBEDF7D",
+"0 c #EFBEDF7DEFBE",
+"q c #EFBEEFBEDF7D",
+"w c #208130C22081",
+"e c #410351445144",
+"r c #514451446185",
+"t c #71C6618571C6",
+"y c #861771C68617",
+"u c #9E7992489E79",
+"i c #9E79AEBA9E79",
+"p c #BEFBAEBABEFB",
+"a c #BEFBCF3CBEFB",
+"s c #BEFBCF3CCF3C",
+"d c #CF3CCF3CDF7D",
+"f c #CF3CDF7DCF3C",
+"g c #DF7DDF7DEFBE",
+"h c #208120812081",
+"j c #30C2208130C2",
+"k c #410330C230C2",
+"l c #4103410330C2",
+"z c #410351444103",
+"x c #618551445144",
+"c c #618561855144",
+"v c #618571C66185",
+"b c #861771C671C6",
+"n c #8617820771C6",
+"m c #965882079658",
+"M c #9E7992489658",
+"N c #AEBAA289AEBA",
+"B c #BEFBAEBAAEBA",
+"V c #DF7DCF3CDF7D",
+"C c #CF3CDF7DDF7D",
+"Z c #208120811040",
+"A c #965892488617",
+"S c #104020812081",
+"D c #861782078617",
+"F c #861792489658",
+"G c #965892489E79",
+"H c #104020811040",
+"J c #208110402081",
+"K c #30C220812081",
+"L c #BEFBBEFBCF3C",
+"P c #104010401040",
+"I c #208110401040",
+"U c #618571C671C6",
+"Y c #71C671C68617",
+"T c #71C682078617",
+"R c #CF3CBEFBBEFB",
+"E c #CF3CCF3CBEFB",
+"W c #000010401040",
+"Q c #104010402081",
+"! c #9E79AEBAAEBA",
+"~ c #104010400000",
+"^ c #AEBAA2899E79",
+"/ c #71C671C66185",
+"( c #000010400000",
+") c #000000000000",
+"_ c #104000001040",
+"` c #2081208130C2",
+"' c #9658A2899E79",
+"] c #104000000000",
+"[ c #000000001040",
+"{ c #30C241034103",
+"} c #9E79A289AEBA",
+"| c #AEBABEFBBEFB",
+" . c #514461856185",
+".. c #9E79A2899658",
+"X. c #71C661856185",
+"o. c #30C230C24103",
+"O. c #514441035144",
+"+. c #514451444103",
+"@. c #410341035144",
+"#. c #AEBAAEBABEFB",
+"$. c #208130C230C2",
+"%. c #6185618571C6",
+"&. c #514441034103",
+"*. c #861782079658",
+" . X o O + @ # $ % & * = - ; : > , < 1 2 2 3 4 5 6 7 7 8 9 0 q ",
+" w X X O + @ e r % t & y - ; : u i < < p a 3 s d f 7 7 g 9 0 9 ; ",
+" h j X k l + z x c t v b n m ; M > N < B 2 2 a 3 4 V 6 7 7 0 9 m ; ",
+" h h w X f d f d f V f V f 7 f 7 C 7 f V f V f d f V f 7 9 g 9 m ; ; ",
+" Z h w j - 4 4 5 4 5 4 5 4 V f V 6 V f V f V 4 5 4 5 4 V 7 7 7 m A ; ; ",
+" S h h j - D s 4 4 4 4 4 4 4 4 d f V f d f d 4 d 4 4 4 V C 7 7 m - ; F G ",
+" H J Z K * D D m ; M 5 4 V 7 = D m - ; ; ",
+" H h S h * y D L F ; : 4 f V C D D m a ; ; G ",
+" P I H J & b n 2 2 m A M 3 4 5 f y D = 2 2 A ; ; ",
+" P P H J U Y & p 1 2 - ; : 4 4 d f y T D 1 p 1 ; F G ",
+" P P H J % t & < < < m ; u R E 4 f b * y B < < A ; ; ",
+" W P P Q % t v < ! < - ; : L a 4 4 & * y < < ! ; ; G ",
+" ~ P ~ I c $ % > ^ > m ; M 2 2 3 4 t / b ^ i ^ ; M ; ",
+" ( P W P # $ % > > > F ; : p a 3 s t U & > > > ; ; G ",
+" ) _ ( _ @ $ # M ; u m ; u p 2 2 a % v t M ; u ; M ; ",
+" ( _ ( P P P H h h ` w X o : ; F F ; : & * D - G ' > i < 1 2 a % v t : ; F ; : u ",
+" ) ] ( _ ~ P P I Z h w j X O m - m ; ; M & y - m ; > i N < 2 2 $ c % m - m ; M : ",
+") [ ( _ W P P Q H h h j X O { D D - F G : y T m ; u > } < p | r .% D D - G : u ",
+"V f 5 4 5 f V f V f V f V f V y * y m ; u f 5 f V f 5 4 V f x @ $ y * y : u ..",
+"4 d f 4 f d f d 4 d f V f V f U & U F G : d f d f d f 4 4 d @ r # U & U G : > ",
+"3 4 3 E 4 E 4 4 3 4 4 4 5 4 5 t v X.; ; u 4 4 4 4 E 4 E 3 4 @ @ x t v X.; u ..",
+"a 4 a o.{ + .% v ; G > 3 a 4 e @ # .% v u ' > ",
+"3 2 3 X O o $ # $ ; ; u 2 3 2 O.+.@ $ # $ : u > ",
+"a 2 a X o + @ @ @ ; u ' 2 2 2 z @ @ @ @ @ u > } ",
+"p < p X k l O.z O.; : u 1 p < O.+.@ O.z O...> i ",
+"1 < 1 o.o + @.z @.; G > #.1 < z O.@ + @.z > > } ",
+"N , N X O o l + o ; ; u 1 1 1 O.+.@ O l + : u > ",
+"i } i o.o + O o o.; u o + z @ # % v } i } e @ @ } < #.| L a 4 f V o o.o G ' > ",
+"> ..u o O + . X . ; o O + O.@ $ % & u u ..@ @ x , < 1 2 2 3 4 5 6 X . X ; u ..",
+"' u : O + + j $.j $.o.{ O.e r % %.U G : u @ r # < < p 2 3 s d f 7 $.j $.u : u ",
+"; A M l + + h j . K h j h K h h h h ; ; A x @ $ h h h h h K h j 6 7 7 0 : u ..",
+"- m - + { @. h h w %.w h h h h h S h S m - m # r # h S h S h h h f 7 9 g F G : ",
+"y D D l + + Z h h t % h Z J Z J Z J Z J D y D x # $ H J Z J Z J f V 7 7 - M ; ",
+"* y * + z O. S h h & U t y * y @ $ . 4 d C 7 - m ; ",
+"& / b l + + P J Z y & t & & / x c $ E 5 4 V n = D ",
+"v %.v + z O. H J H D * & & v %.# % . a 4 f V * D - ",
+"X.% % + &.z P P H D n y c $ % $ c $ a 3 4 V * y D ",
+"# $ # + z @ P P H J m - D $ # $ # $ % 2 3 4 d * y T ",
+"@ @ x + + z W P P Q m D m @ @ @ $ c % 2 R E 4 & b * ",
+"z O.e + z @ P ~ I ; ; *. @ z O. .% % L s 4 U & * ",
+"&.+ &.l &.+.W P M ; m + &.+ $ c X.2 3 v t & ",
+"{ + { @.z O._ u ' ; + { + .$ % 3 v t & ",
+"O o k + O.P P P H h h ` w X o l + z @ c X./ b n m ; u o O o $ % % % t v ",
+"$.X $.@._ ~ P P I Z h w j X O + + @ # % v & * D - ; : X $.X .% v %.v ",
+"j . j _ W P P Q H h h j X O { + &.@ $ c t & y D m ; > . j . % c X.% ",
+"w j w ` w j w ` w ` h ` h h S h h h h ` h ` w ` w j w ` w j .% % ",
+"h h K h h h h h h h J h J H J Z J H J h h h h h h h J h h h $ % ",
+"S h h h H h S h S h S h H Q H J H Q H h H h S h S h S h S h . "};
+
+
+class OpenGLWidgetInterface : public WidgetInterface
+{
+public:
+ OpenGLWidgetInterface();
+
+ QRESULT queryInterface( const QUuid&, QUnknownInterface ** );
+ Q_REFCOUNT;
+
+ QStringList featureList() const;
+
+ QWidget* create( const QString &classname, QWidget* parent = 0, const char* name = 0 );
+ QString group( const QString& ) const;
+ QIconSet iconSet( const QString& ) const;
+ QString includeFile( const QString& ) const;
+ QString toolTip( const QString& ) const;
+ QString whatsThis( const QString& ) const;
+ bool isContainer( const QString& ) const;
+
+private:
+ QObjectCleanupHandler objects;
+};
+
+OpenGLWidgetInterface::OpenGLWidgetInterface()
+{
+}
+
+QStringList OpenGLWidgetInterface::featureList() const
+{
+ QStringList list;
+
+ list << "GLWidget";
+
+ return list;
+}
+
+QWidget* OpenGLWidgetInterface::create( const QString &description, QWidget* parent, const char* name )
+{
+ QWidget* w = 0;
+
+ if ( description == "GLWidget" )
+ w = new GLWidget( parent, name );
+
+ objects.add( w );
+ return w;
+}
+
+QString OpenGLWidgetInterface::group( const QString &description ) const
+{
+ if ( description == "GLWidget" )
+ return "Views";
+ return QString::null;
+}
+
+QIconSet OpenGLWidgetInterface::iconSet( const QString &description ) const
+{
+ if ( description == "GLWidget" )
+ return QIconSet( (const char**)cube_xmp );
+ return QIconSet();
+}
+
+QString OpenGLWidgetInterface::includeFile( const QString &description ) const
+{
+ if ( description == "GLWidget" )
+ return "glwidget.h";
+ return QString::null;
+}
+
+QString OpenGLWidgetInterface::toolTip( const QString &description ) const
+{
+ if ( description == "GLWidget" )
+ return QT_TR_NOOP("OpenGL Widget");
+ return QString::null;
+}
+
+QString OpenGLWidgetInterface::whatsThis( const QString &description ) const
+{
+ if ( description == "GLWidget" )
+ return "A widget for OpenGL rendering";
+ return QString::null;
+}
+
+bool OpenGLWidgetInterface::isContainer( const QString& ) const
+{
+ return FALSE;
+}
+
+QRESULT OpenGLWidgetInterface::queryInterface( const QUuid& uuid, QUnknownInterface **iface )
+{
+ *iface = 0;
+
+ if ( uuid == IID_QUnknown )
+ *iface = (QUnknownInterface*)this;
+ else if ( uuid == IID_QFeatureList )
+ *iface = (QFeatureListInterface*)this;
+ else if ( uuid == IID_Widget )
+ *iface = (WidgetInterface*)this;
+ else
+ return QE_NOINTERFACE;
+
+ (*iface)->addRef();
+ return QS_OK;
+}
+
+Q_EXPORT_COMPONENT()
+{
+ Q_CREATE_INSTANCE( OpenGLWidgetInterface );
+}
diff --git a/tools/designer/examples/opengl/opengl.pro b/tools/designer/examples/opengl/opengl.pro
new file mode 100644
index 0000000..d28eb32
--- /dev/null
+++ b/tools/designer/examples/opengl/opengl.pro
@@ -0,0 +1,11 @@
+TEMPLATE = lib
+CONFIG += qt warn_on release plugin
+HEADERS = glwidget.h
+SOURCES = main.cpp \
+ glwidget.cpp
+DESTDIR = ../../../../plugins/designer
+INCLUDEPATH += ../../interfaces
+
+TARGET = glwidget
+target.path += $$plugins.path/designer
+INSTALLS += target
diff --git a/tools/designer/examples/receiver1/main.cpp b/tools/designer/examples/receiver1/main.cpp
new file mode 100644
index 0000000..fd2cf20
--- /dev/null
+++ b/tools/designer/examples/receiver1/main.cpp
@@ -0,0 +1,24 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#include <qapplication.h>
+#include "mainform.h"
+
+int main( int argc, char *argv[] )
+{
+ QApplication app( argc, argv );
+
+ MainForm *mainForm = new MainForm;
+ app.setMainWidget( mainForm );
+ mainForm->show();
+
+ return app.exec();
+}
+
+
diff --git a/tools/designer/examples/receiver1/mainform.ui b/tools/designer/examples/receiver1/mainform.ui
new file mode 100644
index 0000000..abe714f
--- /dev/null
+++ b/tools/designer/examples/receiver1/mainform.ui
@@ -0,0 +1,87 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>MainForm</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MainForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>389</width>
+ <height>115</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Main Form</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton" row="0" column="1">
+ <property name="name">
+ <cstring>quitPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Quit</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>creditPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Credit Dialog</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Credit Rating</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>ratingTextLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Unrated</string>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>creditPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>MainForm</receiver>
+ <slot>creditDialog()</slot>
+ </connection>
+ <connection>
+ <sender>quitPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>MainForm</receiver>
+ <slot>accept()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="global" impldecl="in implementation">qspinbox.h</include>
+ <include location="global" impldecl="in implementation">qwidgetfactory.h</include>
+ <include location="local" impldecl="in implementation">mainform.ui.h</include>
+</includes>
+<slots>
+ <slot access="protected">init()</slot>
+ <slot access="protected">destroy()</slot>
+ <slot>creditDialog()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/tools/designer/examples/receiver1/mainform.ui.h b/tools/designer/examples/receiver1/mainform.ui.h
new file mode 100644
index 0000000..5318e2e
--- /dev/null
+++ b/tools/designer/examples/receiver1/mainform.ui.h
@@ -0,0 +1,25 @@
+void MainForm::init()
+{
+
+}
+
+void MainForm::destroy()
+{
+
+}
+
+void MainForm::creditDialog()
+{
+ QDialog *creditForm = (QDialog *)
+ QWidgetFactory::create( "../credit/creditformbase.ui" );
+ // Set up the dynamic dialog here
+
+ if ( creditForm->exec() ) {
+ // The user accepted, act accordingly
+ QSpinBox *amount = (QSpinBox *) creditForm->child( "amountSpinBox", "QSpinBox" );
+ if ( amount )
+ ratingTextLabel->setText( amount->text() );
+ }
+ delete creditForm;
+}
+
diff --git a/tools/designer/examples/receiver1/receiver.pro b/tools/designer/examples/receiver1/receiver.pro
new file mode 100644
index 0000000..0758559
--- /dev/null
+++ b/tools/designer/examples/receiver1/receiver.pro
@@ -0,0 +1,11 @@
+TEMPLATE = app
+LANGUAGE = C++
+TARGET = receiver
+
+CONFIG += qt warn_on release
+INCLUDEPATH += $$QT_SOURCE_TREE/tools/designer/uilib
+LIBS += -lqui
+SOURCES += main.cpp
+IMAGEFILE = images.cpp
+FORMS = mainform.ui
+DBFILE = receiver.db
diff --git a/tools/designer/examples/receiver2/main.cpp b/tools/designer/examples/receiver2/main.cpp
new file mode 100644
index 0000000..8c76ef2
--- /dev/null
+++ b/tools/designer/examples/receiver2/main.cpp
@@ -0,0 +1,25 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#include <qapplication.h>
+#include "mainform.h"
+
+
+int main( int argc, char *argv[] )
+{
+ QApplication app( argc, argv );
+
+ MainForm *mainForm = new MainForm;
+ app.setMainWidget( mainForm );
+ mainForm->show();
+
+ return app.exec();
+}
+
+
diff --git a/tools/designer/examples/receiver2/mainform.ui b/tools/designer/examples/receiver2/mainform.ui
new file mode 100644
index 0000000..690f185
--- /dev/null
+++ b/tools/designer/examples/receiver2/mainform.ui
@@ -0,0 +1,82 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>MainForm</class>
+<include location="global" impldecl="in implementation">qwidgetfactory.h</include>
+<include location="global" impldecl="in implementation">qspinbox.h</include>
+<include location="local" impldecl="in implementation">receiver.h</include>
+<include location="local" implDecl="in declaration">mainform.ui.h</include>
+<layoutdefaults spacing="6" margin="11"/>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MainForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>373</width>
+ <height>107</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Main Form</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton" row="0" column="1">
+ <property name="name">
+ <cstring>quitPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Quit</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>creditPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Credit Dialog</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Credit Rating</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>ratingTextLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Unrated</string>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection language="C++">
+ <sender>creditPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>MainForm</receiver>
+ <slot>creditDialog()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>quitPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>MainForm</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">creditDialog()</slot>
+</connections>
+</UI>
diff --git a/tools/designer/examples/receiver2/mainform.ui.h b/tools/designer/examples/receiver2/mainform.ui.h
new file mode 100644
index 0000000..3cc3b69
--- /dev/null
+++ b/tools/designer/examples/receiver2/mainform.ui.h
@@ -0,0 +1,20 @@
+void MainForm::creditDialog()
+{
+ Receiver *receiver = new Receiver;
+ QDialog *creditForm = (QDialog *)
+ QWidgetFactory::create( "../credit/creditformbase.ui", receiver );
+ receiver->setParent( creditForm );
+
+ // Set up the dynamic dialog here
+
+ if ( creditForm->exec() ) {
+ // The user accepted, act accordingly
+ QSpinBox *amount = (QSpinBox *) creditForm->child( "amountSpinBox", "QSpinBox" );
+ if ( amount )
+ ratingTextLabel->setText( amount->text() );
+ }
+
+ delete receiver;
+ delete creditForm;
+}
+
diff --git a/tools/designer/examples/receiver2/receiver.cpp b/tools/designer/examples/receiver2/receiver.cpp
new file mode 100644
index 0000000..1f66d0b
--- /dev/null
+++ b/tools/designer/examples/receiver2/receiver.cpp
@@ -0,0 +1,29 @@
+#include <qradiobutton.h>
+#include <qspinbox.h>
+#include "receiver.h"
+
+void Receiver::setParent( QDialog *parent )
+{
+ p = parent;
+ setAmount();
+}
+
+void Receiver::setAmount()
+{
+ QSpinBox *amount =
+ (QSpinBox *) p->child( "amountSpinBox", "QSpinBox" );
+
+ QRadioButton *radio =
+ (QRadioButton *) p->child( "stdRadioButton", "QRadioButton" );
+ if ( radio && radio->isChecked() ) {
+ if ( amount )
+ amount->setValue( amount->maxValue() / 2 );
+ return;
+ }
+
+ radio =
+ (QRadioButton *) p->child( "noneRadioButton", "QRadioButton" );
+ if ( radio && radio->isChecked() )
+ if ( amount )
+ amount->setValue( amount->minValue() );
+}
diff --git a/tools/designer/examples/receiver2/receiver.h b/tools/designer/examples/receiver2/receiver.h
new file mode 100644
index 0000000..34b80e9
--- /dev/null
+++ b/tools/designer/examples/receiver2/receiver.h
@@ -0,0 +1,13 @@
+#include <qobject.h>
+#include <qdialog.h>
+
+class Receiver : public QObject
+{
+ Q_OBJECT
+public:
+ void setParent( QDialog *parent );
+public slots:
+ void setAmount();
+private:
+ QDialog *p;
+};
diff --git a/tools/designer/examples/receiver2/receiver.pro b/tools/designer/examples/receiver2/receiver.pro
new file mode 100644
index 0000000..5c7bf79
--- /dev/null
+++ b/tools/designer/examples/receiver2/receiver.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+LANGUAGE = C++
+TARGET = receiver
+
+CONFIG += qt warn_on release
+INCLUDEPATH += $$QT_SOURCE_TREE/tools/designer/uilib
+LIBS += -lqui
+SOURCES += main.cpp receiver.cpp
+HEADERS += receiver.h
+FORMS = mainform.ui
+DBFILE = receiver.db
+IMAGEFILE = images.cpp
diff --git a/tools/designer/examples/richedit/images/editcopy.png b/tools/designer/examples/richedit/images/editcopy.png
new file mode 100644
index 0000000..abfe86e
--- /dev/null
+++ b/tools/designer/examples/richedit/images/editcopy.png
Binary files differ
diff --git a/tools/designer/examples/richedit/images/editcut.png b/tools/designer/examples/richedit/images/editcut.png
new file mode 100644
index 0000000..2d179bc
--- /dev/null
+++ b/tools/designer/examples/richedit/images/editcut.png
Binary files differ
diff --git a/tools/designer/examples/richedit/images/editpaste.png b/tools/designer/examples/richedit/images/editpaste.png
new file mode 100644
index 0000000..356ee55
--- /dev/null
+++ b/tools/designer/examples/richedit/images/editpaste.png
Binary files differ
diff --git a/tools/designer/examples/richedit/images/filenew.png b/tools/designer/examples/richedit/images/filenew.png
new file mode 100644
index 0000000..9853d97
--- /dev/null
+++ b/tools/designer/examples/richedit/images/filenew.png
Binary files differ
diff --git a/tools/designer/examples/richedit/images/fileopen.png b/tools/designer/examples/richedit/images/fileopen.png
new file mode 100644
index 0000000..85dab43
--- /dev/null
+++ b/tools/designer/examples/richedit/images/fileopen.png
Binary files differ
diff --git a/tools/designer/examples/richedit/images/filesave.png b/tools/designer/examples/richedit/images/filesave.png
new file mode 100644
index 0000000..21309aa
--- /dev/null
+++ b/tools/designer/examples/richedit/images/filesave.png
Binary files differ
diff --git a/tools/designer/examples/richedit/images/redo.png b/tools/designer/examples/richedit/images/redo.png
new file mode 100644
index 0000000..857d093
--- /dev/null
+++ b/tools/designer/examples/richedit/images/redo.png
Binary files differ
diff --git a/tools/designer/examples/richedit/images/textbold.png b/tools/designer/examples/richedit/images/textbold.png
new file mode 100644
index 0000000..c51e5c0
--- /dev/null
+++ b/tools/designer/examples/richedit/images/textbold.png
Binary files differ
diff --git a/tools/designer/examples/richedit/images/textcenter.png b/tools/designer/examples/richedit/images/textcenter.png
new file mode 100644
index 0000000..032a9bb
--- /dev/null
+++ b/tools/designer/examples/richedit/images/textcenter.png
Binary files differ
diff --git a/tools/designer/examples/richedit/images/textitalic.png b/tools/designer/examples/richedit/images/textitalic.png
new file mode 100644
index 0000000..b725b43
--- /dev/null
+++ b/tools/designer/examples/richedit/images/textitalic.png
Binary files differ
diff --git a/tools/designer/examples/richedit/images/textleft.png b/tools/designer/examples/richedit/images/textleft.png
new file mode 100644
index 0000000..4ef081f
--- /dev/null
+++ b/tools/designer/examples/richedit/images/textleft.png
Binary files differ
diff --git a/tools/designer/examples/richedit/images/textright.png b/tools/designer/examples/richedit/images/textright.png
new file mode 100644
index 0000000..a9b2b55
--- /dev/null
+++ b/tools/designer/examples/richedit/images/textright.png
Binary files differ
diff --git a/tools/designer/examples/richedit/images/textunder.png b/tools/designer/examples/richedit/images/textunder.png
new file mode 100644
index 0000000..5093509
--- /dev/null
+++ b/tools/designer/examples/richedit/images/textunder.png
Binary files differ
diff --git a/tools/designer/examples/richedit/images/undo.png b/tools/designer/examples/richedit/images/undo.png
new file mode 100644
index 0000000..9346c6c
--- /dev/null
+++ b/tools/designer/examples/richedit/images/undo.png
Binary files differ
diff --git a/tools/designer/examples/richedit/main.cpp b/tools/designer/examples/richedit/main.cpp
new file mode 100644
index 0000000..a5a0d6d
--- /dev/null
+++ b/tools/designer/examples/richedit/main.cpp
@@ -0,0 +1,25 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#include <qapplication.h>
+#include "richedit.h"
+
+
+int main( int argc, char *argv[] )
+{
+ QApplication app( argc, argv );
+
+ EditorForm richeditForm;
+ app.setMainWidget( &richeditForm );
+ richeditForm.show();
+
+ return app.exec();
+}
+
+
diff --git a/tools/designer/examples/richedit/richedit.pro b/tools/designer/examples/richedit/richedit.pro
new file mode 100644
index 0000000..bcc3d4d
--- /dev/null
+++ b/tools/designer/examples/richedit/richedit.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+TARGET = richedit
+LANGUAGE = C++
+
+CONFIG += qt warn_on release
+SOURCES += main.cpp
+IMAGEFILE = images.cpp
+FORMS = richedit.ui
+IMAGES = images/editcopy.png images/editcut.png images/editpaste.png images/filenew.png images/fileopen.png images/filesave.png images/redo.png images/textbold.png images/textcenter.png images/textitalic.png images/textleft.png images/textright.png images/textunder.png images/undo.png
+DBFILE = richedit.db
diff --git a/tools/designer/examples/richedit/richedit.ui b/tools/designer/examples/richedit/richedit.ui
new file mode 100644
index 0000000..2ae033f
--- /dev/null
+++ b/tools/designer/examples/richedit/richedit.ui
@@ -0,0 +1,612 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>EditorForm</class>
+<include location="global" impldecl="in implementation">qfile.h</include>
+<include location="global" impldecl="in implementation">qfontdatabase.h</include>
+<include location="global" impldecl="in implementation">qmessagebox.h</include>
+<include location="global" impldecl="in implementation">qapplication.h</include>
+<include location="global" impldecl="in implementation">qfiledialog.h</include>
+<include location="global" impldecl="in implementation">qtextstream.h</include>
+<include location="local" implDecl="in declaration">richedit.ui.h</include>
+<variable>QString fileName;</variable>
+<pixmapinproject/>
+<layoutdefaults spacing="6" margin="11"/>
+<widget class="QMainWindow">
+ <property name="name">
+ <cstring>EditorForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>646</width>
+ <height>436</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Rich Edit</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QTextEdit">
+ <property name="name">
+ <cstring>textEdit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="textFormat">
+ <enum>RichText</enum>
+ </property>
+ </widget>
+ </hbox>
+</widget>
+<menubar>
+ <property name="name">
+ <cstring>menubar</cstring>
+ </property>
+ <item text="&amp;File" name="fileMenu">
+ <action name="fileNewAction"/>
+ <action name="fileOpenAction"/>
+ <action name="fileSaveAction"/>
+ <action name="fileSaveAsAction"/>
+ <separator/>
+ <action name="fileExitAction"/>
+ </item>
+ <item text="&amp;Edit" name="editMenu">
+ <action name="editUndoAction"/>
+ <action name="editRedoAction"/>
+ <separator/>
+ <action name="editCutAction"/>
+ <action name="editCopyAction"/>
+ <action name="editPasteAction"/>
+ </item>
+ <item text="F&amp;ormat" name="PopupMenu_2">
+ <action name="leftAlignAction"/>
+ <action name="rightAlignAction"/>
+ <action name="centerAlignAction"/>
+ <separator/>
+ <action name="boldAction"/>
+ <action name="italicAction"/>
+ <action name="underlineAction"/>
+ </item>
+ <item text="&amp;Help" name="helpMenu">
+ <action name="helpContentsAction"/>
+ <action name="helpIndexAction"/>
+ <separator/>
+ <action name="helpAboutAction"/>
+ </item>
+</menubar>
+<toolbars>
+ <toolbar dock="2">
+ <property name="name">
+ <cstring>toolBar</cstring>
+ </property>
+ <property name="label">
+ <string>Tools</string>
+ </property>
+ <action name="fileNewAction"/>
+ <action name="fileOpenAction"/>
+ <action name="fileSaveAction"/>
+ <separator/>
+ <action name="editUndoAction"/>
+ <action name="editRedoAction"/>
+ <action name="editCutAction"/>
+ <action name="editCopyAction"/>
+ <action name="editPasteAction"/>
+ </toolbar>
+ <toolbar dock="2">
+ <property name="name">
+ <cstring>Toolbar</cstring>
+ </property>
+ <property name="label">
+ <string>Toolbar</string>
+ </property>
+ <action name="leftAlignAction"/>
+ <action name="centerAlignAction"/>
+ <action name="rightAlignAction"/>
+ <separator/>
+ <action name="boldAction"/>
+ <action name="italicAction"/>
+ <action name="underlineAction"/>
+ <separator/>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>fontComboBox</cstring>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>SpinBox2</cstring>
+ </property>
+ <property name="minValue">
+ <number>6</number>
+ </property>
+ <property name="value">
+ <number>10</number>
+ </property>
+ </widget>
+ </toolbar>
+</toolbars>
+<actions>
+ <action>
+ <property name="name">
+ <cstring>fileNewAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>filenew.png</iconset>
+ </property>
+ <property name="text">
+ <string>New</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;New</string>
+ </property>
+ <property name="accel">
+ <number>4194382</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileOpenAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>fileopen.png</iconset>
+ </property>
+ <property name="text">
+ <string>Open</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Open...</string>
+ </property>
+ <property name="accel">
+ <number>4194383</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileSaveAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>filesave.png</iconset>
+ </property>
+ <property name="text">
+ <string>Save</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Save</string>
+ </property>
+ <property name="accel">
+ <number>4194387</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileSaveAsAction</cstring>
+ </property>
+ <property name="text">
+ <string>Save As</string>
+ </property>
+ <property name="menuText">
+ <string>Save &amp;As...</string>
+ </property>
+ <property name="accel">
+ <number>0</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileExitAction</cstring>
+ </property>
+ <property name="text">
+ <string>Exit</string>
+ </property>
+ <property name="menuText">
+ <string>E&amp;xit</string>
+ </property>
+ <property name="accel">
+ <number>0</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editUndoAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>undo.png</iconset>
+ </property>
+ <property name="text">
+ <string>Undo</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Undo</string>
+ </property>
+ <property name="accel">
+ <number>4194394</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editRedoAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>redo.png</iconset>
+ </property>
+ <property name="text">
+ <string>Redo</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Redo</string>
+ </property>
+ <property name="accel">
+ <number>4194393</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editCutAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>editcut.png</iconset>
+ </property>
+ <property name="text">
+ <string>Cut</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Cut</string>
+ </property>
+ <property name="accel">
+ <number>4194392</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editCopyAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>editcopy.png</iconset>
+ </property>
+ <property name="text">
+ <string>Copy</string>
+ </property>
+ <property name="menuText">
+ <string>C&amp;opy</string>
+ </property>
+ <property name="accel">
+ <number>4194371</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editPasteAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>editpaste.png</iconset>
+ </property>
+ <property name="text">
+ <string>Paste</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Paste</string>
+ </property>
+ <property name="accel">
+ <number>4194390</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>helpContentsAction</cstring>
+ </property>
+ <property name="text">
+ <string>Contents</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Contents...</string>
+ </property>
+ <property name="accel">
+ <number>0</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>helpIndexAction</cstring>
+ </property>
+ <property name="text">
+ <string>Index</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Index...</string>
+ </property>
+ <property name="accel">
+ <number>0</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>helpAboutAction</cstring>
+ </property>
+ <property name="text">
+ <string>About</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;About</string>
+ </property>
+ <property name="accel">
+ <number>0</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>boldAction</cstring>
+ </property>
+ <property name="toggleAction">
+ <bool>true</bool>
+ </property>
+ <property name="iconSet">
+ <iconset>textbold.png</iconset>
+ </property>
+ <property name="text">
+ <string>bold</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Bold</string>
+ </property>
+ <property name="accel">
+ <number>272629826</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>italicAction</cstring>
+ </property>
+ <property name="toggleAction">
+ <bool>true</bool>
+ </property>
+ <property name="iconSet">
+ <iconset>textitalic.png</iconset>
+ </property>
+ <property name="text">
+ <string>italic</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Italic</string>
+ </property>
+ <property name="accel">
+ <number>272629833</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>underlineAction</cstring>
+ </property>
+ <property name="toggleAction">
+ <bool>true</bool>
+ </property>
+ <property name="iconSet">
+ <iconset>textunder.png</iconset>
+ </property>
+ <property name="text">
+ <string>underline</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Underline</string>
+ </property>
+ <property name="accel">
+ <number>272629845</number>
+ </property>
+ </action>
+ <actiongroup>
+ <property name="name">
+ <cstring>alignActionGroup</cstring>
+ </property>
+ <property name="text">
+ <string>align</string>
+ </property>
+ <property name="usesDropDown">
+ <bool>false</bool>
+ </property>
+ <action>
+ <property name="name">
+ <cstring>leftAlignAction</cstring>
+ </property>
+ <property name="toggleAction">
+ <bool>true</bool>
+ </property>
+ <property name="iconSet">
+ <iconset>textleft.png</iconset>
+ </property>
+ <property name="text">
+ <string>left</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Left</string>
+ </property>
+ <property name="accel">
+ <number>272629836</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>rightAlignAction</cstring>
+ </property>
+ <property name="toggleAction">
+ <bool>true</bool>
+ </property>
+ <property name="iconSet">
+ <iconset>textright.png</iconset>
+ </property>
+ <property name="text">
+ <string>right</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Right</string>
+ </property>
+ <property name="accel">
+ <number>272629842</number>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>centerAlignAction</cstring>
+ </property>
+ <property name="toggleAction">
+ <bool>true</bool>
+ </property>
+ <property name="iconSet">
+ <iconset>textcenter.png</iconset>
+ </property>
+ <property name="text">
+ <string>center</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Center</string>
+ </property>
+ </action>
+ </actiongroup>
+</actions>
+<connections>
+ <connection language="C++">
+ <sender>fileNewAction</sender>
+ <signal>activated()</signal>
+ <receiver>EditorForm</receiver>
+ <slot>fileNew()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>fileOpenAction</sender>
+ <signal>activated()</signal>
+ <receiver>EditorForm</receiver>
+ <slot>fileOpen()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>fileSaveAction</sender>
+ <signal>activated()</signal>
+ <receiver>EditorForm</receiver>
+ <slot>fileSave()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>fileSaveAsAction</sender>
+ <signal>activated()</signal>
+ <receiver>EditorForm</receiver>
+ <slot>fileSaveAs()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>fileExitAction</sender>
+ <signal>activated()</signal>
+ <receiver>EditorForm</receiver>
+ <slot>fileExit()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>helpIndexAction</sender>
+ <signal>activated()</signal>
+ <receiver>EditorForm</receiver>
+ <slot>helpIndex()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>helpContentsAction</sender>
+ <signal>activated()</signal>
+ <receiver>EditorForm</receiver>
+ <slot>helpContents()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>helpAboutAction</sender>
+ <signal>activated()</signal>
+ <receiver>EditorForm</receiver>
+ <slot>helpAbout()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>SpinBox2</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>textEdit</receiver>
+ <slot>setPointSize(int)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>editCutAction</sender>
+ <signal>activated()</signal>
+ <receiver>textEdit</receiver>
+ <slot>cut()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>editPasteAction</sender>
+ <signal>activated()</signal>
+ <receiver>textEdit</receiver>
+ <slot>paste()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>editCopyAction</sender>
+ <signal>activated()</signal>
+ <receiver>textEdit</receiver>
+ <slot>copy()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>editRedoAction</sender>
+ <signal>activated()</signal>
+ <receiver>textEdit</receiver>
+ <slot>redo()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>editUndoAction</sender>
+ <signal>activated()</signal>
+ <receiver>textEdit</receiver>
+ <slot>undo()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>alignActionGroup</sender>
+ <signal>selected(QAction*)</signal>
+ <receiver>EditorForm</receiver>
+ <slot>changeAlignment(QAction*)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>underlineAction</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>textEdit</receiver>
+ <slot>setUnderline(bool)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>italicAction</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>textEdit</receiver>
+ <slot>setItalic(bool)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>boldAction</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>textEdit</receiver>
+ <slot>setBold(bool)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>fontComboBox</sender>
+ <signal>activated(const QString&amp;)</signal>
+ <receiver>textEdit</receiver>
+ <slot>setFamily(const QString&amp;)</slot>
+ </connection>
+ <connection language="C++">
+ <sender>fontComboBox</sender>
+ <signal>activated(const QString&amp;)</signal>
+ <receiver>textEdit</receiver>
+ <slot>setFocus()</slot>
+ </connection>
+ <slot access="protected" specifier="virtual" language="C++" returnType="void">init()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">fileExit()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">fileNew()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">fileOpen()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">fileSave()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">fileSaveAs()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">helpAbout()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">helpContents()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">helpIndex()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">changeAlignment( QAction * align )</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="int">saveAndContinue( const QString &amp; action )</slot>
+</connections>
+</UI>
diff --git a/tools/designer/examples/richedit/richedit.ui.h b/tools/designer/examples/richedit/richedit.ui.h
new file mode 100644
index 0000000..761848e
--- /dev/null
+++ b/tools/designer/examples/richedit/richedit.ui.h
@@ -0,0 +1,120 @@
+void EditorForm::init()
+{
+ textEdit->setFocus();
+
+ QFontDatabase fonts;
+ fontComboBox->insertStringList( fonts.families() );
+ QString font = textEdit->family();
+ font = font.lower();
+ for ( int i = 0 ; i < fontComboBox->count(); i++ ) {
+ if ( font == fontComboBox->text( i ) ) {
+ fontComboBox->setCurrentItem( i );
+ break;
+ }
+ }
+}
+
+void EditorForm::fileExit()
+{
+ if ( saveAndContinue( "Exit" ) )
+ qApp->exit();
+}
+
+void EditorForm::fileNew()
+{
+ if ( saveAndContinue( "New" ) )
+ textEdit->clear();
+}
+
+void EditorForm::fileOpen()
+{
+ if ( saveAndContinue( "Open" ) ) {
+ QString fn( QFileDialog::getOpenFileName(
+ QString::null,
+ "Rich Text Files (*.htm*)", this ) );
+ if ( !fn.isEmpty() ) {
+ fileName = fn;
+ QFile file( fileName );
+ if ( file.open( IO_ReadOnly ) ) {
+ QTextStream ts( &file );
+ textEdit->setText( ts.read() );
+ }
+ }
+ }
+}
+
+void EditorForm::fileSave()
+{
+ if ( fileName.isEmpty() ) {
+ fileSaveAs();
+ } else {
+ QFile f( fileName );
+ if ( f.open( IO_WriteOnly ) ) {
+ QTextStream ts( &f );
+ ts << textEdit->text();
+ textEdit->setModified( FALSE );
+ }
+ }
+}
+
+void EditorForm::fileSaveAs()
+{
+ QString fn = QFileDialog::getSaveFileName(
+ "", "Rich Text Files (*.htm*)", this );
+ if ( !fn.isEmpty() ) {
+ fileName = fn;
+ fileSave();
+ }
+}
+
+void EditorForm::helpAbout()
+{
+
+}
+
+void EditorForm::helpContents()
+{
+
+}
+
+void EditorForm::helpIndex()
+{
+
+}
+
+void EditorForm::changeAlignment(QAction * align)
+{
+ if ( align == leftAlignAction )
+ textEdit->setAlignment( Qt::AlignLeft );
+ else if ( align == rightAlignAction )
+ textEdit->setAlignment( Qt::AlignRight );
+ else if ( align == centerAlignAction )
+ textEdit->setAlignment( Qt::AlignCenter );
+}
+
+int EditorForm::saveAndContinue(const QString & action)
+{
+ int continueAction = 1;
+
+ if ( textEdit->isModified() ) {
+ switch( QMessageBox::information(
+ this, "Rich Edit",
+ "The document contains unsaved changes.\n"
+ "Do you want to save the changes?",
+ "&Save", "&Don't Save", "&Cancel " + action,
+ 0, // Enter == button 0
+ 2 ) ) { // Escape == button 2
+ case 0: // Save; continue
+ fileSave();
+ break;
+ case 1: // Do not save; continue
+ break;
+ case 2: // Cancel
+ continueAction = 0;
+ break;
+ }
+ }
+
+ return continueAction;
+}
+
diff --git a/tools/designer/examples/sizeaware/main.cpp b/tools/designer/examples/sizeaware/main.cpp
new file mode 100644
index 0000000..f8cd6ac
--- /dev/null
+++ b/tools/designer/examples/sizeaware/main.cpp
@@ -0,0 +1,11 @@
+#include <qapplication.h>
+#include "sizeaware.h"
+
+int main( int argc, char ** argv )
+{
+ QApplication app( argc, argv );
+ SizeAware *sizeaware = new SizeAware( 0, 0, TRUE );
+ sizeaware->exec();
+ sizeaware->destroy();
+ return 0;
+}
diff --git a/tools/designer/examples/sizeaware/sizeaware.cpp b/tools/designer/examples/sizeaware/sizeaware.cpp
new file mode 100644
index 0000000..1510a15
--- /dev/null
+++ b/tools/designer/examples/sizeaware/sizeaware.cpp
@@ -0,0 +1,38 @@
+#include "sizeaware.h"
+#include <qsettings.h>
+
+
+SizeAware::SizeAware( QDialog *parent, const char *name, bool modal )
+ : QDialog( parent, name, modal )
+{
+ if ( company().isEmpty() )
+ setCompany( "UnknownCompany" );
+ if ( settingsFile().isEmpty() )
+ setSettingsFile( "UnknownFile" );
+
+ QSettings settings;
+ settings.insertSearchPath( QSettings::Windows, "/" + company() );
+ settings.insertSearchPath( QSettings::Unix, "/Opt/" + company() + "/share" );
+ int width = settings.readNumEntry( "/" + settingsFile() + "/width", 640 );
+ int height = settings.readNumEntry( "/" + settingsFile() + "/height", 480 );
+ resize( width, height );
+}
+
+
+SizeAware::~SizeAware()
+{
+ // NOOP
+}
+
+void SizeAware::destroy()
+{
+ QSettings settings;
+ settings.insertSearchPath( QSettings::Windows, "/" + company() );
+ settings.insertSearchPath( QSettings::Unix, "/Opt/" + company() + "/share" );
+ settings.writeEntry( "/" + settingsFile() + "/width", width() );
+ settings.writeEntry( "/" + settingsFile() + "/height", height() );
+ close( TRUE );
+}
+
+
+
diff --git a/tools/designer/examples/sizeaware/sizeaware.h b/tools/designer/examples/sizeaware/sizeaware.h
new file mode 100644
index 0000000..efa9357
--- /dev/null
+++ b/tools/designer/examples/sizeaware/sizeaware.h
@@ -0,0 +1,23 @@
+#ifndef SIZEAWARE_H
+#define SIZEAWARE_H
+#include <qdialog.h>
+
+class SizeAware : public QDialog
+{
+ Q_OBJECT
+ Q_PROPERTY( QString company READ company WRITE setCompany )
+ Q_PROPERTY( QString settingsFile READ settingsFile WRITE setSettingsFile )
+public:
+ SizeAware( QDialog *parent = 0, const char *name = 0, bool modal = FALSE );
+ ~SizeAware();
+ void setCompany( QString company ) { m_company = company; }
+ QString company() const { return m_company; }
+ void setSettingsFile( QString settingsFile ) { m_settingsFile = settingsFile; }
+ QString settingsFile() const { return m_settingsFile; }
+public slots:
+ void destroy();
+private:
+ QString m_company;
+ QString m_settingsFile;
+};
+#endif
diff --git a/tools/designer/examples/sizeaware/sizeaware.pro b/tools/designer/examples/sizeaware/sizeaware.pro
new file mode 100644
index 0000000..c223ed7
--- /dev/null
+++ b/tools/designer/examples/sizeaware/sizeaware.pro
@@ -0,0 +1,6 @@
+TEMPLATE = app
+TARGET = sizeaware
+
+CONFIG += qt warn_on release
+SOURCES += sizeaware.cpp main.cpp
+HEADERS += sizeaware.h
diff --git a/tools/designer/examples/vcr/main.cpp b/tools/designer/examples/vcr/main.cpp
new file mode 100644
index 0000000..a848328
--- /dev/null
+++ b/tools/designer/examples/vcr/main.cpp
@@ -0,0 +1,10 @@
+#include <qapplication.h>
+#include "vcr.h"
+
+int main( int argc, char ** argv )
+{
+ QApplication app( argc, argv );
+ Vcr *vcr = new Vcr;
+ vcr->show();
+ return app.exec();
+}
diff --git a/tools/designer/examples/vcr/play.xpm b/tools/designer/examples/vcr/play.xpm
new file mode 100644
index 0000000..8102ed1
--- /dev/null
+++ b/tools/designer/examples/vcr/play.xpm
@@ -0,0 +1,23 @@
+/* XPM */
+static char * play_xpm[] = {
+"16 16 3 1",
+" c None",
+". c #FFFFFF",
+"+ c #000000",
+"................",
+".++.............",
+".++++...........",
+".++++++.........",
+".++++++++.......",
+".++++++++++.....",
+".++++++++++++...",
+".+++++++++++++..",
+".+++++++++++++..",
+".++++++++++++...",
+".++++++++++.....",
+".++++++++.......",
+".++++++.........",
+".++++...........",
+".+++............",
+"................"};
+
diff --git a/tools/designer/examples/vcr/vcr.cpp b/tools/designer/examples/vcr/vcr.cpp
new file mode 100644
index 0000000..1b2bccf
--- /dev/null
+++ b/tools/designer/examples/vcr/vcr.cpp
@@ -0,0 +1,117 @@
+#include "vcr.h"
+#include <qpushbutton.h>
+#include <qlayout.h>
+
+static const char * rewind_xpm[] = {
+"16 16 3 1",
+" c None",
+". c #FFFFFF",
+"+ c #000000",
+"................",
+".++..........++.",
+".++........++++.",
+".++......++++++.",
+".++....++++++++.",
+".++..++++++++++.",
+".++++++++++++++.",
+".++++++++++++++.",
+".++++++++++++++.",
+".++++++++++++++.",
+".++..++++++++++.",
+".++....++++++++.",
+".++......++++++.",
+".++........++++.",
+".++.........+++.",
+"................"};
+
+static const char * play_xpm[] = {
+"16 16 3 1",
+" c None",
+". c #FFFFFF",
+"+ c #000000",
+"................",
+".++.............",
+".++++...........",
+".++++++.........",
+".++++++++.......",
+".++++++++++.....",
+".++++++++++++...",
+".+++++++++++++..",
+".+++++++++++++..",
+".++++++++++++...",
+".++++++++++.....",
+".++++++++.......",
+".++++++.........",
+".++++...........",
+".+++............",
+"................"};
+
+static const char * next_xpm[] = {
+"16 16 3 1",
+" c None",
+". c #FFFFFF",
+"+ c #000000",
+"................",
+".++.....+.......",
+".+++....++......",
+".++++...+++.....",
+".+++++..++++....",
+".++++++.+++++...",
+".+++++++++++++..",
+".++++++++++++++.",
+".++++++++++++++.",
+".+++++++++++++..",
+".++++++.+++++...",
+".+++++..++++....",
+".++++...+++.....",
+".+++....++......",
+".++.....+.......",
+"................"};
+
+static const char * stop_xpm[] = {
+"16 16 3 1",
+" c None",
+". c #FFFFFF",
+"+ c #000000",
+"................",
+".++++++++++++++.",
+".++++++++++++++.",
+".++++++++++++++.",
+".+++........+++.",
+".+++........+++.",
+".+++........+++.",
+".+++........+++.",
+".+++........+++.",
+".+++........+++.",
+".+++........+++.",
+".+++........+++.",
+".++++++++++++++.",
+".++++++++++++++.",
+".++++++++++++++.",
+"................"};
+
+
+Vcr::Vcr( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ QHBoxLayout *layout = new QHBoxLayout( this );
+ layout->setMargin( 0 );
+
+ QPushButton *rewind = new QPushButton( QPixmap( rewind_xpm ), 0, this, "vcr_rewind" );
+ layout->addWidget( rewind );
+ connect( rewind, SIGNAL(clicked()), SIGNAL(rewind()) );
+
+ QPushButton *play = new QPushButton( QPixmap( play_xpm ), 0, this, "vcr_play" );
+ layout->addWidget( play );
+ connect( play, SIGNAL(clicked()), SIGNAL(play()) );
+
+ QPushButton *next = new QPushButton( QPixmap( next_xpm ), 0, this, "vcr_next" );
+ layout->addWidget( next );
+ connect( next, SIGNAL(clicked()), SIGNAL(next()) );
+
+ QPushButton *stop = new QPushButton( QPixmap( stop_xpm ), 0, this, "vcr_stop" );
+ layout->addWidget( stop );
+ connect( stop, SIGNAL(clicked()), SIGNAL(stop()) );
+}
+
+
diff --git a/tools/designer/examples/vcr/vcr.h b/tools/designer/examples/vcr/vcr.h
new file mode 100644
index 0000000..c24086e
--- /dev/null
+++ b/tools/designer/examples/vcr/vcr.h
@@ -0,0 +1,17 @@
+#ifndef VCR_H
+#define VCR_H
+#include <qwidget.h>
+
+class Vcr : public QWidget
+{
+ Q_OBJECT
+public:
+ Vcr( QWidget *parent = 0, const char *name = 0 );
+ ~Vcr() {}
+signals:
+ void rewind();
+ void play();
+ void next();
+ void stop();
+};
+#endif
diff --git a/tools/designer/examples/vcr/vcr.pro b/tools/designer/examples/vcr/vcr.pro
new file mode 100644
index 0000000..8bda690
--- /dev/null
+++ b/tools/designer/examples/vcr/vcr.pro
@@ -0,0 +1,8 @@
+TEMPLATE = app
+LANGUAGE = C++
+TARGET = vcr
+
+CONFIG += qt warn_on release
+SOURCES += vcr.cpp main.cpp
+HEADERS += vcr.h
+DBFILE = vcr.db