diff options
author | Christian Kandeler <christian.kandeler@digia.com> | 2014-08-28 17:33:47 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@digia.com> | 2014-08-29 14:10:41 +0200 |
commit | 1d5091e48f6df341dbd4436843c25afe25cbf4ce (patch) | |
tree | 9151d71b36bcffbba219ef1a0fc4e4f234adbc89 /src/plugins/qmldesigner/components | |
parent | 7ba0f8a4c42c5db144b599861f38d2e771e0dafe (diff) | |
download | qt-creator-1d5091e48f6df341dbd4436843c25afe25cbf4ce.tar.gz |
Do not use deprecated Qt functionality.
Replace all* remaining deprecated Qt 4 functions with
their Qt 5 counterparts. This means we no longer need to
define the QT_DISABLE_DEPRECATED_BEFORE macro.
This patch is relatively small because most source-compatible
changes of this kind have been done before.
* The one exception is the QmlDesigner, which uses QWeakPointer
in a deprecated way all over the place.
Change-Id: Id4b839c6685f3b5bdf2b89137f95231758ec53c7
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
Diffstat (limited to 'src/plugins/qmldesigner/components')
9 files changed, 29 insertions, 12 deletions
diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp index bc6bf23682..43bab012d5 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp @@ -103,6 +103,11 @@ QVariant ItemLibraryModel::data(const QModelIndex &index, int role) const return QVariant(); } +QHash<int, QByteArray> ItemLibraryModel::roleNames() const +{ + return m_roleNames; +} + QString ItemLibraryModel::searchText() const { return m_searchText; @@ -242,8 +247,6 @@ void ItemLibraryModel::addRoleNames() m_roleNames.insert(role, property.name()); ++role; } - - setRoleNames(m_roleNames); } void ItemLibraryModel::resetModel() diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.h b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.h index 063f70b95a..451872a57f 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.h +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.h @@ -55,6 +55,7 @@ public: int rowCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + QHash<int, QByteArray> roleNames() const; QString searchText() const; diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarysectionmodel.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarysectionmodel.cpp index 430bf69d8e..10c8186568 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarysectionmodel.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarysectionmodel.cpp @@ -70,6 +70,11 @@ QVariant ItemLibrarySectionModel::data(const QModelIndex &index, int role) const return QVariant(); } +QHash<int, QByteArray> ItemLibrarySectionModel::roleNames() const +{ + return m_roleNames; +} + void ItemLibrarySectionModel::clearItems() { beginResetModel(); @@ -111,8 +116,6 @@ void ItemLibrarySectionModel::addRoleNames() m_roleNames.insert(role, property.name()); ++role; } - - setRoleNames(m_roleNames); } } // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarysectionmodel.h b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarysectionmodel.h index e38fffc95f..e28816e6f5 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarysectionmodel.h +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarysectionmodel.h @@ -48,6 +48,7 @@ public: int rowCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + QHash<int, QByteArray> roleNames() const; void clearItems(); diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp index 91b2c657cd..6b982e9da1 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp @@ -113,8 +113,6 @@ NavigatorTreeModel::NavigatorTreeModel(QObject *parent) setColumnCount(2); # endif - setSupportedDragActions(Qt::LinkAction); - connect(this, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(handleChangedItem(QStandardItem*))); } @@ -128,6 +126,11 @@ Qt::DropActions NavigatorTreeModel::supportedDropActions() const return Qt::LinkAction | Qt::MoveAction; } +Qt::DropActions NavigatorTreeModel::supportedDragActions() const +{ + return Qt::LinkAction; +} + QStringList NavigatorTreeModel::mimeTypes() const { QStringList types; diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.h b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.h index 0c19a803e1..532ab5e846 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.h +++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.h @@ -90,6 +90,7 @@ public: ~NavigatorTreeModel(); Qt::DropActions supportedDropActions() const; + Qt::DropActions supportedDragActions() const; QStringList mimeTypes() const; QMimeData *mimeData(const QModelIndexList &indexes) const; diff --git a/src/plugins/qmldesigner/components/navigator/navigatorview.cpp b/src/plugins/qmldesigner/components/navigator/navigatorview.cpp index 24809188b5..10d2889c55 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatorview.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatorview.cpp @@ -133,7 +133,7 @@ void NavigatorView::modelAttached(Model *model) QTreeView *treeView = treeWidget(); treeView->expandAll(); - treeView->header()->setResizeMode(0, QHeaderView::Stretch); + treeView->header()->setSectionResizeMode(0, QHeaderView::Stretch); treeView->header()->resizeSection(1,26); treeView->setRootIsDecorated(false); treeView->setIndentation(20); diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp index e1fe464268..12554c34b1 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp @@ -53,11 +53,6 @@ StatesEditorModel::StatesEditorModel(StatesEditorView *view) m_statesEditorView(view), m_updateCounter(0) { - QHash<int, QByteArray> roleNames; - roleNames.insert(StateNameRole, "stateName"); - roleNames.insert(StateImageSourceRole, "stateImageSource"); - roleNames.insert(InternalNodeId, "internalNodeId"); - setRoleNames(roleNames); } @@ -133,6 +128,15 @@ QVariant StatesEditorModel::data(const QModelIndex &index, int role) const return QVariant(); } +QHash<int, QByteArray> StatesEditorModel::roleNames() const +{ + QHash<int, QByteArray> roleNames; + roleNames.insert(StateNameRole, "stateName"); + roleNames.insert(StateImageSourceRole, "stateImageSource"); + roleNames.insert(InternalNodeId, "internalNodeId"); + return roleNames; +} + void StatesEditorModel::insertState(int stateIndex) { if (stateIndex >= 0) { diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h index 99f08be602..5739cf0115 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h @@ -57,6 +57,7 @@ public: QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + QHash<int, QByteArray> roleNames() const; void insertState(int stateIndex); void removeState(int stateIndex); |