summaryrefslogtreecommitdiffstats
path: root/qtjava/javalib/examples/menu
diff options
context:
space:
mode:
Diffstat (limited to 'qtjava/javalib/examples/menu')
-rw-r--r--qtjava/javalib/examples/menu/MenuExample.java70
-rw-r--r--qtjava/javalib/examples/menu/README2
2 files changed, 36 insertions, 36 deletions
diff --git a/qtjava/javalib/examples/menu/MenuExample.java b/qtjava/javalib/examples/menu/MenuExample.java
index 3eca97b5..1c4e7231 100644
--- a/qtjava/javalib/examples/menu/MenuExample.java
+++ b/qtjava/javalib/examples/menu/MenuExample.java
@@ -10,11 +10,11 @@
import org.kde.qt.*;
-class MenuExample extends QWidget
+class MenuExample extends TQWidget
{
-private QMenuBar menu;
-private QLabel label;
+private TQMenuBar menu;
+private TQLabel label;
private boolean isBold;
private boolean isUnderline;
private int boldID, underlineID;
@@ -97,26 +97,26 @@ static String p3_xpm[] = {
menu.
*/
/**
-class MyMenuItem extends QCustomMenuItem
+class MyMenuItem extends TQCustomMenuItem
{
private String string;
-private QFont font;
+private TQFont font;
- public MyMenuItem( String s, QFont f )
+ public MyMenuItem( String s, TQFont f )
{
font = f;
string = s;
}
- public void paint( QPainter p, QColorGroup cg, boolean act, boolean enabled, int x, int y, int w, int h )
+ public void paint( TQPainter p, TQColorGroup cg, boolean act, boolean enabled, int x, int y, int w, int h )
{
p.setFont ( font );
p.drawText( x, y, w, h, AlignLeft | AlignVCenter | ShowPrefix | DontClip, string );
}
- public QSize sizeHint()
+ public TQSize sizeHint()
{
- return new QFontMetrics( font ).size( AlignLeft | AlignVCenter | ShowPrefix | DontClip, string );
+ return new TQFontMetrics( font ).size( AlignLeft | AlignVCenter | ShowPrefix | DontClip, string );
}
}
*/
@@ -126,14 +126,14 @@ MenuExample( )
this(null, null);
}
-MenuExample( QWidget parent, String name )
+MenuExample( TQWidget parent, String name )
{
super( parent, name );
- QPixmap p1 = new QPixmap( p1_xpm );
- QPixmap p2 = new QPixmap( p2_xpm );
- QPixmap p3 = new QPixmap( p3_xpm );
+ TQPixmap p1 = new TQPixmap( p1_xpm );
+ TQPixmap p2 = new TQPixmap( p2_xpm );
+ TQPixmap p3 = new TQPixmap( p3_xpm );
- QPopupMenu print = new QPopupMenu( this );
+ TQPopupMenu print = new TQPopupMenu( this );
print.insertTearOffHandle();
print.insertItem( "&Print to printer", this, SLOT("printer()") );
print.insertItem( "Print to &file", this, SLOT("file()") );
@@ -141,38 +141,38 @@ MenuExample( QWidget parent, String name )
print.insertSeparator();
print.insertItem( "Printer &Setup", this, SLOT("printerSetup()") );
- QPopupMenu file = new QPopupMenu( this );
- file.insertItem( new QIconSet(p1), "&Open", this, SLOT("open()"), new QKeySequence(CTRL+Key_O) );
- file.insertItem( new QIconSet(p2), "&New", this, SLOT("news()"), new QKeySequence(CTRL+Key_N) );
- file.insertItem( new QIconSet(p3), "&Save", this, SLOT("save()"), new QKeySequence(CTRL+Key_S) );
- file.insertItem( "&Close", this, SLOT("closeDoc()"), new QKeySequence(CTRL+Key_W) );
+ TQPopupMenu file = new TQPopupMenu( this );
+ file.insertItem( new TQIconSet(p1), "&Open", this, SLOT("open()"), new TQKeySequence(CTRL+Key_O) );
+ file.insertItem( new TQIconSet(p2), "&New", this, SLOT("news()"), new TQKeySequence(CTRL+Key_N) );
+ file.insertItem( new TQIconSet(p3), "&Save", this, SLOT("save()"), new TQKeySequence(CTRL+Key_S) );
+ file.insertItem( "&Close", this, SLOT("closeDoc()"), new TQKeySequence(CTRL+Key_W) );
file.insertSeparator();
file.insertItem( "&Print", print, CTRL+Key_P );
file.insertSeparator();
- file.insertItem( "E&xit", qApp(), SLOT("quit()"), new QKeySequence(CTRL+Key_Q) );
+ file.insertItem( "E&xit", qApp(), SLOT("quit()"), new TQKeySequence(CTRL+Key_Q) );
- QPopupMenu edit = new QPopupMenu( this );
+ TQPopupMenu edit = new TQPopupMenu( this );
int undoID = edit.insertItem( "&Undo", this, SLOT("undo()") );
int redoID = edit.insertItem( "&Redo", this, SLOT("redo()") );
edit.setItemEnabled( undoID, false );
edit.setItemEnabled( redoID, false );
- QPopupMenu options = new QPopupMenu( this );
+ TQPopupMenu options = new TQPopupMenu( this );
options.insertTearOffHandle();
options.setCaption("Options");
options.insertItem( "&Normal Font", this, SLOT("normal()") );
options.insertSeparator();
options.polish(); // adjust system settings
- QFont f = options.font();
+ TQFont f = options.font();
f.setBold( true );
// boldID = options.insertItem( new MyMenuItem( "&Bold", f ) );
- options.setAccel( new QKeySequence(CTRL+Key_B), boldID );
+ options.setAccel( new TQKeySequence(CTRL+Key_B), boldID );
options.connectItem( boldID, this, SLOT("bold()") );
f = font();
f.setUnderline( true );
// underlineID = options.insertItem( new MyMenuItem( "&Underline", f ) );
- options.setAccel( new QKeySequence(CTRL+Key_U), underlineID );
+ options.setAccel( new TQKeySequence(CTRL+Key_U), underlineID );
options.connectItem( underlineID, this, SLOT("underline()") );
isBold = false;
@@ -180,21 +180,21 @@ MenuExample( QWidget parent, String name )
options.setCheckable( true );
- QPopupMenu help = new QPopupMenu( this );
- help.insertItem( "&About", this, SLOT("about()"), new QKeySequence(CTRL+Key_H) );
+ TQPopupMenu help = new TQPopupMenu( this );
+ help.insertItem( "&About", this, SLOT("about()"), new TQKeySequence(CTRL+Key_H) );
help.insertItem( "About &Qt", this, SLOT("aboutQt()") );
- menu = new QMenuBar( this );
+ menu = new TQMenuBar( this );
menu.insertItem( "&File", file );
menu.insertItem( "&Edit", edit );
menu.insertItem( "&Options", options );
menu.insertSeparator();
menu.insertItem( "&Help", help );
- menu.setSeparator( QMenuBar.InWindowsStyle );
+ menu.setSeparator( TQMenuBar.InWindowsStyle );
- label = new QLabel( this );
+ label = new TQLabel( this );
label.setGeometry( 20, rect().center().y()-20, width()-40, 40 );
- label.setFrameStyle( QFrame.Box | QFrame.Raised );
+ label.setFrameStyle( TQFrame.Box | TQFrame.Raised );
label.setLineWidth( 1 );
label.setAlignment( AlignCenter );
@@ -268,7 +268,7 @@ void underline()
void about()
{
- QMessageBox.about( this, "Qt Menu Example",
+ TQMessageBox.about( this, "Qt Menu Example",
"This example demonstrates simple use of Qt menus.\n"
+ "You can cut and paste lines from it to your own\n"
+ "programs." );
@@ -277,7 +277,7 @@ void about()
void aboutQt()
{
- QMessageBox.aboutQt( this, "Qt Menu Example" );
+ TQMessageBox.aboutQt( this, "Qt Menu Example" );
}
@@ -302,7 +302,7 @@ void printerSetup()
}
-protected void resizeEvent( QResizeEvent e )
+protected void resizeEvent( TQResizeEvent e )
{
label.setGeometry( 20, rect().center().y()-20, width()-40, 40 );
}
@@ -310,7 +310,7 @@ protected void resizeEvent( QResizeEvent e )
public static void main(String[] args)
{
- QApplication a = new QApplication( args );
+ TQApplication a = new TQApplication( args );
MenuExample m = new MenuExample();
m.setCaption("Qt Examples - Menus");
a.setMainWidget( m );
diff --git a/qtjava/javalib/examples/menu/README b/qtjava/javalib/examples/menu/README
index 958edd19..326a3f20 100644
--- a/qtjava/javalib/examples/menu/README
+++ b/qtjava/javalib/examples/menu/README
@@ -1,2 +1,2 @@
-The class MyMenuItem isn't translated to Java, as the QCustomMenuItem.paint()
+The class MyMenuItem isn't translated to Java, as the TQCustomMenuItem.paint()
and sizeHint() virtual method callbacks aren't implemented yet.