mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user