diff options
Diffstat (limited to 'qtjava/javalib/examples/dragdrop/DropSite.java')
-rw-r--r-- | qtjava/javalib/examples/dragdrop/DropSite.java | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/qtjava/javalib/examples/dragdrop/DropSite.java b/qtjava/javalib/examples/dragdrop/DropSite.java index 3584f1e4..34f41f12 100644 --- a/qtjava/javalib/examples/dragdrop/DropSite.java +++ b/qtjava/javalib/examples/dragdrop/DropSite.java @@ -15,7 +15,7 @@ import org.kde.qt.*; import java.util.*; -class DropSite extends QLabel +class DropSite extends TQLabel { SecretSource s; @@ -24,12 +24,12 @@ void setSecretSource(SecretSource source) s = source; } -DropSite( QWidget parent ) +DropSite( TQWidget parent ) { this(parent, null); } -DropSite( QWidget parent, String name ) +DropSite( TQWidget parent, String name ) { super( parent, name ); setAcceptDrops(true); @@ -41,20 +41,20 @@ DropSite( QWidget parent, String name ) } -protected void dragMoveEvent( QDragMoveEvent e ) +protected void dragMoveEvent( TQDragMoveEvent e ) { // Check if you want the drag at e.pos()... // Give the user some feedback... } -protected void dragEnterEvent( QDragEnterEvent e ) +protected void dragEnterEvent( TQDragEnterEvent e ) { // Check if you want the drag... if ( SecretDrag.canDecode( e ) - || QTextDrag.canDecode( e ) - || QImageDrag.canDecode( e ) - || QUriDrag.canDecode( e ) ) { + || TQTextDrag.canDecode( e ) + || TQImageDrag.canDecode( e ) + || TQUriDrag.canDecode( e ) ) { e.accept(); } @@ -68,7 +68,7 @@ protected void dragEnterEvent( QDragEnterEvent e ) setBackgroundColor(white()); } -protected void dragLeaveEvent( QDragLeaveEvent e ) +protected void dragLeaveEvent( TQDragLeaveEvent e ) { // Give the user some feedback... emit("message", ""); @@ -76,34 +76,34 @@ protected void dragLeaveEvent( QDragLeaveEvent e ) } -protected void dropEvent( QDropEvent e ) +protected void dropEvent( TQDropEvent e ) { setBackgroundColor(lightGray()); // Try to decode to the data you understand... StringBuffer str = new StringBuffer(""); - if ( QTextDrag.decode( e, str ) ) { + if ( TQTextDrag.decode( e, str ) ) { setText( str.toString() ); setMinimumSize( minimumSize().expandedTo( sizeHint() ) ); return; } - QPixmap pm = new QPixmap(); - if ( QImageDrag.decode( e, pm ) ) { + TQPixmap pm = new TQPixmap(); + if ( TQImageDrag.decode( e, pm ) ) { setPixmap( pm ); setMinimumSize( minimumSize().expandedTo( sizeHint() ) ); return; } ArrayList strings = new ArrayList(); - if ( QUriDrag.decode( e, strings ) ) { + if ( TQUriDrag.decode( e, strings ) ) { String m = "Full URLs:\n"; Iterator it = strings.iterator(); while (it.hasNext()) m += " " + (String) it.next() + "\n"; ArrayList files = new ArrayList(); - if ( QUriDrag.decodeLocalFiles( e, files ) ) { + if ( TQUriDrag.decodeLocalFiles( e, files ) ) { m = m + "Files:\n"; Iterator i = strings.iterator(); while (i.hasNext()) @@ -121,36 +121,36 @@ protected void dropEvent( QDropEvent e ) } } -protected void mousePressEvent( QMouseEvent e ) +protected void mousePressEvent( TQMouseEvent e ) { - QDragObject drobj; + TQDragObject drobj; if ( pixmap() != null ) { - drobj = new QImageDrag( pixmap().convertToImage(), this ); - QPixmap pm = new QPixmap(); + drobj = new TQImageDrag( pixmap().convertToImage(), this ); + TQPixmap pm = new TQPixmap(); pm.convertFromImage(pixmap().convertToImage().smoothScale( pixmap().width()/3,pixmap().height()/3)); - drobj.setPixmap(pm,new QPoint(-5,-7)); + drobj.setPixmap(pm,new TQPoint(-5,-7)); // Try it. // new DragMoviePlayer(drobj); } else { - drobj = new QTextDrag( text(), this ); + drobj = new TQTextDrag( text(), this ); } drobj.dragCopy(); } -class DragMoviePlayer extends QObject { - QDragObject dobj; - QMovie movie; +class DragMoviePlayer extends TQObject { + TQDragObject dobj; + TQMovie movie; -DragMoviePlayer( QDragObject p ) +DragMoviePlayer( TQDragObject p ) { -// QObject(p), +// TQObject(p), dobj = p; - movie = new QMovie("trolltech.gif" ); - movie.connectUpdate(this,SLOT("updatePixmap(QRect)")); + movie = new TQMovie("trolltech.gif" ); + movie.connectUpdate(this,SLOT("updatePixmap(TQRect)")); } -void updatePixmap( QRect rect ) +void updatePixmap( TQRect rect ) { dobj.setPixmap(movie.framePixmap()); } @@ -158,7 +158,7 @@ void updatePixmap( QRect rect ) } -void backgroundColorChange( QColor color ) +void backgroundColorChange( TQColor color ) { // Reduce flicker by using repaint() rather than update() repaint(); |