summaryrefslogtreecommitdiffstats
path: root/python/pyqt/examples3/SQL/README
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit90825e2392b2d70e43c7a25b8a3752299a933894 (patch)
treee33aa27f02b74604afbfd0ea4f1cfca8833d882a /python/pyqt/examples3/SQL/README
downloadtdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.tar.gz
tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'python/pyqt/examples3/SQL/README')
-rw-r--r--python/pyqt/examples3/SQL/README76
1 files changed, 76 insertions, 0 deletions
diff --git a/python/pyqt/examples3/SQL/README b/python/pyqt/examples3/SQL/README
new file mode 100644
index 00000000..9dfc5d41
--- /dev/null
+++ b/python/pyqt/examples3/SQL/README
@@ -0,0 +1,76 @@
+This directory contains some translated sql examples from Qt 3.x.
+
+runform1.py, form1.ui:
+
+ A simple designer generated QDataTable. Run "pyuic form1.ui -o form1.py".
+
+runform2.py, form2.ui:
+
+ A simple designer generated QDataBrowser. Run "pyuic form2.ui -o form2.py".
+
+sqlcustom1.py:
+
+ QSqlForm based form with a simple custom editor forcing all input to
+ be uppercase
+
+sqltable4.py:
+
+ Custom QDataTable with reimplemented paintField method, combined with
+ a QComboBox based custom field editor (StatusPicker), gathering its
+ items from a different table (status) and a calculated column (monsalary).
+ Note, that QSqlEditorFactory based field editors are somewhat restricted,
+ because Qt's Q_PROPERTY feature isn't supported, yet. I've circumvented
+ this limitation by choosing the status table ids corresponding to the
+ index in the QComboBox.
+
+sqlsubclass5.py:
+
+ Similar to the former, and even more deviated from its qt ancestor,
+ because the sense escaped me. This could be related to the different
+ database layout needed for MySQL (Trolltech used PostgreSQL sequences,
+ while we're using the simpler, but less powerful auto_increment here).
+ If you enter and invalid date (e.g. day: 0) in the Paid column, it is
+ shown as "not yet", but produces some qt warnings.
+
+runsqlex.py, sqlex.ui, sqlex.ui.h, connect.ui, connect.ui.h:
+
+ This one is a most advanced example, showing the use of a QSqlCursor
+ driven by QSqlQuery and iterating through database tables and fields.
+ Definitely worth a look.
+
+Unfortunately you will have to make sure that these prerequisites are met
+before trying the examples:
+
+ - Install MySQL or PostgreSQL and any development packages
+
+ - Create a database user with sufficient rights
+
+ - Create the testdb database
+ - For MySQL, run: mysql -u user -p password < testdb_mysql.sql
+ - For PostgreSQL, run: psql -U user template1 -f testdb_pg.sql
+
+ - Build Qt with the mysql and/or psql modules activated.
+
+Now you should be ready for the fun part. You can run dbconnect.py from
+a command line and try to connect to the database. If all went well,
+'ok' should be printed after pressing OK. If you don't want to enter all
+your data over and over again, create a file named local_dbpar.py here,
+with the following keys (with your own data, of course):
+
+DB_HOSTNAMES = ["localhost"]
+DB_DATABASES = ["testdb"]
+DB_USERNAME = "name"
+DB_PASSWORD = "pass"
+
+The dbconnect.py script is generated from dbconnect.ui, which was created
+with qt's designer. You can find it also in Boudewijn Rempt's book
+"GUI Programming with Python, using the Qt Toolkit". Although you won't find
+the SQL widgets discussed there, for the simple reason of the book being
+written before they appeared, it is a valuable source for anybody new in
+this area.
+
+Please direct any comments, patches and questions to <pykde@mats.gmd.de>.
+
+Good luck
+
+Hans-Peter Jansen <hpj@urpla.net>