diff options
author | Timothy Pearson <[email protected]> | 2011-07-10 15:24:15 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2011-07-10 15:24:15 -0500 |
commit | bd0f3345a938b35ce6a12f6150373b0955b8dd12 (patch) | |
tree | 7a520322212d48ebcb9fbe1087e7fca28b76185c /examples/extension | |
download | qt3-bd0f3345a938b35ce6a12f6150373b0955b8dd12.tar.gz qt3-bd0f3345a938b35ce6a12f6150373b0955b8dd12.zip |
Add Qt3 development HEAD version
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 0000000..0784c86 --- /dev/null +++ b/examples/extension/dialogform.ui @@ -0,0 +1,206 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>DialogForm</class> +<widget class="QDialog"> + <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="QLayoutWidget"> + <property name="name"> + <cstring>Layout7</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout5</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <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="QCheckBox"> + <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="QLayoutWidget"> + <property name="name"> + <cstring>Layout4</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton"> + <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="QLayoutWidget"> + <property name="name"> + <cstring>Layout3</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>okPushButton</cstring> + </property> + <property name="text"> + <string>OK</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>cancelPushButton</cstring> + </property> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + <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 0000000..a1f8894 --- /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 Qt Designer which will +** update this file, preserving your code. Create an init() function in place +** of a constructor, and a destroy() function in place of a destructor. +*****************************************************************************/ + +void DialogForm::init() +{ + extensionShown = FALSE; + setExtension( new Extension( this ) ); + setOrientation( Vertical ); +} + + +void DialogForm::toggleDetails() +{ + extensionShown = !extensionShown; + showExtension( extensionShown ); + QString text = tr( "&Details " ); + text += QString( extensionShown ? "<<<" : ">>>" ); + detailsPushButton->setText( text ); +} diff --git a/examples/extension/extension.doc b/examples/extension/extension.doc new file mode 100644 index 0000000..98b4a33 --- /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 0000000..7cc6598 --- /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 0000000..e5daba6 --- /dev/null +++ b/examples/extension/extension.ui @@ -0,0 +1,114 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>Extension</class> +<widget class="QWidget"> + <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="QLayoutWidget"> + <property name="name"> + <cstring>Layout6</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <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="QLineEdit"> + <property name="name"> + <cstring>logfileLineEdit</cstring> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>browsePushButton</cstring> + </property> + <property name="text"> + <string>&Browse...</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QButtonGroup"> + <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="QLayoutWidget"> + <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="QCheckBox"> + <property name="name"> + <cstring>logActionsCheckBox</cstring> + </property> + <property name="text"> + <string>&Actions</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QCheckBox"> + <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 0000000..f17a035 --- /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 Qt Designer which will +** update this file, preserving your code. Create an init() function in place +** of a constructor, and a destroy() function in place of a destructor. +*****************************************************************************/ diff --git a/examples/extension/main.cpp b/examples/extension/main.cpp new file mode 100644 index 0000000..15cb68f --- /dev/null +++ b/examples/extension/main.cpp @@ -0,0 +1,11 @@ +#include <qapplication.h> +#include "mainform.h" + +int main( int argc, char ** argv ) +{ + QApplication a( argc, argv ); + MainForm *w = new MainForm; + w->show(); + a.connect( &a, SIGNAL( lastWindowClosed() ), w, SLOT( quit() ) ); + return a.exec(); +} diff --git a/examples/extension/mainform.ui b/examples/extension/mainform.ui new file mode 100644 index 0000000..8495be8 --- /dev/null +++ b/examples/extension/mainform.ui @@ -0,0 +1,74 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>MainForm</class> +<widget class="QDialog"> + <property name="name"> + <cstring>MainForm</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>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="QPushButton"> + <property name="name"> + <cstring>optionsPushButton</cstring> + </property> + <property name="text"> + <string>&Options...</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>quitPushButton</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>quitPushButton</sender> + <signal>clicked()</signal> + <receiver>MainForm</receiver> + <slot>quit()</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>QString log_filename;</variable> +</variables> +<slots> + <slot>optionsDlg()</slot> + <slot>quit()</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 0000000..c025d73 --- /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 Qt Designer which will +** update this file, preserving your code. Create an init() function in place +** of a constructor, and a destroy() function in place of a destructor. +*****************************************************************************/ +#include "dialogform.h" +#include "extension.h" +#include <qapplication.h> +#include <qcheckbox.h> +#include <qlineedit.h> + +void MainForm::init() +{ + sessions = FALSE; + logging = FALSE; + log_filename = QString::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::quit() +{ + QApplication::exit( 0 ); +} |