summaryrefslogtreecommitdiffstats
path: root/qtjava/javalib/examples/application
diff options
context:
space:
mode:
Diffstat (limited to 'qtjava/javalib/examples/application')
-rw-r--r--qtjava/javalib/examples/application/ApplicationWindow.java68
-rw-r--r--qtjava/javalib/examples/application/Main.java4
2 files changed, 36 insertions, 36 deletions
diff --git a/qtjava/javalib/examples/application/ApplicationWindow.java b/qtjava/javalib/examples/application/ApplicationWindow.java
index e334ad17..8e393df2 100644
--- a/qtjava/javalib/examples/application/ApplicationWindow.java
+++ b/qtjava/javalib/examples/application/ApplicationWindow.java
@@ -1,8 +1,8 @@
import org.kde.qt.*;
-public class ApplicationWindow extends QMainWindow {
- private QPrinter printer;
- private QMultiLineEdit e;
+public class ApplicationWindow extends TQMainWindow {
+ private TQPrinter printer;
+ private TQMultiLineEdit e;
private String filename;
private final String fileOpenText = "<img source=\"fileopen\"> "+
@@ -92,55 +92,55 @@ public class ApplicationWindow extends QMainWindow {
// create a printer
- printer = new QPrinter();
+ printer = new TQPrinter();
// create user interface actions
- QAction fileNewAction, fileOpenAction, fileSaveAction,
+ TQAction fileNewAction, fileOpenAction, fileSaveAction,
fileSaveAsAction, filePrintAction, fileCloseAction,
fileQuitAction;
- fileNewAction = new QAction("New", "&New", new QKeySequence(CTRL+Key_N), this, "new", false);
+ fileNewAction = new TQAction("New", "&New", new TQKeySequence(CTRL+Key_N), this, "new", false);
connect(fileNewAction, SIGNAL("activated()"), this, SLOT("newDoc()"));
- fileOpenAction = new QAction("Open File", new QIconSet(new QPixmap(fileopen)), "&Open", new QKeySequence(CTRL+Key_O), this, "open", false);
+ fileOpenAction = new TQAction("Open File", new TQIconSet(new TQPixmap(fileopen)), "&Open", new TQKeySequence(CTRL+Key_O), this, "open", false);
connect(fileOpenAction, SIGNAL("activated()"), this, SLOT("load()"));
- QMimeSourceFactory.defaultFactory().setPixmap("fileopen", new QPixmap(fileopen));
+ TQMimeSourceFactory.defaultFactory().setPixmap("fileopen", new TQPixmap(fileopen));
fileOpenAction.setWhatsThis(fileOpenText);
- fileSaveAction = new QAction("Save File", new QIconSet(new QPixmap(filesave)), "&Save", new QKeySequence(CTRL+Key_S), this, "save", false);
+ fileSaveAction = new TQAction("Save File", new TQIconSet(new TQPixmap(filesave)), "&Save", new TQKeySequence(CTRL+Key_S), this, "save", false);
connect(fileSaveAction, SIGNAL("activated()"), this, SLOT("save()"));
fileSaveAction.setWhatsThis(fileSaveText);
- fileSaveAsAction = new QAction("Save File As", "Save &as", new QKeySequence(), this, "save as", false);
+ fileSaveAsAction = new TQAction("Save File As", "Save &as", new TQKeySequence(), this, "save as", false);
connect(fileSaveAsAction, SIGNAL("activated()"), this, SLOT("saveAs()"));
fileSaveAsAction.setWhatsThis(fileSaveText);
- filePrintAction = new QAction("Print File", new QIconSet(new QPixmap(fileprint)), "&Print", new QKeySequence(CTRL+Key_P), this, "print", false);
+ filePrintAction = new TQAction("Print File", new TQIconSet(new TQPixmap(fileprint)), "&Print", new TQKeySequence(CTRL+Key_P), this, "print", false);
connect(filePrintAction, SIGNAL("activated()"), this, SLOT("print()"));
filePrintAction.setWhatsThis(filePrintText);
- fileCloseAction = new QAction("Close", "&Close", new QKeySequence(CTRL+Key_W), this, "close", false);
+ fileCloseAction = new TQAction("Close", "&Close", new TQKeySequence(CTRL+Key_W), this, "close", false);
connect(fileCloseAction, SIGNAL("activated()"), this, SLOT("close()"));
- fileQuitAction = new QAction("Quit", "&Quit", new QKeySequence(CTRL+Key_Q), this, "quit", false);
+ fileQuitAction = new TQAction("Quit", "&Quit", new TQKeySequence(CTRL+Key_Q), this, "quit", false);
connect(fileQuitAction, SIGNAL("activated()"), qApp(), SLOT("closeAllWindows()"));
// populate a tool bar with some actions
- QToolBar fileTools = new QToolBar(this, "file operations");
+ TQToolBar fileTools = new TQToolBar(this, "file operations");
fileTools.setLabel(tr("File Operations"));
fileOpenAction.addTo(fileTools);
fileSaveAction.addTo(fileTools);
filePrintAction.addTo(fileTools);
- QWhatsThis.whatsThisButton(fileTools);
+ TQWhatsThis.whatsThisButton(fileTools);
// popuplate a menu with all actions
- QPopupMenu file = new QPopupMenu(this, "file");
+ TQPopupMenu file = new TQPopupMenu(this, "file");
menuBar().insertItem("&File", file);
fileNewAction.addTo(file);
fileOpenAction.addTo(file);
@@ -155,18 +155,18 @@ public class ApplicationWindow extends QMainWindow {
// add a help menu
- QPopupMenu help = new QPopupMenu(this, "help");
+ TQPopupMenu help = new TQPopupMenu(this, "help");
menuBar().insertSeparator();
menuBar().insertItem("&Help", help);
- help.insertItem("&About", this, SLOT("about()"), new QKeySequence(Key_F1), -1, -1);
+ help.insertItem("&About", this, SLOT("about()"), new TQKeySequence(Key_F1), -1, -1);
help.insertItem("About &Qt", this, SLOT("aboutQt()"));
help.insertSeparator();
- help.insertItem("What's &This", this, SLOT("whatsThis()"), new QKeySequence(SHIFT+Key_F1), -1, -1);
+ help.insertItem("What's &This", this, SLOT("whatsThis()"), new TQKeySequence(SHIFT+Key_F1), -1, -1);
// create and define the central widget
- e = new QMultiLineEdit(this, "editor");
+ e = new TQMultiLineEdit(this, "editor");
e.setFocus();
setCentralWidget(e);
statusBar().message("Ready", 2000);
@@ -179,7 +179,7 @@ public class ApplicationWindow extends QMainWindow {
}
private void load() {
- String fn = QFileDialog.getOpenFileName("", "", this);
+ String fn = TQFileDialog.getOpenFileName("", "", this);
if (!(fn.length()==0))
load(fn);
else
@@ -188,7 +188,7 @@ public class ApplicationWindow extends QMainWindow {
private void load(String fileName) {
- QFile f = new QFile(fileName);
+ TQFile f = new TQFile(fileName);
if (!f.open(1))
return;
@@ -197,7 +197,7 @@ public class ApplicationWindow extends QMainWindow {
e.setAutoUpdate(false);
e.clear();
- QTextStream t = new QTextStream(f);
+ TQTextStream t = new TQTextStream(f);
while (!t.eof()) {
String s = t.readLine();
e.append(s);
@@ -219,13 +219,13 @@ public class ApplicationWindow extends QMainWindow {
}
String text = e.text();
- QFile f = new QFile(filename);
+ TQFile f = new TQFile(filename);
if (!f.open(2)) {
statusBar().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();
@@ -238,7 +238,7 @@ public class ApplicationWindow extends QMainWindow {
private void saveAs() {
- String fn = QFileDialog.getSaveFileName("", "", this);
+ String fn = TQFileDialog.getSaveFileName("", "", this);
if (!(fn.length()==0)) {
filename = fn;
save();
@@ -253,14 +253,14 @@ public class ApplicationWindow extends QMainWindow {
if (printer.setup(this)) { // printer dialog
statusBar().message("Printing...");
- QPainter p = new QPainter();
+ TQPainter p = new TQPainter();
p.begin(printer); // paint on printer
p.setFont(e.font());
int yPos = 0; // y position for each line
- QFontMetrics fm = p.fontMetrics();
+ TQFontMetrics fm = p.fontMetrics();
// need width/height of printer surface
- QPaintDeviceMetrics metrics = new QPaintDeviceMetrics(printer);
+ TQPaintDeviceMetrics metrics = new TQPaintDeviceMetrics(printer);
for(int i = 0 ; i < e.numLines() ; i++) {
if (Margin + yPos > metrics.height() - Margin) {
@@ -282,13 +282,13 @@ public class ApplicationWindow extends QMainWindow {
}
}
- protected void closeEvent(QCloseEvent ce) {
+ protected void closeEvent(TQCloseEvent ce) {
if (!e.edited()) {
ce.accept();
return;
}
- switch(QMessageBox.information(this, "Qt Application Example",
+ switch(TQMessageBox.information(this, "Qt Application Example",
"The document has been changed since the last save.",
"Save Now", "Cancel", "Leave Anyway", 0, 1)) {
case 0:
@@ -306,13 +306,13 @@ public class ApplicationWindow extends QMainWindow {
}
private void about() {
- QMessageBox.about(this, "Qt Application Example",
+ TQMessageBox.about(this, "Qt Application Example",
"This example demonstrates simple use of "+
- "QMainWindow,\nQMenuBar and QToolBar.");
+ "TQMainWindow,\nTQMenuBar and TQToolBar.");
}
private void aboutQt() {
- QMessageBox.aboutQt(this, "Qt Application Example");
+ TQMessageBox.aboutQt(this, "Qt Application Example");
}
}
diff --git a/qtjava/javalib/examples/application/Main.java b/qtjava/javalib/examples/application/Main.java
index 2ba09ea9..9527f75c 100644
--- a/qtjava/javalib/examples/application/Main.java
+++ b/qtjava/javalib/examples/application/Main.java
@@ -1,8 +1,8 @@
import org.kde.qt.*;
-public class Main extends QObject {
+public class Main extends TQObject {
public static void main(String[] args) {
- QApplication a = new QApplication (args);
+ TQApplication a = new TQApplication (args);
ApplicationWindow mw = new ApplicationWindow();
mw.setCaption("Document 1");
mw.show();