Obsolete Members for QAbstractItemModel

以下成員源於類 QAbstractItemModel 已過時。 提供它們是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它們。

公共函數

(obsolete) void setSupportedDragActions (Qt::DropActions actions )

保護函數

(obsolete) void reset ()
(obsolete) void setRoleNames (const QHash<int, QByteArray> & roleNames )

成員函數文檔編製

[protected] void QAbstractItemModel:: reset ()

Resets the model to its original state in any attached views.

This function emits the signals modelAboutToBeReset () 和 modelReset ().

注意: 使用 beginResetModel () 和 endResetModel () instead whenever possible. Use this method only if there is no way to call beginResetModel () before invalidating the model. Otherwise it could lead to unexpected behaviour, especially when used with proxy models.

For example, in this code both signals modelAboutToBeReset () 和 modelReset () are emitted after the data changes:

myData.clear();
reset();
					

Instead you should use:

beginResetModel();
myData.clear();
endResetModel();
					

[protected] void QAbstractItemModel:: setRoleNames (const QHash < int , QByteArray > & roleNames )

This function is obsolete. Reimplement roleNames () 代替。

Sets the model's role names to roleNames .

This function allows mapping of role identifiers to role property names in scripting languages.

該函數在 Qt 4.6 引入。

另請參閱 roleNames ().

void QAbstractItemModel:: setSupportedDragActions ( Qt::DropActions actions )

This function is obsolete. Reimplement supportedDragActions () 代替。

Sets the supported drag actions for the items in the model.

該函數在 Qt 4.2 引入。

另請參閱 supportedDragActions () 和 將拖放用於項視圖 .