[Qt-interest] Clues and Q's on missing DragDrop Indicator *between* Items
Hostile Fork
hostilefork at gmail.com
Thu Aug 6 01:32:24 CEST 2009
Hi Qt people :)
I've hit some similar problems to what others have reported with the
drop indicator not showing up *between* items in views:
http://www.qtcentre.org/forum/archive/index.php/t-419.html
http://www.mail-archive.com/qt-jambi-interest@trolltech.com/msg01201.html
http://lists.trolltech.com/pipermail/qt-jambi-interest/2008-June/000395.html
Since I couldn't find any resolution on the web, I decided to browse
the Qt sources. The "between" lines seem to get drawn in
QAbstractItemView's dragMoveEvent:
http://qt.gitorious.org/qt/qt/blobs/master/src/gui/itemviews/qabstractitemview.cpp#line1731
There's also a routine in QAbstractItemView's private implementation
called "paintDropIndicator"...which isn't sensitive to the
DropIndicatorPosition:
http://qt.gitorious.org/qt/qt/blobs/master/src/gui/itemviews/qabstractitemview_p.h#line169
Whether that's a problem or not, it got me wondering if the theme or
KDE could be painting over the line after it was drawn. Sure enough,
when I put this code in my main():
QApplication::setStyle(new QWindowsStyle)
...it made it clearer what was going on. The DropIndicator line was
being obscured by the bitmap representing the drag object. The reason
it was so easy to obscure was that it was only being drawn on the edge
of the single cell I was hovering over... not the entire row.
[My TreeView has
setSelectionBehavior(QAbstractItemView::SelectRows)... but I didn't
notice an analogous feature for making sure the drop indicator is
applied to rows and not cells.]
Hope that sheds some light on this issue. Does anyone have advice on
a workaround?
Thanks!
Brian
---
http://hostilefork.com
More information about the Qt-interest-old
mailing list