Results 1 to 2 of 2

Thread: QTableWidget - D&D

  1. #1
    Join Date
    Mar 2010
    Posts
    107
    Thanks
    22
    Qt products
    Qt4
    Platforms
    Windows

    Default QTableWidget - D&D

    Hello
    I have used Qt Designer to make a dialog containing a QTableWidget.
    I have set the following - so that I can drag and drop rows within the table
    Qt Code:
    1. tableWidget->setAcceptDrops(true);
    2. tableWidget->setDragEnabled(true);
    3. tableWidget->setDefaultDropAction(Qt::MoveAction);
    4. tableWidget->setSelectionMode(QAbstractItemView::NoSelection);
    5. tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
    To copy to clipboard, switch view to plain text mode 

    However I cannot drag rows within the table

    What have I missed

    TIA

    Graham

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QTableWidget - D&D

    Qt Code:
    1. tableWidget->setSelectionMode(QAbstractItemView::NoSelection);
    To copy to clipboard, switch view to plain text mode 
    This tells the table that no items can be selected.
    So if they can't be selected, how can they be dragged?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Replies: 1
    Last Post: 6th January 2011, 04:19
  2. qtablewidget bug?
    By vectori in forum Qt Programming
    Replies: 0
    Last Post: 30th July 2010, 12:46
  3. Help with QTableWidget!
    By bottin in forum Qt Programming
    Replies: 1
    Last Post: 24th July 2009, 15:10
  4. Help with QTableWidget
    By aarelovich in forum Qt Programming
    Replies: 4
    Last Post: 20th July 2009, 12:22
  5. QTableWidget
    By cmaxb in forum Qt Programming
    Replies: 1
    Last Post: 11th November 2006, 08:49

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.