elements collection model : use QStandardItemModel has base class instead of QAbstractItemModel.

Add minor improvement.


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4538 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2016-06-05 16:34:46 +00:00
parent 9a0e14161f
commit 1b00a457d7
14 changed files with 881 additions and 1477 deletions

View File

@@ -23,6 +23,7 @@
#include "element.h"
#include <QDrag>
#include <QStandardItemModel>
static int MAX_DND_PIXMAP_WIDTH = 500;
static int MAX_DND_PIXMAP_HEIGHT = 375;
@@ -49,18 +50,16 @@ void ElementsTreeView::startDrag(Qt::DropActions supportedActions)
return;
}
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(index.internalPointer());
if (!eci) {
QTreeView::startDrag(supportedActions);
return;
if (QStandardItemModel *qsim = static_cast<QStandardItemModel *>(model())) {
if (ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsim->itemFromIndex(index))) {
ElementsLocation loc (eci->collectionPath());
if (loc.exist()) {
startElementDrag(loc);
return;
}
}
}
ElementsLocation loc (eci->collectionPath());
if (loc.exist())
startElementDrag(loc);
else
QTreeView::startDrag(supportedActions);
QTreeView::startDrag(supportedActions);
}
/**