diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-05 15:55:57 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-05 15:55:57 -0600 |
commit | 9ba04742771370f59740e32e11c5f3a1e6a1b70a (patch) | |
tree | c81c34dae2b3b1ea73801bf18a960265dc4207f7 /qtjava/javalib/examples/mdi/MDIWindow.java | |
parent | 1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff) | |
download | tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip |
Initial TQt conversion
Diffstat (limited to 'qtjava/javalib/examples/mdi/MDIWindow.java')
-rw-r--r-- | qtjava/javalib/examples/mdi/MDIWindow.java | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/qtjava/javalib/examples/mdi/MDIWindow.java b/qtjava/javalib/examples/mdi/MDIWindow.java index ef5efd64..c8abf0be 100644 --- a/qtjava/javalib/examples/mdi/MDIWindow.java +++ b/qtjava/javalib/examples/mdi/MDIWindow.java @@ -11,18 +11,18 @@ import org.kde.qt.*; -class MDIWindow extends QMainWindow +class MDIWindow extends TQMainWindow { -private QMultiLineEdit medit; -private QMovie mmovie; +private TQMultiLineEdit medit; +private TQMovie mmovie; private String filename = ""; -MDIWindow( QWidget parent, String name, int wflags ) +MDIWindow( TQWidget parent, String name, int wflags ) { super( parent, name, wflags ); mmovie = null; - medit = new QMultiLineEdit( this ); + medit = new TQMultiLineEdit( this ); setFocusProxy( medit ); setCentralWidget( medit ); } @@ -31,24 +31,24 @@ MDIWindow( QWidget parent, String name, int wflags ) void load( String fn ) { filename = fn; - QFile f = new QFile( filename ); - if ( !f.open( QIODevice.IO_ReadOnly ) ) + TQFile f = new TQFile( filename ); + if ( !f.open( TQIODevice.IO_ReadOnly ) ) return; if(fn.indexOf(".gif") != -1) { - QWidget tmp=new QWidget(this); + TQWidget tmp=new TQWidget(this); setFocusProxy(tmp); setCentralWidget(tmp); medit.hide(); - QMovie qm=new QMovie(fn); + TQMovie qm=new TQMovie(fn); // qm.setDisplayWidget(tmp); - tmp.setBackgroundMode(QWidget.NoBackground); + tmp.setBackgroundMode(TQWidget.NoBackground); tmp.show(); mmovie=qm; } else { mmovie = null; - QTextStream t = new QTextStream(f); + TQTextStream t = new TQTextStream(f); String s = t.read(); medit.setText( s ); f.close(); @@ -67,14 +67,14 @@ void save() } String text = medit.text(); - QFile f = new QFile( filename ); - if ( !f.open( QIODevice.IO_WriteOnly ) ) { + TQFile f = new TQFile( filename ); + if ( !f.open( TQIODevice.IO_WriteOnly ) ) { emit("message", "Could not write to " + filename, 2000 ); return; } - QTextStream t = new QTextStream( f ); + TQTextStream t = new TQTextStream( f ); t.writeRawBytes( text, text.length() ); f.close(); @@ -85,7 +85,7 @@ void save() void saveAs() { - String fn = QFileDialog.getSaveFileName( filename, "", this ); + String fn = TQFileDialog.getSaveFileName( filename, "", this ); if ( !fn.equals("") ) { filename = fn; save(); @@ -94,20 +94,20 @@ void saveAs() } } -void print( QPrinter printer) +void print( TQPrinter printer) { int Margin = 10; int pageNo = 1; if ( printer.setup(this) ) { // printer dialog emit("message", "Printing...", 0 ); - QPainter p = new QPainter(); + TQPainter p = new TQPainter(); if ( !p.begin( printer ) ) return; // paint on printer p.setFont( medit.font() ); int yPos = 0; // y position for each line - QFontMetrics fm = p.fontMetrics(); - QPaintDeviceMetrics metrics = new QPaintDeviceMetrics( printer ); // need width/height + TQFontMetrics fm = p.fontMetrics(); + TQPaintDeviceMetrics metrics = new TQPaintDeviceMetrics( printer ); // need width/height // of printer surface for( int i = 0 ; i < medit.numLines() ; i++ ) { if ( Margin + yPos > metrics.height() - Margin ) { |