summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorkh1 <qt-info@nokia.com>2010-02-17 11:31:42 (GMT)
committerkh1 <qt-info@nokia.com>2010-02-17 14:49:34 (GMT)
commit4f9f068ccd2da8859eb0208455ac2a6ca494afdc (patch)
tree96a29d71597898977e5831351f73f6481b541dfe /tools
parentc679687f418b71442da07ade575482d005b79c4d (diff)
downloadQt-4f9f068ccd2da8859eb0208455ac2a6ca494afdc.zip
Qt-4f9f068ccd2da8859eb0208455ac2a6ca494afdc.tar.gz
Qt-4f9f068ccd2da8859eb0208455ac2a6ca494afdc.tar.bz2
Fix broken Drag&Drop, reset and clear the model if we set new bookmarks.
Reviewed-by: ck
Diffstat (limited to 'tools')
-rw-r--r--tools/assistant/tools/assistant/bookmarkmodel.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/assistant/tools/assistant/bookmarkmodel.cpp b/tools/assistant/tools/assistant/bookmarkmodel.cpp
index c785f16..f9c9980 100644
--- a/tools/assistant/tools/assistant/bookmarkmodel.cpp
+++ b/tools/assistant/tools/assistant/bookmarkmodel.cpp
@@ -79,6 +79,9 @@ BookmarkModel::bookmarks() const
void
BookmarkModel::setBookmarks(const QByteArray &bookmarks)
{
+ beginResetModel();
+
+ delete rootItem;
folderIcon = QApplication::style()->standardIcon(QStyle::SP_DirClosedIcon);
bookmarkIcon = QIcon(QLatin1String(":/trolltech/assistant/images/bookmark.png"));
@@ -115,6 +118,8 @@ BookmarkModel::setBookmarks(const QByteArray &bookmarks)
setupCache(root);
cache.insert(static_cast<BookmarkItem*> (root.internalPointer()), root);
+
+ endResetModel();
}
void
@@ -220,9 +225,9 @@ BookmarkModel::flags(const QModelIndex &index) const
if (m_editable)
defaultFlags |= Qt::ItemIsEditable;
- if (itemFromIndex(index) && index.data(UserRoleFolder).toBool()
- && index.column() > 0) {
- defaultFlags &= ~Qt::ItemIsEditable;
+ if (itemFromIndex(index) && index.data(UserRoleFolder).toBool()) {
+ if (index.column() > 0)
+ return defaultFlags &~ Qt::ItemIsEditable;
return defaultFlags | Qt::ItemIsDropEnabled;
}
@@ -241,11 +246,13 @@ BookmarkModel::data(const QModelIndex &index, int role) const
return QLatin1String("");
return item->data(index.column());
} break;
+
case Qt::DecorationRole: {
if (index.column() == 0)
return index.data(UserRoleFolder).toBool()
? folderIcon : bookmarkIcon;
} break;
+
default:;
return item->data(role);
}