diff options
Diffstat (limited to 'qtjava/javalib/examples/popup/Frame.java')
-rw-r--r-- | qtjava/javalib/examples/popup/Frame.java | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/qtjava/javalib/examples/popup/Frame.java b/qtjava/javalib/examples/popup/Frame.java index afbf2edc..1f1e3eb3 100644 --- a/qtjava/javalib/examples/popup/Frame.java +++ b/qtjava/javalib/examples/popup/Frame.java @@ -14,13 +14,13 @@ import org.kde.qt.*; -class Frame extends QFrame +class Frame extends TQFrame { -private QPushButton button1; -private QPushButton button2; +private TQPushButton button1; +private TQPushButton button2; -private QFrame popup1; +private TQFrame popup1; private FancyPopup popup2; Frame() @@ -28,15 +28,15 @@ Frame() this(null, null); } -Frame(QWidget parent, String name) +Frame(TQWidget parent, String name) { super(parent, name); - button1 = new QPushButton("Simple Popup", this); + button1 = new TQPushButton("Simple Popup", this); connect ( button1, SIGNAL(" clicked()"), SLOT(" button1Clicked()") ); - button2 = new QPushButton("Fancy Popup", this); + button2 = new TQPushButton("Fancy Popup", this); connect ( button2, SIGNAL(" pressed()"), SLOT(" button2Pressed()") ); - QBoxLayout l = new QHBoxLayout( this ); + TQBoxLayout l = new TQHBoxLayout( this ); button1.setMaximumSize(button1.sizeHint()); button2.setMaximumSize(button2.sizeHint()); l.addWidget( button1 ); @@ -50,14 +50,14 @@ Frame(QWidget parent, String name) //create a very simple popup: it is just composed with other //widget and will be shown after clicking on button1 - popup1 = new QFrame( this ,null, WType_Popup); + popup1 = new TQFrame( this ,null, WType_Popup); popup1.setFrameStyle( WinPanel|Raised ); popup1.resize(150,100); - QLineEdit tmpE = new QLineEdit( popup1 ); + TQLineEdit tmpE = new TQLineEdit( popup1 ); connect( tmpE, SIGNAL(" returnPressed()"), popup1, SLOT(" hide()") ); tmpE.setGeometry(10,10, 130, 30); tmpE.setFocus(); - QPushButton tmpB = new QPushButton("Click me!", popup1); + TQPushButton tmpB = new TQPushButton("Click me!", popup1); connect( tmpB, SIGNAL(" clicked()"), popup1, SLOT(" close()") ); tmpB.setGeometry(10, 50, 130, 30); @@ -71,7 +71,7 @@ Frame(QWidget parent, String name) // it with any other widget. The next four lines (if not // commented out) will for instance add a line edit widget. -// tmpE = new QLineEdit( popup2 ); +// tmpE = new TQLineEdit( popup2 ); // tmpE.setFocus(); // connect( tmpE, SIGNAL(" returnPressed()"), popup2, SLOT(" close()") ); // tmpE.setGeometry(10, 10, 130, 30); @@ -87,19 +87,19 @@ void button2Pressed(){ popup2.popup(button2); } -class FancyPopup extends QLabel +class FancyPopup extends TQLabel { -private QWidget popupParent; +private TQWidget popupParent; private int moves; -FancyPopup( QWidget parent ) +FancyPopup( TQWidget parent ) { this(parent, null); } -FancyPopup( QWidget parent, String name ) +FancyPopup( TQWidget parent, String name ) { super( parent, name, WType_Popup ); setFrameStyle( WinPanel|Raised ); @@ -109,20 +109,20 @@ FancyPopup( QWidget parent, String name ) setMouseTracking( true ); } -protected void mouseMoveEvent( QMouseEvent e){ +protected void mouseMoveEvent( TQMouseEvent e){ moves++; String s = e.pos().x() + "/" + e.pos().y(); - if ((e.state() & QMouseEvent.LeftButton) != 0) + if ((e.state() & TQMouseEvent.LeftButton) != 0) s += " (down)"; setText(s); } -protected void mouseReleaseEvent( QMouseEvent e){ +protected void mouseReleaseEvent( TQMouseEvent e){ if (rect().contains( e.pos() ) || moves > 5) close(); } -protected void closeEvent( QCloseEvent e ){ +protected void closeEvent( TQCloseEvent e ){ e.accept(); moves = 0; if (popupParent == null) @@ -133,11 +133,11 @@ protected void closeEvent( QCloseEvent e ){ // the popupParent popped us up in its mousePressEvent handler. To // avoid the button remaining in pressed state we simply send a // faked mouse button release event to it. - QMouseEvent me = new QMouseEvent( QEvent.MouseButtonRelease, new QPoint(0,0), new QPoint(0,0), QMouseEvent.LeftButton, QMouseEvent.NoButton); - QApplication.sendEvent( popupParent, me ); + TQMouseEvent me = new TQMouseEvent( TQEvent.MouseButtonRelease, new TQPoint(0,0), new TQPoint(0,0), TQMouseEvent.LeftButton, TQMouseEvent.NoButton); + TQApplication.sendEvent( popupParent, me ); } -void popup( QWidget parent) { +void popup( TQWidget parent) { popupParent = parent; setText("Move the mouse!"); if (popupParent != null) @@ -150,7 +150,7 @@ void popup( QWidget parent) { public static void main(String[] args) { - QApplication a = new QApplication( args ); + TQApplication a = new TQApplication( args ); Frame frame = new Frame(); frame.setCaption("Qt Example - Custom Popups"); |