Home > Mobile >  About the QTableWidget QTreeView + QDirModel implement drag and drop
About the QTableWidget QTreeView + QDirModel implement drag and drop

Time:05-21

, ladies and gentlemen, now, please think about QTreeView + QDirModel implement drag and drop to the QTableWidget, ideas are as follows:
Rewrite the custom QDirModel, then QTreeView + custom QDirModel model implemented on drag and drop to the QTableWidget,
Specific code is as follows:
The class cCustomTableModel: public QDirModel
{
Q_OBJECT
Public:
Explicit cCustomTableModel (QDirModel * parent=nullptr);
~ cCustomTableModel ();

Qt: : ItemFlags flags (const QModelIndex & amp; The index) const;
QMimeData * mimeData (const QModelIndexList & amp; The indexes) const;
Bool dropMimeData (const QMimeData * data, Qt: : DropAction action,
Int row, int column, const QModelIndex & amp; The parent);
QStringList mimeTypes () const;

Signals:

Private:
Int m_rowCount;

};
Do you have any good examples or advice to give directions, the younger brother in this thank you very much


  •  Tags:  
  • Qt
  • Related