summaryrefslogtreecommitdiffstats
path: root/tools/assistant
diff options
context:
space:
mode:
authorkh1 <qt-info@nokia.com>2010-06-23 14:19:37 (GMT)
committerkh1 <qt-info@nokia.com>2010-06-23 14:19:37 (GMT)
commitcbbaa029501d8833773d599b630aa44ded5d6c78 (patch)
tree24eeaaaaaa9c646a1de49dfc10b2983c7438ef0e /tools/assistant
parentb483c61023f8a71aa51bca8cfcffb5264dc71ad6 (diff)
downloadQt-cbbaa029501d8833773d599b630aa44ded5d6c78.zip
Qt-cbbaa029501d8833773d599b630aa44ded5d6c78.tar.gz
Qt-cbbaa029501d8833773d599b630aa44ded5d6c78.tar.bz2
Set the item data thru the model, so we actually emit dataChanged.
Task-number: QTBUG-10629 Reviewed-by: kh
Diffstat (limited to 'tools/assistant')
-rw-r--r--tools/assistant/tools/assistant/bookmarkdialog.cpp3
-rw-r--r--tools/assistant/tools/assistant/bookmarkmodel.cpp8
-rw-r--r--tools/assistant/tools/assistant/bookmarkmodel.h1
3 files changed, 10 insertions, 2 deletions
diff --git a/tools/assistant/tools/assistant/bookmarkdialog.cpp b/tools/assistant/tools/assistant/bookmarkdialog.cpp
index 8b195c1..d9e9a53 100644
--- a/tools/assistant/tools/assistant/bookmarkdialog.cpp
+++ b/tools/assistant/tools/assistant/bookmarkdialog.cpp
@@ -160,8 +160,7 @@ void BookmarkDialog::accepted()
QModelIndex index = ui.treeView->currentIndex();
if (index.isValid()) {
index = bookmarkModel->addItem(bookmarkTreeModel->mapToSource(index));
- if (BookmarkItem *item = bookmarkModel->itemFromIndex(index))
- item->setData(DataVector() << m_title << m_url << false);
+ bookmarkModel->setData(index, DataVector() << m_title << m_url << false);
} else
rejected();
diff --git a/tools/assistant/tools/assistant/bookmarkmodel.cpp b/tools/assistant/tools/assistant/bookmarkmodel.cpp
index e446ff0..4c30b42 100644
--- a/tools/assistant/tools/assistant/bookmarkmodel.cpp
+++ b/tools/assistant/tools/assistant/bookmarkmodel.cpp
@@ -261,6 +261,14 @@ BookmarkModel::data(const QModelIndex &index, int role) const
return QVariant();
}
+void BookmarkModel::setData(const QModelIndex &index, const DataVector &data)
+{
+ if (BookmarkItem *item = itemFromIndex(index)) {
+ item->setData(data);
+ emit dataChanged(index, index);
+ }
+}
+
bool
BookmarkModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
diff --git a/tools/assistant/tools/assistant/bookmarkmodel.h b/tools/assistant/tools/assistant/bookmarkmodel.h
index 6469258..f74baea 100644
--- a/tools/assistant/tools/assistant/bookmarkmodel.h
+++ b/tools/assistant/tools/assistant/bookmarkmodel.h
@@ -79,6 +79,7 @@ public:
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant data(const QModelIndex &index, int role) const;
+ void setData(const QModelIndex &index, const QVector<QVariant> &data);
bool setData(const QModelIndex &index, const QVariant &value, int role);
QVariant headerData(int section, Qt::Orientation orientation, int role) const;