diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 90825e2392b2d70e43c7a25b8a3752299a933894 (patch) | |
tree | e33aa27f02b74604afbfd0ea4f1cfca8833d882a /qtjava/javalib/examples/tux | |
download | tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.tar.gz tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'qtjava/javalib/examples/tux')
-rw-r--r-- | qtjava/javalib/examples/tux/MoveMe.java | 68 | ||||
-rw-r--r-- | qtjava/javalib/examples/tux/tux.png | bin | 0 -> 14786 bytes |
2 files changed, 68 insertions, 0 deletions
diff --git a/qtjava/javalib/examples/tux/MoveMe.java b/qtjava/javalib/examples/tux/MoveMe.java new file mode 100644 index 00000000..02c4bf9a --- /dev/null +++ b/qtjava/javalib/examples/tux/MoveMe.java @@ -0,0 +1,68 @@ + +import org.kde.qt.*; + +class MoveMe extends QWidget +{ +public MoveMe( QWidget parent, String name, int f) +{ + super(parent,name, f); +} + +private QPoint clickPos; + +protected void mousePressEvent( QMouseEvent e ) +{ + // if ( e.button() == LeftButton ) + clickPos = e.pos(); +} + +protected void mouseMoveEvent( QMouseEvent e ) +{ + // if ( e.state() & LeftButton ) + move( new QPoint( e.globalPos().x() - clickPos.x(), + e.globalPos().y() - clickPos.y() ) ); +} + + + +public static void main(String[] args) +{ + QApplication a = new QApplication( args ); + + String fn="tux.png"; + + if ( args.length >= 1 ) + fn = args[0]; + + if ( ! QFile.exists( fn ) ) + System.exit( 1 ); + + QImage img = new QImage( fn ); + QPixmap p = new QPixmap(); + p.convertFromImage( img ); + if ( p.mask() == null ) + if ( img.hasAlphaBuffer() ) { + QBitmap bm = new QBitmap(img.createAlphaMask()); + p.setMask( bm ); + } else { + QBitmap bm = new QBitmap(img.createHeuristicMask()); + p.setMask( bm ); + } + MoveMe w = new MoveMe(null,null,Qt.WStyle_Customize|Qt.WStyle_NoBorder); + w.setBackgroundPixmap( p ); + w.setFixedSize( p.size() ); + if ( p.mask() != null ) + w.setMask( p.mask() ); + w.show(); + a.setMainWidget(w); + + + a.exec(); + return; +} + + static { + qtjava.initialize(); + } + +} diff --git a/qtjava/javalib/examples/tux/tux.png b/qtjava/javalib/examples/tux/tux.png Binary files differnew file mode 100644 index 00000000..7eab1410 --- /dev/null +++ b/qtjava/javalib/examples/tux/tux.png |