diff options
Diffstat (limited to 'tqtinterface/qt4/tools/designer/examples')
142 files changed, 9283 insertions, 0 deletions
diff --git a/tqtinterface/qt4/tools/designer/examples/addressbook/addressbook.pro b/tqtinterface/qt4/tools/designer/examples/addressbook/addressbook.pro new file mode 100644 index 0000000..a658372 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/addressbook/addressbook.pro @@ -0,0 +1,14 @@ +TEMPLATE = app +LANGUAGE = C++ + +CONFIG += qt warn_on release +unix { + UI_DIR = .ui + TQMOC_DIR = .tqmoc + 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/tqtinterface/qt4/tools/designer/examples/addressbook/addressbook.ui b/tqtinterface/qt4/tools/designer/examples/addressbook/addressbook.ui new file mode 100644 index 0000000..27078a6 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/addressbook/addressbook.ui @@ -0,0 +1,324 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>AddressBook</class> +<widget class="TQMainWindow"> + <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="TQListView"> + <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="&File" name="fileMenu"> + <action name="fileNewAction"/> + <action name="fileOpenAction"/> + <action name="fileSaveAction"/> + <action name="fileSaveAsAction"/> + <separator/> + <action name="fileExitAction"/> + </item> + <item text="&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>&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>&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>&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 &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&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>&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> +<Q_SLOTS> + <slot>fileNew()</slot> + <slot>insertAddress( const QString & firstName, const QString & lastName, const QString & phoneNumber, const QString & street, const QString & city, const QString & country, const QString & zipCode )</slot> + <slot>deleteAddress()</slot> + <slot>fileOpen()</slot> + <slot>fileSave()</slot> + <slot>fileSaveAs()</slot> + <slot>fileExit()</slot> + <slot>editFind()</slot> + <slot>searchAddress( const QString & expr )</slot> +</Q_SLOTS> +<pixmapinproject/> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/tqtinterface/qt4/tools/designer/examples/addressbook/addressbook.ui.h b/tqtinterface/qt4/tools/designer/examples/addressbook/addressbook.ui.h new file mode 100644 index 0000000..bd3c218 --- /dev/null +++ b/tqtinterface/qt4/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 Q_SLOTS use TQt 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 <tqfile.h> +#include <tqtextstream.h> +#include <tqfiledialog.h> +#include <tqapplication.h> + +void AddressBook::fileNew() +{ + AddressDetails dia( this, 0, TRUE ); + connect( &dia, TQT_SIGNAL( newAddress( const TQString &, + const TQString &, + const TQString &, + const TQString &, + const TQString &, + const TQString &, + const TQString & ) ), + this, TQT_SLOT( insertAddress( const TQString &, + const TQString &, + const TQString &, + const TQString &, + const TQString &, + const TQString &, + const TQString & ) ) ); + dia.exec(); +} + +void AddressBook::insertAddress( const TQString &firstName, + const TQString &lastName, + const TQString &phoneNumber, + const TQString &street, + const TQString &city, + const TQString &country, + const TQString &zipCode ) +{ + TQListViewItem *i = new TQListViewItem( 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() +{ + TQListViewItemIterator it( addressView ); + while ( it.current() ) { + TQListViewItem *i = it.current(); + ++it; + if ( i->isSelected() ) + delete i; + } +} + +void AddressBook::fileOpen() +{ + addressView->clear(); + TQString fn = TQFileDialog::getOpenFileName(); + if ( fn.isEmpty() ) + return; + currentFileName = fn; + TQFile f( currentFileName ); + if ( !f.open( IO_ReadOnly ) ) + return; + TQTextStream ts( &f ); + + while ( !ts.eof() ) { + TQListViewItem *item = new TQListViewItem( addressView ); + for ( int i = 0; i < 7; ++i ) + item->setText( i, ts.readLine() ); + } + +} + +void AddressBook::fileSave() +{ + if ( currentFileName.isEmpty() ) + fileSaveAs(); + TQFile f( currentFileName ); + if ( !f.open( IO_WriteOnly ) ) + return; + TQTextStream ts( &f ); + + TQListViewItemIterator it( addressView ); + while ( it.current() ) { + for ( int i = 0; i < 7; ++i ) + ts << it.current()->text( i ) << endl; + ++it; + } + + f.close(); +} + +void AddressBook::fileSaveAs() +{ + TQString fn = TQFileDialog::getSaveFileName(); + if ( fn.isEmpty() ) + return; + currentFileName = fn; + fileSave(); +} + +void AddressBook::fileExit() +{ + tqApp->exit(); +} + +void AddressBook::editFind() +{ + SearchDialog dia( this, 0, TRUE ); + connect( &dia, TQT_SIGNAL( searchAddress( const TQString & ) ), + this, TQT_SLOT( searchAddress( const TQString & ) ) ); + dia.exec(); +} + +void AddressBook::searchAddress( const TQString &expr ) +{ + addressView->clearSelection(); + TQListViewItemIterator it( addressView ); + while ( it.current() ) { + for ( int i = 0; i < 7; ++i ) { + if ( it.current()->text( i ).tqfind( expr ) != -1 ) + addressView->setSelected( it.current(), TRUE ); + } + ++it; + } +}
\ No newline at end of file diff --git a/tqtinterface/qt4/tools/designer/examples/addressbook/addressdetails.ui b/tqtinterface/qt4/tools/designer/examples/addressbook/addressdetails.ui new file mode 100644 index 0000000..46963e6 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/addressbook/addressdetails.ui @@ -0,0 +1,243 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>AddressDetails</class> +<widget class="TQDialog"> + <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="TQLayoutWidget"> + <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="TQLabel" row="3" column="0"> + <property name="name"> + <cstring>TextLabel8</cstring> + </property> + <property name="text"> + <string>Street</string> + </property> + </widget> + <widget class="TQLineEdit" row="3" column="1"> + <property name="name"> + <cstring>editStreet</cstring> + </property> + </widget> + <widget class="TQLineEdit" row="2" column="1"> + <property name="name"> + <cstring>editPhoneNumber</cstring> + </property> + </widget> + <widget class="TQLabel" row="4" column="0"> + <property name="name"> + <cstring>TextLabel7</cstring> + </property> + <property name="text"> + <string>City</string> + </property> + </widget> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>Last Name</string> + </property> + </widget> + <widget class="TQLabel" row="2" column="0"> + <property name="name"> + <cstring>TextLabel6</cstring> + </property> + <property name="text"> + <string>Phone Number</string> + </property> + </widget> + <widget class="TQLineEdit" row="5" column="1"> + <property name="name"> + <cstring>editCountry</cstring> + </property> + </widget> + <widget class="TQLabel" row="6" column="0"> + <property name="name"> + <cstring>TextLabel10</cstring> + </property> + <property name="text"> + <string>Zip Code</string> + </property> + </widget> + <widget class="TQLineEdit" row="0" column="1"> + <property name="name"> + <cstring>editLastName</cstring> + </property> + </widget> + <widget class="TQLineEdit" row="6" column="1"> + <property name="name"> + <cstring>editZipCode</cstring> + </property> + </widget> + <widget class="TQLabel" row="1" column="0"> + <property name="name"> + <cstring>TextLabel4</cstring> + </property> + <property name="text"> + <string>First Name</string> + </property> + </widget> + <widget class="TQLineEdit" row="4" column="1"> + <property name="name"> + <cstring>editCity</cstring> + </property> + </widget> + <widget class="TQLabel" row="5" column="0"> + <property name="name"> + <cstring>TextLabel9</cstring> + </property> + <property name="text"> + <string>Country</string> + </property> + </widget> + <widget class="TQLineEdit" 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="tqsizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQLayoutWidget"> + <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="tqsizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButton2</cstring> + </property> + <property name="text"> + <string>OK</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="TQPushButton"> + <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> +<Q_SIGNALS> + <signal>newAddress( const QString &, const QString &, const QString &, const QString &, const QString &, const QString &, const QString & );</signal> +</Q_SIGNALS> +<Q_SLOTS> + <slot>init()</slot> + <slot>okClicked()</slot> +</Q_SLOTS> +<pixmapinproject/> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/tqtinterface/qt4/tools/designer/examples/addressbook/addressdetails.ui.h b/tqtinterface/qt4/tools/designer/examples/addressbook/addressdetails.ui.h new file mode 100644 index 0000000..66047a7 --- /dev/null +++ b/tqtinterface/qt4/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 Q_SLOTS use TQt 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/tqtinterface/qt4/tools/designer/examples/addressbook/images/editcut.png b/tqtinterface/qt4/tools/designer/examples/addressbook/images/editcut.png Binary files differnew file mode 100644 index 0000000..9c7fb3c --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/addressbook/images/editcut.png diff --git a/tqtinterface/qt4/tools/designer/examples/addressbook/images/filenew.png b/tqtinterface/qt4/tools/designer/examples/addressbook/images/filenew.png Binary files differnew file mode 100644 index 0000000..d898107 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/addressbook/images/filenew.png diff --git a/tqtinterface/qt4/tools/designer/examples/addressbook/images/fileopen.png b/tqtinterface/qt4/tools/designer/examples/addressbook/images/fileopen.png Binary files differnew file mode 100644 index 0000000..7e49adb --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/addressbook/images/fileopen.png diff --git a/tqtinterface/qt4/tools/designer/examples/addressbook/images/filesave.png b/tqtinterface/qt4/tools/designer/examples/addressbook/images/filesave.png Binary files differnew file mode 100644 index 0000000..77d9f50 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/addressbook/images/filesave.png diff --git a/tqtinterface/qt4/tools/designer/examples/addressbook/images/searchfind.png b/tqtinterface/qt4/tools/designer/examples/addressbook/images/searchfind.png Binary files differnew file mode 100644 index 0000000..f18b029 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/addressbook/images/searchfind.png diff --git a/tqtinterface/qt4/tools/designer/examples/addressbook/main.cpp b/tqtinterface/qt4/tools/designer/examples/addressbook/main.cpp new file mode 100644 index 0000000..57c9ced --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/addressbook/main.cpp @@ -0,0 +1,11 @@ +#include <tqapplication.h> +#include "addressbook.h" + +int main( int argc, char ** argv ) +{ + TQApplication a( argc, argv ); + AddressBook *w = new AddressBook; + w->show(); + a.connect( &a, TQT_SIGNAL( lastWindowClosed() ), &a, TQT_SLOT( quit() ) ); + return a.exec(); +} diff --git a/tqtinterface/qt4/tools/designer/examples/addressbook/search.ui b/tqtinterface/qt4/tools/designer/examples/addressbook/search.ui new file mode 100644 index 0000000..4dd1386 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/addressbook/search.ui @@ -0,0 +1,136 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>SearchDialog</class> +<widget class="TQDialog"> + <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="TQLayoutWidget"> + <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="TQLabel"> + <property name="name"> + <cstring>TextLabel12</cstring> + </property> + <property name="text"> + <string>Search</string> + </property> + </widget> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>editSearch</cstring> + </property> + </widget> + </hbox> + </widget> + <widget class="TQLayoutWidget"> + <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="tqsizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButton4</cstring> + </property> + <property name="text"> + <string>Search</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="TQPushButton"> + <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> +<Q_SIGNALS> + <signal>searchAddress( const QString & )</signal> +</Q_SIGNALS> +<Q_SLOTS> + <slot>search()</slot> +</Q_SLOTS> +<pixmapinproject/> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/tqtinterface/qt4/tools/designer/examples/addressbook/search.ui.h b/tqtinterface/qt4/tools/designer/examples/addressbook/search.ui.h new file mode 100644 index 0000000..47cab31 --- /dev/null +++ b/tqtinterface/qt4/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 Q_SLOTS use TQt 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/tqtinterface/qt4/tools/designer/examples/book/book.sql b/tqtinterface/qt4/tools/designer/examples/book/book.sql new file mode 100644 index 0000000..a92daac --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book.sql @@ -0,0 +1,42 @@ +-- The following SQL generates the database +-- used by the 'book' example programs +--** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +-- +-- 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/tqtinterface/qt4/tools/designer/examples/book/book1/book.ui b/tqtinterface/qt4/tools/designer/examples/book/book1/book.ui new file mode 100644 index 0000000..40fac0e --- /dev/null +++ b/tqtinterface/qt4/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="TQDialog"> + <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="TQDataTable"> + <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/tqtinterface/qt4/tools/designer/examples/book/book1/book.ui.h b/tqtinterface/qt4/tools/designer/examples/book/book1/book.ui.h new file mode 100644 index 0000000..d727860 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book1/book.ui.h @@ -0,0 +1,5 @@ +void BookForm::primeInsertAuthor( TQSqlRecord * ) +{ + +} + diff --git a/tqtinterface/qt4/tools/designer/examples/book/book1/book1.pro b/tqtinterface/qt4/tools/designer/examples/book/book1/book1.pro new file mode 100644 index 0000000..a7e1f7b --- /dev/null +++ b/tqtinterface/qt4/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/tqtinterface/qt4/tools/designer/examples/book/book1/main.cpp b/tqtinterface/qt4/tools/designer/examples/book/book1/main.cpp new file mode 100644 index 0000000..d244790 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book1/main.cpp @@ -0,0 +1,27 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#include <tqapplication.h> +#include <tqsqldatabase.h> +#include "book.h" +#include "../connection.h" + +int main( int argc, char *argv[] ) +{ + TQApplication app( argc, argv ); + + if ( ! createConnections() ) + return 1; + + BookForm bookForm; + app.setMainWidget( &bookForm ); + bookForm.show(); + + return app.exec(); +} diff --git a/tqtinterface/qt4/tools/designer/examples/book/book2/book.ui b/tqtinterface/qt4/tools/designer/examples/book/book2/book.ui new file mode 100644 index 0000000..1e91d13 --- /dev/null +++ b/tqtinterface/qt4/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="TQDialog"> + <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="TQDataTable"> + <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/tqtinterface/qt4/tools/designer/examples/book/book2/book.ui.h b/tqtinterface/qt4/tools/designer/examples/book/book2/book.ui.h new file mode 100644 index 0000000..3295581 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book2/book.ui.h @@ -0,0 +1,10 @@ +void BookForm::primeInsertAuthor( TQSqlRecord * buffer ) +{ + TQSqlQuery 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/tqtinterface/qt4/tools/designer/examples/book/book2/book2.pro b/tqtinterface/qt4/tools/designer/examples/book/book2/book2.pro new file mode 100644 index 0000000..a7e1f7b --- /dev/null +++ b/tqtinterface/qt4/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/tqtinterface/qt4/tools/designer/examples/book/book2/main.cpp b/tqtinterface/qt4/tools/designer/examples/book/book2/main.cpp new file mode 100644 index 0000000..d244790 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book2/main.cpp @@ -0,0 +1,27 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#include <tqapplication.h> +#include <tqsqldatabase.h> +#include "book.h" +#include "../connection.h" + +int main( int argc, char *argv[] ) +{ + TQApplication app( argc, argv ); + + if ( ! createConnections() ) + return 1; + + BookForm bookForm; + app.setMainWidget( &bookForm ); + bookForm.show(); + + return app.exec(); +} diff --git a/tqtinterface/qt4/tools/designer/examples/book/book3/book.ui b/tqtinterface/qt4/tools/designer/examples/book/book3/book.ui new file mode 100644 index 0000000..ece1235 --- /dev/null +++ b/tqtinterface/qt4/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="TQDialog"> + <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="TQSplitter"> + <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="TQDataTable"> + <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="TQDataTable"> + <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/tqtinterface/qt4/tools/designer/examples/book/book3/book.ui.h b/tqtinterface/qt4/tools/designer/examples/book/book3/book.ui.h new file mode 100644 index 0000000..707ee90 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book3/book.ui.h @@ -0,0 +1,16 @@ +void BookForm::newCurrentAuthor( TQSqlRecord *author ) +{ + BookDataTable->setFilter( "authorid=" + author->value( "id" ).toString() ); + BookDataTable->refresh(); +} + +void BookForm::primeInsertAuthor( TQSqlRecord *buffer ) +{ + TQSqlQuery 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/tqtinterface/qt4/tools/designer/examples/book/book3/book3.pro b/tqtinterface/qt4/tools/designer/examples/book/book3/book3.pro new file mode 100644 index 0000000..a7e1f7b --- /dev/null +++ b/tqtinterface/qt4/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/tqtinterface/qt4/tools/designer/examples/book/book3/main.cpp b/tqtinterface/qt4/tools/designer/examples/book/book3/main.cpp new file mode 100644 index 0000000..1e0f042 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book3/main.cpp @@ -0,0 +1,27 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#include <tqapplication.h> +#include <tqsqldatabase.h> +#include "book.h" +#include "../connection.h" + +int main( int argc, char *argv[] ) +{ + TQApplication app( argc, argv ); + + if ( ! createConnections() ) + return 1; + + BookForm bookForm; + app.setMainWidget( &bookForm ); + bookForm.show(); + + return app.exec(); +} diff --git a/tqtinterface/qt4/tools/designer/examples/book/book4/book.ui b/tqtinterface/qt4/tools/designer/examples/book/book4/book.ui new file mode 100644 index 0000000..d39d271 --- /dev/null +++ b/tqtinterface/qt4/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="TQDialog"> + <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="TQSplitter"> + <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="TQDataTable"> + <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="TQDataTable"> + <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="TQLayoutWidget"> + <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="TQPushButton"> + <property name="name"> + <cstring>EditPushButton</cstring> + </property> + <property name="text"> + <string>&Edit Books</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>QuitPushButton</cstring> + </property> + <property name="text"> + <string>&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/tqtinterface/qt4/tools/designer/examples/book/book4/book.ui.h b/tqtinterface/qt4/tools/designer/examples/book/book4/book.ui.h new file mode 100644 index 0000000..730cafe --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book4/book.ui.h @@ -0,0 +1,16 @@ +void BookForm::newCurrentAuthor( TQSqlRecord * author ) +{ + BookDataTable->setFilter( "authorid=" + author->value( "id" ).toString() ); + BookDataTable->refresh(); +} + +void BookForm::primeInsertAuthor( TQSqlRecord * buffer ) +{ + TQSqlQuery 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/tqtinterface/qt4/tools/designer/examples/book/book4/book4.pro b/tqtinterface/qt4/tools/designer/examples/book/book4/book4.pro new file mode 100644 index 0000000..a7e1f7b --- /dev/null +++ b/tqtinterface/qt4/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/tqtinterface/qt4/tools/designer/examples/book/book4/main.cpp b/tqtinterface/qt4/tools/designer/examples/book/book4/main.cpp new file mode 100644 index 0000000..f611d3d --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book4/main.cpp @@ -0,0 +1,29 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#include <tqapplication.h> +#include <tqsqldatabase.h> +#include "book.h" +#include "../connection.h" + +int main( int argc, char *argv[] ) +{ + TQApplication app( argc, argv ); + + if ( ! createConnections() ) + return 1; + + BookForm bookForm; + app.setMainWidget( &bookForm ); + bookForm.show(); + + return app.exec(); +} + + diff --git a/tqtinterface/qt4/tools/designer/examples/book/book5/book.ui b/tqtinterface/qt4/tools/designer/examples/book/book5/book.ui new file mode 100644 index 0000000..399e7fd --- /dev/null +++ b/tqtinterface/qt4/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="TQDialog"> + <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="TQSplitter"> + <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="TQDataTable"> + <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="TQDataTable"> + <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="TQLayoutWidget"> + <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="TQPushButton"> + <property name="name"> + <cstring>EditPushButton</cstring> + </property> + <property name="text"> + <string>&Edit Books</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>QuitPushButton</cstring> + </property> + <property name="text"> + <string>&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/tqtinterface/qt4/tools/designer/examples/book/book5/book.ui.h b/tqtinterface/qt4/tools/designer/examples/book/book5/book.ui.h new file mode 100644 index 0000000..c41fa17 --- /dev/null +++ b/tqtinterface/qt4/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( TQSqlRecord *author ) +{ + BookDataTable->setFilter( "authorid=" + author->value( "id" ).toString() ); + BookDataTable->refresh(); +} + +void BookForm::primeInsertAuthor( TQSqlRecord *buffer ) +{ + TQSqlQuery 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/tqtinterface/qt4/tools/designer/examples/book/book5/book5.pro b/tqtinterface/qt4/tools/designer/examples/book/book5/book5.pro new file mode 100644 index 0000000..030db5f --- /dev/null +++ b/tqtinterface/qt4/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/tqtinterface/qt4/tools/designer/examples/book/book5/editbook.ui b/tqtinterface/qt4/tools/designer/examples/book/book5/editbook.ui new file mode 100644 index 0000000..70a6df0 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book5/editbook.ui @@ -0,0 +1,291 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>EditBookForm</class> +<widget class="TQDialog"> + <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="TQDataBrowser"> + <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="TQLayoutWidget" 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="TQLabel" row="1" column="0"> + <property name="name"> + <cstring>labelPrice</cstring> + </property> + <property name="text"> + <string>Price</string> + </property> + </widget> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>labelTitle</cstring> + </property> + <property name="text"> + <string>Title</string> + </property> + </widget> + <widget class="TQLineEdit" 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="TQLineEdit" 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="TQLayoutWidget" 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="TQPushButton"> + <property name="name"> + <cstring>PushButtonFirst</cstring> + </property> + <property name="text"> + <string>|< &First</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonPrev</cstring> + </property> + <property name="text"> + <string><< &Prev</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonNext</cstring> + </property> + <property name="text"> + <string>&Next >></string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonLast</cstring> + </property> + <property name="text"> + <string>&Last >|</string> + </property> + </widget> + </hbox> + </widget> + <widget class="TQLayoutWidget" 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="TQPushButton"> + <property name="name"> + <cstring>PushButtonInsert</cstring> + </property> + <property name="text"> + <string>&Insert</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonUpdate</cstring> + </property> + <property name="text"> + <string>&Update</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonDelete</cstring> + </property> + <property name="text"> + <string>&Delete</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonClose</cstring> + </property> + <property name="text"> + <string>&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> +<Q_SLOTS> + <slot>init()</slot> + <slot>destroy()</slot> +</Q_SLOTS> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/tqtinterface/qt4/tools/designer/examples/book/book5/editbook.ui.h b/tqtinterface/qt4/tools/designer/examples/book/book5/editbook.ui.h new file mode 100644 index 0000000..4a8a636 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book5/editbook.ui.h @@ -0,0 +1,10 @@ +void EditBookForm::init() +{ + +} + +void EditBookForm::destroy() +{ + +} + diff --git a/tqtinterface/qt4/tools/designer/examples/book/book5/main.cpp b/tqtinterface/qt4/tools/designer/examples/book/book5/main.cpp new file mode 100644 index 0000000..d244790 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book5/main.cpp @@ -0,0 +1,27 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#include <tqapplication.h> +#include <tqsqldatabase.h> +#include "book.h" +#include "../connection.h" + +int main( int argc, char *argv[] ) +{ + TQApplication app( argc, argv ); + + if ( ! createConnections() ) + return 1; + + BookForm bookForm; + app.setMainWidget( &bookForm ); + bookForm.show(); + + return app.exec(); +} diff --git a/tqtinterface/qt4/tools/designer/examples/book/book6/book.ui b/tqtinterface/qt4/tools/designer/examples/book/book6/book.ui new file mode 100644 index 0000000..9fc5992 --- /dev/null +++ b/tqtinterface/qt4/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="TQDialog"> + <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="TQSplitter"> + <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="TQDataTable"> + <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="TQDataTable"> + <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="TQLayoutWidget"> + <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="TQPushButton"> + <property name="name"> + <cstring>EditPushButton</cstring> + </property> + <property name="text"> + <string>&Edit Books</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>QuitPushButton</cstring> + </property> + <property name="text"> + <string>&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/tqtinterface/qt4/tools/designer/examples/book/book6/book.ui.h b/tqtinterface/qt4/tools/designer/examples/book/book6/book.ui.h new file mode 100644 index 0000000..fe0b39d --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book6/book.ui.h @@ -0,0 +1,33 @@ +void BookForm::editClicked() +{ + EditBookForm *dialog = new EditBookForm( this, "Edit Book Form", TRUE ); + TQSqlCursor cur( "book" ); + dialog->BookDataBrowser->setSqlCursor( &cur ); + dialog->BookDataBrowser->setFilter( BookDataTable->filter() ); + dialog->BookDataBrowser->setSort(TQSqlIndex::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( TQSqlRecord * author ) +{ + BookDataTable->setFilter( "authorid=" + author->value( "id" ).toString() ); + BookDataTable->refresh(); +} + +void BookForm::primeInsertAuthor( TQSqlRecord * buffer ) +{ + TQSqlQuery 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/tqtinterface/qt4/tools/designer/examples/book/book6/book6.pro b/tqtinterface/qt4/tools/designer/examples/book/book6/book6.pro new file mode 100644 index 0000000..030db5f --- /dev/null +++ b/tqtinterface/qt4/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/tqtinterface/qt4/tools/designer/examples/book/book6/editbook.ui b/tqtinterface/qt4/tools/designer/examples/book/book6/editbook.ui new file mode 100644 index 0000000..abbab27 --- /dev/null +++ b/tqtinterface/qt4/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="TQDialog"> + <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="TQDataBrowser"> + <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="TQLayoutWidget" 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="TQLabel" row="1" column="0"> + <property name="name"> + <cstring>labelPrice</cstring> + </property> + <property name="text"> + <string>Price</string> + </property> + </widget> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>labelTitle</cstring> + </property> + <property name="text"> + <string>Title</string> + </property> + </widget> + <widget class="TQLineEdit" 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="TQLineEdit" 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="TQLayoutWidget" 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="TQPushButton"> + <property name="name"> + <cstring>PushButtonFirst</cstring> + </property> + <property name="text"> + <string>|< &First</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonPrev</cstring> + </property> + <property name="text"> + <string><< &Prev</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonNext</cstring> + </property> + <property name="text"> + <string>&Next >></string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonLast</cstring> + </property> + <property name="text"> + <string>&Last >|</string> + </property> + </widget> + </hbox> + </widget> + <widget class="TQLayoutWidget" 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="TQPushButton"> + <property name="name"> + <cstring>PushButtonInsert</cstring> + </property> + <property name="text"> + <string>&Insert</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonUpdate</cstring> + </property> + <property name="text"> + <string>&Update</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonDelete</cstring> + </property> + <property name="text"> + <string>&Delete</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonClose</cstring> + </property> + <property name="text"> + <string>&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/tqtinterface/qt4/tools/designer/examples/book/book6/editbook.ui.h b/tqtinterface/qt4/tools/designer/examples/book/book6/editbook.ui.h new file mode 100644 index 0000000..28d5035 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book6/editbook.ui.h @@ -0,0 +1,10 @@ +void EditBookForm::primeInsertBook( TQSqlRecord * buffer ) +{ + TQSqlQuery 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/tqtinterface/qt4/tools/designer/examples/book/book6/main.cpp b/tqtinterface/qt4/tools/designer/examples/book/book6/main.cpp new file mode 100644 index 0000000..d244790 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book6/main.cpp @@ -0,0 +1,27 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#include <tqapplication.h> +#include <tqsqldatabase.h> +#include "book.h" +#include "../connection.h" + +int main( int argc, char *argv[] ) +{ + TQApplication app( argc, argv ); + + if ( ! createConnections() ) + return 1; + + BookForm bookForm; + app.setMainWidget( &bookForm ); + bookForm.show(); + + return app.exec(); +} diff --git a/tqtinterface/qt4/tools/designer/examples/book/book7/book.ui b/tqtinterface/qt4/tools/designer/examples/book/book7/book.ui new file mode 100644 index 0000000..cc6f1d8 --- /dev/null +++ b/tqtinterface/qt4/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="TQDialog"> + <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="TQSplitter"> + <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="TQDataTable"> + <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="TQDataTable"> + <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="TQLayoutWidget"> + <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="TQPushButton"> + <property name="name"> + <cstring>EditPushButton</cstring> + </property> + <property name="text"> + <string>&Edit Books</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>QuitPushButton</cstring> + </property> + <property name="text"> + <string>&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/tqtinterface/qt4/tools/designer/examples/book/book7/book.ui.h b/tqtinterface/qt4/tools/designer/examples/book/book7/book.ui.h new file mode 100644 index 0000000..1cb2f0b --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book7/book.ui.h @@ -0,0 +1,33 @@ +void BookForm::editClicked() +{ + EditBookForm *dialog = new EditBookForm( this, "Edit Book Form", TRUE ); + TQSqlCursor cur( "book" ); + dialog->BookDataBrowser->setSqlCursor( &cur ); + dialog->BookDataBrowser->setFilter( BookDataTable->filter() ); + dialog->BookDataBrowser->setSort(TQSqlIndex::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( TQSqlRecord *author ) +{ + BookDataTable->setFilter( "authorid=" + author->value( "id" ).toString() ); + BookDataTable->refresh(); +} + +void BookForm::primeInsertAuthor( TQSqlRecord *buffer ) +{ + TQSqlQuery 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/tqtinterface/qt4/tools/designer/examples/book/book7/book7.pro b/tqtinterface/qt4/tools/designer/examples/book/book7/book7.pro new file mode 100644 index 0000000..22c7e9b --- /dev/null +++ b/tqtinterface/qt4/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/tqtinterface/qt4/tools/designer/examples/book/book7/editbook.ui b/tqtinterface/qt4/tools/designer/examples/book/book7/editbook.ui new file mode 100644 index 0000000..c8bf0bf --- /dev/null +++ b/tqtinterface/qt4/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="TQDialog"> + <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="TQDataBrowser"> + <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="TQLayoutWidget" 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="TQLabel" row="1" column="0"> + <property name="name"> + <cstring>labelPrice</cstring> + </property> + <property name="text"> + <string>Price</string> + </property> + </widget> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>labelTitle</cstring> + </property> + <property name="text"> + <string>Title</string> + </property> + </widget> + <widget class="TQLineEdit" 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="TQLineEdit" 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="TQLayoutWidget" 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="TQPushButton"> + <property name="name"> + <cstring>PushButtonInsert</cstring> + </property> + <property name="text"> + <string>&Insert</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonUpdate</cstring> + </property> + <property name="text"> + <string>&Update</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonDelete</cstring> + </property> + <property name="text"> + <string>&Delete</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonClose</cstring> + </property> + <property name="text"> + <string>&Close</string> + </property> + </widget> + </hbox> + </widget> + <widget class="TQLayoutWidget" 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="TQPushButton"> + <property name="name"> + <cstring>PushButtonFirst</cstring> + </property> + <property name="text"> + <string>|< &First</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonPrev</cstring> + </property> + <property name="text"> + <string><< &Prev</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonNext</cstring> + </property> + <property name="text"> + <string>&Next >></string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonLast</cstring> + </property> + <property name="text"> + <string>&Last >|</string> + </property> + </widget> + </hbox> + </widget> + <widget class="TQLayoutWidget" 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="TQLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>Author</string> + </property> + </widget> + <widget class="TQComboBox"> + <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/tqtinterface/qt4/tools/designer/examples/book/book7/editbook.ui.h b/tqtinterface/qt4/tools/designer/examples/book/book7/editbook.ui.h new file mode 100644 index 0000000..0bedf8b --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book7/editbook.ui.h @@ -0,0 +1,42 @@ +void EditBookForm::init() +{ + TQSqlQuery query( "SELECT surname FROM author ORDER BY surname;" ); + while ( query.next() ) + ComboBoxAuthor->insertItem( query.value( 0 ).toString()); +} + +void EditBookForm::beforeUpdateBook( TQSqlRecord * buffer ) +{ + TQSqlQuery query( "SELECT id FROM author WHERE surname ='" + + ComboBoxAuthor->currentText() + "';" ); + if ( query.next() ) + buffer->setValue( "authorid", query.value( 0 ) ); +} + +void EditBookForm::primeInsertBook( TQSqlRecord * buffer ) +{ + TQSqlQuery 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( TQSqlRecord * buffer ) +{ + // Who is this book's author? + TQSqlQuery query( "SELECT surname FROM author WHERE id='" + + buffer->value( "authorid" ).toString() + "';" ); + TQString 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/tqtinterface/qt4/tools/designer/examples/book/book7/main.cpp b/tqtinterface/qt4/tools/designer/examples/book/book7/main.cpp new file mode 100644 index 0000000..d244790 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book7/main.cpp @@ -0,0 +1,27 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#include <tqapplication.h> +#include <tqsqldatabase.h> +#include "book.h" +#include "../connection.h" + +int main( int argc, char *argv[] ) +{ + TQApplication app( argc, argv ); + + if ( ! createConnections() ) + return 1; + + BookForm bookForm; + app.setMainWidget( &bookForm ); + bookForm.show(); + + return app.exec(); +} diff --git a/tqtinterface/qt4/tools/designer/examples/book/book8/book.ui b/tqtinterface/qt4/tools/designer/examples/book/book8/book.ui new file mode 100644 index 0000000..cc6f1d8 --- /dev/null +++ b/tqtinterface/qt4/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="TQDialog"> + <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="TQSplitter"> + <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="TQDataTable"> + <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="TQDataTable"> + <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="TQLayoutWidget"> + <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="TQPushButton"> + <property name="name"> + <cstring>EditPushButton</cstring> + </property> + <property name="text"> + <string>&Edit Books</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>QuitPushButton</cstring> + </property> + <property name="text"> + <string>&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/tqtinterface/qt4/tools/designer/examples/book/book8/book.ui.h b/tqtinterface/qt4/tools/designer/examples/book/book8/book.ui.h new file mode 100644 index 0000000..24bb69c --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book8/book.ui.h @@ -0,0 +1,33 @@ +void BookForm::editClicked() +{ + EditBookForm *dialog = new EditBookForm( this, "Edit Book Form", TRUE ); + TQSqlCursor cur( "book" ); + dialog->BookDataBrowser->setSqlCursor( &cur ); + dialog->BookDataBrowser->setFilter( BookDataTable->filter() ); + dialog->BookDataBrowser->setSort(TQSqlIndex::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( TQSqlRecord *author ) +{ + BookDataTable->setFilter( "authorid=" + author->value( "id" ).toString() ); + BookDataTable->refresh(); +} + +void BookForm::primeInsertAuthor( TQSqlRecord *buffer ) +{ + TQSqlQuery 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/tqtinterface/qt4/tools/designer/examples/book/book8/book8.pro b/tqtinterface/qt4/tools/designer/examples/book/book8/book8.pro new file mode 100644 index 0000000..e4bdf75 --- /dev/null +++ b/tqtinterface/qt4/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/tqtinterface/qt4/tools/designer/examples/book/book8/editbook.ui b/tqtinterface/qt4/tools/designer/examples/book/book8/editbook.ui new file mode 100644 index 0000000..f4c2cba --- /dev/null +++ b/tqtinterface/qt4/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<QString,int> authorMap;</variable> +<layoutdefaults spacing="6" margin="11"/> +<widget class="TQDialog"> + <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="TQDataBrowser"> + <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="TQLayoutWidget" 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="TQLabel" row="1" column="0"> + <property name="name"> + <cstring>labelPrice</cstring> + </property> + <property name="text"> + <string>Price</string> + </property> + </widget> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>labelTitle</cstring> + </property> + <property name="text"> + <string>Title</string> + </property> + </widget> + <widget class="TQLineEdit" 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="TQLineEdit" 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="TQLayoutWidget" 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="TQPushButton"> + <property name="name"> + <cstring>PushButtonInsert</cstring> + </property> + <property name="text"> + <string>&Insert</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonUpdate</cstring> + </property> + <property name="text"> + <string>&Update</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonDelete</cstring> + </property> + <property name="text"> + <string>&Delete</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonClose</cstring> + </property> + <property name="text"> + <string>&Close</string> + </property> + </widget> + </hbox> + </widget> + <widget class="TQLayoutWidget" 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="TQPushButton"> + <property name="name"> + <cstring>PushButtonFirst</cstring> + </property> + <property name="text"> + <string>|< &First</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonPrev</cstring> + </property> + <property name="text"> + <string><< &Prev</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonNext</cstring> + </property> + <property name="text"> + <string>&Next >></string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>PushButtonLast</cstring> + </property> + <property name="text"> + <string>&Last >|</string> + </property> + </widget> + </hbox> + </widget> + <widget class="TQLayoutWidget" 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="TQLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>Author</string> + </property> + </widget> + <widget class="TQComboBox"> + <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 & name, int & 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/tqtinterface/qt4/tools/designer/examples/book/book8/editbook.ui.h b/tqtinterface/qt4/tools/designer/examples/book/book8/editbook.ui.h new file mode 100644 index 0000000..12e6eb6 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book8/editbook.ui.h @@ -0,0 +1,47 @@ +void EditBookForm::init() +{ + TQSqlQuery 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( TQSqlRecord * buffer ) +{ + int id; + mapAuthor( ComboBoxAuthor->currentText(), id, FALSE ); + buffer->setValue( "authorid", id ); +} + +void EditBookForm::mapAuthor( const TQString & name, int & id, bool populate ) +{ + if ( populate ) + authorMap[ name ] = id; + else + id = authorMap[ name ]; +} + +void EditBookForm::primeInsertBook( TQSqlRecord * buffer ) +{ + TQSqlQuery 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( TQSqlRecord * buffer ) +{ + int id = buffer->value( "authorid" ).toInt(); + for ( int i = 0; i < ComboBoxAuthor->count(); i++ ) { + TQString author = ComboBoxAuthor->text( i ); + if ( authorMap.tqcontains( author ) && authorMap[author] == id ) { + ComboBoxAuthor->setCurrentItem( i ) ; + break; + } + } +} + diff --git a/tqtinterface/qt4/tools/designer/examples/book/book8/main.cpp b/tqtinterface/qt4/tools/designer/examples/book/book8/main.cpp new file mode 100644 index 0000000..d244790 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/book8/main.cpp @@ -0,0 +1,27 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#include <tqapplication.h> +#include <tqsqldatabase.h> +#include "book.h" +#include "../connection.h" + +int main( int argc, char *argv[] ) +{ + TQApplication app( argc, argv ); + + if ( ! createConnections() ) + return 1; + + BookForm bookForm; + app.setMainWidget( &bookForm ); + bookForm.show(); + + return app.exec(); +} diff --git a/tqtinterface/qt4/tools/designer/examples/book/connection.cpp b/tqtinterface/qt4/tools/designer/examples/book/connection.cpp new file mode 100644 index 0000000..190d4fc --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/connection.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ +#include <tqsqldatabase.h> +#include "connection.h" + +bool createConnections() +{ + // create the default database connection + TQSqlDatabase *defaultDB = TQSqlDatabase::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; + } + + TQSqlQuery q(TQString(), 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/tqtinterface/qt4/tools/designer/examples/book/connection.h b/tqtinterface/qt4/tools/designer/examples/book/connection.h new file mode 100644 index 0000000..dc71cb4 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/book/connection.h @@ -0,0 +1,18 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +// Add your own connection parameters here +#define DB_BOOKS_DRIVER "TQSQLITE" +#define DB_BOOKS ":memory:" +#define DB_BOOKS_USER "" +#define DB_BOOKS_PASSWD "" +#define DB_BOOKS_HOST "" + +bool createConnections(); + diff --git a/tqtinterface/qt4/tools/designer/examples/colortool/colornameform.ui b/tqtinterface/qt4/tools/designer/examples/colortool/colornameform.ui new file mode 100644 index 0000000..6a5a1f1 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/colortool/colornameform.ui @@ -0,0 +1,168 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>ColorNameForm</class> +<widget class="TQDialog"> + <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="TQLabel"> + <property name="name"> + <cstring>colorLabel</cstring> + </property> + <property name="tqminimumSize"> + <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="TQLayoutWidget"> + <property name="name"> + <cstring>Layout4</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>&Name</string> + </property> + <property name="buddy" stdset="0"> + <cstring>colorLineEdit</cstring> + </property> + </widget> + <widget class="TQLineEdit"> + <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="tqsizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="TQLayoutWidget"> + <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="tqsizeHint"> + <size> + <width>0</width> + <height>11</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>okPushButton</cstring> + </property> + <property name="text"> + <string>OK</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="TQPushButton"> + <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> +<Q_SLOTS> + <slot>validate()</slot> +</Q_SLOTS> +<functions> + <function>setColors( const QMap<QString, QColor> & colors )</function> +</functions> +<pixmapinproject/> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/tqtinterface/qt4/tools/designer/examples/colortool/colornameform.ui.h b/tqtinterface/qt4/tools/designer/examples/colortool/colornameform.ui.h new file mode 100644 index 0000000..8c50277 --- /dev/null +++ b/tqtinterface/qt4/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 TQt 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 <tqcolor.h> +#include <tqmap.h> +#include <tqstring.h> + +TQMap<TQString,TQColor> m_colors; + +void ColorNameForm::setColors( const TQMap<TQString,TQColor>& colors ) +{ + m_colors = colors; +} + +void ColorNameForm::validate() +{ + TQString name = colorLineEdit->text(); + if ( ! name.isEmpty() && + ( m_colors.isEmpty() || ! m_colors.tqcontains( name ) ) ) + accept(); + else + colorLineEdit->selectAll(); +} diff --git a/tqtinterface/qt4/tools/designer/examples/colortool/colortool.pro b/tqtinterface/qt4/tools/designer/examples/colortool/colortool.pro new file mode 100644 index 0000000..81945eb --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/colortool/colortool.pro @@ -0,0 +1,27 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += main.cpp +unix { + UI_DIR = .ui + TQMOC_DIR = .tqmoc + 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/tqtinterface/qt4/tools/designer/examples/colortool/findform.ui b/tqtinterface/qt4/tools/designer/examples/colortool/findform.ui new file mode 100644 index 0000000..2863f02 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/colortool/findform.ui @@ -0,0 +1,141 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>FindForm</class> +<widget class="TQDialog"> + <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="TQLayoutWidget"> + <property name="name"> + <cstring>Layout11</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>TextLabel3</cstring> + </property> + <property name="text"> + <string>&Look for</string> + </property> + <property name="buddy" stdset="0"> + <cstring>tqfindLineEdit</cstring> + </property> + </widget> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>tqfindLineEdit</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="tqsizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="TQLayoutWidget"> + <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="tqsizeHint"> + <size> + <width>0</width> + <height>9</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>tqfindPushButton</cstring> + </property> + <property name="text"> + <string>&Find</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="TQPushButton"> + <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>tqfindPushButton</sender> + <signal>clicked()</signal> + <receiver>FindForm</receiver> + <slot>tqfind()</slot> + </connection> +</connections> +<includes> + <include location="local" impldecl="in implementation">findform.ui.h</include> +</includes> +<Q_SIGNALS> + <signal>lookfor(const QString&)</signal> +</Q_SIGNALS> +<Q_SLOTS> + <slot>tqfind()</slot> +</Q_SLOTS> +<functions> + <function>notfound()</function> +</functions> +<pixmapinproject/> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/tqtinterface/qt4/tools/designer/examples/colortool/findform.ui.h b/tqtinterface/qt4/tools/designer/examples/colortool/findform.ui.h new file mode 100644 index 0000000..1f6e6b9 --- /dev/null +++ b/tqtinterface/qt4/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 TQt 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::tqfind() +{ + emit lookfor( tqfindLineEdit->text() ); +} + +void FindForm::notfound() +{ + tqfindLineEdit->selectAll(); +} diff --git a/tqtinterface/qt4/tools/designer/examples/colortool/images/editcopy.png b/tqtinterface/qt4/tools/designer/examples/colortool/images/editcopy.png Binary files differnew file mode 100644 index 0000000..abfe86e --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/colortool/images/editcopy.png diff --git a/tqtinterface/qt4/tools/designer/examples/colortool/images/editcut.png b/tqtinterface/qt4/tools/designer/examples/colortool/images/editcut.png Binary files differnew file mode 100644 index 0000000..2d179bc --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/colortool/images/editcut.png diff --git a/tqtinterface/qt4/tools/designer/examples/colortool/images/editraise.png b/tqtinterface/qt4/tools/designer/examples/colortool/images/editraise.png Binary files differnew file mode 100644 index 0000000..0241568 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/colortool/images/editraise.png diff --git a/tqtinterface/qt4/tools/designer/examples/colortool/images/filenew.png b/tqtinterface/qt4/tools/designer/examples/colortool/images/filenew.png Binary files differnew file mode 100644 index 0000000..9853d97 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/colortool/images/filenew.png diff --git a/tqtinterface/qt4/tools/designer/examples/colortool/images/fileopen.png b/tqtinterface/qt4/tools/designer/examples/colortool/images/fileopen.png Binary files differnew file mode 100644 index 0000000..85dab43 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/colortool/images/fileopen.png diff --git a/tqtinterface/qt4/tools/designer/examples/colortool/images/filesave.png b/tqtinterface/qt4/tools/designer/examples/colortool/images/filesave.png Binary files differnew file mode 100644 index 0000000..21309aa --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/colortool/images/filesave.png diff --git a/tqtinterface/qt4/tools/designer/examples/colortool/images/iconview.png b/tqtinterface/qt4/tools/designer/examples/colortool/images/iconview.png Binary files differnew file mode 100644 index 0000000..d755399 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/colortool/images/iconview.png diff --git a/tqtinterface/qt4/tools/designer/examples/colortool/images/richtextedit.png b/tqtinterface/qt4/tools/designer/examples/colortool/images/richtextedit.png Binary files differnew file mode 100644 index 0000000..9f75c25 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/colortool/images/richtextedit.png diff --git a/tqtinterface/qt4/tools/designer/examples/colortool/images/searchfind.png b/tqtinterface/qt4/tools/designer/examples/colortool/images/searchfind.png Binary files differnew file mode 100644 index 0000000..8f7d8ad --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/colortool/images/searchfind.png diff --git a/tqtinterface/qt4/tools/designer/examples/colortool/images/table.png b/tqtinterface/qt4/tools/designer/examples/colortool/images/table.png Binary files differnew file mode 100644 index 0000000..4491b6e --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/colortool/images/table.png diff --git a/tqtinterface/qt4/tools/designer/examples/colortool/images/tabwidget.png b/tqtinterface/qt4/tools/designer/examples/colortool/images/tabwidget.png Binary files differnew file mode 100644 index 0000000..3a16044 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/colortool/images/tabwidget.png diff --git a/tqtinterface/qt4/tools/designer/examples/colortool/images/widgetstack.png b/tqtinterface/qt4/tools/designer/examples/colortool/images/widgetstack.png Binary files differnew file mode 100644 index 0000000..7b5f234 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/colortool/images/widgetstack.png diff --git a/tqtinterface/qt4/tools/designer/examples/colortool/main.cpp b/tqtinterface/qt4/tools/designer/examples/colortool/main.cpp new file mode 100644 index 0000000..8375c59 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/colortool/main.cpp @@ -0,0 +1,10 @@ +#include <tqapplication.h> +#include "mainform.h" + +int main( int argc, char ** argv ) +{ + TQApplication a( argc, argv ); + MainForm *w = new MainForm; + w->show(); + return a.exec(); +} diff --git a/tqtinterface/qt4/tools/designer/examples/colortool/mainform.ui b/tqtinterface/qt4/tools/designer/examples/colortool/mainform.ui new file mode 100644 index 0000000..448a88e --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/colortool/mainform.ui @@ -0,0 +1,601 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>MainForm</class> +<widget class="TQMainWindow"> + <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="TQWidgetStack"> + <property name="name"> + <cstring>colorWidgetStack</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + <widget class="TQWidget"> + <property name="name"> + <cstring>tablePage</cstring> + </property> + <attribute name="id"> + <number>0</number> + </attribute> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQTable"> + <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="TQWidget"> + <property name="name"> + <cstring>iconsPage</cstring> + </property> + <attribute name="id"> + <number>1</number> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQIconView"> + <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="&File" name="fileMenu"> + <action name="fileNewAction"/> + <action name="fileOpenAction"/> + <action name="fileSaveAction"/> + <action name="fileSaveAsAction"/> + <separator/> + <action name="fileExitAction"/> + </item> + <item text="&Edit" name="editMenu"> + <action name="editAddAction"/> + <action name="editCutAction"/> + <action name="editCopyAction"/> + <separator/> + <action name="editFindAction"/> + <separator/> + <action name="optionsAction"/> + </item> + <item text="&View" name="viewMenu"> + <action name="viewTableAction"/> + <action name="viewIconsAction"/> + </item> + <item text="&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>&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>&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>&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 &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&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>&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>&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>&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>&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>&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>&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>&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 &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 &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>&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">tqfindform.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 *tqfindForm;</variable> + <variable>QMap<QString,QColor> m_colors;</variable> +</variables> +<Q_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 & 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> +</Q_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 & filename )</function> + <function returnType="bool">okToClear()</function> + <function>changedColor( const QString & 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/tqtinterface/qt4/tools/designer/examples/colortool/mainform.ui.h b/tqtinterface/qt4/tools/designer/examples/colortool/mainform.ui.h new file mode 100644 index 0000000..0026d8a --- /dev/null +++ b/tqtinterface/qt4/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 TQt 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 TQString WINDOWS_REGISTRY = "/TQtExamples"; +const TQString APP_KEY = "/ColorTool/"; + +void MainForm::init() +{ + clipboard = TQApplication::clipboard(); + if ( clipboard->supportsSelection() ) + clipboard->setSelectionMode( TRUE ); + + tqfindForm = 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"] = TQt::black; + m_colors["blue"] = TQt::blue; + m_colors["cyan"] = TQt::cyan; + m_colors["darkblue"] = TQt::darkBlue; + m_colors["darkcyan"] = TQt::darkCyan; + m_colors["darkgray"] = TQt::darkGray; + m_colors["darkgreen"] = TQt::darkGreen; + m_colors["darkmagenta"] = TQt::darkMagenta; + m_colors["darkred"] = TQt::darkRed; + m_colors["darkyellow"] = TQt::darkYellow; + m_colors["gray"] = TQt::gray; + m_colors["green"] = TQt::green; + m_colors["lightgray"] = TQt::lightGray; + m_colors["magenta"] = TQt::magenta; + m_colors["red"] = TQt::red; + m_colors["white"] = TQt::white; + m_colors["yellow"] = TQt::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() ) { + TQPixmap pixmap( 22, 22 ); + int row = 0; + TQMap<TQString,TQColor>::ConstIterator it; + for ( it = m_colors.constBegin(); it != m_colors.constEnd(); ++it ) { + TQColor 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 ) { + TQCheckTableItem *item = new TQCheckTableItem( 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(); + + TQMap<TQString,TQColor>::ConstIterator it; + for ( it = m_colors.constBegin(); it != m_colors.constEnd(); ++it ) + (void) new TQIconViewItem( colorIconView, it.key(), + colorSwatch( it.data() ) ); + m_icons_dirty = FALSE; + } +} + +TQPixmap MainForm::colorSwatch( const TQColor color ) +{ + TQPixmap pixmap( 80, 80 ); + pixmap.fill( white ); + TQPainter 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; + + TQString filename = TQFileDialog::getOpenFileName( + TQString(), "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; + } + + TQFile file( m_filename ); + if ( file.open( IO_WriteOnly ) ) { + TQTextStream stream( &file ); + if ( ! m_comments.isEmpty() ) + stream << m_comments.join( "\n" ) << "\n"; + TQMap<TQString,TQColor>::ConstIterator it; + for ( it = m_colors.constBegin(); it != m_colors.constEnd(); ++it ) { + TQColor color = it.data(); + stream << TQString( "%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( TQString( "Color Tool -- %1" ).arg( m_filename ) ); + statusBar()->message( TQString( "Saved %1 colors to '%2'" ). + arg( m_colors.count() ). + arg( m_filename ), 3000 ); + m_changed = FALSE; + } + else + statusBar()->message( TQString( "Failed to save '%1'" ). + arg( m_filename ), 3000 ); + +} + +void MainForm::fileSaveAs() +{ + TQString filename = TQFileDialog::getSaveFileName( + TQString(), "Colors (*.txt)", this, + "file save as", "Color Tool -- File Save As" ); + if ( ! filename.isEmpty() ) { + int ans = 0; + if ( TQFile::exists( filename ) ) + ans = TQMessageBox::warning( + this, "Color Tool -- Overwrite File", + TQString( "Overwrite\n'%1'?" ). + arg( filename ), + "&Yes", "&No", TQString(), 1, 1 ); + if ( ans == 0 ) { + m_filename = filename; + fileSave(); + return; + } + } + statusBar()->message( "Saving abandoned", 2000 ); +} + +void MainForm::load( const TQString& filename ) +{ + clearData( FALSE ); + m_filename = filename; + TQRegExp regex( "^\\s*(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\S+.*)$" ); + TQFile file( filename ); + if ( file.open( IO_ReadOnly ) ) { + statusBar()->message( TQString( "Loading '%1'..." ). + arg( filename ) ); + TQTextStream stream( &file ); + TQString line; + while ( ! stream.eof() ) { + line = stream.readLine(); + if ( regex.search( line ) == -1 ) + m_comments += line; + else + m_colors[regex.cap( 4 )] = TQColor( + regex.cap( 1 ).toInt(), + regex.cap( 2 ).toInt(), + regex.cap( 3 ).toInt() ); + } + file.close(); + m_filename = filename; + setCaption( TQString( "Color Tool -- %1" ).arg( m_filename ) ); + statusBar()->message( TQString( "Loaded '%1'" ). + arg( m_filename ), 3000 ); + TQWidget *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( TQString( "Failed to load '%1'" ). + arg( m_filename ), 3000 ); +} + + +bool MainForm::okToClear() +{ + if ( m_changed ) { + TQString msg; + if ( m_filename.isEmpty() ) + msg = "Unnamed colors "; + else + msg = TQString( "Colors '%1'\n" ).arg( m_filename ); + msg += TQString( "has been changed." ); + int ans = TQMessageBox::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( TQCloseEvent * ) +{ + fileExit(); +} + +void MainForm::fileExit() +{ + if ( okToClear() ) { + saveSettings(); + TQApplication::exit( 0 ); + } +} + +void MainForm::editCut() +{ + TQString name; + TQWidget *visible = colorWidgetStack->visibleWidget(); + statusBar()->message( TQString( "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() ) { + TQIconViewItem *item = colorIconView->currentItem(); + name = item->text(); + if ( colorIconView->count() == 1 ) + colorIconView->clear(); + else { + TQIconViewItem *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( TQString( "Deleted '%1'" ).arg( name ), 5000 ); + } + else + statusBar()->message( TQString( "Failed to delete '%1'" ).arg( name ), 5000 ); +} + +void MainForm::editCopy() +{ + TQString text; + TQWidget *visible = colorWidgetStack->visibleWidget(); + + if ( visible == tablePage && colorTable->numRows() ) { + int row = colorTable->currentRow(); + text = colorTable->text( row, 0 ); + } + else if ( visible == iconsPage && colorIconView->currentItem() ) { + TQIconViewItem *item = colorIconView->currentItem(); + text = item->text(); + } + if ( ! text.isNull() ) { + TQColor 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 = TQString( "%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 ( ! tqfindForm ) { + tqfindForm = new FindForm( this ); + connect( tqfindForm, TQT_SIGNAL( lookfor(const TQString&) ), + this, TQT_SLOT( lookfor(const TQString&) ) ); + } + tqfindForm->show(); +} + +void MainForm::lookfor( const TQString& text ) +{ + if ( text.isEmpty() ) + return; + TQString ltext = text.lower(); + TQWidget *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().tqcontains( ltext ) ) { + colorTable->setCurrentCell( i, 0 ); + colorTable->clearSelection(); + colorTable->selectRow( i ); + found = TRUE; + break; + } + if ( ! found ) + colorTable->setCurrentCell( row, 0 ); + + } + else if ( visible == iconsPage ) { + TQIconViewItem *start = colorIconView->currentItem(); + for ( TQIconViewItem *item = start->nextItem(); item; item = item->nextItem() ) + if ( item->text().lower().tqcontains( ltext ) ) { + colorIconView->setCurrentItem( item ); + colorIconView->ensureItemVisible( item ); + found = TRUE; + break; + } + if ( ! found && start ) + colorIconView->setCurrentItem( start ); + } + if ( ! found ) { + statusBar()->message( TQString( "Could not tqfind '%1' after here" ). + arg( text ) ); + tqfindForm->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( TQIconViewItem *item ) +{ + changedColor( item->text() ); +} + +void MainForm::changedColor( const TQString& name ) +{ + TQColor color = m_colors[name]; + int r = color.red(); + int g = color.green(); + int b = color.blue(); + statusBar()->message( TQString( "%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(TQAction* action) +{ + if ( action == viewTableAction ) + colorWidgetStack->raiseWidget( tablePage ); + else + colorWidgetStack->raiseWidget( iconsPage ); +} + +bool MainForm::isWebColor( TQColor 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() +{ + TQColor color = white; + if ( ! m_colors.isEmpty() ) { + TQWidget *visible = colorWidgetStack->visibleWidget(); + if ( visible == tablePage ) + color = colorTable->text( colorTable->currentRow(), + colorTable->currentColumn() ); + else + color = colorIconView->currentItem()->text(); + } + color = TQColorDialog::getColor( color, this ); + if ( color.isValid() ) { + TQPixmap pixmap( 80, 10 ); + pixmap.fill( color ); + ColorNameForm *colorForm = new ColorNameForm( this, "color", TRUE ); + colorForm->setColors( m_colors ); + colorForm->colorLabel->setPixmap( pixmap ); + if ( colorForm->exec() ) { + TQString name = colorForm->colorLineEdit->text(); + m_colors[name] = color; + TQPixmap 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 ) { + TQCheckTableItem *item = new TQCheckTableItem( colorTable, "" ); + item->setChecked( isWebColor( color ) ); + colorTable->setItem( row, COL_WEB, item ); + } + colorTable->setCurrentCell( row, 0 ); + + (void) new TQIconViewItem( 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() +{ + TQSettings settings; + settings.insertSearchPath( TQSettings::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() +{ + TQSettings settings; + settings.insertSearchPath( TQSettings::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/tqtinterface/qt4/tools/designer/examples/colortool/optionsform.ui b/tqtinterface/qt4/tools/designer/examples/colortool/optionsform.ui new file mode 100644 index 0000000..2e8a4c2 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/colortool/optionsform.ui @@ -0,0 +1,153 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>OptionsForm</class> +<widget class="TQDialog"> + <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="TQGroupBox"> + <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="TQCheckBox"> + <property name="name"> + <cstring>webCheckBox</cstring> + </property> + <property name="text"> + <string>Indicate &Web Colors</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + <widget class="TQButtonGroup"> + <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="TQRadioButton"> + <property name="name"> + <cstring>hexRadioButton</cstring> + </property> + <property name="text"> + <string>&Hex, e.g. #AB347F</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>nameRadioButton</cstring> + </property> + <property name="text"> + <string>&Name, e.g. light blue</string> + </property> + </widget> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>rgbRadioButton</cstring> + </property> + <property name="text"> + <string>&RGB, e.g. 51,255,102</string> + </property> + </widget> + </vbox> + </widget> + <widget class="TQLayoutWidget"> + <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="tqsizeHint"> + <size> + <width>0</width> + <height>10</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>okPushButton</cstring> + </property> + <property name="text"> + <string>OK</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="TQPushButton"> + <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/tqtinterface/qt4/tools/designer/examples/colortool/optionsform.ui.h b/tqtinterface/qt4/tools/designer/examples/colortool/optionsform.ui.h new file mode 100644 index 0000000..e43b8f3 --- /dev/null +++ b/tqtinterface/qt4/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 TQt 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/tqtinterface/qt4/tools/designer/examples/credit/credit.pro b/tqtinterface/qt4/tools/designer/examples/credit/credit.pro new file mode 100644 index 0000000..4dc246d --- /dev/null +++ b/tqtinterface/qt4/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/tqtinterface/qt4/tools/designer/examples/credit/creditform.cpp b/tqtinterface/qt4/tools/designer/examples/credit/creditform.cpp new file mode 100644 index 0000000..2a0b52e --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/credit/creditform.cpp @@ -0,0 +1,20 @@ +#include <tqradiobutton.h> +#include <tqspinbox.h> +#include "creditform.h" + +CreditForm::CreditForm( TQWidget* tqparent, const char* name, + bool modal, WFlags fl ) + : CreditFormBase( tqparent, 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/tqtinterface/qt4/tools/designer/examples/credit/creditform.h b/tqtinterface/qt4/tools/designer/examples/credit/creditform.h new file mode 100644 index 0000000..b8998a2 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/credit/creditform.h @@ -0,0 +1,12 @@ +#include "creditformbase.h" + +class CreditForm : public CreditFormBase +{ + TQ_OBJECT +public: + CreditForm( TQWidget* tqparent = 0, const char* name = 0, + bool modal = FALSE, WFlags fl = 0 ); + ~CreditForm(); +public Q_SLOTS: + void setAmount(); +}; diff --git a/tqtinterface/qt4/tools/designer/examples/credit/creditformbase.cpp b/tqtinterface/qt4/tools/designer/examples/credit/creditformbase.cpp new file mode 100644 index 0000000..07543be --- /dev/null +++ b/tqtinterface/qt4/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 <tqvariant.h> // first for gcc 2.7.2 +#include <tqbuttongroup.h> +#include <tqpushbutton.h> +#include <tqradiobutton.h> +#include <tqspinbox.h> +#include <tqmime.h> +#include <tqdragobject.h> +#include <tqlayout.h> +#include <tqtooltip.h> +#include <tqwhatsthis.h> +#include "creditformbase.ui.h" +#include <tqimage.h> +#include <tqpixmap.h> + +static TQPixmap uic_load_pixmap_CreditFormBase( const TQString &name ) +{ + const TQMimeSource *m = TQMimeSourceFactory::defaultFactory()->data( name ); + if ( !m ) + return TQPixmap(); + TQPixmap pix; + TQImageDrag::decode( m, pix ); + return pix; +} +/* + * Constructs a CreditFormBase which is a child of 'tqparent', 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( TQWidget* tqparent, const char* name, bool modal, WFlags fl ) + : TQDialog( tqparent, name, modal, fl ) +{ + if ( !name ) + setName( "CreditFormBase" ); + resize( 276, 224 ); + setCaption( trUtf8( "Credit Rating", "" ) ); + CreditFormBaseLayout = new TQVBoxLayout( this ); + CreditFormBaseLayout->setSpacing( 6 ); + CreditFormBaseLayout->setMargin( 11 ); + + creditButtonGroup = new TQButtonGroup( this, "creditButtonGroup" ); + creditButtonGroup->setTitle( trUtf8( "Credit Rating", "" ) ); + creditButtonGroup->setColumnLayout(0, Qt::Vertical ); + creditButtonGroup->tqlayout()->setSpacing( 0 ); + creditButtonGroup->tqlayout()->setMargin( 0 ); + creditButtonGroupLayout = new TQVBoxLayout( creditButtonGroup->tqlayout() ); + creditButtonGroupLayout->tqsetAlignment( TQt::AlignTop ); + creditButtonGroupLayout->setSpacing( 6 ); + creditButtonGroupLayout->setMargin( 11 ); + + stdRadioButton = new TQRadioButton( creditButtonGroup, "stdRadioButton" ); + stdRadioButton->setText( trUtf8( "&Standard", "" ) ); + stdRadioButton->setChecked( TRUE ); + creditButtonGroupLayout->addWidget( stdRadioButton ); + + noneRadioButton = new TQRadioButton( creditButtonGroup, "noneRadioButton" ); + noneRadioButton->setText( trUtf8( "&None", "" ) ); + creditButtonGroupLayout->addWidget( noneRadioButton ); + + specialRadioButton = new TQRadioButton( creditButtonGroup, "specialRadioButton" ); + specialRadioButton->setText( trUtf8( "Sp&ecial", "" ) ); + creditButtonGroupLayout->addWidget( specialRadioButton ); + CreditFormBaseLayout->addWidget( creditButtonGroup ); + + amountSpinBox = new TQSpinBox( this, "amountSpinBox" ); + amountSpinBox->setEnabled( FALSE ); + amountSpinBox->setPrefix( trUtf8( "$ ", "" ) ); + amountSpinBox->setButtonSymbols( TQSpinBox::UpDownArrows ); + amountSpinBox->setMaxValue( 100000 ); + amountSpinBox->setLineStep( 10000 ); + CreditFormBaseLayout->addWidget( amountSpinBox ); + + Layout4 = new TQHBoxLayout; + Layout4->setSpacing( 6 ); + Layout4->setMargin( 0 ); + TQSpacerItem* spacer = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum ); + Layout4->addItem( spacer ); + + okPushButton = new TQPushButton( this, "okPushButton" ); + okPushButton->setText( trUtf8( "OK", "" ) ); + okPushButton->setDefault( TRUE ); + Layout4->addWidget( okPushButton ); + TQSpacerItem* spacer_2 = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum ); + Layout4->addItem( spacer_2 ); + + cancelPushButton = new TQPushButton( this, "cancelPushButton" ); + cancelPushButton->setText( trUtf8( "Cancel", "" ) ); + Layout4->addWidget( cancelPushButton ); + TQSpacerItem* spacer_3 = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum ); + Layout4->addItem( spacer_3 ); + CreditFormBaseLayout->addLayout( Layout4 ); + + + + + + // Q_SIGNALS and Q_SLOTS connections + connect( okPushButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( accept() ) ); + connect( cancelPushButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( reject() ) ); + connect( creditButtonGroup, TQT_SIGNAL( clicked(int) ), this, TQT_SLOT( setAmount() ) ); + connect( specialRadioButton, TQT_SIGNAL( toggled(bool) ), amountSpinBox, TQT_SLOT( setEnabled(bool) ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +CreditFormBase::~CreditFormBase() +{ + // no need to delete child widgets, TQt does it all for us +} + diff --git a/tqtinterface/qt4/tools/designer/examples/credit/creditformbase.h b/tqtinterface/qt4/tools/designer/examples/credit/creditformbase.h new file mode 100644 index 0000000..87c32d4 --- /dev/null +++ b/tqtinterface/qt4/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 <tqvariant.h> +#include <tqdialog.h> +class TQVBoxLayout; +class TQHBoxLayout; +class TQGridLayout; +class TQButtonGroup; +class TQPushButton; +class TQRadioButton; +class TQSpinBox; + +class CreditFormBase : public TQDialog +{ + TQ_OBJECT + +public: + CreditFormBase( TQWidget* tqparent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~CreditFormBase(); + + TQButtonGroup* creditButtonGroup; + TQRadioButton* stdRadioButton; + TQRadioButton* noneRadioButton; + TQRadioButton* specialRadioButton; + TQSpinBox* amountSpinBox; + TQPushButton* okPushButton; + TQPushButton* cancelPushButton; + + +public Q_SLOTS: + virtual void setAmount(); + +protected: + TQVBoxLayout* CreditFormBaseLayout; + TQVBoxLayout* creditButtonGroupLayout; + TQHBoxLayout* Layout4; +}; + +#endif // CREDITFORMBASE_H diff --git a/tqtinterface/qt4/tools/designer/examples/credit/creditformbase.ui b/tqtinterface/qt4/tools/designer/examples/credit/creditformbase.ui new file mode 100644 index 0000000..00aa9a0 --- /dev/null +++ b/tqtinterface/qt4/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="TQDialog"> + <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="TQButtonGroup"> + <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="TQRadioButton"> + <property name="name"> + <cstring>stdRadioButton</cstring> + </property> + <property name="text"> + <string>&Standard</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>noneRadioButton</cstring> + </property> + <property name="text"> + <string>&None</string> + </property> + </widget> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>specialRadioButton</cstring> + </property> + <property name="text"> + <string>Sp&ecial</string> + </property> + </widget> + </vbox> + </widget> + <widget class="TQSpinBox"> + <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="TQLayoutWidget"> + <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="tqsizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <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="tqsizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <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="tqsizeHint"> + <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/tqtinterface/qt4/tools/designer/examples/credit/creditformbase.ui.h b/tqtinterface/qt4/tools/designer/examples/credit/creditformbase.ui.h new file mode 100644 index 0000000..6cf4faa --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/credit/creditformbase.ui.h @@ -0,0 +1,5 @@ +void CreditFormBase::setAmount() +{ + +} + diff --git a/tqtinterface/qt4/tools/designer/examples/credit/main.cpp b/tqtinterface/qt4/tools/designer/examples/credit/main.cpp new file mode 100644 index 0000000..a16183d --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/credit/main.cpp @@ -0,0 +1,25 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#include <tqapplication.h> +#include "creditform.h" + + +int main( int argc, char *argv[] ) +{ + TQApplication app( argc, argv ); + + CreditForm creditForm; + app.setMainWidget( &creditForm ); + creditForm.show(); + + return app.exec(); +} + + diff --git a/tqtinterface/qt4/tools/designer/examples/filechooser/plugin/plugin.cpp b/tqtinterface/qt4/tools/designer/examples/filechooser/plugin/plugin.cpp new file mode 100644 index 0000000..f256dc9 --- /dev/null +++ b/tqtinterface/qt4/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() +{ +} + +TQStringList CustomWidgetPlugin::keys() const +{ + TQStringList list; + list << "FileChooser"; + return list; +} + +TQWidget* CustomWidgetPlugin::create( const TQString &key, TQWidget* tqparent, const char* name ) +{ + if ( key == "FileChooser" ) + return new FileChooser( tqparent, name ); + return 0; +} + +TQString CustomWidgetPlugin::group( const TQString& feature ) const +{ + if ( feature == "FileChooser" ) + return "Input"; + return TQString(); +} + +TQIconSet CustomWidgetPlugin::iconSet( const TQString& ) const +{ + return TQIconSet( TQPixmap( filechooser_pixmap ) ); +} + +TQString CustomWidgetPlugin::includeFile( const TQString& feature ) const +{ + if ( feature == "FileChooser" ) + return "filechooser.h"; + return TQString(); +} + +TQString CustomWidgetPlugin::toolTip( const TQString& feature ) const +{ + if ( feature == "FileChooser" ) + return "File Chooser Widget"; + return TQString(); +} + +TQString CustomWidgetPlugin::whatsThis( const TQString& feature ) const +{ + if ( feature == "FileChooser" ) + return "A widget to choose a file or directory"; + return TQString(); +} + +bool CustomWidgetPlugin::isContainer( const TQString& ) const +{ + return FALSE; +} + + +TQ_EXPORT_PLUGIN( CustomWidgetPlugin ) diff --git a/tqtinterface/qt4/tools/designer/examples/filechooser/plugin/plugin.h b/tqtinterface/qt4/tools/designer/examples/filechooser/plugin/plugin.h new file mode 100644 index 0000000..e2bd12f --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/filechooser/plugin/plugin.h @@ -0,0 +1,16 @@ +#include <tqwidgetplugin.h> + +class CustomWidgetPlugin : public TQWidgetPlugin +{ +public: + CustomWidgetPlugin(); + + TQStringList keys() const; + TQWidget* create( const TQString &classname, TQWidget* tqparent = 0, const char* name = 0 ); + TQString group( const TQString& ) const; + TQIconSet iconSet( const TQString& ) const; + TQString includeFile( const TQString& ) const; + TQString toolTip( const TQString& ) const; + TQString whatsThis( const TQString& ) const; + bool isContainer( const TQString& ) const; +}; diff --git a/tqtinterface/qt4/tools/designer/examples/filechooser/plugin/plugin.pro b/tqtinterface/qt4/tools/designer/examples/filechooser/plugin/plugin.pro new file mode 100644 index 0000000..012f185 --- /dev/null +++ b/tqtinterface/qt4/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/tqtinterface/qt4/tools/designer/examples/filechooser/widget/filechooser.cpp b/tqtinterface/qt4/tools/designer/examples/filechooser/widget/filechooser.cpp new file mode 100644 index 0000000..f3f986b --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/filechooser/widget/filechooser.cpp @@ -0,0 +1,62 @@ +#include "filechooser.h" +#include <tqlineedit.h> +#include <tqpushbutton.h> +#include <tqfiledialog.h> +#include <tqlayout.h> + +FileChooser::FileChooser( TQWidget *tqparent, const char *name ) + : TQWidget( tqparent, name ), md( File ) +{ + TQHBoxLayout *tqlayout = new TQHBoxLayout( this ); + tqlayout->setMargin( 0 ); + + lineEdit = new TQLineEdit( this, "filechooser_lineedit" ); + tqlayout->addWidget( lineEdit ); + + connect( lineEdit, TQT_SIGNAL( textChanged( const TQString & ) ), + this, TQT_SIGNAL( fileNameChanged( const TQString & ) ) ); + + button = new TQPushButton( "...", this, "filechooser_button" ); + button->setFixedWidth( button->fontMetrics().width( " ... " ) ); + tqlayout->addWidget( button ); + + connect( button, TQT_SIGNAL( clicked() ), + this, TQT_SLOT( chooseFile() ) ); + + setFocusProxy( lineEdit ); +} + +void FileChooser::setMode( Mode m ) +{ + md = m; +} + +FileChooser::Mode FileChooser::mode() const +{ + return md; +} + +void FileChooser::setFileName( const TQString &fn ) +{ + lineEdit->setText( fn ); +} + +TQString FileChooser::fileName() const +{ + return lineEdit->text(); +} + +void FileChooser::chooseFile() +{ + TQString fn; + if ( mode() == File ) + fn = TQFileDialog::getOpenFileName( lineEdit->text(), TQString(), this ); + else + fn = TQFileDialog::getExistingDirectory( lineEdit->text(),this ); + + if ( !fn.isEmpty() ) { + lineEdit->setText( fn ); + emit fileNameChanged( fn ); + } +} + diff --git a/tqtinterface/qt4/tools/designer/examples/filechooser/widget/filechooser.h b/tqtinterface/qt4/tools/designer/examples/filechooser/widget/filechooser.h new file mode 100644 index 0000000..0062e5b --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/filechooser/widget/filechooser.h @@ -0,0 +1,48 @@ +#ifndef FILECHOOSER_H +#define FILECHOOSER_H + +#include <tqwidget.h> +#include <tqwidgetplugin.h> + +class TQLineEdit; +class TQPushButton; + +#ifdef FILECHOOSER_IS_WIDGET +#undef TQT_WIDGET_PLUGIN_EXPORT +#define TQT_WIDGET_PLUGIN_EXPORT +#endif + +class TQT_WIDGET_PLUGIN_EXPORT FileChooser : public TQWidget +{ + TQ_OBJECT + + TQ_ENUMS( Mode ) + Q_PROPERTY( Mode mode READ mode WRITE setMode ) + Q_PROPERTY( TQString fileName READ fileName WRITE setFileName ) + +public: + FileChooser( TQWidget *tqparent = 0, const char *name = 0); + + enum Mode { File, Directory }; + + TQString fileName() const; + Mode mode() const; + +public Q_SLOTS: + void setFileName( const TQString &fn ); + void setMode( Mode m ); + +Q_SIGNALS: + void fileNameChanged( const TQString & ); + +private Q_SLOTS: + void chooseFile(); + +private: + TQLineEdit *lineEdit; + TQPushButton *button; + Mode md; + +}; + +#endif diff --git a/tqtinterface/qt4/tools/designer/examples/filechooser/widget/filechooser.pro b/tqtinterface/qt4/tools/designer/examples/filechooser/widget/filechooser.pro new file mode 100644 index 0000000..20ea787 --- /dev/null +++ b/tqtinterface/qt4/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/tqtinterface/qt4/tools/designer/examples/filechooser/widget/main.cpp b/tqtinterface/qt4/tools/designer/examples/filechooser/widget/main.cpp new file mode 100644 index 0000000..6daaddd --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/filechooser/widget/main.cpp @@ -0,0 +1,10 @@ +#include <tqapplication.h> +#include "filechooser.h" + +int main( int argc, char ** argv ) +{ + TQApplication a( argc, argv ); + FileChooser *fc = new FileChooser; + fc->show(); + return a.exec(); +} diff --git a/tqtinterface/qt4/tools/designer/examples/metric/main.cpp b/tqtinterface/qt4/tools/designer/examples/metric/main.cpp new file mode 100644 index 0000000..9f2b1dc --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/metric/main.cpp @@ -0,0 +1,12 @@ +#include <tqapplication.h> +#include "metric.h" + +int main( int argc, char ** argv ) +{ + TQApplication a( argc, argv ); + ConversionForm *w = new ConversionForm; + w->show(); + a.setMainWidget( w ); + a.connect( &a, TQT_SIGNAL( lastWindowClosed() ), &a, TQT_SLOT( quit() ) ); + return a.exec(); +} diff --git a/tqtinterface/qt4/tools/designer/examples/metric/metric.pro b/tqtinterface/qt4/tools/designer/examples/metric/metric.pro new file mode 100644 index 0000000..b31b997 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/metric/metric.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +LANGUAGE = C++ + +SOURCES += main.cpp +unix { + UI_DIR = .ui + TQMOC_DIR = .tqmoc + OBJECTS_DIR = .obj +} +FORMS = metric.ui +CONFIG += qt warn_on release +DBFILE = metric.db diff --git a/tqtinterface/qt4/tools/designer/examples/metric/metric.ui b/tqtinterface/qt4/tools/designer/examples/metric/metric.ui new file mode 100644 index 0000000..8ff4427 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/metric/metric.ui @@ -0,0 +1,366 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>ConversionForm</class> +<widget class="TQDialog"> + <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="TQLayoutWidget"> + <property name="name"> + <cstring>Layout4</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLayoutWidget" 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="tqsizeHint"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQSpinBox"> + <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="TQComboBox" 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="TQLabel" row="3" column="0"> + <property name="name"> + <cstring>TextLabel4</cstring> + </property> + <property name="text"> + <string>Result:</string> + </property> + </widget> + <widget class="TQLabel" row="1" column="0"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>Convert &From:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>fromComboBox</cstring> + </property> + </widget> + <widget class="TQLabel" row="2" column="0"> + <property name="name"> + <cstring>TextLabel3</cstring> + </property> + <property name="text"> + <string>Convert &To:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>toComboBox</cstring> + </property> + </widget> + <widget class="TQLabel" row="4" column="0"> + <property name="name"> + <cstring>TextLabel1_2</cstring> + </property> + <property name="text"> + <string>&Decimals:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>decimalsSpinBox</cstring> + </property> + </widget> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>Enter &Number:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>numberLineEdit</cstring> + </property> + </widget> + <widget class="TQLabel" 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="tqalignment"> + <set>AlignVCenter|AlignRight</set> + </property> + </widget> + <widget class="TQLineEdit" row="0" column="1"> + <property name="name"> + <cstring>numberLineEdit</cstring> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="tqalignment"> + <set>AlignRight</set> + </property> + </widget> + <widget class="TQComboBox" 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="tqsizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQPushButton"> + <property name="name"> + <cstring>clearButton</cstring> + </property> + <property name="text"> + <string>&Clear</string> + </property> + </widget> + <widget class="TQPushButton"> + <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="tqsizeHint"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>quitButton</cstring> + </property> + <property name="text"> + <string>&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> +<Q_SLOTS> + <slot>convert()</slot> +</Q_SLOTS> +<functions> + <function access="private">init()</function> +</functions> +<pixmapinproject/> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/tqtinterface/qt4/tools/designer/examples/metric/metric.ui.h b/tqtinterface/qt4/tools/designer/examples/metric/metric.ui.h new file mode 100644 index 0000000..7a451ee --- /dev/null +++ b/tqtinterface/qt4/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 Q_SLOTS use +** TQt 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 <tqvalidator.h> + +void ConversionForm::init() +{ + numberLineEdit->setValidator( new TQDoubleValidator( 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( TQString::number( result, 'f', decimals ) ); + numberLineEdit->setText( TQString::number( input, 'f', decimals ) ); +} + diff --git a/tqtinterface/qt4/tools/designer/examples/multiclip/main.cpp b/tqtinterface/qt4/tools/designer/examples/multiclip/main.cpp new file mode 100644 index 0000000..73b9451 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/multiclip/main.cpp @@ -0,0 +1,25 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#include <tqapplication.h> +#include "multiclip.h" + + +int main( int argc, char *argv[] ) +{ + TQApplication app( argc, argv ); + + MulticlipForm clippingForm; + app.setMainWidget( &clippingForm ); + clippingForm.show(); + + return app.exec(); +} + + diff --git a/tqtinterface/qt4/tools/designer/examples/multiclip/multiclip.pro b/tqtinterface/qt4/tools/designer/examples/multiclip/multiclip.pro new file mode 100644 index 0000000..f9391cb --- /dev/null +++ b/tqtinterface/qt4/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/tqtinterface/qt4/tools/designer/examples/multiclip/multiclip.ui b/tqtinterface/qt4/tools/designer/examples/multiclip/multiclip.ui new file mode 100644 index 0000000..5e78a47 --- /dev/null +++ b/tqtinterface/qt4/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="TQDialog"> + <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="TQLayoutWidget"> + <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="TQLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>Current Clipping</string> + </property> + </widget> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>currentLineEdit</cstring> + </property> + </widget> + </hbox> + </widget> + <widget class="TQLayoutWidget"> + <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="TQPushButton" row="4" column="1"> + <property name="name"> + <cstring>addPushButton</cstring> + </property> + <property name="text"> + <string>&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="tqsizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQPushButton" row="7" column="1"> + <property name="name"> + <cstring>quitPushButton</cstring> + </property> + <property name="text"> + <string>&Quit</string> + </property> + </widget> + <widget class="TQLabel" row="0" column="1"> + <property name="name"> + <cstring>TextLabel3</cstring> + </property> + <property name="text"> + <string>Length</string> + </property> + </widget> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>Previous Clippings</string> + </property> + </widget> + <widget class="TQCheckBox" row="3" column="1"> + <property name="name"> + <cstring>autoCheckBox</cstring> + </property> + <property name="text"> + <string>A&uto Add Clippings</string> + </property> + </widget> + <widget class="TQLCDNumber" row="1" column="1"> + <property name="name"> + <cstring>lengthLCDNumber</cstring> + </property> + </widget> + <widget class="TQPushButton" row="6" column="1"> + <property name="name"> + <cstring>deletePushButton</cstring> + </property> + <property name="text"> + <string>&Delete Clipping</string> + </property> + </widget> + <widget class="TQListBox" row="1" column="0" rowspan="7" colspan="1"> + <property name="name"> + <cstring>clippingsListBox</cstring> + </property> + </widget> + <widget class="TQPushButton" row="5" column="1"> + <property name="name"> + <cstring>copyPushButton</cstring> + </property> + <property name="text"> + <string>&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 & 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/tqtinterface/qt4/tools/designer/examples/multiclip/multiclip.ui.h b/tqtinterface/qt4/tools/designer/examples/multiclip/multiclip.ui.h new file mode 100644 index 0000000..684c367 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/multiclip/multiclip.ui.h @@ -0,0 +1,70 @@ +void MulticlipForm::addClipping() +{ + TQString 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() +{ + TQString 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 = tqApp->clipboard(); + connect( cb, TQT_SIGNAL( dataChanged() ), TQT_SLOT( dataChanged() ) ); + if ( cb->supportsSelection() ) + connect( cb, TQT_SIGNAL( selectionChanged() ), TQT_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 TQString & clipping ) +{ + currentLineEdit->setText( clipping ); + lengthLCDNumber->display( (int)clipping.length() ); +} + diff --git a/tqtinterface/qt4/tools/designer/examples/opengl/glwidget.cpp b/tqtinterface/qt4/tools/designer/examples/opengl/glwidget.cpp new file mode 100644 index 0000000..1109807 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/opengl/glwidget.cpp @@ -0,0 +1,170 @@ +/********************************************************************** +** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of TQt 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 TQt 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 TQt Commercial licenses may use this file in +** accordance with the TQt 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( TQWidget* tqparent, const char* name ) + : TQGLWidget( tqparent, 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/tqtinterface/qt4/tools/designer/examples/opengl/glwidget.h b/tqtinterface/qt4/tools/designer/examples/opengl/glwidget.h new file mode 100644 index 0000000..7efe658 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/opengl/glwidget.h @@ -0,0 +1,75 @@ +/********************************************************************** +** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of TQt 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 TQt 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 TQt Commercial licenses may use this file in +** accordance with the TQt 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 <tqgl.h> + +class GLWidget : public TQGLWidget +{ + TQ_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( TQWidget* tqparent, 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 Q_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/tqtinterface/qt4/tools/designer/examples/opengl/main.cpp b/tqtinterface/qt4/tools/designer/examples/opengl/main.cpp new file mode 100644 index 0000000..ec2ebbd --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/opengl/main.cpp @@ -0,0 +1,305 @@ +/********************************************************************** +** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of TQt 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 TQt 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 TQt Commercial licenses may use this file in +** accordance with the TQt 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 <tqobjectcleanuphandler.h> +#include <tqpixmap.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(); + + TQRESULT queryInterface( const TQUuid&, TQUnknownInterface ** ); + TQ_REFCOUNT; + + TQStringList featureList() const; + + TQWidget* create( const TQString &classname, TQWidget* tqparent = 0, const char* name = 0 ); + TQString group( const TQString& ) const; + TQIconSet iconSet( const TQString& ) const; + TQString includeFile( const TQString& ) const; + TQString toolTip( const TQString& ) const; + TQString whatsThis( const TQString& ) const; + bool isContainer( const TQString& ) const; + +private: + TQObjectCleanupHandler objects; +}; + +OpenGLWidgetInterface::OpenGLWidgetInterface() +{ +} + +TQStringList OpenGLWidgetInterface::featureList() const +{ + TQStringList list; + + list << "GLWidget"; + + return list; +} + +TQWidget* OpenGLWidgetInterface::create( const TQString &description, TQWidget* tqparent, const char* name ) +{ + TQWidget* w = 0; + + if ( description == "GLWidget" ) + w = new GLWidget( tqparent, name ); + + objects.add( w ); + return w; +} + +TQString OpenGLWidgetInterface::group( const TQString &description ) const +{ + if ( description == "GLWidget" ) + return "Views"; + return TQString(); +} + +TQIconSet OpenGLWidgetInterface::iconSet( const TQString &description ) const +{ + if ( description == "GLWidget" ) + return TQIconSet( (const char**)cube_xmp ); + return TQIconSet(); +} + +TQString OpenGLWidgetInterface::includeFile( const TQString &description ) const +{ + if ( description == "GLWidget" ) + return "glwidget.h"; + return TQString(); +} + +TQString OpenGLWidgetInterface::toolTip( const TQString &description ) const +{ + if ( description == "GLWidget" ) + return TQT_TR_NOOP("OpenGL Widget"); + return TQString(); +} + +TQString OpenGLWidgetInterface::whatsThis( const TQString &description ) const +{ + if ( description == "GLWidget" ) + return "A widget for OpenGL rendering"; + return TQString(); +} + +bool OpenGLWidgetInterface::isContainer( const TQString& ) const +{ + return FALSE; +} + +TQRESULT OpenGLWidgetInterface::queryInterface( const TQUuid& uuid, TQUnknownInterface **iface ) +{ + *iface = 0; + + if ( uuid == IID_TQUnknown ) + *iface = (TQUnknownInterface*)this; + else if ( uuid == IID_TQFeatureList ) + *iface = (TQFeatureListInterface*)this; + else if ( uuid == IID_Widget ) + *iface = (WidgetInterface*)this; + else + return TQE_NOINTERFACE; + + (*iface)->addRef(); + return TQS_OK; +} + +TQ_EXPORT_COMPONENT() +{ + TQ_CREATE_INSTANCE( OpenGLWidgetInterface ); +} diff --git a/tqtinterface/qt4/tools/designer/examples/opengl/opengl.pro b/tqtinterface/qt4/tools/designer/examples/opengl/opengl.pro new file mode 100644 index 0000000..d28eb32 --- /dev/null +++ b/tqtinterface/qt4/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/tqtinterface/qt4/tools/designer/examples/receiver1/main.cpp b/tqtinterface/qt4/tools/designer/examples/receiver1/main.cpp new file mode 100644 index 0000000..794c4ab --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/receiver1/main.cpp @@ -0,0 +1,24 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#include <tqapplication.h> +#include "mainform.h" + +int main( int argc, char *argv[] ) +{ + TQApplication app( argc, argv ); + + MainForm *mainForm = new MainForm; + app.setMainWidget( mainForm ); + mainForm->show(); + + return app.exec(); +} + + diff --git a/tqtinterface/qt4/tools/designer/examples/receiver1/mainform.ui b/tqtinterface/qt4/tools/designer/examples/receiver1/mainform.ui new file mode 100644 index 0000000..863b20c --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/receiver1/mainform.ui @@ -0,0 +1,87 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>MainForm</class> +<widget class="TQDialog"> + <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="TQPushButton" row="0" column="1"> + <property name="name"> + <cstring>quitPushButton</cstring> + </property> + <property name="text"> + <string>&Quit</string> + </property> + </widget> + <widget class="TQPushButton" row="0" column="0"> + <property name="name"> + <cstring>creditPushButton</cstring> + </property> + <property name="text"> + <string>&Credit Dialog</string> + </property> + </widget> + <widget class="TQLabel" row="1" column="0"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>Credit Rating</string> + </property> + </widget> + <widget class="TQLabel" 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">tqspinbox.h</include> + <include location="global" impldecl="in implementation">tqwidgetfactory.h</include> + <include location="local" impldecl="in implementation">mainform.ui.h</include> +</includes> +<Q_SLOTS> + <slot access="protected">init()</slot> + <slot access="protected">destroy()</slot> + <slot>creditDialog()</slot> +</Q_SLOTS> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/tqtinterface/qt4/tools/designer/examples/receiver1/mainform.ui.h b/tqtinterface/qt4/tools/designer/examples/receiver1/mainform.ui.h new file mode 100644 index 0000000..e19324e --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/receiver1/mainform.ui.h @@ -0,0 +1,25 @@ +void MainForm::init() +{ + +} + +void MainForm::destroy() +{ + +} + +void MainForm::creditDialog() +{ + TQDialog *creditForm = (TQDialog *) + TQWidgetFactory::create( "../credit/creditformbase.ui" ); + // Set up the dynamic dialog here + + if ( creditForm->exec() ) { + // The user accepted, act accordingly + TQSpinBox *amount = (TQSpinBox *) creditForm->child( "amountSpinBox", "TQSpinBox" ); + if ( amount ) + ratingTextLabel->setText( amount->text() ); + } + delete creditForm; +} + diff --git a/tqtinterface/qt4/tools/designer/examples/receiver1/receiver.pro b/tqtinterface/qt4/tools/designer/examples/receiver1/receiver.pro new file mode 100644 index 0000000..0758559 --- /dev/null +++ b/tqtinterface/qt4/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/tqtinterface/qt4/tools/designer/examples/receiver2/main.cpp b/tqtinterface/qt4/tools/designer/examples/receiver2/main.cpp new file mode 100644 index 0000000..8d0b761 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/receiver2/main.cpp @@ -0,0 +1,25 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#include <tqapplication.h> +#include "mainform.h" + + +int main( int argc, char *argv[] ) +{ + TQApplication app( argc, argv ); + + MainForm *mainForm = new MainForm; + app.setMainWidget( mainForm ); + mainForm->show(); + + return app.exec(); +} + + diff --git a/tqtinterface/qt4/tools/designer/examples/receiver2/mainform.ui b/tqtinterface/qt4/tools/designer/examples/receiver2/mainform.ui new file mode 100644 index 0000000..cdcc140 --- /dev/null +++ b/tqtinterface/qt4/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">tqwidgetfactory.h</include> +<include location="global" impldecl="in implementation">tqspinbox.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="TQDialog"> + <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="TQPushButton" row="0" column="1"> + <property name="name"> + <cstring>quitPushButton</cstring> + </property> + <property name="text"> + <string>&Quit</string> + </property> + </widget> + <widget class="TQPushButton" row="0" column="0"> + <property name="name"> + <cstring>creditPushButton</cstring> + </property> + <property name="text"> + <string>&Credit Dialog</string> + </property> + </widget> + <widget class="TQLabel" row="1" column="0"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>Credit Rating</string> + </property> + </widget> + <widget class="TQLabel" 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/tqtinterface/qt4/tools/designer/examples/receiver2/mainform.ui.h b/tqtinterface/qt4/tools/designer/examples/receiver2/mainform.ui.h new file mode 100644 index 0000000..65f2ef9 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/receiver2/mainform.ui.h @@ -0,0 +1,20 @@ +void MainForm::creditDialog() +{ + Receiver *receiver = new Receiver; + TQDialog *creditForm = (TQDialog *) + TQWidgetFactory::create( "../credit/creditformbase.ui", receiver ); + receiver->setParent( creditForm ); + + // Set up the dynamic dialog here + + if ( creditForm->exec() ) { + // The user accepted, act accordingly + TQSpinBox *amount = (TQSpinBox *) creditForm->child( "amountSpinBox", "TQSpinBox" ); + if ( amount ) + ratingTextLabel->setText( amount->text() ); + } + + delete receiver; + delete creditForm; +} + diff --git a/tqtinterface/qt4/tools/designer/examples/receiver2/receiver.cpp b/tqtinterface/qt4/tools/designer/examples/receiver2/receiver.cpp new file mode 100644 index 0000000..dd40459 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/receiver2/receiver.cpp @@ -0,0 +1,29 @@ +#include <tqradiobutton.h> +#include <tqspinbox.h> +#include "receiver.h" + +void Receiver::setParent( TQDialog *tqparent ) +{ + p = tqparent; + setAmount(); +} + +void Receiver::setAmount() +{ + TQSpinBox *amount = + (TQSpinBox *) p->child( "amountSpinBox", "TQSpinBox" ); + + TQRadioButton *radio = + (TQRadioButton *) p->child( "stdRadioButton", "TQRadioButton" ); + if ( radio && radio->isChecked() ) { + if ( amount ) + amount->setValue( amount->maxValue() / 2 ); + return; + } + + radio = + (TQRadioButton *) p->child( "noneRadioButton", "TQRadioButton" ); + if ( radio && radio->isChecked() ) + if ( amount ) + amount->setValue( amount->minValue() ); +} diff --git a/tqtinterface/qt4/tools/designer/examples/receiver2/receiver.h b/tqtinterface/qt4/tools/designer/examples/receiver2/receiver.h new file mode 100644 index 0000000..5d0867f --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/receiver2/receiver.h @@ -0,0 +1,13 @@ +#include <tqobject.h> +#include <tqdialog.h> + +class Receiver : public TQObject +{ + TQ_OBJECT +public: + void setParent( TQDialog *tqparent ); +public Q_SLOTS: + void setAmount(); +private: + TQDialog *p; +}; diff --git a/tqtinterface/qt4/tools/designer/examples/receiver2/receiver.pro b/tqtinterface/qt4/tools/designer/examples/receiver2/receiver.pro new file mode 100644 index 0000000..5c7bf79 --- /dev/null +++ b/tqtinterface/qt4/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/tqtinterface/qt4/tools/designer/examples/richedit/images/editcopy.png b/tqtinterface/qt4/tools/designer/examples/richedit/images/editcopy.png Binary files differnew file mode 100644 index 0000000..abfe86e --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/richedit/images/editcopy.png diff --git a/tqtinterface/qt4/tools/designer/examples/richedit/images/editcut.png b/tqtinterface/qt4/tools/designer/examples/richedit/images/editcut.png Binary files differnew file mode 100644 index 0000000..2d179bc --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/richedit/images/editcut.png diff --git a/tqtinterface/qt4/tools/designer/examples/richedit/images/editpaste.png b/tqtinterface/qt4/tools/designer/examples/richedit/images/editpaste.png Binary files differnew file mode 100644 index 0000000..356ee55 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/richedit/images/editpaste.png diff --git a/tqtinterface/qt4/tools/designer/examples/richedit/images/filenew.png b/tqtinterface/qt4/tools/designer/examples/richedit/images/filenew.png Binary files differnew file mode 100644 index 0000000..9853d97 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/richedit/images/filenew.png diff --git a/tqtinterface/qt4/tools/designer/examples/richedit/images/fileopen.png b/tqtinterface/qt4/tools/designer/examples/richedit/images/fileopen.png Binary files differnew file mode 100644 index 0000000..85dab43 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/richedit/images/fileopen.png diff --git a/tqtinterface/qt4/tools/designer/examples/richedit/images/filesave.png b/tqtinterface/qt4/tools/designer/examples/richedit/images/filesave.png Binary files differnew file mode 100644 index 0000000..21309aa --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/richedit/images/filesave.png diff --git a/tqtinterface/qt4/tools/designer/examples/richedit/images/redo.png b/tqtinterface/qt4/tools/designer/examples/richedit/images/redo.png Binary files differnew file mode 100644 index 0000000..857d093 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/richedit/images/redo.png diff --git a/tqtinterface/qt4/tools/designer/examples/richedit/images/textbold.png b/tqtinterface/qt4/tools/designer/examples/richedit/images/textbold.png Binary files differnew file mode 100644 index 0000000..c51e5c0 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/richedit/images/textbold.png diff --git a/tqtinterface/qt4/tools/designer/examples/richedit/images/textcenter.png b/tqtinterface/qt4/tools/designer/examples/richedit/images/textcenter.png Binary files differnew file mode 100644 index 0000000..032a9bb --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/richedit/images/textcenter.png diff --git a/tqtinterface/qt4/tools/designer/examples/richedit/images/textitalic.png b/tqtinterface/qt4/tools/designer/examples/richedit/images/textitalic.png Binary files differnew file mode 100644 index 0000000..b725b43 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/richedit/images/textitalic.png diff --git a/tqtinterface/qt4/tools/designer/examples/richedit/images/textleft.png b/tqtinterface/qt4/tools/designer/examples/richedit/images/textleft.png Binary files differnew file mode 100644 index 0000000..4ef081f --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/richedit/images/textleft.png diff --git a/tqtinterface/qt4/tools/designer/examples/richedit/images/textright.png b/tqtinterface/qt4/tools/designer/examples/richedit/images/textright.png Binary files differnew file mode 100644 index 0000000..a9b2b55 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/richedit/images/textright.png diff --git a/tqtinterface/qt4/tools/designer/examples/richedit/images/textunder.png b/tqtinterface/qt4/tools/designer/examples/richedit/images/textunder.png Binary files differnew file mode 100644 index 0000000..5093509 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/richedit/images/textunder.png diff --git a/tqtinterface/qt4/tools/designer/examples/richedit/images/undo.png b/tqtinterface/qt4/tools/designer/examples/richedit/images/undo.png Binary files differnew file mode 100644 index 0000000..9346c6c --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/richedit/images/undo.png diff --git a/tqtinterface/qt4/tools/designer/examples/richedit/main.cpp b/tqtinterface/qt4/tools/designer/examples/richedit/main.cpp new file mode 100644 index 0000000..c2053ee --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/richedit/main.cpp @@ -0,0 +1,25 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#include <tqapplication.h> +#include "richedit.h" + + +int main( int argc, char *argv[] ) +{ + TQApplication app( argc, argv ); + + EditorForm richeditForm; + app.setMainWidget( &richeditForm ); + richeditForm.show(); + + return app.exec(); +} + + diff --git a/tqtinterface/qt4/tools/designer/examples/richedit/richedit.pro b/tqtinterface/qt4/tools/designer/examples/richedit/richedit.pro new file mode 100644 index 0000000..bcc3d4d --- /dev/null +++ b/tqtinterface/qt4/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/tqtinterface/qt4/tools/designer/examples/richedit/richedit.ui b/tqtinterface/qt4/tools/designer/examples/richedit/richedit.ui new file mode 100644 index 0000000..eda509d --- /dev/null +++ b/tqtinterface/qt4/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="TQMainWindow"> + <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="TQTextEdit"> + <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="&File" name="fileMenu"> + <action name="fileNewAction"/> + <action name="fileOpenAction"/> + <action name="fileSaveAction"/> + <action name="fileSaveAsAction"/> + <separator/> + <action name="fileExitAction"/> + </item> + <item text="&Edit" name="editMenu"> + <action name="editUndoAction"/> + <action name="editRedoAction"/> + <separator/> + <action name="editCutAction"/> + <action name="editCopyAction"/> + <action name="editPasteAction"/> + </item> + <item text="F&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="&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="TQComboBox"> + <property name="name"> + <cstring>fontComboBox</cstring> + </property> + </widget> + <widget class="TQSpinBox"> + <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>&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>&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>&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 &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&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>&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>&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>&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&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>&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>&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>&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>&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>&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>&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>&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>&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>&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>&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&)</signal> + <receiver>textEdit</receiver> + <slot>setFamily(const QString&)</slot> + </connection> + <connection language="C++"> + <sender>fontComboBox</sender> + <signal>activated(const QString&)</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 & action )</slot> +</connections> +</UI> diff --git a/tqtinterface/qt4/tools/designer/examples/richedit/richedit.ui.h b/tqtinterface/qt4/tools/designer/examples/richedit/richedit.ui.h new file mode 100644 index 0000000..087d8d0 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/richedit/richedit.ui.h @@ -0,0 +1,120 @@ +void EditorForm::init() +{ + textEdit->setFocus(); + + TQFontDatabase fonts; + fontComboBox->insertStringList( fonts.families() ); + TQString 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" ) ) + tqApp->exit(); +} + +void EditorForm::fileNew() +{ + if ( saveAndContinue( "New" ) ) + textEdit->clear(); +} + +void EditorForm::fileOpen() +{ + if ( saveAndContinue( "Open" ) ) { + TQString fn( TQFileDialog::getOpenFileName( + TQString(), + "Rich Text Files (*.htm*)", this ) ); + if ( !fn.isEmpty() ) { + fileName = fn; + TQFile file( fileName ); + if ( file.open( IO_ReadOnly ) ) { + TQTextStream ts( &file ); + textEdit->setText( ts.read() ); + } + } + } +} + +void EditorForm::fileSave() +{ + if ( fileName.isEmpty() ) { + fileSaveAs(); + } else { + TQFile f( fileName ); + if ( f.open( IO_WriteOnly ) ) { + TQTextStream ts( &f ); + ts << textEdit->text(); + textEdit->setModified( FALSE ); + } + } +} + +void EditorForm::fileSaveAs() +{ + TQString fn = TQFileDialog::getSaveFileName( + "", "Rich Text Files (*.htm*)", this ); + if ( !fn.isEmpty() ) { + fileName = fn; + fileSave(); + } +} + +void EditorForm::helpAbout() +{ + +} + +void EditorForm::helpContents() +{ + +} + +void EditorForm::helpIndex() +{ + +} + +void EditorForm::changeAlignment(TQAction * align) +{ + if ( align == leftAlignAction ) + textEdit->tqsetAlignment( TQt::AlignLeft ); + else if ( align == rightAlignAction ) + textEdit->tqsetAlignment( TQt::AlignRight ); + else if ( align == centerAlignAction ) + textEdit->tqsetAlignment( TQt::AlignCenter ); +} + +int EditorForm::saveAndContinue(const TQString & action) +{ + int continueAction = 1; + + if ( textEdit->isModified() ) { + switch( TQMessageBox::information( + this, "Rich Edit", + "The document tqcontains 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/tqtinterface/qt4/tools/designer/examples/sizeaware/main.cpp b/tqtinterface/qt4/tools/designer/examples/sizeaware/main.cpp new file mode 100644 index 0000000..11d4e15 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/sizeaware/main.cpp @@ -0,0 +1,11 @@ +#include <tqapplication.h> +#include "sizeaware.h" + +int main( int argc, char ** argv ) +{ + TQApplication app( argc, argv ); + SizeAware *sizeaware = new SizeAware( 0, 0, TRUE ); + sizeaware->exec(); + sizeaware->destroy(); + return 0; +} diff --git a/tqtinterface/qt4/tools/designer/examples/sizeaware/sizeaware.cpp b/tqtinterface/qt4/tools/designer/examples/sizeaware/sizeaware.cpp new file mode 100644 index 0000000..45c568e --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/sizeaware/sizeaware.cpp @@ -0,0 +1,38 @@ +#include "sizeaware.h" +#include <tqsettings.h> + + +SizeAware::SizeAware( TQDialog *tqparent, const char *name, bool modal ) + : TQDialog( tqparent, name, modal ) +{ + if ( company().isEmpty() ) + setCompany( "UnknownCompany" ); + if ( settingsFile().isEmpty() ) + setSettingsFile( "UnknownFile" ); + + TQSettings settings; + settings.insertSearchPath( TQSettings::Windows, "/" + company() ); + settings.insertSearchPath( TQSettings::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() +{ + TQSettings settings; + settings.insertSearchPath( TQSettings::Windows, "/" + company() ); + settings.insertSearchPath( TQSettings::Unix, "/Opt/" + company() + "/share" ); + settings.writeEntry( "/" + settingsFile() + "/width", width() ); + settings.writeEntry( "/" + settingsFile() + "/height", height() ); + close( TRUE ); +} + + + diff --git a/tqtinterface/qt4/tools/designer/examples/sizeaware/sizeaware.h b/tqtinterface/qt4/tools/designer/examples/sizeaware/sizeaware.h new file mode 100644 index 0000000..7cdca8f --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/sizeaware/sizeaware.h @@ -0,0 +1,23 @@ +#ifndef SIZEAWARE_H +#define SIZEAWARE_H +#include <tqdialog.h> + +class SizeAware : public TQDialog +{ + TQ_OBJECT + Q_PROPERTY( TQString company READ company WRITE setCompany ) + Q_PROPERTY( TQString settingsFile READ settingsFile WRITE setSettingsFile ) +public: + SizeAware( TQDialog *tqparent = 0, const char *name = 0, bool modal = FALSE ); + ~SizeAware(); + void setCompany( TQString company ) { m_company = company; } + TQString company() const { return m_company; } + void setSettingsFile( TQString settingsFile ) { m_settingsFile = settingsFile; } + TQString settingsFile() const { return m_settingsFile; } +public Q_SLOTS: + void destroy(); +private: + TQString m_company; + TQString m_settingsFile; +}; +#endif diff --git a/tqtinterface/qt4/tools/designer/examples/sizeaware/sizeaware.pro b/tqtinterface/qt4/tools/designer/examples/sizeaware/sizeaware.pro new file mode 100644 index 0000000..c223ed7 --- /dev/null +++ b/tqtinterface/qt4/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/tqtinterface/qt4/tools/designer/examples/vcr/main.cpp b/tqtinterface/qt4/tools/designer/examples/vcr/main.cpp new file mode 100644 index 0000000..71f04f8 --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/vcr/main.cpp @@ -0,0 +1,10 @@ +#include <tqapplication.h> +#include "vcr.h" + +int main( int argc, char ** argv ) +{ + TQApplication app( argc, argv ); + Vcr *vcr = new Vcr; + vcr->show(); + return app.exec(); +} diff --git a/tqtinterface/qt4/tools/designer/examples/vcr/play.xpm b/tqtinterface/qt4/tools/designer/examples/vcr/play.xpm new file mode 100644 index 0000000..8102ed1 --- /dev/null +++ b/tqtinterface/qt4/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/tqtinterface/qt4/tools/designer/examples/vcr/vcr.cpp b/tqtinterface/qt4/tools/designer/examples/vcr/vcr.cpp new file mode 100644 index 0000000..c22fb1d --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/vcr/vcr.cpp @@ -0,0 +1,117 @@ +#include "vcr.h" +#include <tqpushbutton.h> +#include <tqlayout.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( TQWidget *tqparent, const char *name ) + : TQWidget( tqparent, name ) +{ + TQHBoxLayout *tqlayout = new TQHBoxLayout( this ); + tqlayout->setMargin( 0 ); + + TQPushButton *rewind = new TQPushButton( TQPixmap( rewind_xpm ), 0, this, "vcr_rewind" ); + tqlayout->addWidget( rewind ); + connect( rewind, TQT_SIGNAL(clicked()), TQT_SIGNAL(rewind()) ); + + TQPushButton *play = new TQPushButton( TQPixmap( play_xpm ), 0, this, "vcr_play" ); + tqlayout->addWidget( play ); + connect( play, TQT_SIGNAL(clicked()), TQT_SIGNAL(play()) ); + + TQPushButton *next = new TQPushButton( TQPixmap( next_xpm ), 0, this, "vcr_next" ); + tqlayout->addWidget( next ); + connect( next, TQT_SIGNAL(clicked()), TQT_SIGNAL(next()) ); + + TQPushButton *stop = new TQPushButton( TQPixmap( stop_xpm ), 0, this, "vcr_stop" ); + tqlayout->addWidget( stop ); + connect( stop, TQT_SIGNAL(clicked()), TQT_SIGNAL(stop()) ); +} + + diff --git a/tqtinterface/qt4/tools/designer/examples/vcr/vcr.h b/tqtinterface/qt4/tools/designer/examples/vcr/vcr.h new file mode 100644 index 0000000..1dccc8c --- /dev/null +++ b/tqtinterface/qt4/tools/designer/examples/vcr/vcr.h @@ -0,0 +1,17 @@ +#ifndef VCR_H +#define VCR_H +#include <tqwidget.h> + +class Vcr : public TQWidget +{ + TQ_OBJECT +public: + Vcr( TQWidget *tqparent = 0, const char *name = 0 ); + ~Vcr() {} +Q_SIGNALS: + void rewind(); + void play(); + void next(); + void stop(); +}; +#endif diff --git a/tqtinterface/qt4/tools/designer/examples/vcr/vcr.pro b/tqtinterface/qt4/tools/designer/examples/vcr/vcr.pro new file mode 100644 index 0000000..8bda690 --- /dev/null +++ b/tqtinterface/qt4/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 |