[patch] Fix KListView's drop highlighter
David Faure
faure at kde.org
Sun Dec 12 18:53:29 GMT 2004
On Sunday 12 December 2004 13:36, Volker Krause wrote:
> Hi,
>
> the attached one-line patch fixes some issues with the KListView drop
> highlighter. According to the API docs it should be "a rectangle around the
> item under the mouse cursor". However it is currently not shown on expanded
> items with child nodes and it sometimes highlights the item above. You can
> see all this in the group view of the latest KNode.
I'm not objecting to this patch, but I think the feature is still a bit broken.
The rectangle of the drop highlighter has a wrong left coordinate, it should be 0
for a toplevel item.
Testcase:
--- klistviewtest.cpp 28 Feb 2004 17:52:00 -0000 1.3
+++ klistviewtest.cpp 12 Dec 2004 18:45:25 -0000
@@ -11,7 +11,9 @@ int main( int argc, char **argv )
KListView *view = new KListView( dialog.makeVBoxMainWidget() );
view->setSelectionModeExt( KListView::FileManager );
view->setDragEnabled( true );
- view->setItemsMovable( false );
+ view->setItemsMovable( true );
+ view->setDropHighlighter( true );
+ view->setDropVisualizer( false );
view->setAcceptDrops( true );
view->addColumn("Column 1");
view->addColumn("Column 2");
==
I think I finally understood how klistview handles the two different ways of doing DnD:
* DnD to move items relatively to each other, like in keditbookmarks: setDropHighlighter(true)
* DnD from the outside, to drop items into e.g. folders, like in kmail (and I guess knode): setDropVisualizer(true)
But the dropped() signal itself doesn't have those two modes, hence klistview.cpp 1.233
reverted in 1.239.
I think that we should have a single setDropVisualizer method, and a setDropMode( enum )
which allows choosing between the two modes of DnD, to do the right thing both
for the visualizer and for the dropped signal. But this is easier done for a major release
(BIC), and I'm not sure what Qt4's treeview does for us already, so we'll see.
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the kde-core-devel
mailing list