summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/itemviews/qstandarditemmodel.cpp9
-rw-r--r--src/gui/itemviews/qstandarditemmodel_p.h2
2 files changed, 7 insertions, 4 deletions
diff --git a/src/gui/itemviews/qstandarditemmodel.cpp b/src/gui/itemviews/qstandarditemmodel.cpp
index bc25edd..8c9a2fd 100644
--- a/src/gui/itemviews/qstandarditemmodel.cpp
+++ b/src/gui/itemviews/qstandarditemmodel.cpp
@@ -2965,7 +2965,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
Used by QStandardItemModel::dropMimeData
stream out an item and his children
*/
-static void decodeDataRecursive(QDataStream &stream, QStandardItem *item)
+void QStandardItemModelPrivate::decodeDataRecursive(QDataStream &stream, QStandardItem *item)
{
int colCount, childCount;
stream >> *item;
@@ -2976,7 +2976,7 @@ static void decodeDataRecursive(QDataStream &stream, QStandardItem *item)
while(childPos > 0) {
childPos--;
- QStandardItem *child = new QStandardItem;
+ QStandardItem *child = createItem();
decodeDataRecursive(stream, child);
item->setChild( childPos / colCount, childPos % colCount, child);
}
@@ -2989,6 +2989,7 @@ static void decodeDataRecursive(QDataStream &stream, QStandardItem *item)
bool QStandardItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
int row, int column, const QModelIndex &parent)
{
+ Q_D(QStandardItemModel);
// check if the action is supported
if (!data || !(action == Qt::CopyAction || action == Qt::MoveAction))
return false;
@@ -3020,9 +3021,9 @@ bool QStandardItemModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
while (!stream.atEnd()) {
int r, c;
- QStandardItem *item = new QStandardItem;
+ QStandardItem *item = d->createItem();
stream >> r >> c;
- decodeDataRecursive(stream, item);
+ d->decodeDataRecursive(stream, item);
rows.append(r);
columns.append(c);
diff --git a/src/gui/itemviews/qstandarditemmodel_p.h b/src/gui/itemviews/qstandarditemmodel_p.h
index 3d842f3..430fcb6 100644
--- a/src/gui/itemviews/qstandarditemmodel_p.h
+++ b/src/gui/itemviews/qstandarditemmodel_p.h
@@ -175,6 +175,8 @@ public:
void _q_emitItemChanged(const QModelIndex &topLeft,
const QModelIndex &bottomRight);
+ void decodeDataRecursive(QDataStream &stream, QStandardItem *item);
+
QVector<QStandardItem*> columnHeaderItems;
QVector<QStandardItem*> rowHeaderItems;
QStandardItem *root;