Page 2 of 2 FirstFirst 12
Results 21 to 22 of 22

Thread: Drag & Drop using QTableWidget

  1. #21
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Drag & Drop using QTableWidget

    Quote Originally Posted by para View Post
    I am having the same problem, trying to drag&drop from one table to another.
    Does this work for you?
    Qt Code:
    1. #include <QtGui>
    2.  
    3. QTableWidget* createTableWidget(QWidget* parent)
    4. {
    5. QTableWidget* tableWidget = new QTableWidget(4, 4, parent);
    6. tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
    7. tableWidget->setDragEnabled(true);
    8. tableWidget->setAcceptDrops(true);
    9. tableWidget->setDropIndicatorShown(true);
    10. return tableWidget;
    11. }
    12.  
    13. int main(int argc, char* argv[])
    14. {
    15. QApplication a(argc, argv);
    16. QSplitter splitter;
    17. splitter.addWidget(createTableWidget(&splitter));
    18. splitter.addWidget(createTableWidget(&splitter));
    19. splitter.show();
    20. return a.exec();
    21. }
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  2. #22
    Join Date
    Oct 2006
    Posts
    5
    Qt products
    Qt4

    Default Re: Drag & Drop using QTableWidget

    Quote Originally Posted by jpn View Post
    Does this work for you?
    Yeah that worked, thanks a lot. I must have missed something.


Similar Threads

  1. Drag & drop with model/view (Qt4)
    By yogeshm02 in forum Qt Programming
    Replies: 16
    Last Post: 19th September 2011, 20:36
  2. Drag and Drop
    By allensr in forum Qt Programming
    Replies: 1
    Last Post: 11th December 2006, 20:50
  3. Replies: 7
    Last Post: 8th September 2006, 16:19
  4. Drag and drop revisited
    By Big Duck in forum Newbie
    Replies: 2
    Last Post: 30th June 2006, 16:41
  5. Drag 'n Drop problem
    By kiker99 in forum Qt Programming
    Replies: 4
    Last Post: 16th January 2006, 16:35

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.