Results 1 to 3 of 3

Thread: Dragging an item from QTableView to a QPushButton

  1. #1
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Dragging an item from QTableView to a QPushButton

    Hi,

    I have a push button which is used as a 'trash can'. I want to be able to drag items to it from my QTableView which would then delete the item. Is this possible?

    Regards,
    Steve

  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: Dragging an item from QTableView to a QPushButton

    Yes. Reimplement dragEnterEvent and dropEvent for the button. Just make sure you only accept move actions (or delete the item in the dropEvent).

  3. #3
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Dragging an item from QTableView to a QPushButton

    Hi,

    Thought as much, guess I just subclass a QPushButton.

    Regards,
    Steve

Similar Threads

  1. QTableView header dragging
    By cmaxb in forum Qt Programming
    Replies: 1
    Last Post: 9th December 2006, 12:11

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.