summaryrefslogtreecommitdiffstats
path: root/qtjava/javalib/examples/qmag/MagWidget.java
diff options
context:
space:
mode:
Diffstat (limited to 'qtjava/javalib/examples/qmag/MagWidget.java')
-rw-r--r--qtjava/javalib/examples/qmag/MagWidget.java82
1 files changed, 41 insertions, 41 deletions
diff --git a/qtjava/javalib/examples/qmag/MagWidget.java b/qtjava/javalib/examples/qmag/MagWidget.java
index 66c68705..cf766570 100644
--- a/qtjava/javalib/examples/qmag/MagWidget.java
+++ b/qtjava/javalib/examples/qmag/MagWidget.java
@@ -10,17 +10,17 @@
import org.kde.qt.*;
-class MagWidget extends QWidget
+class MagWidget extends TQWidget
{
-private QComboBox zoom;
-private QComboBox refresh;
-private QPushButton saveButton;
-private QPushButton multiSaveButton;
-private QPushButton quitButton;
-private QPixmap pm; // pixmap, magnified
-private QPixmap p; // pixmap
-private QImage image; // image of pixmap (for RGB)
-private QLabel rgb;
+private TQComboBox zoom;
+private TQComboBox refresh;
+private TQPushButton saveButton;
+private TQPushButton multiSaveButton;
+private TQPushButton quitButton;
+private TQPixmap pm; // pixmap, magnified
+private TQPixmap p; // pixmap
+private TQImage image; // image of pixmap (for RGB)
+private TQLabel rgb;
private int yoffset; // pixels in addition to the actual picture
private int z; // magnification factor
private int r; // autorefresh rate (index into refreshrates)
@@ -47,7 +47,7 @@ MagWidget( )
this(null, null);
}
-MagWidget( QWidget parent, String name )
+MagWidget( TQWidget parent, String name )
{
super( parent, name);
z = 1; // default zoom (100%)
@@ -55,11 +55,11 @@ MagWidget( QWidget parent, String name )
int w=0, x=0, n;
- zoom = new QComboBox( false, this );
+ zoom = new TQComboBox( false, this );
zoom.insertStrList( zoomfactors, 9 );
connect( zoom, SIGNAL("activated(int)"), SLOT("setZoom(int)") );
- refresh = new QComboBox( false, this );
+ refresh = new TQComboBox( false, this );
refresh.insertStrList( refreshrates, 9 );
connect( refresh, SIGNAL("activated(int)"), SLOT("setRefresh(int)") );
@@ -77,20 +77,20 @@ MagWidget( QWidget parent, String name )
}
refresh.setGeometry( x, 2, w+30, 20 );
- saveButton = new QPushButton( this );
+ saveButton = new TQPushButton( this );
connect( saveButton, SIGNAL("clicked()"), this, SLOT("save()") );
saveButton.setText( "Save" );
saveButton.setGeometry( x+w+30+2, 2,
10+saveButton.fontMetrics().width("Save"), 20 );
- multiSaveButton = new QPushButton( this );
+ multiSaveButton = new TQPushButton( this );
multiSaveButton.setToggleButton(true);
connect( multiSaveButton, SIGNAL("clicked()"), this, SLOT("multiSave()") );
multiSaveButton.setText( "MultiSave" );
multiSaveButton.setGeometry( saveButton.geometry().right() + 2, 2,
10+multiSaveButton.fontMetrics().width("MultiSave"), 20 );
- quitButton = new QPushButton( this );
+ quitButton = new TQPushButton( this );
connect( quitButton, SIGNAL("clicked()"), qApp(), SLOT("quit()") );
quitButton.setText( "Quit" );
quitButton.setGeometry( multiSaveButton.geometry().right() + 2, 2,
@@ -103,7 +103,7 @@ MagWidget( QWidget parent, String name )
setRefresh(1);
setZoom(5);
- rgb = new QLabel( this );
+ rgb = new TQLabel( this );
rgb.setText( "" );
rgb.setAlignment( AlignVCenter );
rgb.resize( width(), rgb.fontMetrics().height() + 4 );
@@ -122,7 +122,7 @@ MagWidget( QWidget parent, String name )
setMouseTracking( true ); // and do let me know what pixel I'm at, eh?
- grabAround( new QPoint(grabx=qApp().desktop().width()/2, graby=qApp().desktop().height()/2) );
+ grabAround( new TQPoint(grabx=qApp().desktop().width()/2, graby=qApp().desktop().height()/2) );
}
@@ -149,7 +149,7 @@ void save()
{
if ( p != null ) {
killTimers();
- String fn = QFileDialog.getSaveFileName();
+ String fn = TQFileDialog.getSaveFileName();
if ( !fn.equals("") )
p.save( fn, "BMP" );
if ( r != 0)
@@ -161,7 +161,7 @@ void multiSave()
{
if ( p != null ) {
multifn = ""; // stops saving
- multifn = QFileDialog.getSaveFileName();
+ multifn = TQFileDialog.getSaveFileName();
if ( multifn.equals("") )
multiSaveButton.setOn(false);
if ( r == 0)
@@ -189,40 +189,40 @@ void grab()
x = grabx-w/2; // find a suitable position to grab from
y = graby-h/2;
- if ( x + w > QApplication.desktop().width() )
- x = QApplication.desktop().width()-w;
+ if ( x + w > TQApplication.desktop().width() )
+ x = TQApplication.desktop().width()-w;
else if ( x < 0 )
x = 0;
- if ( y + h > QApplication.desktop().height() )
- y = QApplication.desktop().height()-h;
+ if ( y + h > TQApplication.desktop().height() )
+ y = TQApplication.desktop().height()-h;
else if ( y < 0 )
y = 0;
- p = QPixmap.grabWindow( QApplication.desktop().winId(), x, y, w, h );
+ p = TQPixmap.grabWindow( TQApplication.desktop().winId(), x, y, w, h );
image = p.convertToImage();
- QWMatrix m = new QWMatrix(); // after getting it, scale it
+ TQWMatrix m = new TQWMatrix(); // after getting it, scale it
m.scale( (double)z, (double)z );
- // A cast from Object to QPixmap is needed in java. The xForm methods
+ // A cast from Object to TQPixmap is needed in java. The xForm methods
// have several different return types in C++, and must all be of type
// 'Object' for java
- pm = (QPixmap) p.xForm( m );
+ pm = (TQPixmap) p.xForm( m );
if ( multiSaveButton == null || !multiSaveButton.isOn() )
repaint( false ); // and finally repaint, flicker-free
}
-protected void paintEvent( QPaintEvent e )
+protected void paintEvent( TQPaintEvent e )
{
if ( pm != null ) {
- QPainter paint = new QPainter( this );
+ TQPainter paint = new TQPainter( this );
paint.drawPixmap( 0, zoom != null ? zoom.height()+4 : 0, pm,
0,0, width(), height()-yoffset );
}
}
-protected void mousePressEvent( QMouseEvent e )
+protected void mousePressEvent( TQMouseEvent e )
{
if ( !grabbing ) { // prepare to grab...
grabbing = true;
@@ -238,7 +238,7 @@ protected void mousePressEvent( QMouseEvent e )
-protected void mouseReleaseEvent( QMouseEvent e )
+protected void mouseReleaseEvent( TQMouseEvent e )
{
if ( grabbing && grabx >= 0 && graby >= 0 ) {
grabbing = false;
@@ -247,7 +247,7 @@ protected void mouseReleaseEvent( QMouseEvent e )
}
}
-void grabAround(QPoint pos)
+void grabAround(TQPoint pos)
{
int rx, ry;
rx = mapToGlobal(pos).x();
@@ -258,8 +258,8 @@ void grabAround(QPoint pos)
int pz;
pz = 1;
while ( w*pz*h*pz < width()*(height()-yoffset) &&
- w*pz < QApplication.desktop().width() &&
- h*pz < QApplication.desktop().height() )
+ w*pz < TQApplication.desktop().width() &&
+ h*pz < TQApplication.desktop().height() )
pz++;
if ( (w*pz*h*pz - width()*(height()-yoffset)) >
(width()*(height()-yoffset) - w*(pz-1)*h*(pz-1)) )
@@ -282,7 +282,7 @@ void grabAround(QPoint pos)
}
-protected void mouseMoveEvent( QMouseEvent e )
+protected void mouseMoveEvent( TQMouseEvent e )
{
if ( grabbing || pm.isNull() ||
e.pos().y() > height() - (zoom != null ? zoom.fontMetrics().height() - 4 : 0) ||
@@ -307,18 +307,18 @@ protected void mouseMoveEvent( QMouseEvent e )
}
-protected void focusOutEvent( QFocusEvent e )
+protected void focusOutEvent( TQFocusEvent e )
{
rgb.setText( "" );
}
-protected void timerEvent( QTimerEvent e )
+protected void timerEvent( TQTimerEvent e )
{
grab();
/*
if ( multiSaveButton.isOn() && !multifn.equals("") ) {
- QRegExp num("[0-9][0-9]");
+ TQRegExp num("[0-9][0-9]");
int start;
int len;
if ((start=num.match(multifn,0,&len))>=0)
@@ -331,7 +331,7 @@ protected void timerEvent( QTimerEvent e )
}
-protected void resizeEvent( QResizeEvent e )
+protected void resizeEvent( TQResizeEvent e )
{
rgb.setGeometry( 0, height() - rgb.height(), width(), rgb.height() );
grab();
@@ -342,7 +342,7 @@ protected void resizeEvent( QResizeEvent e )
public static void main(String[] args)
{
- QApplication a = new QApplication( args );
+ TQApplication a = new TQApplication( args );
MagWidget m = new MagWidget();
a.setMainWidget( m );
m.show();