Results 1 to 4 of 4

Thread: QtableWidget that don't accept drop item between rows?

  1. #1
    Join Date
    Sep 2008
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question QtableWidget that don't accept drop item between rows?

    Hi everybody!
    I find this forum very helpful, this is my first post.
    I'm a newbie using Qt 4.4 and I'm looking for an easy way to drag and drop (move) items internally in a QTableWidget, from its actual position to another free position.
    I can move items from one cell to free cells and I can tell my existing items to not accept drops (Qt::ItemIsDropEnabled), that's works ok.
    But when I drop an item between rows, the item disappear!
    How can I tell the QTableWidget to not accept drops between rows, only onto cells?
    Is it possible?
    Thanks you very much for your help!
    Sergio

  2. #2
    Join Date
    Jul 2010
    Posts
    1
    Qt products
    Platforms
    Unix/X11

    Default Re: QtableWidget that don't accept drop item between rows?

    I'm a first-time Qt programmer and have a similar issue. I drop entries from a QTreeWidget onto a QTableWidget. But I want to restrict the user to drops 'on cells' only and discard drops between rows. What is the easiest way to do this ?
    Any help will be greatly appreciated.

  3. #3
    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: QtableWidget that don't accept drop item between rows?

    Make sure ItemIsDropEnabled flag is not set for an invalid (empty) QModelIndex/root item.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Sep 2010
    Posts
    62
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QtableWidget that don't accept drop item between rows?

    Hello,
    I have an opposite problem, I'd like to INSERT the dragged row of the QTableWidget BETWEEN two other rows. The drag and drop works OK, the insertion is possible only between the rows, but item disappears instead of to be inserted.
    Optimally, the gap after the moved item shall be closed ( according part of the rows shall be moved)

    any idea how to to do this?

    thanks for the help

Similar Threads

  1. Drag & Drop rows in a QTableWidget
    By vycke in forum Qt Programming
    Replies: 7
    Last Post: 19th January 2012, 01:01
  2. QTableWidget item checkable and combo?
    By darpan in forum Qt Programming
    Replies: 1
    Last Post: 10th October 2006, 08:12
  3. Replies: 6
    Last Post: 5th March 2006, 22:05

Tags for this Thread

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.