summaryrefslogtreecommitdiffstats
path: root/examples3/SQL
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-29 01:11:08 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-29 01:11:08 -0600
commit8a055d66f43592c257cece2eb8cc021808062917 (patch)
treed0922f201bd5d24b62a33160d1d9baf9e89f9a70 /examples3/SQL
parentb388516ca2691303a076a0764fd40bf7116fe43d (diff)
downloadpytqt-8a055d66f43592c257cece2eb8cc021808062917.tar.gz
pytqt-8a055d66f43592c257cece2eb8cc021808062917.zip
Initial TQt conversion
Diffstat (limited to 'examples3/SQL')
-rw-r--r--examples3/SQL/README28
-rw-r--r--examples3/SQL/connect.ui34
-rw-r--r--examples3/SQL/connect.ui.h6
-rwxr-xr-xexamples3/SQL/dbconnect.py20
-rw-r--r--examples3/SQL/dbpar.py4
-rw-r--r--examples3/SQL/form1.ui4
-rw-r--r--examples3/SQL/form2.ui56
-rw-r--r--examples3/SQL/frmconnect.py58
-rw-r--r--examples3/SQL/frmconnect.ui28
-rwxr-xr-xexamples3/SQL/runform1.py4
-rwxr-xr-xexamples3/SQL/runform2.py4
-rwxr-xr-xexamples3/SQL/runsqlex.py46
-rwxr-xr-xexamples3/SQL/sqlcustom1.py34
-rw-r--r--examples3/SQL/sqlex.ui40
-rw-r--r--examples3/SQL/sqlex.ui.h8
-rwxr-xr-xexamples3/SQL/sqlsubclass5.py68
-rwxr-xr-xexamples3/SQL/sqltable4.py50
-rw-r--r--examples3/SQL/testdb_pg.sql24
18 files changed, 258 insertions, 258 deletions
diff --git a/examples3/SQL/README b/examples3/SQL/README
index 9dfc5d4..6e28f6e 100644
--- a/examples3/SQL/README
+++ b/examples3/SQL/README
@@ -1,27 +1,27 @@
-This directory contains some translated sql examples from Qt 3.x.
+This directory contains some translated sql examples from TQt 3.x.
runform1.py, form1.ui:
- A simple designer generated QDataTable. Run "pyuic form1.ui -o form1.py".
+ A simple designer generated TQDataTable. Run "pyuic form1.ui -o form1.py".
runform2.py, form2.ui:
- A simple designer generated QDataBrowser. Run "pyuic form2.ui -o form2.py".
+ A simple designer generated TQDataBrowser. Run "pyuic form2.ui -o form2.py".
sqlcustom1.py:
- QSqlForm based form with a simple custom editor forcing all input to
+ TQSqlForm 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
+ Custom TQDataTable with reimplemented paintField method, combined with
+ a TQComboBox 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
+ Note, that TQSqlEditorFactory based field editors are somewhat restricted,
+ because TQt'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.
+ index in the TQComboBox.
sqlsubclass5.py:
@@ -34,11 +34,11 @@ sqlsubclass5.py:
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.
+ This one is a most advanced example, showing the use of a TQSqlCursor
+ driven by TQSqlQuery and iterating through database tables and fields.
Definitely worth a look.
-Unfortunately you will have to make sure that these prerequisites are met
+Unfortunately you will have to make sure that these preretquisites are met
before trying the examples:
- Install MySQL or PostgreSQL and any development packages
@@ -49,7 +49,7 @@ before trying the examples:
- 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.
+ - Build TQt 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,
@@ -64,7 +64,7 @@ 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
+"GUI Programming with Python, using the TQt 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.
diff --git a/examples3/SQL/connect.ui b/examples3/SQL/connect.ui
index cc41920..d33a783 100644
--- a/examples3/SQL/connect.ui
+++ b/examples3/SQL/connect.ui
@@ -1,6 +1,6 @@
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>ConnectDialog</class>
-<widget class="QDialog">
+<widget class="TQDialog">
<property name="name">
<cstring>ConnectDialog</cstring>
</property>
@@ -25,7 +25,7 @@
<property name="spacing">
<number>6</number>
</property>
- <widget class="QGroupBox">
+ <widget class="TQGroupBox">
<property name="name">
<cstring>GroupBox3</cstring>
</property>
@@ -42,12 +42,12 @@
<property name="spacing">
<number>6</number>
</property>
- <widget class="QLineEdit" row="1" column="1">
+ <widget class="TQLineEdit" row="1" column="1">
<property name="name">
<cstring>editDatabase</cstring>
</property>
</widget>
- <widget class="QLabel" row="1" column="0">
+ <widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>TextLabel3</cstring>
</property>
@@ -58,7 +58,7 @@
<cstring>comboDatabase</cstring>
</property>
</widget>
- <widget class="QLineEdit" row="3" column="1">
+ <widget class="TQLineEdit" row="3" column="1">
<property name="name">
<cstring>editPassword</cstring>
</property>
@@ -66,7 +66,7 @@
<enum>Password</enum>
</property>
</widget>
- <widget class="QLabel" row="2" column="0">
+ <widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>TextLabel4</cstring>
</property>
@@ -77,7 +77,7 @@
<cstring>editUsername</cstring>
</property>
</widget>
- <widget class="QLabel" row="3" column="0">
+ <widget class="TQLabel" row="3" column="0">
<property name="name">
<cstring>TextLabel4_2</cstring>
</property>
@@ -88,22 +88,22 @@
<cstring>editPassword</cstring>
</property>
</widget>
- <widget class="QComboBox" row="0" column="1">
+ <widget class="TQComboBox" row="0" column="1">
<property name="name">
<cstring>comboDriver</cstring>
</property>
</widget>
- <widget class="QLineEdit" row="2" column="1">
+ <widget class="TQLineEdit" row="2" column="1">
<property name="name">
<cstring>editUsername</cstring>
</property>
</widget>
- <widget class="QLineEdit" row="4" column="1">
+ <widget class="TQLineEdit" row="4" column="1">
<property name="name">
<cstring>editHostname</cstring>
</property>
</widget>
- <widget class="QLabel" row="4" column="0">
+ <widget class="TQLabel" row="4" column="0">
<property name="name">
<cstring>TextLabel5</cstring>
</property>
@@ -114,7 +114,7 @@
<cstring>editHostname</cstring>
</property>
</widget>
- <widget class="QLabel" row="5" column="0">
+ <widget class="TQLabel" row="5" column="0">
<property name="name">
<cstring>TextLabel5_2</cstring>
</property>
@@ -125,7 +125,7 @@
<cstring>portSpinBox</cstring>
</property>
</widget>
- <widget class="QSpinBox" row="5" column="1">
+ <widget class="TQSpinBox" row="5" column="1">
<property name="name">
<cstring>portSpinBox</cstring>
</property>
@@ -142,7 +142,7 @@
<number>-1</number>
</property>
</widget>
- <widget class="QLabel" row="0" column="0">
+ <widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>TextLabel2</cstring>
</property>
@@ -155,7 +155,7 @@
</widget>
</grid>
</widget>
- <widget class="QLayoutWidget">
+ <widget class="TQLayoutWidget">
<property name="name">
<cstring>Layout25</cstring>
</property>
@@ -180,7 +180,7 @@
<enum>Expanding</enum>
</property>
</spacer>
- <widget class="QPushButton">
+ <widget class="TQPushButton">
<property name="name">
<cstring>PushButton1</cstring>
</property>
@@ -191,7 +191,7 @@
<bool>true</bool>
</property>
</widget>
- <widget class="QPushButton">
+ <widget class="TQPushButton">
<property name="name">
<cstring>PushButton2</cstring>
</property>
diff --git a/examples3/SQL/connect.ui.h b/examples3/SQL/connect.ui.h
index cbeeabd..9d994ff 100644
--- a/examples3/SQL/connect.ui.h
+++ b/examples3/SQL/connect.ui.h
@@ -1,7 +1,7 @@
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
-** If you wish to add, delete or rename slots use Qt Designer which will
+** If you wish to add, delete or rename slots use TQt Designer which will
** update this file, preserving your code. Create an init() slot in place of
** a constructor, and a destroy() slot in place of a destructor.
*****************************************************************************/
@@ -9,10 +9,10 @@
void ConnectDialog::init()
{
-from qtsql import QSqlDatabase
+from qtsql import TQSqlDatabase
#qDebug("ConnectDialog init")
self.comboDriver.clear()
-self.comboDriver.insertStringList(QSqlDatabase.drivers())
+self.comboDriver.insertStringList(TQSqlDatabase.drivers())
}
void ConnectDialog::destroy()
diff --git a/examples3/SQL/dbconnect.py b/examples3/SQL/dbconnect.py
index fdae7de..6986d08 100755
--- a/examples3/SQL/dbconnect.py
+++ b/examples3/SQL/dbconnect.py
@@ -12,19 +12,19 @@ FALSE = 0
def createConnection():
driver = DB_DRIVER
- # all qt examples use QSqlDatabase::addDatabase, but
+ # all qt examples use TQSqlDatabase::addDatabase, but
# this never returns NULL in my experience
- drivers = map(str, QSqlDatabase.drivers())
+ drivers = map(str, TQSqlDatabase.drivers())
if driver in drivers:
dlg = dbConnect(driver)
#TODO: make connection parameters accessible
return dlg.exec_loop()
else:
- QMessageBox.warning(None, "Database Error",
+ TQMessageBox.warning(None, "Database Error",
"<%s> database driver not found!\n\n"
"Please make sure, that this database adaptor\n"
- "is available in your Qt installation.\n" %
- (driver), QMessageBox.Abort | QMessageBox.Escape)
+ "is available in your TQt installation.\n" %
+ (driver), TQMessageBox.Abort | TQMessageBox.Escape)
return FALSE
class dbConnect(frmConnect):
@@ -50,7 +50,7 @@ class dbConnect(frmConnect):
self.database = self.cmbDatabase.currentText()
self.username = self.txtName.text()
self.password = self.txtPasswd.text()
- db = QSqlDatabase.addDatabase(self.dbdriver)
+ db = TQSqlDatabase.addDatabase(self.dbdriver)
if db:
db.setHostName(self.hostname)
db.setDatabaseName(self.database)
@@ -59,7 +59,7 @@ class dbConnect(frmConnect):
if db.open():
frmConnect.accept(self)
else:
- QMessageBox.warning(self, "Database Error",
+ TQMessageBox.warning(self, "Database Error",
"Cannot open %s database on %s!\n\n%s\n%s\n" %
(self.database, self.hostname,
db.lastError().driverText(),
@@ -67,15 +67,15 @@ class dbConnect(frmConnect):
def buttonHelp_clicked(self):
- QMessageBox.information(self, "About Connecting",
+ TQMessageBox.information(self, "About Connecting",
"Here you specify userid, password, host and database\n"
- "for the PyQt sql examples. If you encounter any problems,\n"
+ "for the PyTQt sql examples. If you encounter any problems,\n"
"please read the README file in this folder before posting.\n\n"
"Thanks,\nHans-Peter Jansen <hpj@urpla.net>\n")
if __name__ == "__main__":
- app = QApplication(sys.argv)
+ app = TQApplication(sys.argv)
if createConnection():
print "ok"
else:
diff --git a/examples3/SQL/dbpar.py b/examples3/SQL/dbpar.py
index 90e9270..19e6d9b 100644
--- a/examples3/SQL/dbpar.py
+++ b/examples3/SQL/dbpar.py
@@ -3,8 +3,8 @@
# you can create a local_dbpar.py module with definitons
# of your own parameters to overrule these defaults
-#DB_DRIVER = "QPSQL7"
-DB_DRIVER = "QMYSQL3"
+#DB_DRIVER = "TQPSQL7"
+DB_DRIVER = "TQMYSQL3"
# list of servers
DB_HOSTNAMES = ["localhost"]
# list of databases
diff --git a/examples3/SQL/form1.ui b/examples3/SQL/form1.ui
index 38b3cb2..118a84e 100644
--- a/examples3/SQL/form1.ui
+++ b/examples3/SQL/form1.ui
@@ -1,6 +1,6 @@
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>Form1</class>
-<widget class="QDialog">
+<widget class="TQDialog">
<property name="name">
<cstring>Form1</cstring>
</property>
@@ -15,7 +15,7 @@
<property name="caption">
<string>Form1</string>
</property>
- <widget class="QDataTable">
+ <widget class="TQDataTable">
<column>
<property name="text">
<string>Forename</string>
diff --git a/examples3/SQL/form2.ui b/examples3/SQL/form2.ui
index ffe2beb..4856e39 100644
--- a/examples3/SQL/form2.ui
+++ b/examples3/SQL/form2.ui
@@ -1,6 +1,6 @@
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>Form2</class>
-<widget class="QDialog">
+<widget class="TQDialog">
<property name="name">
<cstring>Form2</cstring>
</property>
@@ -15,7 +15,7 @@
<property name="caption">
<string>Form2</string>
</property>
- <widget class="QDataBrowser">
+ <widget class="TQDataBrowser">
<property name="name">
<cstring>DataBrowser1</cstring>
</property>
@@ -49,7 +49,7 @@
<property name="spacing">
<number>6</number>
</property>
- <widget class="QLayoutWidget" row="0" column="0">
+ <widget class="TQLayoutWidget" row="0" column="0">
<property name="name">
<cstring>Layout2</cstring>
</property>
@@ -63,7 +63,7 @@
<property name="spacing">
<number>6</number>
</property>
- <widget class="QLabel" row="1" column="0">
+ <widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>labelSurname</cstring>
</property>
@@ -71,9 +71,9 @@
<string>Surname</string>
</property>
</widget>
- <widget class="QSpinBox" row="1" column="3">
+ <widget class="TQSpinBox" row="1" column="3">
<property name="name">
- <cstring>QSpinBoxStatusid</cstring>
+ <cstring>TQSpinBoxStatusid</cstring>
</property>
<property name="maxValue">
<number>2147483647</number>
@@ -86,9 +86,9 @@
</stringlist>
</property>
</widget>
- <widget class="QLineEdit" row="1" column="1">
+ <widget class="TQLineEdit" row="1" column="1">
<property name="name">
- <cstring>QLineEditSurname</cstring>
+ <cstring>TQLineEditSurname</cstring>
</property>
<property name="database" stdset="0">
<stringlist>
@@ -98,7 +98,7 @@
</stringlist>
</property>
</widget>
- <widget class="QLabel" row="1" column="2">
+ <widget class="TQLabel" row="1" column="2">
<property name="name">
<cstring>labelStatusid</cstring>
</property>
@@ -106,7 +106,7 @@
<string>Statusid</string>
</property>
</widget>
- <widget class="QLabel" row="0" column="0">
+ <widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>labelForename</cstring>
</property>
@@ -114,9 +114,9 @@
<string>Forename</string>
</property>
</widget>
- <widget class="QLineEdit" row="0" column="3">
+ <widget class="TQLineEdit" row="0" column="3">
<property name="name">
- <cstring>QLineEditSalary</cstring>
+ <cstring>TQLineEditSalary</cstring>
</property>
<property name="alignment">
<set>AlignRight</set>
@@ -129,7 +129,7 @@
</stringlist>
</property>
</widget>
- <widget class="QLabel" row="0" column="2">
+ <widget class="TQLabel" row="0" column="2">
<property name="name">
<cstring>labelSalary</cstring>
</property>
@@ -137,9 +137,9 @@
<string>Salary</string>
</property>
</widget>
- <widget class="QLineEdit" row="0" column="1">
+ <widget class="TQLineEdit" row="0" column="1">
<property name="name">
- <cstring>QLineEditForename</cstring>
+ <cstring>TQLineEditForename</cstring>
</property>
<property name="database" stdset="0">
<stringlist>
@@ -151,7 +151,7 @@
</widget>
</grid>
</widget>
- <widget class="QLayoutWidget" row="1" column="0">
+ <widget class="TQLayoutWidget" row="1" column="0">
<property name="name">
<cstring>Layout3</cstring>
</property>
@@ -165,7 +165,7 @@
<property name="spacing">
<number>6</number>
</property>
- <widget class="QPushButton">
+ <widget class="TQPushButton">
<property name="name">
<cstring>PushButtonFirst</cstring>
</property>
@@ -173,7 +173,7 @@
<string>|&lt; &amp;First</string>
</property>
</widget>
- <widget class="QPushButton">
+ <widget class="TQPushButton">
<property name="name">
<cstring>PushButtonPrev</cstring>
</property>
@@ -181,7 +181,7 @@
<string>&lt;&lt; &amp;Prev</string>
</property>
</widget>
- <widget class="QPushButton">
+ <widget class="TQPushButton">
<property name="name">
<cstring>PushButtonNext</cstring>
</property>
@@ -189,7 +189,7 @@
<string>&amp;Next &gt;&gt;</string>
</property>
</widget>
- <widget class="QPushButton">
+ <widget class="TQPushButton">
<property name="name">
<cstring>PushButtonLast</cstring>
</property>
@@ -199,7 +199,7 @@
</widget>
</hbox>
</widget>
- <widget class="QLayoutWidget" row="2" column="0">
+ <widget class="TQLayoutWidget" row="2" column="0">
<property name="name">
<cstring>Layout4</cstring>
</property>
@@ -213,7 +213,7 @@
<property name="spacing">
<number>6</number>
</property>
- <widget class="QPushButton">
+ <widget class="TQPushButton">
<property name="name">
<cstring>PushButtonInsert</cstring>
</property>
@@ -221,7 +221,7 @@
<string>&amp;Insert</string>
</property>
</widget>
- <widget class="QPushButton">
+ <widget class="TQPushButton">
<property name="name">
<cstring>PushButtonUpdate</cstring>
</property>
@@ -229,7 +229,7 @@
<string>&amp;Update</string>
</property>
</widget>
- <widget class="QPushButton">
+ <widget class="TQPushButton">
<property name="name">
<cstring>PushButtonDelete</cstring>
</property>
@@ -311,10 +311,10 @@
</connection>
</connections>
<tabstops>
- <tabstop>QLineEditForename</tabstop>
- <tabstop>QLineEditSurname</tabstop>
- <tabstop>QLineEditSalary</tabstop>
- <tabstop>QSpinBoxStatusid</tabstop>
+ <tabstop>TQLineEditForename</tabstop>
+ <tabstop>TQLineEditSurname</tabstop>
+ <tabstop>TQLineEditSalary</tabstop>
+ <tabstop>TQSpinBoxStatusid</tabstop>
<tabstop>PushButtonFirst</tabstop>
<tabstop>PushButtonPrev</tabstop>
<tabstop>PushButtonNext</tabstop>
diff --git a/examples3/SQL/frmconnect.py b/examples3/SQL/frmconnect.py
index 23cd067..92cf3f6 100644
--- a/examples3/SQL/frmconnect.py
+++ b/examples3/SQL/frmconnect.py
@@ -1,7 +1,7 @@
# Form implementation generated from reading ui file 'frmconnect.ui'
#
# Created: Sam Jul 6 12:47:10 2002
-# by: The PyQt User Interface Compiler (pyuic)
+# by: The PyTQt User Interface Compiler (pyuic)
#
# WARNING! All changes made in this file will be lost!
@@ -9,9 +9,9 @@
from qt import *
-class frmConnect(QDialog):
+class frmConnect(TQDialog):
def __init__(self,parent = None,name = None,modal = 0,fl = 0):
- QDialog.__init__(self,parent,name,modal,fl)
+ TQDialog.__init__(self,parent,name,modal,fl)
if name == None:
self.setName("frmConnect")
@@ -20,85 +20,85 @@ class frmConnect(QDialog):
self.setCaption(self.trUtf8("Connecting"))
self.setSizeGripEnabled(1)
- frmConnectLayout = QGridLayout(self,1,1,11,6,"frmConnectLayout")
+ frmConnectLayout = TQGridLayout(self,1,1,11,6,"frmConnectLayout")
- Layout7 = QVBoxLayout(None,0,6,"Layout7")
+ Layout7 = TQVBoxLayout(None,0,6,"Layout7")
- self.buttonOK = QPushButton(self,"buttonOK")
+ self.buttonOK = TQPushButton(self,"buttonOK")
self.buttonOK.setText(self.trUtf8("&OK"))
self.buttonOK.setAutoDefault(1)
self.buttonOK.setDefault(1)
- QToolTip.add(self.buttonOK,self.trUtf8("Connect to Database"))
+ TQToolTip.add(self.buttonOK,self.trUtf8("Connect to Database"))
Layout7.addWidget(self.buttonOK)
- self.buttonCancel = QPushButton(self,"buttonCancel")
+ self.buttonCancel = TQPushButton(self,"buttonCancel")
self.buttonCancel.setText(self.trUtf8("&Cancel"))
- QToolTip.add(self.buttonCancel,self.trUtf8("Cancel Connecting"))
+ TQToolTip.add(self.buttonCancel,self.trUtf8("Cancel Connecting"))
Layout7.addWidget(self.buttonCancel)
- self.buttonHelp = QPushButton(self,"buttonHelp")
+ self.buttonHelp = TQPushButton(self,"buttonHelp")
self.buttonHelp.setText(self.trUtf8("&Help"))
- QToolTip.add(self.buttonHelp,self.trUtf8("About Connecting"))
+ TQToolTip.add(self.buttonHelp,self.trUtf8("About Connecting"))
Layout7.addWidget(self.buttonHelp)
- spacer = QSpacerItem(0,0,QSizePolicy.Minimum,QSizePolicy.Expanding)
+ spacer = TQSpacerItem(0,0,TQSizePolicy.Minimum,TQSizePolicy.Expanding)
Layout7.addItem(spacer)
frmConnectLayout.addLayout(Layout7,0,1)
- self.grpConnection = QGroupBox(self,"grpConnection")
+ self.grpConnection = TQGroupBox(self,"grpConnection")
self.grpConnection.setTitle(self.trUtf8(""))
- self.grpConnection.setColumnLayout(0,Qt.Vertical)
+ self.grpConnection.setColumnLayout(0,TQt.Vertical)
self.grpConnection.layout().setSpacing(6)
self.grpConnection.layout().setMargin(11)
- grpConnectionLayout = QGridLayout(self.grpConnection.layout())
- grpConnectionLayout.setAlignment(Qt.AlignTop)
+ grpConnectionLayout = TQGridLayout(self.grpConnection.layout())
+ grpConnectionLayout.setAlignment(TQt.AlignTop)
- self.txtName = QLineEdit(self.grpConnection,"txtName")
+ self.txtName = TQLineEdit(self.grpConnection,"txtName")
self.txtName.setMaxLength(16)
- QToolTip.add(self.txtName,self.trUtf8("Database User ID"))
+ TQToolTip.add(self.txtName,self.trUtf8("Database User ID"))
grpConnectionLayout.addWidget(self.txtName,0,1)
- self.lblDatabase = QLabel(self.grpConnection,"lblDatabase")
+ self.lblDatabase = TQLabel(self.grpConnection,"lblDatabase")
self.lblDatabase.setText(self.trUtf8("&Database"))
grpConnectionLayout.addWidget(self.lblDatabase,3,0)
- self.lblServer = QLabel(self.grpConnection,"lblServer")
+ self.lblServer = TQLabel(self.grpConnection,"lblServer")
self.lblServer.setText(self.trUtf8("&Server"))
grpConnectionLayout.addWidget(self.lblServer,2,0)
- self.lblName = QLabel(self.grpConnection,"lblName")
+ self.lblName = TQLabel(self.grpConnection,"lblName")
self.lblName.setText(self.trUtf8("&Name"))
grpConnectionLayout.addWidget(self.lblName,0,0)
- self.cmbDatabase = QComboBox(0,self.grpConnection,"cmbDatabase")
+ self.cmbDatabase = TQComboBox(0,self.grpConnection,"cmbDatabase")
self.cmbDatabase.setEditable(1)
self.cmbDatabase.setAutoCompletion(1)
self.cmbDatabase.setDuplicatesEnabled(0)
- QToolTip.add(self.cmbDatabase,self.trUtf8("Database Name"))
+ TQToolTip.add(self.cmbDatabase,self.trUtf8("Database Name"))
grpConnectionLayout.addWidget(self.cmbDatabase,3,1)
- self.txtPasswd = QLineEdit(self.grpConnection,"txtPasswd")
+ self.txtPasswd = TQLineEdit(self.grpConnection,"txtPasswd")
self.txtPasswd.setMaxLength(16)
- self.txtPasswd.setEchoMode(QLineEdit.Password)
- QToolTip.add(self.txtPasswd,self.trUtf8("Database User Password"))
+ self.txtPasswd.setEchoMode(TQLineEdit.Password)
+ TQToolTip.add(self.txtPasswd,self.trUtf8("Database User Password"))
grpConnectionLayout.addWidget(self.txtPasswd,1,1)
- self.lblPasswd = QLabel(self.grpConnection,"lblPasswd")
+ self.lblPasswd = TQLabel(self.grpConnection,"lblPasswd")
self.lblPasswd.setText(self.trUtf8("&Password"))
grpConnectionLayout.addWidget(self.lblPasswd,1,0)
- self.cmbServer = QComboBox(0,self.grpConnection,"cmbServer")
+ self.cmbServer = TQComboBox(0,self.grpConnection,"cmbServer")
self.cmbServer.setEditable(1)
self.cmbServer.setAutoCompletion(1)
self.cmbServer.setDuplicatesEnabled(0)
- QToolTip.add(self.cmbServer,self.trUtf8("Database Server Address"))
+ TQToolTip.add(self.cmbServer,self.trUtf8("Database Server Address"))
grpConnectionLayout.addWidget(self.cmbServer,2,1)
diff --git a/examples3/SQL/frmconnect.ui b/examples3/SQL/frmconnect.ui
index a6fc15c..f2017ee 100644
--- a/examples3/SQL/frmconnect.ui
+++ b/examples3/SQL/frmconnect.ui
@@ -1,6 +1,6 @@
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>frmConnect</class>
-<widget class="QDialog">
+<widget class="TQDialog">
<property name="name">
<cstring>frmConnect</cstring>
</property>
@@ -28,7 +28,7 @@
<property name="spacing">
<number>6</number>
</property>
- <widget class="QLayoutWidget" row="0" column="1">
+ <widget class="TQLayoutWidget" row="0" column="1">
<property name="name">
<cstring>Layout7</cstring>
</property>
@@ -42,7 +42,7 @@
<property name="spacing">
<number>6</number>
</property>
- <widget class="QPushButton">
+ <widget class="TQPushButton">
<property name="name">
<cstring>buttonOK</cstring>
</property>
@@ -59,7 +59,7 @@
<string>Connect to Database</string>
</property>
</widget>
- <widget class="QPushButton">
+ <widget class="TQPushButton">
<property name="name">
<cstring>buttonCancel</cstring>
</property>
@@ -70,7 +70,7 @@
<string>Cancel Connecting</string>
</property>
</widget>
- <widget class="QPushButton">
+ <widget class="TQPushButton">
<property name="name">
<cstring>buttonHelp</cstring>
</property>
@@ -94,7 +94,7 @@
</spacer>
</vbox>
</widget>
- <widget class="QGroupBox" row="0" column="0">
+ <widget class="TQGroupBox" row="0" column="0">
<property name="name">
<cstring>grpConnection</cstring>
</property>
@@ -111,7 +111,7 @@
<property name="spacing">
<number>6</number>
</property>
- <widget class="QLineEdit" row="0" column="1">
+ <widget class="TQLineEdit" row="0" column="1">
<property name="name">
<cstring>txtName</cstring>
</property>
@@ -122,7 +122,7 @@
<string>Database User ID</string>
</property>
</widget>
- <widget class="QLabel" row="3" column="0">
+ <widget class="TQLabel" row="3" column="0">
<property name="name">
<cstring>lblDatabase</cstring>
</property>
@@ -133,7 +133,7 @@
<cstring>cmbDatabase</cstring>
</property>
</widget>
- <widget class="QLabel" row="2" column="0">
+ <widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>lblServer</cstring>
</property>
@@ -144,7 +144,7 @@
<cstring>cmbServer</cstring>
</property>
</widget>
- <widget class="QLabel" row="0" column="0">
+ <widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>lblName</cstring>
</property>
@@ -155,7 +155,7 @@
<cstring>txtName</cstring>
</property>
</widget>
- <widget class="QComboBox" row="3" column="1">
+ <widget class="TQComboBox" row="3" column="1">
<property name="name">
<cstring>cmbDatabase</cstring>
</property>
@@ -172,7 +172,7 @@
<string>Database Name</string>
</property>
</widget>
- <widget class="QLineEdit" row="1" column="1">
+ <widget class="TQLineEdit" row="1" column="1">
<property name="name">
<cstring>txtPasswd</cstring>
</property>
@@ -186,7 +186,7 @@
<string>Database User Password</string>
</property>
</widget>
- <widget class="QLabel" row="1" column="0">
+ <widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>lblPasswd</cstring>
</property>
@@ -197,7 +197,7 @@
<cstring>txtPasswd</cstring>
</property>
</widget>
- <widget class="QComboBox" row="2" column="1">
+ <widget class="TQComboBox" row="2" column="1">
<property name="name">
<cstring>cmbServer</cstring>
</property>
diff --git a/examples3/SQL/runform1.py b/examples3/SQL/runform1.py
index d5760ce..b2b9951 100755
--- a/examples3/SQL/runform1.py
+++ b/examples3/SQL/runform1.py
@@ -11,9 +11,9 @@ class mainWindow(Form1):
Form1.__init__(self,parent,name,fl)
if __name__ == "__main__":
- a = QApplication(sys.argv)
+ a = TQApplication(sys.argv)
if createConnection():
- QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
+ TQObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
w = mainWindow()
a.setMainWidget(w)
w.show()
diff --git a/examples3/SQL/runform2.py b/examples3/SQL/runform2.py
index ba0ca4a..485eed3 100755
--- a/examples3/SQL/runform2.py
+++ b/examples3/SQL/runform2.py
@@ -11,9 +11,9 @@ class mainWindow(Form2):
Form2.__init__(self,parent,name,fl)
if __name__ == "__main__":
- a = QApplication(sys.argv)
+ a = TQApplication(sys.argv)
if createConnection():
- QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
+ TQObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
w = mainWindow()
a.setMainWidget(w)
w.show()
diff --git a/examples3/SQL/runsqlex.py b/examples3/SQL/runsqlex.py
index 7f2afa7..09f567d 100755
--- a/examples3/SQL/runsqlex.py
+++ b/examples3/SQL/runsqlex.py
@@ -13,30 +13,30 @@ TRUE = 1
FALSE = 0
def showError(err, parent):
- errStr = QString("The database reported an error:\n\n")
+ errStr = TQString("The database reported an error:\n\n")
if not err.databaseText().isEmpty():
errStr.append(err.databaseText())
errStr.append("\n")
if not err.driverText().isEmpty():
errStr.append(err.driverText())
errStr.append("\n")
- QMessageBox.warning(parent, "Error", errStr)
+ TQMessageBox.warning(parent, "Error", errStr)
-class CustomSqlCursor(QSqlCursor):
+class CustomSqlCursor(TQSqlCursor):
def __init__(self, query = None, autopopulate = TRUE, db = None):
- QSqlCursor.__init__(self, None, autopopulate, db)
+ TQSqlCursor.__init__(self, None, autopopulate, db)
self.execQuery(query)
if self.isSelect() and autopopulate:
fields = self.driver().recordInfo(self)
for f in fields:
self.append(f)
- self.setMode(QSqlCursor.ReadOnly)
+ self.setMode(TQSqlCursor.ReadOnly)
- def select(self, filter, sort = QSqlIndex()):
+ def select(self, filter, sort = TQSqlIndex()):
return self.execQuery(self.lastQuery())
def primaryIndex(self, prime = TRUE):
- return QSqlIndex()
+ return TQSqlIndex()
def insert(self, invalidate = TRUE):
return FALSE
@@ -68,21 +68,21 @@ class MainWindow(SqlEx):
if str(self.conDiag.comboDriver.text(i)) == DB_DRIVER:
self.conDiag.comboDriver.setCurrentItem(i)
break
- if self.conDiag.exec_loop() != QDialog.Accepted:
+ if self.conDiag.exec_loop() != TQDialog.Accepted:
return
if self.dt.sqlCursor():
self.dt.setSqlCursor()
# close old connection (if any)
- if QSqlDatabase.contains("SqlEx"):
- oldDb = QSqlDatabase.database("SqlEx")
+ if TQSqlDatabase.contains("SqlEx"):
+ oldDb = TQSqlDatabase.database("SqlEx")
oldDb.close()
- QSqlDatabase.removeDatabase("SqlEx")
+ TQSqlDatabase.removeDatabase("SqlEx")
# open the new connection
- db = QSqlDatabase.addDatabase(self.conDiag.comboDriver.currentText(), "SqlEx")
+ db = TQSqlDatabase.addDatabase(self.conDiag.comboDriver.currentText(), "SqlEx")
if not db:
- QMessageBox.warning(self, "Error", "Could not open database")
+ TQMessageBox.warning(self, "Error", "Could not open database")
return
db.setHostName(self.conDiag.editHostname.text())
@@ -98,15 +98,15 @@ class MainWindow(SqlEx):
tables = db.tables()
for t in tables:
- lvi = QListViewItem(self.lv, t)
+ lvi = TQListViewItem(self.lv, t)
fields = db.recordInfo(t)
for f in fields:
req = "?"
- if f.isRequired() > 0:
+ if f.isRetquired() > 0:
req = "Yes"
- elif f.isRequired() == 0:
+ elif f.isRetquired() == 0:
req = "No"
- fi = QListViewItem(lvi, f.name(), QVariant.typeToName(f.type()), req)
+ fi = TQListViewItem(lvi, f.name(), TQVariant.typeToName(f.type()), req)
lvi.insertItem(fi)
self.lv.insertItem(lvi)
@@ -114,11 +114,11 @@ class MainWindow(SqlEx):
def execQuery(self):
cursor = CustomSqlCursor(self.te.text(), TRUE,
- QSqlDatabase.database("SqlEx", TRUE))
+ TQSqlDatabase.database("SqlEx", TRUE))
if cursor.isSelect():
self.dt.setSqlCursor(cursor, TRUE, TRUE)
self.dt.refresh()
- txt = QString("Query OK")
+ txt = TQString("Query OK")
if cursor.size() >= 0:
txt.append(", returned rows: %s" % cursor.size())
self.lbl.setText(txt)
@@ -134,16 +134,16 @@ class MainWindow(SqlEx):
i = item.parent()
if not i:
i = item
- cursor = QSqlCursor(i.text(0), TRUE, QSqlDatabase.database("SqlEx", TRUE))
+ cursor = TQSqlCursor(i.text(0), TRUE, TQSqlDatabase.database("SqlEx", TRUE))
self.dt.setSqlCursor(cursor, TRUE, TRUE)
self.dt.setSort(cursor.primaryIndex())
- self.dt.refresh(QDataTable.RefreshAll)
+ self.dt.refresh(TQDataTable.RefreshAll)
self.lbl.setText("Displaying table %s" % i.text(0))
if __name__ == "__main__":
- a = QApplication(sys.argv)
- QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
+ a = TQApplication(sys.argv)
+ TQObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
w = MainWindow()
a.setMainWidget(w)
w.show()
diff --git a/examples3/SQL/sqlcustom1.py b/examples3/SQL/sqlcustom1.py
index cacb010..f708c1e 100755
--- a/examples3/SQL/sqlcustom1.py
+++ b/examples3/SQL/sqlcustom1.py
@@ -5,7 +5,7 @@
#**
#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved.
#**
-#** This file is part of an example program for PyQt. This example
+#** This file is part of an example program for PyTQt. This example
#** program may be used, distributed and modified without limitation.
#**
#*****************************************************************************/
@@ -19,10 +19,10 @@ from dbconnect import createConnection
TRUE = 1
FALSE = 0
-class CustomEdit(QLineEdit):
+class CustomEdit(TQLineEdit):
def __init__(self, parent = None, name = None):
- QLineEdit.__init__(self, parent, name)
- QObject.connect(self, SIGNAL("textChanged(const QString &)"),
+ TQLineEdit.__init__(self, parent, name)
+ TQObject.connect(self, SIGNAL("textChanged(const TQString &)"),
self.changed)
def changed(self, line):
@@ -33,20 +33,20 @@ class CustomEdit(QLineEdit):
self.setText(self.upperLineText)
-class FormDialog(QDialog):
+class FormDialog(TQDialog):
def __init__(self):
- QDialog.__init__(self)
- forenameLabel = QLabel("Forename:", self)
+ TQDialog.__init__(self)
+ forenameLabel = TQLabel("Forename:", self)
forenameEdit = CustomEdit(self)
- surnameLabel = QLabel("Surname:", self)
+ surnameLabel = TQLabel("Surname:", self)
surnameEdit = CustomEdit(self)
- salaryLabel = QLabel("Salary:", self)
- salaryEdit = QLineEdit(self)
- salaryEdit.setAlignment(Qt.AlignRight)
- saveButton = QPushButton("&Save", self)
+ salaryLabel = TQLabel("Salary:", self)
+ salaryEdit = TQLineEdit(self)
+ salaryEdit.setAlignment(TQt.AlignRight)
+ saveButton = TQPushButton("&Save", self)
self.connect(saveButton, SIGNAL("clicked()"), self.save)
- grid = QGridLayout(self)
+ grid = TQGridLayout(self)
grid.addWidget(forenameLabel, 0, 0)
grid.addWidget(forenameEdit, 0, 1)
grid.addWidget(surnameLabel, 1, 0)
@@ -56,17 +56,17 @@ class FormDialog(QDialog):
grid.addWidget(saveButton, 3, 0)
grid.activate()
- self.staffCursor = QSqlCursor("staff")
+ self.staffCursor = TQSqlCursor("staff")
self.staffCursor.setTrimmed("forename", TRUE)
self.staffCursor.setTrimmed("surname", TRUE)
self.idIndex = self.staffCursor.index("id")
self.staffCursor.select(self.idIndex)
self.staffCursor.first()
- self.propMap = QSqlPropertyMap()
+ self.propMap = TQSqlPropertyMap()
self.propMap.insert(forenameEdit.className(), "upperLine")
- self.sqlForm = QSqlForm()
+ self.sqlForm = TQSqlForm()
self.sqlForm.setRecord(self.staffCursor.primeUpdate())
self.sqlForm.installPropertyMap(self.propMap)
self.sqlForm.insert(forenameEdit, "forename")
@@ -82,7 +82,7 @@ class FormDialog(QDialog):
if __name__=='__main__':
- app = QApplication( sys.argv )
+ app = TQApplication( sys.argv )
if createConnection():
formDialog = FormDialog()
diff --git a/examples3/SQL/sqlex.ui b/examples3/SQL/sqlex.ui
index 022fed9..5b9303d 100644
--- a/examples3/SQL/sqlex.ui
+++ b/examples3/SQL/sqlex.ui
@@ -1,6 +1,6 @@
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>SqlEx</class>
-<widget class="QWidget">
+<widget class="TQWidget">
<property name="name">
<cstring>SqlEx</cstring>
</property>
@@ -25,7 +25,7 @@
<property name="spacing">
<number>6</number>
</property>
- <widget class="QLayoutWidget" row="1" column="0">
+ <widget class="TQLayoutWidget" row="1" column="0">
<property name="name">
<cstring>Layout23</cstring>
</property>
@@ -39,7 +39,7 @@
<property name="spacing">
<number>6</number>
</property>
- <widget class="QLabel">
+ <widget class="TQLabel">
<property name="name">
<cstring>lbl</cstring>
</property>
@@ -47,7 +47,7 @@
<string>Press "Connect" to open a database</string>
</property>
</widget>
- <widget class="QPushButton">
+ <widget class="TQPushButton">
<property name="name">
<cstring>conBtn</cstring>
</property>
@@ -71,21 +71,21 @@
</widget>
</hbox>
</widget>
- <widget class="QSplitter" row="0" column="0">
+ <widget class="TQSplitter" row="0" column="0">
<property name="name">
<cstring>vsplit</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
- <widget class="QSplitter">
+ <widget class="TQSplitter">
<property name="name">
<cstring>hsplit</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
- <widget class="QListView">
+ <widget class="TQListView">
<column>
<property name="text">
<string>Tables</string>
@@ -110,7 +110,7 @@
</column>
<column>
<property name="text">
- <string>Required</string>
+ <string>Retquired</string>
</property>
<property name="clickable">
<bool>true</bool>
@@ -135,7 +135,7 @@
<enum>LastColumn</enum>
</property>
</widget>
- <widget class="QDataTable">
+ <widget class="TQDataTable">
<property name="name">
<cstring>dt</cstring>
</property>
@@ -144,7 +144,7 @@
</property>
</widget>
</widget>
- <widget class="QGroupBox">
+ <widget class="TQGroupBox">
<property name="name">
<cstring>gb</cstring>
</property>
@@ -161,7 +161,7 @@
<property name="spacing">
<number>6</number>
</property>
- <widget class="QLayoutWidget" row="0" column="0">
+ <widget class="TQLayoutWidget" row="0" column="0">
<property name="name">
<cstring>Layout22</cstring>
</property>
@@ -175,12 +175,12 @@
<property name="spacing">
<number>6</number>
</property>
- <widget class="QTextEdit">
+ <widget class="TQTextEdit">
<property name="name">
<cstring>te</cstring>
</property>
</widget>
- <widget class="QLayoutWidget">
+ <widget class="TQLayoutWidget">
<property name="name">
<cstring>Layout21</cstring>
</property>
@@ -205,7 +205,7 @@
<enum>Expanding</enum>
</property>
</spacer>
- <widget class="QPushButton">
+ <widget class="TQPushButton">
<property name="name">
<cstring>submitBtn</cstring>
</property>
@@ -227,7 +227,7 @@
<string>&amp;Submit</string>
</property>
</widget>
- <widget class="QPushButton">
+ <widget class="TQPushButton">
<property name="name">
<cstring>clearBtn</cstring>
</property>
@@ -273,15 +273,15 @@
</connection>
<connection>
<sender>lv</sender>
- <signal>returnPressed(QListViewItem*)</signal>
+ <signal>returnPressed(TQListViewItem*)</signal>
<receiver>SqlEx</receiver>
- <slot>showTable(QListViewItem*)</slot>
+ <slot>showTable(TQListViewItem*)</slot>
</connection>
<connection>
<sender>lv</sender>
- <signal>doubleClicked(QListViewItem*)</signal>
+ <signal>doubleClicked(TQListViewItem*)</signal>
<receiver>SqlEx</receiver>
- <slot>showTable(QListViewItem*)</slot>
+ <slot>showTable(TQListViewItem*)</slot>
</connection>
<connection>
<sender>submitBtn</sender>
@@ -296,7 +296,7 @@
<slots>
<slot>init()</slot>
<slot>dbConnect()</slot>
- <slot>showTable( QListViewItem * )</slot>
+ <slot>showTable( TQListViewItem * )</slot>
<slot>execQuery()</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
diff --git a/examples3/SQL/sqlex.ui.h b/examples3/SQL/sqlex.ui.h
index 1acdc5d..07edcd0 100644
--- a/examples3/SQL/sqlex.ui.h
+++ b/examples3/SQL/sqlex.ui.h
@@ -1,7 +1,7 @@
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
-** If you wish to add, delete or rename slots use Qt Designer which will
+** If you wish to add, delete or rename slots use TQt Designer which will
** update this file, preserving your code. Create an init() slot in place of
** a constructor, and a destroy() slot in place of a destructor.
*****************************************************************************/
@@ -10,8 +10,8 @@
void SqlEx::init()
{
self.hsplit.setSizes([250])
-self.hsplit.setResizeMode(self.lv, QSplitter.KeepSize)
-self.vsplit.setResizeMode(self.gb, QSplitter.KeepSize)
+self.hsplit.setResizeMode(self.lv, TQSplitter.KeepSize)
+self.vsplit.setResizeMode(self.gb, TQSplitter.KeepSize)
self.submitBtn.setEnabled(0)
}
@@ -22,7 +22,7 @@ void SqlEx::dbConnect()
}
-void SqlEx::showTable( QListViewItem * )
+void SqlEx::showTable( TQListViewItem * )
{
}
diff --git a/examples3/SQL/sqlsubclass5.py b/examples3/SQL/sqlsubclass5.py
index 137ff93..07cc90a 100755
--- a/examples3/SQL/sqlsubclass5.py
+++ b/examples3/SQL/sqlsubclass5.py
@@ -5,7 +5,7 @@
#**
#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved.
#**
-#** This file is part of an example program for PyQt. This example
+#** This file is part of an example program for PyTQt. This example
#** program may be used, distributed and modified without limitation.
#**
#*****************************************************************************/
@@ -19,16 +19,16 @@ from dbconnect import createConnection
TRUE = 1
FALSE = 0
-class CustomTable(QDataTable):
+class CustomTable(TQDataTable):
def __init__(self, cursor, autoPopulate = FALSE, parent = None, name = None):
- QDataTable.__init__(self, cursor, autoPopulate, parent, name)
+ TQDataTable.__init__(self, cursor, autoPopulate, parent, name)
def paintField(self, p, field, cr, b):
if not field:
return
fn = str(field.name())
if fn == "pricesid":
- query = QSqlQuery("SELECT name FROM prices WHERE id=%s" %
+ query = TQSqlQuery("SELECT name FROM prices WHERE id=%s" %
field.value().toString())
value = ""
if query.next():
@@ -37,78 +37,78 @@ class CustomTable(QDataTable):
self.fieldAlignment(field), value)
elif fn == "quantity":
p.drawText(2, 2, cr.width()-6, cr.height()-4,
- Qt.AlignRight|Qt.AlignVCenter, field.value().toString())
+ TQt.AlignRight|TQt.AlignVCenter, field.value().toString())
elif fn in ("price", "cost"):
v = field.value().toDouble()
if v < 0:
- p.setPen(QColor("red"))
- value = QString(u"%.2f \u20ac" % v)
+ p.setPen(TQColor("red"))
+ value = TQString(u"%.2f \u20ac" % v)
p.drawText(2, 2, cr.width()-6, cr.height()-4,
- Qt.AlignRight|Qt.AlignVCenter, value)
+ TQt.AlignRight|TQt.AlignVCenter, value)
elif fn == "paiddate":
if field.value().toDate().isNull():
- v = QString("not yet")
- p.setPen(QColor("red"))
+ v = TQString("not yet")
+ p.setPen(TQColor("red"))
else:
- v = field.value().toDate().toString(Qt.LocalDate)
+ v = field.value().toDate().toString(TQt.LocalDate)
p.drawText(2, 2, cr.width()-4, cr.height()-4,
- Qt.AlignHCenter|Qt.AlignVCenter, v)
+ TQt.AlignHCenter|TQt.AlignVCenter, v)
else:
- QDataTable.paintField(self, p, field, cr, b)
+ TQDataTable.paintField(self, p, field, cr, b)
-class InvoiceItemCursor(QSqlCursor):
+class InvoiceItemCursor(TQSqlCursor):
def __init__(self):
- QSqlCursor.__init__(self, "invoiceitem")
+ TQSqlCursor.__init__(self, "invoiceitem")
- productPrice = QSqlFieldInfo("price", QVariant.Double)
+ productPrice = TQSqlFieldInfo("price", TQVariant.Double)
self.append(productPrice)
self.setCalculated(productPrice.name(), TRUE)
- productCost = QSqlFieldInfo("cost", QVariant.Double)
+ productCost = TQSqlFieldInfo("cost", TQVariant.Double)
self.append(productCost)
self.setCalculated(productCost.name(), TRUE)
def calculateField(self, name):
fn = str(name)
if fn == "productname":
- query = QSqlQuery("SELECT name FROM prices WHERE id=%d;" %
+ query = TQSqlQuery("SELECT name FROM prices WHERE id=%d;" %
(self.field("pricesid").value().toInt()))
if query.next():
return query.value(0)
elif fn == "price":
- query = QSqlQuery("SELECT price FROM prices WHERE id=%d;" %
+ query = TQSqlQuery("SELECT price FROM prices WHERE id=%d;" %
(self.field("pricesid").value().toInt()))
if query.next():
return query.value(0)
elif fn == "cost":
- query = QSqlQuery("SELECT price FROM prices WHERE id=%d;" %
+ query = TQSqlQuery("SELECT price FROM prices WHERE id=%d;" %
(self.field("pricesid").value().toInt()))
if query.next():
- return QVariant(query.value(0).toDouble() *
+ return TQVariant(query.value(0).toDouble() *
self.value("quantity").toDouble())
- return QVariant(QString.null)
+ return TQVariant(TQString.null)
def primeInsert(self):
buffer = self.editBuffer()
- buffer.setValue("id", QVariant(0))
- buffer.setValue("paiddate", QVariant(QDate.currentDate()))
- buffer.setValue("quantity", QVariant(1))
+ buffer.setValue("id", TQVariant(0))
+ buffer.setValue("paiddate", TQVariant(TQDate.currentDate()))
+ buffer.setValue("quantity", TQVariant(1))
return buffer
-class ProductPicker(QComboBox):
+class ProductPicker(TQComboBox):
def __init__(self, parent = None, name = None):
- QComboBox.__init__(self, parent, name)
- cur = QSqlCursor("prices")
+ TQComboBox.__init__(self, parent, name)
+ cur = TQSqlCursor("prices")
cur.select(cur.index("id"))
while cur.next():
self.insertItem(cur.value("name").toString(), cur.value("id").toInt())
-class CustomSqlEditorFactory(QSqlEditorFactory):
+class CustomSqlEditorFactory(TQSqlEditorFactory):
def __init__(self):
- QSqlEditorFactory.__init__(self)
+ TQSqlEditorFactory.__init__(self)
def createEditor(self, parent, field):
try:
@@ -116,13 +116,13 @@ class CustomSqlEditorFactory(QSqlEditorFactory):
return ProductPicker(parent)
except AttributeError:
pass
- return QSqlEditorFactory.createEditor(self, parent, field)
+ return TQSqlEditorFactory.createEditor(self, parent, field)
class Table(CustomTable):
def __init__(self):
self.invoiceItemCursor = InvoiceItemCursor()
- QDataTable.__init__(self, self.invoiceItemCursor)
- self.propMap = QSqlPropertyMap()
+ TQDataTable.__init__(self, self.invoiceItemCursor)
+ self.propMap = TQSqlPropertyMap()
self.editorFactory = CustomSqlEditorFactory()
self.propMap.insert("ProductPicker", "pricesid")
self.installPropertyMap(self.propMap)
@@ -141,7 +141,7 @@ class Table(CustomTable):
if __name__=='__main__':
- app = QApplication(sys.argv)
+ app = TQApplication(sys.argv)
if createConnection():
t = Table()
app.setMainWidget(t)
diff --git a/examples3/SQL/sqltable4.py b/examples3/SQL/sqltable4.py
index 8f488d3..001e897 100755
--- a/examples3/SQL/sqltable4.py
+++ b/examples3/SQL/sqltable4.py
@@ -5,7 +5,7 @@
#**
#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved.
#**
-#** This file is part of an example program for PyQt. This example
+#** This file is part of an example program for PyTQt. This example
#** program may be used, distributed and modified without limitation.
#**
#*****************************************************************************/
@@ -19,9 +19,9 @@ from dbconnect import createConnection
TRUE = 1
FALSE = 0
-class CustomTable(QDataTable):
+class CustomTable(TQDataTable):
def __init__(self, cursor, autoPopulate = FALSE, parent = None, name = None):
- QDataTable.__init__(self, cursor, autoPopulate, parent, name)
+ TQDataTable.__init__(self, cursor, autoPopulate, parent, name)
def paintField(self, p, field, cr, b):
if not field:
@@ -30,13 +30,13 @@ class CustomTable(QDataTable):
if fn in ("salary", "monsalary"):
v = field.value().toDouble()
if v < 0:
- p.setPen(QColor("red"))
- value = QString(u"%.2f \u20ac" % v)
+ p.setPen(TQColor("red"))
+ value = TQString(u"%.2f \u20ac" % v)
#print unicode(value).encode("iso-8859-15")
p.drawText(2, 2, cr.width()-6, cr.height()-4,
- Qt.AlignRight|Qt.AlignVCenter, value)
+ TQt.AlignRight|TQt.AlignVCenter, value)
elif fn == "statusid":
- query = QSqlQuery("SELECT name FROM status WHERE id=%s" %
+ query = TQSqlQuery("SELECT name FROM status WHERE id=%s" %
field.value().toString())
value = ""
if query.next():
@@ -44,21 +44,21 @@ class CustomTable(QDataTable):
p.drawText(2, 2, cr.width()-4, cr.height()-4,
self.fieldAlignment(field), value)
else:
- QDataTable.paintField(self, p, field, cr, b)
+ TQDataTable.paintField(self, p, field, cr, b)
-class StatusPicker(QComboBox):
+class StatusPicker(TQComboBox):
def __init__(self, parent = None, name = None):
- QComboBox.__init__(self, parent, name)
- cur = QSqlCursor("status")
+ TQComboBox.__init__(self, parent, name)
+ cur = TQSqlCursor("status")
cur.select(cur.index("id"))
while cur.next():
self.insertItem(cur.value("name").toString(), cur.value("id").toInt())
-class CustomSqlEditorFactory(QSqlEditorFactory):
+class CustomSqlEditorFactory(TQSqlEditorFactory):
def __init__(self):
- QSqlEditorFactory.__init__(self)
+ TQSqlEditorFactory.__init__(self)
def createEditor(self, parent, field):
try:
@@ -66,28 +66,28 @@ class CustomSqlEditorFactory(QSqlEditorFactory):
return StatusPicker(parent)
except AttributeError:
pass
- return QSqlEditorFactory.createEditor(self, parent, field)
+ return TQSqlEditorFactory.createEditor(self, parent, field)
-class StaffCursor(QSqlCursor):
+class StaffCursor(TQSqlCursor):
def __init__(self):
- QSqlCursor.__init__(self, "staff")
- monSalary = QSqlFieldInfo("monsalary", QVariant.Double)
+ TQSqlCursor.__init__(self, "staff")
+ monSalary = TQSqlFieldInfo("monsalary", TQVariant.Double)
self.append(monSalary)
self.setCalculated(monSalary.name(), TRUE)
def calculateField(self, name):
if str(name) == "monsalary":
- return QVariant(self.value("salary").toDouble() / 12)
- return QVariant(QString.null)
+ return TQVariant(self.value("salary").toDouble() / 12)
+ return TQVariant(TQString.null)
class Table(CustomTable):
def __init__(self):
- #self.staffCursor = QSqlCursor("staff")
+ #self.staffCursor = TQSqlCursor("staff")
self.staffCursor = StaffCursor()
- QDataTable.__init__(self, self.staffCursor)
- self.propMap = QSqlPropertyMap()
+ TQDataTable.__init__(self, self.staffCursor)
+ self.propMap = TQSqlPropertyMap()
self.editorFactory = CustomSqlEditorFactory()
self.propMap.insert("StatusPicker", "statusid")
self.installPropertyMap(self.propMap)
@@ -98,15 +98,15 @@ class Table(CustomTable):
("monsalary","Monthly Salary"),
("statusid", "Status")):
self.addColumn(cn, ch)
- self.order = QStringList("surname")
+ self.order = TQStringList("surname")
self.order.append("forename")
self.setSort(self.order)
self.refresh()
if __name__=='__main__':
- app = QApplication(sys.argv)
- #app.setFont(QFont("Verdana", 11))
+ app = TQApplication(sys.argv)
+ #app.setFont(TQFont("Verdana", 11))
if createConnection():
t = Table()
diff --git a/examples3/SQL/testdb_pg.sql b/examples3/SQL/testdb_pg.sql
index 73a4270..ef0479f 100644
--- a/examples3/SQL/testdb_pg.sql
+++ b/examples3/SQL/testdb_pg.sql
@@ -93,34 +93,34 @@ CREATE TABLE "invoiceitem" (
--
-- TOC Entry ID 2 (OID 17351)
--
--- Name: people_id_seq Type: SEQUENCE Owner: postgres
+-- Name: people_id_seq Type: SETQUENCE Owner: postgres
--
-CREATE SEQUENCE "people_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
+CREATE SETQUENCE "people_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
--
-- TOC Entry ID 4 (OID 17353)
--
--- Name: staff_id_seq Type: SEQUENCE Owner: postgres
+-- Name: staff_id_seq Type: SETQUENCE Owner: postgres
--
-CREATE SEQUENCE "staff_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
+CREATE SETQUENCE "staff_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
--
-- TOC Entry ID 6 (OID 17355)
--
--- Name: creditors_id_seq Type: SEQUENCE Owner: postgres
+-- Name: creditors_id_seq Type: SETQUENCE Owner: postgres
--
-CREATE SEQUENCE "creditors_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
+CREATE SETQUENCE "creditors_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
--
-- TOC Entry ID 8 (OID 17357)
--
--- Name: invoice_id_seq Type: SEQUENCE Owner: postgres
+-- Name: invoice_id_seq Type: SETQUENCE Owner: postgres
--
-CREATE SEQUENCE "invoice_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
+CREATE SETQUENCE "invoice_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
--
-- Data for TOC Entry ID 28 (OID 17332)
@@ -201,7 +201,7 @@ COPY "invoiceitem" FROM stdin;
--
-- TOC Entry ID 3 (OID 17351)
--
--- Name: people_id_seq Type: SEQUENCE SET Owner: postgres
+-- Name: people_id_seq Type: SETQUENCE SET Owner: postgres
--
SELECT setval ('"people_id_seq"', 1, false);
@@ -209,7 +209,7 @@ SELECT setval ('"people_id_seq"', 1, false);
--
-- TOC Entry ID 5 (OID 17353)
--
--- Name: staff_id_seq Type: SEQUENCE SET Owner: postgres
+-- Name: staff_id_seq Type: SETQUENCE SET Owner: postgres
--
SELECT setval ('"staff_id_seq"', 8, true);
@@ -217,7 +217,7 @@ SELECT setval ('"staff_id_seq"', 8, true);
--
-- TOC Entry ID 7 (OID 17355)
--
--- Name: creditors_id_seq Type: SEQUENCE SET Owner: postgres
+-- Name: creditors_id_seq Type: SETQUENCE SET Owner: postgres
--
SELECT setval ('"creditors_id_seq"', 1, false);
@@ -225,7 +225,7 @@ SELECT setval ('"creditors_id_seq"', 1, false);
--
-- TOC Entry ID 9 (OID 17357)
--
--- Name: invoice_id_seq Type: SEQUENCE SET Owner: postgres
+-- Name: invoice_id_seq Type: SETQUENCE SET Owner: postgres
--
SELECT setval ('"invoice_id_seq"', 1, false);