Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QT5.6 QTableWidget Drag and drop mode can be used. only "InternalMove" mode has effect when use setDragDropMode
Forum Updated to NodeBB v4.3 + New Features

QT5.6 QTableWidget Drag and drop mode can be used. only "InternalMove" mode has effect when use setDragDropMode

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 554 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cawlfj
    wrote on 15 Feb 2016, 03:07 last edited by
    #1

    I try to made a class Inherited from QTableWidget and it's event.
    The drag and drop can be used only on internalMove mode, why can be used by DragDrop mode.
    Code:
    h file
    class MyListTabel:public QTableWidget
    { Q_OBJECT
    public:
    explicit MyListTabel(QWidget *parent=0);
    protected:
    void dragEnterEvent(QDragEnterEvent *e);
    void dropEvent(QDropEvent *e);
    // void dragMoveEvent(QDragMoveEvent *e);

    };

    cpp file

    MyListTabel::MyListTabel(QWidget *parent){
    this->setAcceptDrops(true);
    this->setDragEnabled(true);
    this->setDropIndicatorShown(true);
    this->setDragDropMode(QAbstractItemView::InternalMove); //DragDrop
    }

    void MyListTabel::dragEnterEvent(QDragEnterEvent *e){
    e->setAccepted(true);
    e->setDropAction(Qt::MoveAction);
    e->acceptProposedAction();
    }
    void MyListTabel::dropEvent(QDropEvent *e)
    {
    if(this!=e->source()){
    MyPoint3d InsertP;
    this->setFocus();
    .....................

    1 Reply Last reply
    0

    1/1

    15 Feb 2016, 03:07

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved