summaryrefslogtreecommitdiffstats
path: root/examples3/mdi.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples3/mdi.py')
-rwxr-xr-xexamples3/mdi.py122
1 files changed, 61 insertions, 61 deletions
diff --git a/examples3/mdi.py b/examples3/mdi.py
index 2c1d121..3ff7e2e 100755
--- a/examples3/mdi.py
+++ b/examples3/mdi.py
@@ -118,39 +118,39 @@ You can also select the <b>Print</b> command from the <b>File</b> menu.'''
True=1
False=0
-class ApplicationWindow(QMainWindow):
+class ApplicationWindow(TQMainWindow):
def __init__(self):
- QMainWindow.__init__(self,None,'example application main window',Qt.WDestructiveClose)
+ TQMainWindow.__init__(self,None,'example application main window',TQt.WDestructiveClose)
- self.filename = QString.null
- self.printer = QPrinter()
+ self.filename = TQString.null
+ self.printer = TQPrinter()
- self.fileTools = QToolBar(self,'file operations')
+ self.fileTools = TQToolBar(self,'file operations')
- openIcon = QPixmap(fileopen)
- self.fileOpen = QToolButton(QIconSet(openIcon),'Open File',QString.null,self.load,self.fileTools,'open file')
+ openIcon = TQPixmap(fileopen)
+ self.fileOpen = TQToolButton(TQIconSet(openIcon),'Open File',TQString.null,self.load,self.fileTools,'open file')
- saveIcon = QPixmap(filesave)
- self.fileSave = QToolButton(QIconSet(saveIcon),'Save File',QString.null,self.save,self.fileTools,'save file')
- printIcon = QPixmap(fileprint)
- self.filePrint = QToolButton(QIconSet(printIcon),'Print File',QString.null,self.printDoc,self.fileTools,'print file')
+ saveIcon = TQPixmap(filesave)
+ self.fileSave = TQToolButton(TQIconSet(saveIcon),'Save File',TQString.null,self.save,self.fileTools,'save file')
+ printIcon = TQPixmap(fileprint)
+ self.filePrint = TQToolButton(TQIconSet(printIcon),'Print File',TQString.null,self.printDoc,self.fileTools,'print file')
- QWhatsThis.whatsThisButton(self.fileTools)
+ TQWhatsThis.whatsThisButton(self.fileTools)
- QWhatsThis.add(self.fileOpen,fileOpenText)
- QMimeSourceFactory.defaultFactory().setPixmap('fileopen',openIcon)
- QWhatsThis.add(self.fileSave,fileSaveText)
- QWhatsThis.add(self.filePrint,filePrintText)
+ TQWhatsThis.add(self.fileOpen,fileOpenText)
+ TQMimeSourceFactory.defaultFactory().setPixmap('fileopen',openIcon)
+ TQWhatsThis.add(self.fileSave,fileSaveText)
+ TQWhatsThis.add(self.filePrint,filePrintText)
- self.file = QPopupMenu(self)
+ self.file = TQPopupMenu(self)
self.menuBar().insertItem('&File',self.file)
- self.file.insertItem('&New',self.newDoc,Qt.CTRL + Qt.Key_N)
+ self.file.insertItem('&New',self.newDoc,TQt.CTRL + TQt.Key_N)
- id = self.file.insertItem(QIconSet(openIcon),'&Open',self.load,Qt.CTRL + Qt.Key_O)
+ id = self.file.insertItem(TQIconSet(openIcon),'&Open',self.load,TQt.CTRL + TQt.Key_O)
self.file.setWhatsThis(id,fileOpenText)
- id = self.file.insertItem(QIconSet(saveIcon),'&Save',self.save,Qt.CTRL + Qt.Key_S)
+ id = self.file.insertItem(TQIconSet(saveIcon),'&Save',self.save,TQt.CTRL + TQt.Key_S)
self.file.setWhatsThis(id,fileSaveText)
id = self.file.insertItem('Save &as',self.saveAs)
@@ -158,35 +158,35 @@ class ApplicationWindow(QMainWindow):
self.file.insertSeparator()
- id = self.file.insertItem(QIconSet(printIcon),'&Print',self.printDoc,Qt.CTRL + Qt.Key_P)
+ id = self.file.insertItem(TQIconSet(printIcon),'&Print',self.printDoc,TQt.CTRL + TQt.Key_P)
self.file.setWhatsThis(id,filePrintText)
self.file.insertSeparator()
- self.file.insertItem('&Close',self,SLOT('close()'),Qt.CTRL + Qt.Key_W)
- self.file.insertItem('&Quit',qApp,SLOT('closeAllWindows()'),Qt.CTRL + Qt.Key_Q)
+ self.file.insertItem('&Close',self,SLOT('close()'),TQt.CTRL + TQt.Key_W)
+ self.file.insertItem('&Quit',qApp,SLOT('closeAllWindows()'),TQt.CTRL + TQt.Key_Q)
self.menuBar().insertSeparator()
- self.windows = QPopupMenu( self )
+ self.windows = TQPopupMenu( self )
self.windows.setCheckable( True )
self.connect( self.windows, SIGNAL( "aboutToShow()" ),
self.windowsMenuAboutToShow )
self.menuBar().insertItem( "&Windows", self.windows )
- self.help = QPopupMenu(self)
+ self.help = TQPopupMenu(self)
self.menuBar().insertSeparator()
self.menuBar().insertItem('&Help',self.help)
- self.help.insertItem('&About',self.about,Qt.Key_F1)
- self.help.insertItem('About &Qt',self.aboutQt)
+ self.help.insertItem('&About',self.about,TQt.Key_F1)
+ self.help.insertItem('About &TQt',self.aboutTQt)
self.help.insertSeparator()
- self.help.insertItem( "What's &This", self, SLOT("whatsThis()"), Qt.SHIFT+Qt.Key_F1)
+ self.help.insertItem( "What's &This", self, SLOT("whatsThis()"), TQt.SHIFT+TQt.Key_F1)
self.menuBar().insertSeparator()
- self.vb = QVBox( self )
- self.vb.setFrameStyle( QFrame.StyledPanel | QFrame.Sunken )
- self.ws = QWorkspace( self.vb )
+ self.vb = TQVBox( self )
+ self.vb.setFrameStyle( TQFrame.StyledPanel | TQFrame.Sunken )
+ self.ws = TQWorkspace( self.vb )
self.ws.setScrollBarsEnabled( True )
self.setCentralWidget( self.vb )
@@ -194,10 +194,10 @@ class ApplicationWindow(QMainWindow):
#self.resize(450,600)
def newDoc(self):
- w = MDIWindow( self.ws, "", Qt.WDestructiveClose )
- self.connect( w, PYSIGNAL( "message" ), self.statusBar(), SLOT( "message(const QString&, int )") )
+ w = MDIWindow( self.ws, "", TQt.WDestructiveClose )
+ self.connect( w, PYSIGNAL( "message" ), self.statusBar(), SLOT( "message(const TQString&, int )") )
w.setCaption("unnamed document")
- w.setIcon( QPixmap(document) )
+ w.setIcon( TQPixmap(document) )
# show the very first window in maximized mode
if len(self.ws.windowList())==0:
w.showMaximized()
@@ -206,7 +206,7 @@ class ApplicationWindow(QMainWindow):
return w
def load(self):
- fn = QFileDialog.getOpenFileName( QString.null, QString.null, self )
+ fn = TQFileDialog.getOpenFileName( TQString.null, TQString.null, self )
if not fn.isEmpty():
w = self.newDoc()
w.load( fn )
@@ -234,12 +234,12 @@ class ApplicationWindow(QMainWindow):
m.close()
def about(self):
- QMessageBox.about( self, "Qt Application Example",
+ TQMessageBox.about( self, "TQt Application Example",
"This example demonstrates simple use of\n "
- "Qt's Multiple Document Interface (MDI).")
+ "TQt's Multiple Document Interface (MDI).")
- def aboutQt(self):
- QMessageBox.aboutQt( self, "Qt Application Example" )
+ def aboutTQt(self):
+ TQMessageBox.aboutTQt( self, "TQt Application Example" )
def windowsMenuAboutToShow(self):
self.windows.clear()
@@ -264,42 +264,42 @@ class ApplicationWindow(QMainWindow):
w.setFocus()
-class MDIWindow( QMainWindow):
+class MDIWindow( TQMainWindow):
def __init__(self,parent, name, wflags ):
- QMainWindow.__init__(self,parent, name, wflags )
+ TQMainWindow.__init__(self,parent, name, wflags )
self.mmovie = 0
- self.medit = QMultiLineEdit( self )
+ self.medit = TQMultiLineEdit( self )
self.setFocusProxy( self.medit )
self.setCentralWidget( self.medit );
def load(self, fn ):
self.filename = fn
- self.f=QFile( self.filename )
+ self.f=TQFile( self.filename )
if not self.f.open( IO_ReadOnly ):
return
if fn.contains(".gif"):
- tmp=QWidget(self)
+ tmp=TQWidget(self)
self.setFocusProxy(tmp)
self.setCentralWidget(tmp)
self.medit.hide()
del self.medit
- qm=QMovie(fn)
+ qm=TQMovie(fn)
#ifdef Q_WS_QWS // temporary speed-test hack
#qm->setDisplayWidget(tmp);
#endif
- tmp.setBackgroundMode(QWidget.NoBackground)
+ tmp.setBackgroundMode(TQWidget.NoBackground)
tmp.show()
self.mmovie=qm
else :
self.mmovie = 0
- t=QTextStream(self.f)
+ t=TQTextStream(self.f)
s = t.read()
self.medit.setText( s )
self.f.close()
self.setCaption( self.filename )
- self.emit(PYSIGNAL( "message"),(QString("Loaded document %1").arg(self.filename),2000 ))
+ self.emit(PYSIGNAL( "message"),(TQString("Loaded document %1").arg(self.filename),2000 ))
def save(self):
if self.filename.isEmpty():
@@ -308,53 +308,53 @@ class MDIWindow( QMainWindow):
text = self.medit.text()
output=open(str(self.filename),'w')
output.write(str(text))
- #emit message( QString("Could not write to %1").arg(filename), 2000 );
+ #emit message( TQString("Could not write to %1").arg(filename), 2000 );
#return
output.close()
self.setCaption(self.filename)
- self.emit(PYSIGNAL( "message"),(QString("File %1 saved").arg(self.filename),2000 ))
+ self.emit(PYSIGNAL( "message"),(TQString("File %1 saved").arg(self.filename),2000 ))
def saveAs(self):
- fn = QFileDialog.getSaveFileName( self.filename, QString.null, self )
+ fn = TQFileDialog.getSaveFileName( self.filename, TQString.null, self )
if not fn.isEmpty():
self.filename = fn
self.save()
else :
- self.emit(PYSIGNAL( "message"),(QString("Saving aborted"),2000 ))
+ self.emit(PYSIGNAL( "message"),(TQString("Saving aborted"),2000 ))
def printDoc(self,printer):
Margin = 10
pageNo = 1
if printer.setup(self):
- self.emit(PYSIGNAL( "message"),(QString("Printing..."),2000 ))
- p = QPainter()
+ self.emit(PYSIGNAL( "message"),(TQString("Printing..."),2000 ))
+ p = TQPainter()
p.begin(printer)
p.setFont(self.medit.font())
yPos = 0
fm = p.fontMetrics()
- metrics = QPaintDeviceMetrics(printer)
+ metrics = TQPaintDeviceMetrics(printer)
for i in range(self.medit.numLines()):
if Margin + yPos > metrics.height() - Margin:
pageNo = pageNo + 1
- self.emit(PYSIGNAL( "message"),(QString("Printing (page %1) ...").arg(pageNo),2000 ))
+ self.emit(PYSIGNAL( "message"),(TQString("Printing (page %1) ...").arg(pageNo),2000 ))
printer.newPage()
yPos = 0
- p.drawText(Margin,Margin + yPos,metrics.width(),fm.lineSpacing(),Qt.ExpandTabs | Qt.DontClip,self.medit.textLine(i))
+ p.drawText(Margin,Margin + yPos,metrics.width(),fm.lineSpacing(),TQt.ExpandTabs | TQt.DontClip,self.medit.textLine(i))
yPos = yPos + fm.lineSpacing()
p.end()
- self.emit(PYSIGNAL( "message"),(QString("Printing completed"),2000 ))
+ self.emit(PYSIGNAL( "message"),(TQString("Printing completed"),2000 ))
else:
- self.emit(PYSIGNAL( "message"),(QString("Printing aborted"),2000 ))
+ self.emit(PYSIGNAL( "message"),(TQString("Printing aborted"),2000 ))
if __name__=='__main__':
- a = QApplication(sys.argv)
+ a = TQApplication(sys.argv)
mw = ApplicationWindow()
- mw.setCaption("PyQt Example - Multiple Documents Interface (MDI)")
+ mw.setCaption("PyTQt Example - Multiple Documents Interface (MDI)")
mw.show()
a.connect(a, SIGNAL('lastWindowClosed()'), a, SLOT('quit()'))
a.exec_loop()