Obsolete Members for QList

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

公共函數

(obsolete) void swap (int i , int j )
(obsolete) QSet<T> toSet () const
(obsolete) std::list<T> toStdList () const

靜態公共成員

(obsolete) QList<T> fromSet (const QSet<T> & set )
(obsolete) QList<T> fromStdList (const std::list<T> & list )

成員函數文檔編製

[static] QList < T > QList:: fromSet (const QSet < T > & set )

此函數已過時。提供它是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它。

返迴 QList object with the data contained in set . The order of the elements in the QList is undefined.

注意: Since Qt 5.14, range constructors are available for Qt's generic 容器類 and should be used in place of this method.

例如,若有代碼像

QSet<int> set;
// ...
QList<int> list = QList<int>::fromSet(set);
					

可以把它重寫成

QSet<int> set;
// ...
QList<int> list(set.begin(), set.end());
					

另請參閱 QList (InputIterator, InputIterator), fromVector (), toSet (),和 QSet::toList ().

[static] QList < T > QList:: fromStdList (const std::list < T > & list )

此函數已過時。提供它是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它。

返迴 QList object with the data contained in list . The order of the elements in the QList is the same as in list .

注意: Since Qt 5.14, range constructors are available for Qt's generic 容器類 and should be used in place of this method.

例如,若有代碼像

std::list<double> stdlist;
// ...
QList<double> list = QList<double>::fromStdList(stdlist);
					

可以把它重寫成

std::list<double> stdlist;
// ...
QList<double> list(stdlist.begin(), stdlist.end());
					

另請參閱 QList (InputIterator, InputIterator), toStdList (),和 QVector::fromStdVector ().

void QList:: swap ( int i , int j )

此函數已過時。提供它是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它。

使用 swapItemsAt ()

另請參閱 move () 和 swapItemsAt ().

QSet < T > QList:: toSet () const

此函數已過時。提供它是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它。

返迴 QSet object with the data contained in this QList 。由於 QSet doesn't allow duplicates, the resulting QSet might be smaller than the original list was.

注意: Since Qt 5.14, range constructors are available for Qt's generic 容器類 and should be used in place of this method.

例如,若有代碼像

QStringList list;
// ...
QSet<QString> set = list.toSet();
					

可以把它重寫成

QStringList list;
// ...
QSet<QString> set(list.begin(), list.end());
					

另請參閱 QSet::QSet (InputIterator, InputIterator), toVector (), fromSet (),和 QSet::fromList ().

std::list < T > QList:: toStdList () const

此函數已過時。提供它是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它。

Returns a std::list object with the data contained in this QList 。範例:

注意: Since Qt 5.14, range constructors are available for Qt's generic 容器類 and should be used in place of this method.

例如,若有代碼像

QList<double> list;
// ...
std::list<double> stdlist = list.toStdList();
					

可以把它重寫成

QList<double> list;
// ...
std::list<double> stdlist(list.begin(), list.end());
					

另請參閱 fromStdList () 和 QVector::toStdVector ().