summaryrefslogtreecommitdiffstats
path: root/examples3/fontdisplayer.py
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2011-11-29 01:11:08 -0600
committerTimothy Pearson <[email protected]>2011-11-29 01:11:08 -0600
commit8a055d66f43592c257cece2eb8cc021808062917 (patch)
treed0922f201bd5d24b62a33160d1d9baf9e89f9a70 /examples3/fontdisplayer.py
parentb388516ca2691303a076a0764fd40bf7116fe43d (diff)
downloadpytqt-8a055d66f43592c257cece2eb8cc021808062917.tar.gz
pytqt-8a055d66f43592c257cece2eb8cc021808062917.zip
Initial TQt conversion
Diffstat (limited to 'examples3/fontdisplayer.py')
-rwxr-xr-xexamples3/fontdisplayer.py76
1 files changed, 38 insertions, 38 deletions
diff --git a/examples3/fontdisplayer.py b/examples3/fontdisplayer.py
index f6015df..b11e520 100755
--- a/examples3/fontdisplayer.py
+++ b/examples3/fontdisplayer.py
@@ -5,7 +5,7 @@
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
-** This file is part of an example program for Qt. This example
+** This file is part of an example program for TQt. This example
** program may be used, distributed and modified without limitation.
**
***************************************************************************"""
@@ -13,35 +13,35 @@
import sys
from qt import *
-class FontRowTable( QFrame ):
+class FontRowTable( TQFrame ):
def __init__( self, parent=None, name=None ):
- QFrame.__init__( self, parent, name )
+ TQFrame.__init__( self, parent, name )
self.setBackgroundMode(self.PaletteBase)
self.setFrameStyle(self.Panel|self.Sunken)
self.setMargin(8)
self.setRow(0)
self.row = 0
- self.tablefont = QFont( QApplication.font() )
+ self.tablefont = TQFont( TQApplication.font() )
def sizeHint( self ) :
- width = 16*self.cellSize().width()+QSize(2,2).width()*(self.margin()+self.frameWidth())
- height = 16*self.cellSize().height()+QSize(2,2).height()*(self.margin()+self.frameWidth())
- return QSize(width,height)
+ width = 16*self.cellSize().width()+TQSize(2,2).width()*(self.margin()+self.frameWidth())
+ height = 16*self.cellSize().height()+TQSize(2,2).height()*(self.margin()+self.frameWidth())
+ return TQSize(width,height)
def cellSize( self ) :
fm = self.fontMetrics()
- return QSize( fm.maxWidth(), fm.lineSpacing() + 1 )
+ return TQSize( fm.maxWidth(), fm.lineSpacing() + 1 )
def paintEvent( self, e ):
- QFrame.paintEvent(self, e)
- p = QPainter(self)
+ TQFrame.paintEvent(self, e)
+ p = TQPainter(self)
p.setClipRegion(e.region())
- r = QRect(e.rect())
+ r = TQRect(e.rect())
fm = self.fontMetrics()
ml = self.frameWidth() + self.margin() + 1 + max(0,-fm.minLeftBearing())
mt = self.frameWidth() + self.margin()
- cell = QSize((self.width()-15-ml)/16,(self.height()-15-mt)/16)
+ cell = TQSize((self.width()-15-ml)/16,(self.height()-15-mt)/16)
if not cell.width() or not cell.height() :
return
@@ -53,11 +53,11 @@ class FontRowTable( QFrame ):
h = fm.height()
- body = QColor(255,255,192);
- negative = QColor(255,192,192);
- positive = QColor(192,192,255);
- rnegative = QColor(255,128,128);
- rpositive = QColor(128,128,255);
+ body = TQColor(255,255,192);
+ negative = TQColor(255,192,192);
+ positive = TQColor(192,192,255);
+ rnegative = TQColor(255,128,128);
+ rpositive = TQColor(128,128,255);
for j in range(minj, maxj+1, 1) :
for i in range(mini, maxi+1, 1) :
@@ -65,7 +65,7 @@ class FontRowTable( QFrame ):
x = i*cell.width()
y = j*cell.height()
- ch = QChar(j*16+i) #,self.row) # just accept one argument!!!
+ ch = TQChar(j*16+i) #,self.row) # just accept one argument!!!
if fm.inFont(ch) :
w = fm.width(ch)
@@ -75,7 +75,7 @@ class FontRowTable( QFrame ):
x += ml
y += mt+h
- p.fillRect(x,y,w,-h,QBrush(body))
+ p.fillRect(x,y,w,-h,TQBrush(body))
if w :
if l :
@@ -83,15 +83,15 @@ class FontRowTable( QFrame ):
else: sign = positive
if l > 0: lsign = 0
else: lsign = 1
- p.fillRect(x+lsign, y-h/2, abs(l),-h/2, QBrush(sign))
+ p.fillRect(x+lsign, y-h/2, abs(l),-h/2, TQBrush(sign))
if r :
if r < 0: sign = rnegative
else: sign = rpositive
if r > 0: rsign = r
else: rsign = 0
- p.fillRect(x+w-rsign,y+2, abs(r),-h/2, QBrush(sign))
- s = QString( ch )
- p.setPen(QPen(Qt.black))
+ p.fillRect(x+w-rsign,y+2, abs(r),-h/2, TQBrush(sign))
+ s = TQString( ch )
+ p.setPen(TQPen(TQt.black))
p.drawText(x,y,s)
def setRow( self, r ) :
@@ -99,47 +99,47 @@ class FontRowTable( QFrame ):
fm = self.fontMetrics()
str = " minLB=%d minRB=%d maxW=%d" % (fm.minLeftBearing(), fm.minRightBearing(), fm.maxWidth())
- self.emit( PYSIGNAL("fontInformation"), ( QString(str), ) )
+ self.emit( PYSIGNAL("fontInformation"), ( TQString(str), ) )
self.update()
def chooseFont( self ) :
ok = 0
- oldfont = QFont( self.tablefont )
- self.tablefont, ok = QFontDialog.getFont(oldfont, self)
+ oldfont = TQFont( self.tablefont )
+ self.tablefont, ok = TQFontDialog.getFont(oldfont, self)
if ok:
self.setFont(self.tablefont)
else:
self.tablefont = oldfont
-class FontDisplayer( QMainWindow ) :
+class FontDisplayer( TQMainWindow ) :
def __init__( self, parent=None, name=None ):
- QMainWindow.__init__( self, parent, name )
+ TQMainWindow.__init__( self, parent, name )
table = FontRowTable(self)
- controls = QToolBar(self)
+ controls = TQToolBar(self)
- QLabel(self.tr("Row:"), controls)
- self.row = QSpinBox(0,255,1,controls)
+ TQLabel(self.tr("Row:"), controls)
+ self.row = TQSpinBox(0,255,1,controls)
controls.addSeparator()
- fontbutton = QPushButton(self.tr("Font..."), controls)
- status = QStatusBar(self)
+ fontbutton = TQPushButton(self.tr("Font..."), controls)
+ status = TQStatusBar(self)
self.connect( self.row, SIGNAL("valueChanged(int)"), table.setRow )
self.connect( fontbutton, SIGNAL("clicked()"), table.chooseFont )
self.connect( table, PYSIGNAL("fontInformation"),
- status, SLOT("message(const QString&)") )
+ status, SLOT("message(const TQString&)") )
table.setRow(0)
self.setCentralWidget(table)
def main( args ):
# Use an interesting font
- QApplication.setFont(QFont("unifont",16))
- app = QApplication(sys.argv)
+ TQApplication.setFont(TQFont("unifont",16))
+ app = TQApplication(sys.argv)
m = FontDisplayer()
- sh = QSize( m.centralWidget().sizeHint() )
+ sh = TQSize( m.centralWidget().sizeHint() )
m.resize(sh.width(), sh.height() + 3 * m.statusBar().height())
app.setMainWidget(m);
- m.setCaption("Qt Example - QFD");
+ m.setCaption("TQt Example - TQFD");
m.show()
app.exec_loop()