From bd0f3345a938b35ce6a12f6150373b0955b8dd12 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 10 Jul 2011 15:24:15 -0500 Subject: Add Qt3 development HEAD version --- tools/designer/examples/receiver2/main.cpp | 25 ++++++++ tools/designer/examples/receiver2/mainform.ui | 82 +++++++++++++++++++++++++ tools/designer/examples/receiver2/mainform.ui.h | 20 ++++++ tools/designer/examples/receiver2/receiver.cpp | 29 +++++++++ tools/designer/examples/receiver2/receiver.h | 13 ++++ tools/designer/examples/receiver2/receiver.pro | 12 ++++ 6 files changed, 181 insertions(+) create mode 100644 tools/designer/examples/receiver2/main.cpp create mode 100644 tools/designer/examples/receiver2/mainform.ui create mode 100644 tools/designer/examples/receiver2/mainform.ui.h create mode 100644 tools/designer/examples/receiver2/receiver.cpp create mode 100644 tools/designer/examples/receiver2/receiver.h create mode 100644 tools/designer/examples/receiver2/receiver.pro (limited to 'tools/designer/examples/receiver2') diff --git a/tools/designer/examples/receiver2/main.cpp b/tools/designer/examples/receiver2/main.cpp new file mode 100644 index 0000000..8c76ef2 --- /dev/null +++ b/tools/designer/examples/receiver2/main.cpp @@ -0,0 +1,25 @@ +/**************************************************************************** +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of an example program for Qt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#include +#include "mainform.h" + + +int main( int argc, char *argv[] ) +{ + QApplication app( argc, argv ); + + MainForm *mainForm = new MainForm; + app.setMainWidget( mainForm ); + mainForm->show(); + + return app.exec(); +} + + diff --git a/tools/designer/examples/receiver2/mainform.ui b/tools/designer/examples/receiver2/mainform.ui new file mode 100644 index 0000000..690f185 --- /dev/null +++ b/tools/designer/examples/receiver2/mainform.ui @@ -0,0 +1,82 @@ + +MainForm +qwidgetfactory.h +qspinbox.h +receiver.h +mainform.ui.h + + + + MainForm + + + + 0 + 0 + 373 + 107 + + + + Main Form + + + + unnamed + + + 11 + + + 6 + + + + quitPushButton + + + &Quit + + + + + creditPushButton + + + &Credit Dialog + + + + + TextLabel1 + + + Credit Rating + + + + + ratingTextLabel + + + Unrated + + + + + + + creditPushButton + clicked() + MainForm + creditDialog() + + + quitPushButton + clicked() + MainForm + accept() + + creditDialog() + + diff --git a/tools/designer/examples/receiver2/mainform.ui.h b/tools/designer/examples/receiver2/mainform.ui.h new file mode 100644 index 0000000..3cc3b69 --- /dev/null +++ b/tools/designer/examples/receiver2/mainform.ui.h @@ -0,0 +1,20 @@ +void MainForm::creditDialog() +{ + Receiver *receiver = new Receiver; + QDialog *creditForm = (QDialog *) + QWidgetFactory::create( "../credit/creditformbase.ui", receiver ); + receiver->setParent( creditForm ); + + // Set up the dynamic dialog here + + if ( creditForm->exec() ) { + // The user accepted, act accordingly + QSpinBox *amount = (QSpinBox *) creditForm->child( "amountSpinBox", "QSpinBox" ); + if ( amount ) + ratingTextLabel->setText( amount->text() ); + } + + delete receiver; + delete creditForm; +} + diff --git a/tools/designer/examples/receiver2/receiver.cpp b/tools/designer/examples/receiver2/receiver.cpp new file mode 100644 index 0000000..1f66d0b --- /dev/null +++ b/tools/designer/examples/receiver2/receiver.cpp @@ -0,0 +1,29 @@ +#include +#include +#include "receiver.h" + +void Receiver::setParent( QDialog *parent ) +{ + p = parent; + setAmount(); +} + +void Receiver::setAmount() +{ + QSpinBox *amount = + (QSpinBox *) p->child( "amountSpinBox", "QSpinBox" ); + + QRadioButton *radio = + (QRadioButton *) p->child( "stdRadioButton", "QRadioButton" ); + if ( radio && radio->isChecked() ) { + if ( amount ) + amount->setValue( amount->maxValue() / 2 ); + return; + } + + radio = + (QRadioButton *) p->child( "noneRadioButton", "QRadioButton" ); + if ( radio && radio->isChecked() ) + if ( amount ) + amount->setValue( amount->minValue() ); +} diff --git a/tools/designer/examples/receiver2/receiver.h b/tools/designer/examples/receiver2/receiver.h new file mode 100644 index 0000000..34b80e9 --- /dev/null +++ b/tools/designer/examples/receiver2/receiver.h @@ -0,0 +1,13 @@ +#include +#include + +class Receiver : public QObject +{ + Q_OBJECT +public: + void setParent( QDialog *parent ); +public slots: + void setAmount(); +private: + QDialog *p; +}; diff --git a/tools/designer/examples/receiver2/receiver.pro b/tools/designer/examples/receiver2/receiver.pro new file mode 100644 index 0000000..5c7bf79 --- /dev/null +++ b/tools/designer/examples/receiver2/receiver.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +LANGUAGE = C++ +TARGET = receiver + +CONFIG += qt warn_on release +INCLUDEPATH += $$QT_SOURCE_TREE/tools/designer/uilib +LIBS += -lqui +SOURCES += main.cpp receiver.cpp +HEADERS += receiver.h +FORMS = mainform.ui +DBFILE = receiver.db +IMAGEFILE = images.cpp -- cgit v1.2.3