Results 1 to 3 of 3

Thread: how to disable OnItem drops in a QListView?

  1. #1
    Join Date
    Jan 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question how to disable OnItem drops in a QListView?

    I'm trying to implement manual sorting of a list of items inside a QListView widget by using drag&drop. I've set dragDropModel to InternalMove and it almost works, expect when I drop an item over another; that will replace the hovered item instead of inserting it between two items. Is there a way to disable this?

    I can see there is a QAbstractItemView::DropIndicatorPosition that can take the values:

    QAbstractItemView::AboveItem

    QAbstractItemView::BelowItem

    QAbstractItemView::OnItem

    QAbstractItemView::OnViewport

    I guess I want to disable the OnItem one, though, how?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to disable OnItem drops in a QListView?

    Make sure QAbstractItemModel::flags() doesn't return ItemIsDropEnabled for valid model indexes.

  3. #3
    Join Date
    Jan 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Smile Re: how to disable OnItem drops in a QListView?

    Quote Originally Posted by wysota View Post
    Make sure QAbstractItemModel::flags() doesn't return ItemIsDropEnabled for valid model indexes.
    That was it. Thank you!

Similar Threads

  1. QListView trouble accepting drops
    By thomaspu in forum Qt Programming
    Replies: 4
    Last Post: 6th September 2007, 19:49
  2. How can I disable the QListView Sorting?
    By darpan in forum Qt Programming
    Replies: 3
    Last Post: 27th June 2006, 10:36

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.