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/book/book3/book.ui | 141 +++++++++++++++++++++++++++ tools/designer/examples/book/book3/book.ui.h | 16 +++ tools/designer/examples/book/book3/book3.pro | 8 ++ tools/designer/examples/book/book3/main.cpp | 27 +++++ 4 files changed, 192 insertions(+) create mode 100644 tools/designer/examples/book/book3/book.ui create mode 100644 tools/designer/examples/book/book3/book.ui.h create mode 100644 tools/designer/examples/book/book3/book3.pro create mode 100644 tools/designer/examples/book/book3/main.cpp (limited to 'tools/designer/examples/book/book3') diff --git a/tools/designer/examples/book/book3/book.ui b/tools/designer/examples/book/book3/book.ui new file mode 100644 index 0000000..91e2c04 --- /dev/null +++ b/tools/designer/examples/book/book3/book.ui @@ -0,0 +1,141 @@ + +BookForm +book.ui.h + + + + BookForm + + + + 0 + 0 + 566 + 464 + + + + Book + + + + unnamed + + + 11 + + + 6 + + + + Splitter1 + + + MShape + + + MShadow + + + Vertical + + + + + Surname + + + surname + + + + + Forename + + + forename + + + + AuthorDataTable + + + true + + + + surname ASC + forename ASC + + + + + (default) + author + + + + + + + Title + + + title + + + + + Price + + + price + + + + + Notes + + + notes + + + + BookDataTable + + + true + + + + title ASC + + + + + (default) + book + + + + + + + + + AuthorDataTable + currentChanged(QSqlRecord*) + BookForm + newCurrentAuthor(QSqlRecord*) + + + AuthorDataTable + primeInsert(QSqlRecord*) + BookForm + primeInsertAuthor(QSqlRecord*) + + newCurrentAuthor( QSqlRecord * author ) + primeInsertAuthor( QSqlRecord * buffer ) + + diff --git a/tools/designer/examples/book/book3/book.ui.h b/tools/designer/examples/book/book3/book.ui.h new file mode 100644 index 0000000..b027d01 --- /dev/null +++ b/tools/designer/examples/book/book3/book.ui.h @@ -0,0 +1,16 @@ +void BookForm::newCurrentAuthor( QSqlRecord *author ) +{ + BookDataTable->setFilter( "authorid=" + author->value( "id" ).toString() ); + BookDataTable->refresh(); +} + +void BookForm::primeInsertAuthor( QSqlRecord *buffer ) +{ + QSqlQuery 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/tools/designer/examples/book/book3/book3.pro b/tools/designer/examples/book/book3/book3.pro new file mode 100644 index 0000000..a7e1f7b --- /dev/null +++ b/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/tools/designer/examples/book/book3/main.cpp b/tools/designer/examples/book/book3/main.cpp new file mode 100644 index 0000000..89911b1 --- /dev/null +++ b/tools/designer/examples/book/book3/main.cpp @@ -0,0 +1,27 @@ +/**************************************************************************** +** +** 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 +#include "book.h" +#include "../connection.h" + +int main( int argc, char *argv[] ) +{ + QApplication app( argc, argv ); + + if ( ! createConnections() ) + return 1; + + BookForm bookForm; + app.setMainWidget( &bookForm ); + bookForm.show(); + + return app.exec(); +} -- cgit v1.2.1