diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-08 12:31:36 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-08 12:31:36 -0600 |
commit | d796c9dd933ab96ec83b9a634feedd5d32e1ba3f (patch) | |
tree | 6e3dcca4f77e20ec8966c666aac7c35bd4704053 /examples/extension | |
download | tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.tar.gz tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.zip |
Test conversion to TQt3 from Qt3 8c6fc1f8e35fd264dd01c582ca5e7549b32ab731
Diffstat (limited to 'examples/extension')
-rw-r--r-- | examples/extension/dialogform.ui | 206 | ||||
-rw-r--r-- | examples/extension/dialogform.ui.h | 24 | ||||
-rw-r--r-- | examples/extension/extension.doc | 41 | ||||
-rw-r--r-- | examples/extension/extension.pro | 12 | ||||
-rw-r--r-- | examples/extension/extension.ui | 114 | ||||
-rw-r--r-- | examples/extension/extension.ui.h | 7 | ||||
-rw-r--r-- | examples/extension/main.cpp | 11 | ||||
-rw-r--r-- | examples/extension/mainform.ui | 74 | ||||
-rw-r--r-- | examples/extension/mainform.ui.h | 46 |
9 files changed, 535 insertions, 0 deletions
diff --git a/examples/extension/dialogform.ui b/examples/extension/dialogform.ui new file mode 100644 index 000000000..edb70c76c --- /dev/null +++ b/examples/extension/dialogform.ui @@ -0,0 +1,206 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>DialogForm</class> +<widget class="TQDialog"> + <property name="name"> + <cstring>DialogForm</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>288</width> + <height>145</height> + </rect> + </property> + <property name="caption"> + <string>Dialog</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout7</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout5</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>sessionsCheckBox</cstring> + </property> + <property name="text"> + <string>Save/Restore &Sessions</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>loggingCheckBox</cstring> + </property> + <property name="text"> + <string>&Log Activities</string> + </property> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout4</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQPushButton"> + <property name="name"> + <cstring>detailsPushButton</cstring> + </property> + <property name="text"> + <string>&Details >>></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </vbox> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout3</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <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> + <spacer> + <property name="name"> + <cstring>Spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>okPushButton</sender> + <signal>clicked()</signal> + <receiver>DialogForm</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>cancelPushButton</sender> + <signal>clicked()</signal> + <receiver>DialogForm</receiver> + <slot>reject()</slot> + </connection> + <connection> + <sender>detailsPushButton</sender> + <signal>clicked()</signal> + <receiver>DialogForm</receiver> + <slot>toggleDetails()</slot> + </connection> +</connections> +<includes> + <include location="local" impldecl="in implementation">extension.h</include> + <include location="local" impldecl="in implementation">dialogform.ui.h</include> +</includes> +<variables> + <variable>bool extensionShown;</variable> +</variables> +<slots> + <slot>toggleDetails()</slot> +</slots> +<functions> + <function access="private">init()</function> +</functions> +<pixmapinproject/> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/examples/extension/dialogform.ui.h b/examples/extension/dialogform.ui.h new file mode 100644 index 000000000..d6f873f33 --- /dev/null +++ b/examples/extension/dialogform.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 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 DialogForm::init() +{ + extensionShown = FALSE; + setExtension( new Extension( this ) ); + setOrientation( Vertical ); +} + + +void DialogForm::toggleDetails() +{ + extensionShown = !extensionShown; + showExtension( extensionShown ); + TQString text = tr( "&Details " ); + text += TQString( extensionShown ? "<<<" : ">>>" ); + detailsPushButton->setText( text ); +} diff --git a/examples/extension/extension.doc b/examples/extension/extension.doc new file mode 100644 index 000000000..98b4a3373 --- /dev/null +++ b/examples/extension/extension.doc @@ -0,0 +1,41 @@ +/*! + \page extension-dialog-example.html + + \ingroup step-by-step-examples + + + \title An Extension Dialog Example + + This example demonstrates how to create an extension dialog. + + Essentially all that is necessary is to create a standard dialog + and then create a QWidget form to be used as the extension. See + the article in \link http://doc.trolltech.com/qq/ Qt + Quarterly\endlink issue #3. + + + <hr> + + + Project file: + + \include extension/extension.pro + + <hr> + + <hr> + + Implementation: + + \include extension/mainform.ui.h + \include extension/dialogform.ui.h + \include extension/extension.ui.h + + <hr> + + Main: + + \include extension/main.cpp + + +*/ diff --git a/examples/extension/extension.pro b/examples/extension/extension.pro new file mode 100644 index 000000000..7cc65985a --- /dev/null +++ b/examples/extension/extension.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +LANGUAGE = C++ + +CONFIG += qt warn_on release + +REQUIRES = full-config nocrosscompiler + +SOURCES += main.cpp +FORMS = mainform.ui \ + dialogform.ui \ + extension.ui +DBFILE = extension.db diff --git a/examples/extension/extension.ui b/examples/extension/extension.ui new file mode 100644 index 000000000..32dcc48b7 --- /dev/null +++ b/examples/extension/extension.ui @@ -0,0 +1,114 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>Extension</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>Extension</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>258</width> + <height>128</height> + </rect> + </property> + <property name="caption"> + <string>Extension</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout6</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>Log &File</string> + </property> + <property name="buddy" stdset="0"> + <cstring>logfileLineEdit</cstring> + </property> + </widget> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>logfileLineEdit</cstring> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>browsePushButton</cstring> + </property> + <property name="text"> + <string>&Browse...</string> + </property> + </widget> + </hbox> + </widget> + <widget class="TQButtonGroup"> + <property name="name"> + <cstring>ButtonGroup1</cstring> + </property> + <property name="title"> + <string>Log What?</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>Layout7</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>0</number> + </property> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>logActionsCheckBox</cstring> + </property> + <property name="text"> + <string>&Actions</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>logErrorsCheckBox</cstring> + </property> + <property name="text"> + <string>&Errors</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<includes> + <include location="local" impldecl="in implementation">extension.ui.h</include> +</includes> +<pixmapinproject/> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/examples/extension/extension.ui.h b/examples/extension/extension.ui.h new file mode 100644 index 000000000..e43b8f3fd --- /dev/null +++ b/examples/extension/extension.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/examples/extension/main.cpp b/examples/extension/main.cpp new file mode 100644 index 000000000..608ef06a6 --- /dev/null +++ b/examples/extension/main.cpp @@ -0,0 +1,11 @@ +#include <qapplication.h> +#include "mainform.h" + +int main( int argc, char ** argv ) +{ + TQApplication a( argc, argv ); + MainForm *w = new MainForm; + w->show(); + a.connect( &a, SIGNAL( lastWindowClosed() ), w, SLOT( tquit() ) ); + return a.exec(); +} diff --git a/examples/extension/mainform.ui b/examples/extension/mainform.ui new file mode 100644 index 000000000..db156785b --- /dev/null +++ b/examples/extension/mainform.ui @@ -0,0 +1,74 @@ +<!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>284</width> + <height>120</height> + </rect> + </property> + <property name="caption"> + <string>Main Form</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQPushButton"> + <property name="name"> + <cstring>optionsPushButton</cstring> + </property> + <property name="text"> + <string>&Options...</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>tquitPushButton</cstring> + </property> + <property name="text"> + <string>&Quit</string> + </property> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>optionsPushButton</sender> + <signal>clicked()</signal> + <receiver>MainForm</receiver> + <slot>optionsDlg()</slot> + </connection> + <connection> + <sender>tquitPushButton</sender> + <signal>clicked()</signal> + <receiver>MainForm</receiver> + <slot>tquit()</slot> + </connection> +</connections> +<includes> + <include location="local" impldecl="in implementation">mainform.ui.h</include> +</includes> +<variables> + <variable>bool log_errors;</variable> + <variable>bool log_warnings;</variable> + <variable>bool log_actions;</variable> + <variable>bool logging;</variable> + <variable>bool sessions;</variable> + <variable>TQString log_filename;</variable> +</variables> +<slots> + <slot>optionsDlg()</slot> + <slot>tquit()</slot> +</slots> +<functions> + <function access="private">init()</function> +</functions> +<pixmapinproject/> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/examples/extension/mainform.ui.h b/examples/extension/mainform.ui.h new file mode 100644 index 000000000..82fc700d0 --- /dev/null +++ b/examples/extension/mainform.ui.h @@ -0,0 +1,46 @@ +/**************************************************************************** +** 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 "dialogform.h" +#include "extension.h" +#include <qapplication.h> +#include <qcheckbox.h> +#include <qlineedit.h> + +void MainForm::init() +{ + sessions = FALSE; + logging = FALSE; + log_filename = TQString::null; + log_errors = TRUE; + log_actions = TRUE; +} + +void MainForm::optionsDlg() +{ + DialogForm *dlg = new DialogForm( this, "dialog", TRUE ); + Extension *ext = (Extension*)dlg->extension()->qt_cast( "Extension" ); + if ( !ext ) + return; + dlg->sessionsCheckBox->setChecked( sessions ); + dlg->loggingCheckBox->setChecked( logging ); + ext->logfileLineEdit->setText( log_filename ); + ext->logErrorsCheckBox->setChecked( log_errors ); + + if ( dlg->exec() ) { + sessions = dlg->sessionsCheckBox->isChecked(); + logging = dlg->loggingCheckBox->isChecked(); + log_filename = ext->logfileLineEdit->text(); + log_errors = ext->logErrorsCheckBox->isChecked(); + } +} + + +void MainForm::tquit() +{ + TQApplication::exit( 0 ); +} |