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 () 和 将拖放用于项视图 .