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/iconview | |
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/iconview')
-rw-r--r-- | qtjava/javalib/examples/iconview/ListenDND.java | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/qtjava/javalib/examples/iconview/ListenDND.java b/qtjava/javalib/examples/iconview/ListenDND.java new file mode 100644 index 00000000..59521a55 --- /dev/null +++ b/qtjava/javalib/examples/iconview/ListenDND.java @@ -0,0 +1,69 @@ +/*************************************************************************** +* $Id$ +** +* Copyright (C) 1992-2000 Trolltech AS. All rights reserved. +** +* This file is part of an example program for Qt. This example +* program may be used, distributed and modified without limitation. +** +****************************************************************************/ +import org.kde.qt.*; + + +class ListenDND extends QObject +{ + +public ListenDND( QWidget w ) + {view = w;} + + void dropped( QDropEvent mime ) { + qDebug( "Dropped Mimesource {0} into the view {1}", new Object[] { mime, view } ); + qDebug( " Formats:" ); + int i = 0; + String str = mime.format( i ); + qDebug( " " + str ); + while ( str != null ) { + qDebug( " " + str ); + str = mime.format( ++i ); + } + }; + void moved() { + qDebug( "All selected items were moved to another widget" ); + } + +protected QWidget view; + + +public static void main( String[] args ) +{ + QApplication a = new QApplication( args ); + + QIconView qiconview = new QIconView(); + qiconview.setSelectionMode( QIconView.Extended ); + + for ( int i = 0; i < 3000; i++ ) { + QIconViewItem item = new QIconViewItem( qiconview, "Item " + (i + 1) ); + item.setRenameEnabled( true ); + } + + qiconview.setCaption( "Qt Example - Iconview" ); + + ListenDND listen_dnd = new ListenDND( qiconview ); + QObject.connect( qiconview, SIGNAL(" dropped( QDropEvent , ArrayList )"), + listen_dnd, SLOT(" dropped( QDropEvent )") ); + QObject.connect( qiconview, SIGNAL(" moved()"), listen_dnd, SLOT(" moved()") ); + + a.setMainWidget( qiconview ); + qiconview.show(); + qiconview.resize( qiconview.sizeHint() ); + + a.exec(); + return; +} + +static { + qtjava.initialize(); +} + +} + |