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/book/book2 | |
download | qt3-bd0f3345a938b35ce6a12f6150373b0955b8dd12.tar.gz qt3-bd0f3345a938b35ce6a12f6150373b0955b8dd12.zip |
Add Qt3 development HEAD version
Diffstat (limited to 'tools/designer/examples/book/book2')
-rw-r--r-- | tools/designer/examples/book/book2/book.ui | 77 | ||||
-rw-r--r-- | tools/designer/examples/book/book2/book.ui.h | 10 | ||||
-rw-r--r-- | tools/designer/examples/book/book2/book2.pro | 8 | ||||
-rw-r--r-- | tools/designer/examples/book/book2/main.cpp | 27 |
4 files changed, 122 insertions, 0 deletions
diff --git a/tools/designer/examples/book/book2/book.ui b/tools/designer/examples/book/book2/book.ui new file mode 100644 index 0000000..c66dfae --- /dev/null +++ b/tools/designer/examples/book/book2/book.ui @@ -0,0 +1,77 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>BookForm</class> +<include location="local" implDecl="in declaration">book.ui.h</include> +<layoutdefaults spacing="6" margin="11"/> +<widget class="QDialog"> + <property name="name"> + <cstring>BookForm</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>576</width> + <height>468</height> + </rect> + </property> + <property name="caption"> + <string>Book</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="QDataTable"> + <column> + <property name="text"> + <string>Surname</string> + </property> + <property name="field"> + <string>surname</string> + </property> + </column> + <column> + <property name="text"> + <string>Forename</string> + </property> + <property name="field"> + <string>forename</string> + </property> + </column> + <property name="name"> + <cstring>AuthorcDataTable</cstring> + </property> + <property name="confirmDelete"> + <bool>true</bool> + </property> + <property name="sort"> + <stringlist> + <string>surname ASC</string> + <string>forename ASC</string> + </stringlist> + </property> + <property name="database" stdset="0"> + <stringlist> + <string>(default)</string> + <string>author</string> + </stringlist> + </property> + </widget> + </vbox> +</widget> +<connections> + <connection language="C++"> + <sender>AuthorcDataTable</sender> + <signal>primeInsert(QSqlRecord*)</signal> + <receiver>BookForm</receiver> + <slot>primeInsertAuthor(QSqlRecord*)</slot> + </connection> + <slot access="public" specifier="virtual" language="C++" returnType="void">primeInsertAuthor( QSqlRecord * buffer )</slot> +</connections> +</UI> diff --git a/tools/designer/examples/book/book2/book.ui.h b/tools/designer/examples/book/book2/book.ui.h new file mode 100644 index 0000000..40b1143 --- /dev/null +++ b/tools/designer/examples/book/book2/book.ui.h @@ -0,0 +1,10 @@ +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/book2/book2.pro b/tools/designer/examples/book/book2/book2.pro new file mode 100644 index 0000000..a7e1f7b --- /dev/null +++ b/tools/designer/examples/book/book2/book2.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/book2/main.cpp b/tools/designer/examples/book/book2/main.cpp new file mode 100644 index 0000000..464ed42 --- /dev/null +++ b/tools/designer/examples/book/book2/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 <qapplication.h> +#include <qsqldatabase.h> +#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(); +} |