diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-07-10 15:24:15 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-07-10 15:24:15 -0500 |
commit | bd0f3345a938b35ce6a12f6150373b0955b8dd12 (patch) | |
tree | 7a520322212d48ebcb9fbe1087e7fca28b76185c /tools/designer/examples/credit | |
download | qt3-bd0f3345a938b35ce6a12f6150373b0955b8dd12.tar.gz qt3-bd0f3345a938b35ce6a12f6150373b0955b8dd12.zip |
Add Qt3 development HEAD version
Diffstat (limited to 'tools/designer/examples/credit')
-rw-r--r-- | tools/designer/examples/credit/credit.pro | 11 | ||||
-rw-r--r-- | tools/designer/examples/credit/creditform.cpp | 20 | ||||
-rw-r--r-- | tools/designer/examples/credit/creditform.h | 12 | ||||
-rw-r--r-- | tools/designer/examples/credit/creditformbase.cpp | 122 | ||||
-rw-r--r-- | tools/designer/examples/credit/creditformbase.h | 48 | ||||
-rw-r--r-- | tools/designer/examples/credit/creditformbase.ui | 212 | ||||
-rw-r--r-- | tools/designer/examples/credit/creditformbase.ui.h | 5 | ||||
-rw-r--r-- | tools/designer/examples/credit/main.cpp | 25 |
8 files changed, 455 insertions, 0 deletions
diff --git a/tools/designer/examples/credit/credit.pro b/tools/designer/examples/credit/credit.pro new file mode 100644 index 0000000..4dc246d --- /dev/null +++ b/tools/designer/examples/credit/credit.pro @@ -0,0 +1,11 @@ +TEMPLATE = app +LANGUAGE = C++ +TARGET = credit + +SOURCES += main.cpp +HEADERS += creditform.h +SOURCES += creditform.cpp +FORMS = creditformbase.ui +CONFIG += qt warn_on release +DBFILE = credit.db +IMAGEFILE = images.cpp diff --git a/tools/designer/examples/credit/creditform.cpp b/tools/designer/examples/credit/creditform.cpp new file mode 100644 index 0000000..e49fafb --- /dev/null +++ b/tools/designer/examples/credit/creditform.cpp @@ -0,0 +1,20 @@ +#include <qradiobutton.h> +#include <qspinbox.h> +#include "creditform.h" + +CreditForm::CreditForm( QWidget* parent, const char* name, + bool modal, WFlags fl ) + : CreditFormBase( parent, name, modal, fl ) +{ + setAmount(); +} + +CreditForm::~CreditForm() { /* NOOP */ } + +void CreditForm::setAmount() +{ + if ( stdRadioButton->isChecked() ) + amountSpinBox->setValue( amountSpinBox->maxValue() / 2 ); + else if ( noneRadioButton->isChecked() ) + amountSpinBox->setValue( amountSpinBox->minValue() ); +} diff --git a/tools/designer/examples/credit/creditform.h b/tools/designer/examples/credit/creditform.h new file mode 100644 index 0000000..ffcec14 --- /dev/null +++ b/tools/designer/examples/credit/creditform.h @@ -0,0 +1,12 @@ +#include "creditformbase.h" + +class CreditForm : public CreditFormBase +{ + Q_OBJECT +public: + CreditForm( QWidget* parent = 0, const char* name = 0, + bool modal = FALSE, WFlags fl = 0 ); + ~CreditForm(); +public slots: + void setAmount(); +}; diff --git a/tools/designer/examples/credit/creditformbase.cpp b/tools/designer/examples/credit/creditformbase.cpp new file mode 100644 index 0000000..46d5adc --- /dev/null +++ b/tools/designer/examples/credit/creditformbase.cpp @@ -0,0 +1,122 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'creditformbase.ui' +** +** Created: Fri Aug 10 09:48:16 2001 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "creditformbase.h" + +#include <qvariant.h> // first for gcc 2.7.2 +#include <qbuttongroup.h> +#include <qpushbutton.h> +#include <qradiobutton.h> +#include <qspinbox.h> +#include <qmime.h> +#include <qdragobject.h> +#include <qlayout.h> +#include <qtooltip.h> +#include <qwhatsthis.h> +#include "creditformbase.ui.h" +#include <qimage.h> +#include <qpixmap.h> + +static QPixmap uic_load_pixmap_CreditFormBase( const QString &name ) +{ + const QMimeSource *m = QMimeSourceFactory::defaultFactory()->data( name ); + if ( !m ) + return QPixmap(); + QPixmap pix; + QImageDrag::decode( m, pix ); + return pix; +} +/* + * Constructs a CreditFormBase which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +CreditFormBase::CreditFormBase( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "CreditFormBase" ); + resize( 276, 224 ); + setCaption( trUtf8( "Credit Rating", "" ) ); + CreditFormBaseLayout = new QVBoxLayout( this ); + CreditFormBaseLayout->setSpacing( 6 ); + CreditFormBaseLayout->setMargin( 11 ); + + creditButtonGroup = new QButtonGroup( this, "creditButtonGroup" ); + creditButtonGroup->setTitle( trUtf8( "Credit Rating", "" ) ); + creditButtonGroup->setColumnLayout(0, Qt::Vertical ); + creditButtonGroup->layout()->setSpacing( 0 ); + creditButtonGroup->layout()->setMargin( 0 ); + creditButtonGroupLayout = new QVBoxLayout( creditButtonGroup->layout() ); + creditButtonGroupLayout->setAlignment( Qt::AlignTop ); + creditButtonGroupLayout->setSpacing( 6 ); + creditButtonGroupLayout->setMargin( 11 ); + + stdRadioButton = new QRadioButton( creditButtonGroup, "stdRadioButton" ); + stdRadioButton->setText( trUtf8( "&Standard", "" ) ); + stdRadioButton->setChecked( TRUE ); + creditButtonGroupLayout->addWidget( stdRadioButton ); + + noneRadioButton = new QRadioButton( creditButtonGroup, "noneRadioButton" ); + noneRadioButton->setText( trUtf8( "&None", "" ) ); + creditButtonGroupLayout->addWidget( noneRadioButton ); + + specialRadioButton = new QRadioButton( creditButtonGroup, "specialRadioButton" ); + specialRadioButton->setText( trUtf8( "Sp&ecial", "" ) ); + creditButtonGroupLayout->addWidget( specialRadioButton ); + CreditFormBaseLayout->addWidget( creditButtonGroup ); + + amountSpinBox = new QSpinBox( this, "amountSpinBox" ); + amountSpinBox->setEnabled( FALSE ); + amountSpinBox->setPrefix( trUtf8( "$ ", "" ) ); + amountSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); + amountSpinBox->setMaxValue( 100000 ); + amountSpinBox->setLineStep( 10000 ); + CreditFormBaseLayout->addWidget( amountSpinBox ); + + Layout4 = new QHBoxLayout; + Layout4->setSpacing( 6 ); + Layout4->setMargin( 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout4->addItem( spacer ); + + okPushButton = new QPushButton( this, "okPushButton" ); + okPushButton->setText( trUtf8( "OK", "" ) ); + okPushButton->setDefault( TRUE ); + Layout4->addWidget( okPushButton ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout4->addItem( spacer_2 ); + + cancelPushButton = new QPushButton( this, "cancelPushButton" ); + cancelPushButton->setText( trUtf8( "Cancel", "" ) ); + Layout4->addWidget( cancelPushButton ); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout4->addItem( spacer_3 ); + CreditFormBaseLayout->addLayout( Layout4 ); + + + + + + // signals and slots connections + connect( okPushButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); + connect( cancelPushButton, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect( creditButtonGroup, SIGNAL( clicked(int) ), this, SLOT( setAmount() ) ); + connect( specialRadioButton, SIGNAL( toggled(bool) ), amountSpinBox, SLOT( setEnabled(bool) ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +CreditFormBase::~CreditFormBase() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/tools/designer/examples/credit/creditformbase.h b/tools/designer/examples/credit/creditformbase.h new file mode 100644 index 0000000..6d5e934 --- /dev/null +++ b/tools/designer/examples/credit/creditformbase.h @@ -0,0 +1,48 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'creditformbase.ui' +** +** Created: Fri Aug 10 09:48:10 2001 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef CREDITFORMBASE_H +#define CREDITFORMBASE_H + +#include <qvariant.h> +#include <qdialog.h> +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QPushButton; +class QRadioButton; +class QSpinBox; + +class CreditFormBase : public QDialog +{ + Q_OBJECT + +public: + CreditFormBase( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~CreditFormBase(); + + QButtonGroup* creditButtonGroup; + QRadioButton* stdRadioButton; + QRadioButton* noneRadioButton; + QRadioButton* specialRadioButton; + QSpinBox* amountSpinBox; + QPushButton* okPushButton; + QPushButton* cancelPushButton; + + +public slots: + virtual void setAmount(); + +protected: + QVBoxLayout* CreditFormBaseLayout; + QVBoxLayout* creditButtonGroupLayout; + QHBoxLayout* Layout4; +}; + +#endif // CREDITFORMBASE_H diff --git a/tools/designer/examples/credit/creditformbase.ui b/tools/designer/examples/credit/creditformbase.ui new file mode 100644 index 0000000..4421885 --- /dev/null +++ b/tools/designer/examples/credit/creditformbase.ui @@ -0,0 +1,212 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>CreditFormBase</class> +<include location="local" implDecl="in declaration">creditformbase.ui.h</include> +<pixmapinproject/> +<layoutdefaults spacing="6" margin="11"/> +<widget class="QDialog"> + <property name="name"> + <cstring>CreditFormBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>276</width> + <height>224</height> + </rect> + </property> + <property name="caption"> + <string>Credit Rating</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>creditButtonGroup</cstring> + </property> + <property name="title"> + <string>Credit Rating</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>stdRadioButton</cstring> + </property> + <property name="text"> + <string>&Standard</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>noneRadioButton</cstring> + </property> + <property name="text"> + <string>&None</string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>specialRadioButton</cstring> + </property> + <property name="text"> + <string>Sp&ecial</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>amountSpinBox</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="prefix"> + <string>$ </string> + </property> + <property name="buttonSymbols"> + <enum>UpDownArrows</enum> + </property> + <property name="maxValue"> + <number>100000</number> + </property> + <property name="lineStep"> + <number>10000</number> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout4</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <spacer> + <property name="name"> + <cstring>Spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>okPushButton</cstring> + </property> + <property name="text"> + <string>OK</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer1_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>cancelPushButton</cstring> + </property> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer1_3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </vbox> +</widget> +<connections> + <connection language="C++"> + <sender>okPushButton</sender> + <signal>clicked()</signal> + <receiver>CreditFormBase</receiver> + <slot>accept()</slot> + </connection> + <connection language="C++"> + <sender>cancelPushButton</sender> + <signal>clicked()</signal> + <receiver>CreditFormBase</receiver> + <slot>reject()</slot> + </connection> + <connection language="C++"> + <sender>creditButtonGroup</sender> + <signal>clicked(int)</signal> + <receiver>CreditFormBase</receiver> + <slot>setAmount()</slot> + </connection> + <connection language="C++"> + <sender>specialRadioButton</sender> + <signal>toggled(bool)</signal> + <receiver>amountSpinBox</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <slot access="public" specifier="virtual" language="C++" returnType="void">setAmount()</slot> +</connections> +</UI> diff --git a/tools/designer/examples/credit/creditformbase.ui.h b/tools/designer/examples/credit/creditformbase.ui.h new file mode 100644 index 0000000..6cf4faa --- /dev/null +++ b/tools/designer/examples/credit/creditformbase.ui.h @@ -0,0 +1,5 @@ +void CreditFormBase::setAmount() +{ + +} + diff --git a/tools/designer/examples/credit/main.cpp b/tools/designer/examples/credit/main.cpp new file mode 100644 index 0000000..dde1daa --- /dev/null +++ b/tools/designer/examples/credit/main.cpp @@ -0,0 +1,25 @@ +/**************************************************************************** +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of an example program for Qt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#include <qapplication.h> +#include "creditform.h" + + +int main( int argc, char *argv[] ) +{ + QApplication app( argc, argv ); + + CreditForm creditForm; + app.setMainWidget( &creditForm ); + creditForm.show(); + + return app.exec(); +} + + |