diff options
author | Timothy Pearson <[email protected]> | 2011-12-05 15:55:57 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2011-12-05 15:55:57 -0600 |
commit | 9ba04742771370f59740e32e11c5f3a1e6a1b70a (patch) | |
tree | c81c34dae2b3b1ea73801bf18a960265dc4207f7 /qtjava/javalib/examples/mdi | |
parent | 1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff) | |
download | tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip |
Initial TQt conversion
Diffstat (limited to 'qtjava/javalib/examples/mdi')
-rw-r--r-- | qtjava/javalib/examples/mdi/ApplicationWindow.java | 90 | ||||
-rw-r--r-- | qtjava/javalib/examples/mdi/MDIWindow.java | 38 | ||||
-rw-r--r-- | qtjava/javalib/examples/mdi/Main.java | 2 |
3 files changed, 65 insertions, 65 deletions
diff --git a/qtjava/javalib/examples/mdi/ApplicationWindow.java b/qtjava/javalib/examples/mdi/ApplicationWindow.java index e74e6233..a2d3cbbc 100644 --- a/qtjava/javalib/examples/mdi/ApplicationWindow.java +++ b/qtjava/javalib/examples/mdi/ApplicationWindow.java @@ -11,16 +11,16 @@ import org.kde.qt.*; import java.util.ArrayList; -class ApplicationWindow extends QMainWindow +class ApplicationWindow extends TQMainWindow { -private QPrinter printer; -private QWorkspace ws; +private TQPrinter printer; +private TQWorkspace ws; /* Keep a copy of ws.windowList(), so that the MDIWindow widgets in it won't get garbage collected */ private ArrayList windows; -private QToolBar fileTools; -private QPopupMenu windowsMenu; +private TQToolBar fileTools; +private TQPopupMenu windowsMenu; @@ -110,75 +110,75 @@ ApplicationWindow() super( null, "example application main window", WDestructiveClose ); int id; - QPixmap openIcon, saveIcon; + TQPixmap openIcon, saveIcon; - fileTools = new QToolBar( this, "file operations" ); + fileTools = new TQToolBar( this, "file operations" ); addToolBar( fileTools, tr( "File Operations" ), DockTop, true ); - openIcon = new QPixmap( fileopen ); - QToolButton fileOpen - = new QToolButton( new QIconSet(openIcon), "Open File", "", + openIcon = new TQPixmap( fileopen ); + TQToolButton fileOpen + = new TQToolButton( new TQIconSet(openIcon), "Open File", "", this, SLOT("load()"), fileTools, "open file" ); - saveIcon = new QPixmap( filesave ); - QToolButton fileSave - = new QToolButton( new QIconSet(saveIcon), "Save File", "", + saveIcon = new TQPixmap( filesave ); + TQToolButton fileSave + = new TQToolButton( new TQIconSet(saveIcon), "Save File", "", this, SLOT("save()"), fileTools, "save file" ); - printer = new QPrinter(); - QPixmap printIcon; + printer = new TQPrinter(); + TQPixmap printIcon; - printIcon = new QPixmap( fileprint ); - QToolButton filePrint - = new QToolButton( new QIconSet(printIcon), "Print File", "", + printIcon = new TQPixmap( fileprint ); + TQToolButton filePrint + = new TQToolButton( new TQIconSet(printIcon), "Print File", "", this, SLOT("print()"), fileTools, "print file" ); - QWhatsThis.add( filePrint, filePrintText ); + TQWhatsThis.add( filePrint, filePrintText ); - QWhatsThis.whatsThisButton( fileTools ); + TQWhatsThis.whatsThisButton( fileTools ); - QWhatsThis.add( fileOpen, fileOpenText ); - QWhatsThis.add( fileSave, fileSaveText ); + TQWhatsThis.add( fileOpen, fileOpenText ); + TQWhatsThis.add( fileSave, fileSaveText ); - QPopupMenu file = new QPopupMenu( this ); + TQPopupMenu file = new TQPopupMenu( this ); menuBar().insertItem( "&File", file ); - file.insertItem( "&New", this, SLOT("newDoc()"), new QKeySequence(CTRL+Key_N) ); + file.insertItem( "&New", this, SLOT("newDoc()"), new TQKeySequence(CTRL+Key_N) ); - id = file.insertItem( new QIconSet(openIcon), "&Open...", - this, SLOT("load()"), new QKeySequence(CTRL+Key_O) ); + id = file.insertItem( new TQIconSet(openIcon), "&Open...", + this, SLOT("load()"), new TQKeySequence(CTRL+Key_O) ); file.setWhatsThis( id, fileOpenText ); - id = file.insertItem( new QIconSet(saveIcon), "&Save", - this, SLOT("save()"), new QKeySequence(CTRL+Key_S) ); + id = file.insertItem( new TQIconSet(saveIcon), "&Save", + this, SLOT("save()"), new TQKeySequence(CTRL+Key_S) ); file.setWhatsThis( id, fileSaveText ); id = file.insertItem( "Save &As...", this, SLOT("saveAs()") ); file.setWhatsThis( id, fileSaveText ); file.insertSeparator(); - id = file.insertItem( new QIconSet(printIcon), "&Print...", - this, SLOT("print()"), new QKeySequence(CTRL+Key_P) ); + id = file.insertItem( new TQIconSet(printIcon), "&Print...", + this, SLOT("print()"), new TQKeySequence(CTRL+Key_P) ); file.setWhatsThis( id, filePrintText ); file.insertSeparator(); - file.insertItem( "&Close", this, SLOT("closeWindow()"), new QKeySequence(CTRL+Key_W) ); - file.insertItem( "&Quit", qApp(), SLOT(" closeAllWindows()"), new QKeySequence(CTRL+Key_Q) ); + file.insertItem( "&Close", this, SLOT("closeWindow()"), new TQKeySequence(CTRL+Key_W) ); + file.insertItem( "&Quit", qApp(), SLOT(" closeAllWindows()"), new TQKeySequence(CTRL+Key_Q) ); - windowsMenu = new QPopupMenu( this ); + windowsMenu = new TQPopupMenu( this ); windowsMenu.setCheckable( true ); connect( windowsMenu, SIGNAL(" aboutToShow()"), this, SLOT(" windowsMenuAboutToShow()") ); menuBar().insertItem( "&Windows", windowsMenu ); menuBar().insertSeparator(); - QPopupMenu help = new QPopupMenu( this ); + TQPopupMenu help = new TQPopupMenu( this ); menuBar().insertItem( "&Help", help ); - help.insertItem( "&About", this, SLOT("about()"), new QKeySequence(Key_F1)); + help.insertItem( "&About", this, SLOT("about()"), new TQKeySequence(Key_F1)); help.insertItem( "About &Qt", this, SLOT("aboutQt()")); help.insertSeparator(); - help.insertItem( "What's &This", this, SLOT("whatsThis()"), new QKeySequence(SHIFT+Key_F1)); + help.insertItem( "What's &This", this, SLOT("whatsThis()"), new TQKeySequence(SHIFT+Key_F1)); - QVBox vb = new QVBox( this ); - vb.setFrameStyle( QFrame.StyledPanel | QFrame.Sunken ); - ws = new QWorkspace( vb ); + TQVBox vb = new TQVBox( this ); + vb.setFrameStyle( TQFrame.StyledPanel | TQFrame.Sunken ); + ws = new TQWorkspace( vb ); ws.setScrollBarsEnabled( true ); setCentralWidget( vb ); @@ -191,7 +191,7 @@ MDIWindow newDoc() MDIWindow w = new MDIWindow( ws, null, WDestructiveClose ); connect( w, SIGNAL("message(String,int)"), statusBar(), SLOT("message(String,int)") ); w.setCaption("unnamed document"); - w.setIcon( new QPixmap("document.xpm") ); + w.setIcon( new TQPixmap("document.xpm") ); // show the very first window in maximized mode windows = ws.windowList(); if ( windows.size() == 0 ) @@ -203,7 +203,7 @@ MDIWindow newDoc() void load() { - String fn = QFileDialog.getOpenFileName( "", "", this ); + String fn = TQFileDialog.getOpenFileName( "", "", this ); if ( !fn.equals("") ) { MDIWindow w = newDoc(); w.load( fn ); @@ -245,7 +245,7 @@ void closeWindow() void about() { - QMessageBox.about( this, "Qt Application Example", + TQMessageBox.about( this, "Qt Application Example", "This example demonstrates simple use of\n " + "Qt's Multiple Document Interface (MDI)."); } @@ -253,7 +253,7 @@ void about() void aboutQt() { - QMessageBox.aboutQt( this, "Qt Application Example" ); + TQMessageBox.aboutQt( this, "Qt Application Example" ); } @@ -269,7 +269,7 @@ void windowsMenuAboutToShow() } windowsMenu.insertSeparator(); for ( int i = 0; i < windows.size(); ++i ) { - int id = windowsMenu.insertItem(((QWidget) windows.get(i)).caption(), + int id = windowsMenu.insertItem(((TQWidget) windows.get(i)).caption(), this, SLOT(" windowsMenuActivated( int )") ); windowsMenu.setItemParameter( id, i ); windowsMenu.setItemChecked( id, ws.activeWindow() == windows.get(i) ); @@ -279,7 +279,7 @@ void windowsMenuAboutToShow() void windowsMenuActivated( int id ) { windows = ws.windowList(); - QWidget w = (QWidget) windows.get( id ); + TQWidget w = (TQWidget) windows.get( id ); if ( w != null ) w.showNormal(); w.setFocus(); 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 ) { diff --git a/qtjava/javalib/examples/mdi/Main.java b/qtjava/javalib/examples/mdi/Main.java index 8190b7cf..114c4230 100644 --- a/qtjava/javalib/examples/mdi/Main.java +++ b/qtjava/javalib/examples/mdi/Main.java @@ -13,7 +13,7 @@ import org.kde.qt.*; public class Main { public static void main(String[] args) { - QApplication a = new QApplication( args ); + TQApplication a = new TQApplication( args ); ApplicationWindow mw = new ApplicationWindow(); mw.setCaption( "Qt Example - Multiple Documents Interface (MDI)" ); mw.show(); |