Results 1 to 4 of 4

Thread: How change the DropIndicator of QAbstractItemView

  1. #1
    Join Date
    Mar 2006
    Location
    Dortmund, Germany
    Posts
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question How change the DropIndicator of QAbstractItemView

    hello everyone.

    first, congratulations to this very nice site. i highly appreciate all well organized resources about Qt.

    now to my problem: i want to implement a QTableView where only full rows are selectable. of course, this is not hard at all. i also want to enable drag-n-drop of full rows. when dragging full rows, the DropIndicator should not only highlight a single QModelIndex item, but a full row. therefore i wanted to override dragMoveEvent(QDragMoveEvent * event) of QAbstractItemView. unfortunately this "d" field (which i haven't fully understood), which holds the coordinates of the DropIndicator's drawing rectangle, is not accessible because it's private. is there another way to manipulate the drawing rectangle of the DropIndicator?


    thanks.

    wan-hi

  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 change the DropIndicator of QAbstractItemView

    IMO you just need to change QAbstractItemView::SelectionBehavior property to QAbstractItemView::SelectRows. AFAIR this causes both the whole row to be selected and whole row to be indicated while dragging. No need for any custom code.

  3. #3
    Join Date
    Mar 2006
    Location
    Dortmund, Germany
    Posts
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How change the DropIndicator of QAbstractItemView

    sorry, but you misunderstood. yes, when changing the selection behaviour to QAbstractItemView::SelectRows, the QTableView does select full rows and drags them visually, but it does not change it's DropIndicator behaviour. the DropIndicator still renders frames around single table items, not full rows.

    that's why i wanted to override the dropEvent function because that's where the coordinates of the frame to render are generated. unfortunately these values are given to a private member which i get no access to. i'd love to know how other people worked around this problem.
    Last edited by Wan-Hi; 17th March 2006 at 20:43.

  4. #4
    Join Date
    Mar 2006
    Location
    Dortmund, Germany
    Posts
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How change the DropIndicator of QAbstractItemView

    has nobody dealt with this problem before?

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.