diff options
Diffstat (limited to 'examples3/fonts.py')
-rwxr-xr-x | examples3/fonts.py | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/examples3/fonts.py b/examples3/fonts.py index d3166ce..84dffb4 100755 --- a/examples3/fonts.py +++ b/examples3/fonts.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,46 +13,46 @@ import sys from qt import * -class Viewer( QWidget ): +class Viewer( TQWidget ): def __init__( self ): - QWidget.__init__( self ) + TQWidget.__init__( self ) self.setFontSubstitutions() - #greeting_heb = QString.fromUtf8( "\327\251\327\234\327\225\327\235" ) + #greeting_heb = TQString.fromUtf8( "\327\251\327\234\327\225\327\235" ) greeting_heb = unicode( '\327\251\327\234\327\225\327\235','utf8' ) - #greeting_ru = QString.fromUtf8( "\320\227\320\264\321\200\320\260\320\262\321\201\321\202\320\262\321\203\320\271\321\202\320\265" ) + #greeting_ru = TQString.fromUtf8( "\320\227\320\264\321\200\320\260\320\262\321\201\321\202\320\262\321\203\320\271\321\202\320\265" ) greeting_ru = unicode('\320\227\320\264\321\200\320\260\320\262\321\201\321\202\320\262\321\203\320\271\321\202\320\265','utf8' ) greeting_en = "Hello" - self.greetings = QTextView( self, "textview" ) + self.greetings = TQTextView( self, "textview" ) self.greetings.setText( greeting_en + "\n" + greeting_ru + "\n" + greeting_heb ) - self.fontInfo = QTextView( self, "fontinfo" ) + self.fontInfo = TQTextView( self, "fontinfo" ) self.setDefault() - self.defaultButton = QPushButton( "Default", self, "pushbutton1" ) - self.defaultButton.setFont( QFont( "times" ) ) + self.defaultButton = TQPushButton( "Default", self, "pushbutton1" ) + self.defaultButton.setFont( TQFont( "times" ) ) self.connect( self.defaultButton, SIGNAL("clicked()"), self.setDefault ) - self.sansSerifButton = QPushButton( "Sans Serif", self, "pushbutton2" ) - self.sansSerifButton.setFont( QFont( "Helvetica", 12 ) ) + self.sansSerifButton = TQPushButton( "Sans Serif", self, "pushbutton2" ) + self.sansSerifButton.setFont( TQFont( "Helvetica", 12 ) ) self.connect( self.sansSerifButton, SIGNAL("clicked()"), self.setSansSerif ) - self.italicsButton = QPushButton( "Italics", self, "pushbutton3" ) - self.italicsButton.setFont( QFont( "lucida", 12, QFont.Bold, True ) ) + self.italicsButton = TQPushButton( "Italics", self, "pushbutton3" ) + self.italicsButton.setFont( TQFont( "lucida", 12, TQFont.Bold, True ) ) self.connect( self.italicsButton, SIGNAL("clicked()"), self.setItalics ) self.layout() def setDefault( self ): - font = QFont( "Bavaria" ) + font = TQFont( "Bavaria" ) font.setPointSize( 24 ) - font.setWeight( QFont.Bold ) + font.setWeight( TQFont.Bold ) font.setUnderline( True ) self.greetings.setFont( font ) @@ -60,17 +60,17 @@ class Viewer( QWidget ): self.showFontInfo( font ) def setSansSerif( self ): - font = QFont( "Newyork", 18 ) - font.setStyleHint( QFont.SansSerif ) + font = TQFont( "Newyork", 18 ) + font.setStyleHint( TQFont.SansSerif ) self.greetings.setFont( font ) self.showFontInfo( font ) def setItalics( self ): - font = QFont( "Tokyo" ) + font = TQFont( "Tokyo" ) font.setPointSize( 32 ) - font.setWeight( QFont.Bold ) + font.setWeight( TQFont.Bold ) font.setItalic( True ) self.greetings.setFont( font ) @@ -78,12 +78,12 @@ class Viewer( QWidget ): self.showFontInfo( font ) def showFontInfo( self, font ): - info = QFontInfo( font ) + info = TQFontInfo( font ) messageText = "Font requested: \"" + str(font.family()) + "\" " \ - + str(QString.number( font.pointSize() )) + "pt<BR>" \ + + str(TQString.number( font.pointSize() )) + "pt<BR>" \ + "Font used: \"" + str(info.family()) + "\" " \ - + str(QString.number( info.pointSize() )) + "pt<P>" + + str(TQString.number( info.pointSize() )) + "pt<P>" if not self.substitutes.isEmpty() : messageText += "The following substitutions exist for " + \ @@ -98,24 +98,24 @@ class Viewer( QWidget ): self.fontInfo.setText( messageText ) def setFontSubstitutions( self ): - self.substitutes = QStringList() + self.substitutes = TQStringList() self.substitutes.append( "Times" ) self.substitutes.append( "Mincho" ) self.substitutes.append( "Arabic Newspaper" ) self.substitutes.append( "crox" ) - #QFont.insertSubstitutions( "Bavaria", self.substitutes ) - QFont.insertSubstitution( "Bavaria", "Times" ) - QFont.insertSubstitution( "Tokyo", "Lucida" ) + #TQFont.insertSubstitutions( "Bavaria", self.substitutes ) + TQFont.insertSubstitution( "Bavaria", "Times" ) + TQFont.insertSubstitution( "Tokyo", "Lucida" ) - # For those who prefer to use Qt Designer for creating GUIs + # For those who prefer to use TQt Designer for creating GUIs # the following function might not be of particular interest: # all it does is creating the widget layout. def layout( self ): - textViewContainer = QHBoxLayout() + textViewContainer = TQHBoxLayout() textViewContainer.addWidget( self.greetings ) textViewContainer.addWidget( self.fontInfo ) - buttonContainer = QHBoxLayout() + buttonContainer = TQHBoxLayout() buttonContainer.addWidget( self.defaultButton ) buttonContainer.addWidget( self.sansSerifButton ) buttonContainer.addWidget( self.italicsButton ) @@ -131,17 +131,17 @@ class Viewer( QWidget ): self.sansSerifButton.setFixedHeight( maxButtonHeight ) self.italicsButton.setFixedHeight( maxButtonHeight ) - container = QVBoxLayout( self ) + container = TQVBoxLayout( self ) container.addLayout( textViewContainer ) container.addLayout( buttonContainer ) self.resize( 700, 250 ) def main( args ): - app = QApplication(sys.argv) # application object + app = TQApplication(sys.argv) # application object textViewer = Viewer() - textViewer.setCaption( "Qt Example - Simple QFont Demo" ) + textViewer.setCaption( "TQt Example - Simple TQFont Demo" ) app.setMainWidget( textViewer ) textViewer.show() |