Struct qt_core::QStringList
source · #[repr(C)]pub struct QStringList { /* private fields */ }
Expand description
The QStringList class provides a list of strings.
C++ class: QStringList
.
The QStringList class provides a list of strings.
QStringList inherits from QList<QString>. Like QList, QStringList is implicitly shared. It provides fast index-based access as well as fast insertions and removals. Passing string lists as value parameters is both fast and safe.
All of QList's functionality also applies to QStringList. For example, you can use isEmpty() to test whether the list is empty, and you can call functions like append(), prepend(), insert(), replace(), removeAll(), removeAt(), removeFirst(), removeLast(), and removeOne() to modify a QStringList. In addition, QStringList provides a few convenience functions that make handling lists of strings easier:
Implementations§
source§impl QStringList
impl QStringList
sourcepub unsafe fn contains_q_string_case_sensitivity(
&self,
str: impl CastInto<Ref<QString>>,
cs: CaseSensitivity
) -> bool
pub unsafe fn contains_q_string_case_sensitivity( &self, str: impl CastInto<Ref<QString>>, cs: CaseSensitivity ) -> bool
Returns true
if the list contains the string str; otherwise returns false
. The search is case insensitive if cs is Qt::CaseInsensitive; the search is case sensitive by default.
Calls C++ function: bool QStringList::contains(const QString& str, Qt::CaseSensitivity cs = …) const
.
Returns true
if the list contains the string str; otherwise returns false
. The search is case insensitive if cs is Qt::CaseInsensitive; the search is case sensitive by default.
See also indexOf(), lastIndexOf(), and QString::contains().
sourcepub unsafe fn contains_q_string(&self, str: impl CastInto<Ref<QString>>) -> bool
pub unsafe fn contains_q_string(&self, str: impl CastInto<Ref<QString>>) -> bool
Returns true
if the list contains the string str; otherwise returns false
. The search is case insensitive if cs is Qt::CaseInsensitive; the search is case sensitive by default.
Calls C++ function: bool QStringList::contains(const QString& str) const
.
Returns true
if the list contains the string str; otherwise returns false
. The search is case insensitive if cs is Qt::CaseInsensitive; the search is case sensitive by default.
See also indexOf(), lastIndexOf(), and QString::contains().
sourcepub unsafe fn contains_q_latin1_string_case_sensitivity(
&self,
str: impl CastInto<Ref<QLatin1String>>,
cs: CaseSensitivity
) -> bool
pub unsafe fn contains_q_latin1_string_case_sensitivity( &self, str: impl CastInto<Ref<QLatin1String>>, cs: CaseSensitivity ) -> bool
This is an overloaded function.
Calls C++ function: bool QStringList::contains(QLatin1String str, Qt::CaseSensitivity cs = …) const
.
This is an overloaded function.
Returns true
if the list contains the string str; otherwise returns false
. The search is case insensitive if cs is Qt::CaseInsensitive; the search is case sensitive by default.
This function was introduced in Qt 5.10.
See also indexOf(), lastIndexOf(), and QString::contains().
sourcepub unsafe fn contains_q_latin1_string(
&self,
str: impl CastInto<Ref<QLatin1String>>
) -> bool
pub unsafe fn contains_q_latin1_string( &self, str: impl CastInto<Ref<QLatin1String>> ) -> bool
This is an overloaded function.
Calls C++ function: bool QStringList::contains(QLatin1String str) const
.
This is an overloaded function.
Returns true
if the list contains the string str; otherwise returns false
. The search is case insensitive if cs is Qt::CaseInsensitive; the search is case sensitive by default.
This function was introduced in Qt 5.10.
See also indexOf(), lastIndexOf(), and QString::contains().
sourcepub unsafe fn contains_q_string_view_case_sensitivity(
&self,
str: impl CastInto<Ref<QStringView>>,
cs: CaseSensitivity
) -> bool
Available on cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.
pub unsafe fn contains_q_string_view_case_sensitivity( &self, str: impl CastInto<Ref<QStringView>>, cs: CaseSensitivity ) -> bool
cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.This is an overloaded function.
Calls C++ function: bool QStringList::contains(QStringView str, Qt::CaseSensitivity cs = …) const
.
This is an overloaded function.
Returns true
if the list contains the string str; otherwise returns false
. The search is case insensitive if cs is Qt::CaseInsensitive; the search is case sensitive by default.
This function was introduced in Qt 5.12.
sourcepub unsafe fn contains_q_string_view(
&self,
str: impl CastInto<Ref<QStringView>>
) -> bool
Available on cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.
pub unsafe fn contains_q_string_view( &self, str: impl CastInto<Ref<QStringView>> ) -> bool
cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.This is an overloaded function.
Calls C++ function: bool QStringList::contains(QStringView str) const
.
This is an overloaded function.
Returns true
if the list contains the string str; otherwise returns false
. The search is case insensitive if cs is Qt::CaseInsensitive; the search is case sensitive by default.
This function was introduced in Qt 5.12.
sourcepub unsafe fn copy_from_q_list_of_q_string(
&self,
other: impl CastInto<Ref<QListOfQString>>
) -> Ref<QStringList>
pub unsafe fn copy_from_q_list_of_q_string( &self, other: impl CastInto<Ref<QListOfQString>> ) -> Ref<QStringList>
sourcepub unsafe fn copy_from_q_string_list(
&self,
other: impl CastInto<Ref<QStringList>>
) -> Ref<QStringList>
pub unsafe fn copy_from_q_string_list( &self, other: impl CastInto<Ref<QStringList>> ) -> Ref<QStringList>
The QStringList class provides a list of strings.
Calls C++ function: QStringList& QStringList::operator=(const QStringList& other)
.
The QStringList class provides a list of strings.
QStringList inherits from QList<QString>. Like QList, QStringList is implicitly shared. It provides fast index-based access as well as fast insertions and removals. Passing string lists as value parameters is both fast and safe.
All of QList's functionality also applies to QStringList. For example, you can use isEmpty() to test whether the list is empty, and you can call functions like append(), prepend(), insert(), replace(), removeAll(), removeAt(), removeFirst(), removeLast(), and removeOne() to modify a QStringList. In addition, QStringList provides a few convenience functions that make handling lists of strings easier:
sourcepub unsafe fn index_of_q_reg_exp_int(
&self,
rx: impl CastInto<Ref<QRegExp>>,
from: c_int
) -> c_int
pub unsafe fn index_of_q_reg_exp_int( &self, rx: impl CastInto<Ref<QRegExp>>, from: c_int ) -> c_int
Returns the index position of the first exact match of rx in the list, searching forward from index position from. Returns -1 if no item matched.
Calls C++ function: int QStringList::indexOf(const QRegExp& rx, int from = …) const
.
Returns the index position of the first exact match of rx in the list, searching forward from index position from. Returns -1 if no item matched.
By default, this function is case sensitive.
See also lastIndexOf(), contains(), and QRegExp::exactMatch().
sourcepub unsafe fn index_of_q_reg_exp_int2(
&self,
rx: impl CastInto<Ref<QRegExp>>,
from: c_int
) -> c_int
pub unsafe fn index_of_q_reg_exp_int2( &self, rx: impl CastInto<Ref<QRegExp>>, from: c_int ) -> c_int
This function overloads indexOf().
Calls C++ function: int QStringList::indexOf(QRegExp& rx, int from = …) const
.
This function overloads indexOf().
Returns the index position of the first exact match of rx in the list, searching forward from index position from. Returns -1 if no item matched.
By default, this function is case sensitive.
If an item matched, the rx regular expression will contain the matched objects (see QRegExp::matchedLength, QRegExp::cap).
This function was introduced in Qt 4.5.
See also lastIndexOf(), contains(), and QRegExp::exactMatch().
sourcepub unsafe fn index_of_q_regular_expression_int(
&self,
re: impl CastInto<Ref<QRegularExpression>>,
from: c_int
) -> c_int
pub unsafe fn index_of_q_regular_expression_int( &self, re: impl CastInto<Ref<QRegularExpression>>, from: c_int ) -> c_int
This is an overloaded function.
Calls C++ function: int QStringList::indexOf(const QRegularExpression& re, int from = …) const
.
This is an overloaded function.
Returns the index position of the first match of re in the list, searching forward from index position from. Returns -1 if no item matched.
This function was introduced in Qt 5.0.
See also lastIndexOf().
sourcepub unsafe fn index_of_q_reg_exp(
&self,
rx: impl CastInto<Ref<QRegExp>>
) -> c_int
pub unsafe fn index_of_q_reg_exp( &self, rx: impl CastInto<Ref<QRegExp>> ) -> c_int
Returns the index position of the first exact match of rx in the list, searching forward from index position from. Returns -1 if no item matched.
Calls C++ function: int QStringList::indexOf(const QRegExp& rx) const
.
Returns the index position of the first exact match of rx in the list, searching forward from index position from. Returns -1 if no item matched.
By default, this function is case sensitive.
See also lastIndexOf(), contains(), and QRegExp::exactMatch().
sourcepub unsafe fn index_of_q_reg_exp2(
&self,
rx: impl CastInto<Ref<QRegExp>>
) -> c_int
pub unsafe fn index_of_q_reg_exp2( &self, rx: impl CastInto<Ref<QRegExp>> ) -> c_int
This function overloads indexOf().
Calls C++ function: int QStringList::indexOf(QRegExp& rx) const
.
This function overloads indexOf().
Returns the index position of the first exact match of rx in the list, searching forward from index position from. Returns -1 if no item matched.
By default, this function is case sensitive.
If an item matched, the rx regular expression will contain the matched objects (see QRegExp::matchedLength, QRegExp::cap).
This function was introduced in Qt 4.5.
See also lastIndexOf(), contains(), and QRegExp::exactMatch().
sourcepub unsafe fn index_of_q_regular_expression(
&self,
re: impl CastInto<Ref<QRegularExpression>>
) -> c_int
pub unsafe fn index_of_q_regular_expression( &self, re: impl CastInto<Ref<QRegularExpression>> ) -> c_int
This is an overloaded function.
Calls C++ function: int QStringList::indexOf(const QRegularExpression& re) const
.
This is an overloaded function.
Returns the index position of the first match of re in the list, searching forward from index position from. Returns -1 if no item matched.
This function was introduced in Qt 5.0.
See also lastIndexOf().
sourcepub unsafe fn index_of_q_string_view_int(
&self,
str: impl CastInto<Ref<QStringView>>,
from: c_int
) -> c_int
Available on cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.
pub unsafe fn index_of_q_string_view_int( &self, str: impl CastInto<Ref<QStringView>>, from: c_int ) -> c_int
cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.This is an overloaded function.
Calls C++ function: int QStringList::indexOf(QStringView str, int from = …) const
.
This is an overloaded function.
Returns the index position of the first occurrence of str in the list, searching forward from index position from. Returns -1 if no item matched.
This function was introduced in Qt 5.13.
See also lastIndexOf() and contains().
sourcepub unsafe fn index_of_q_latin1_string_int(
&self,
str: impl CastInto<Ref<QLatin1String>>,
from: c_int
) -> c_int
pub unsafe fn index_of_q_latin1_string_int( &self, str: impl CastInto<Ref<QLatin1String>>, from: c_int ) -> c_int
This is an overloaded function.
Calls C++ function: int QStringList::indexOf(QLatin1String str, int from = …) const
.
This is an overloaded function.
Returns the index position of the first occurrence of str in the list, searching forward from index position from. Returns -1 if no item matched.
This function was introduced in Qt 5.13.
See also lastIndexOf() and contains().
sourcepub unsafe fn index_of_q_string_view(
&self,
str: impl CastInto<Ref<QStringView>>
) -> c_int
Available on cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.
pub unsafe fn index_of_q_string_view( &self, str: impl CastInto<Ref<QStringView>> ) -> c_int
cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.This is an overloaded function.
Calls C++ function: int QStringList::indexOf(QStringView str) const
.
This is an overloaded function.
Returns the index position of the first occurrence of str in the list, searching forward from index position from. Returns -1 if no item matched.
This function was introduced in Qt 5.13.
See also lastIndexOf() and contains().
sourcepub unsafe fn index_of_q_latin1_string(
&self,
str: impl CastInto<Ref<QLatin1String>>
) -> c_int
pub unsafe fn index_of_q_latin1_string( &self, str: impl CastInto<Ref<QLatin1String>> ) -> c_int
This is an overloaded function.
Calls C++ function: int QStringList::indexOf(QLatin1String str) const
.
This is an overloaded function.
Returns the index position of the first occurrence of str in the list, searching forward from index position from. Returns -1 if no item matched.
This function was introduced in Qt 5.13.
See also lastIndexOf() and contains().
sourcepub unsafe fn last_index_of_q_reg_exp_int(
&self,
rx: impl CastInto<Ref<QRegExp>>,
from: c_int
) -> c_int
pub unsafe fn last_index_of_q_reg_exp_int( &self, rx: impl CastInto<Ref<QRegExp>>, from: c_int ) -> c_int
Returns the index position of the last exact match of rx in the list, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
Calls C++ function: int QStringList::lastIndexOf(const QRegExp& rx, int from = …) const
.
Returns the index position of the last exact match of rx in the list, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
By default, this function is case sensitive.
See also indexOf(), contains(), and QRegExp::exactMatch().
sourcepub unsafe fn last_index_of_q_reg_exp_int2(
&self,
rx: impl CastInto<Ref<QRegExp>>,
from: c_int
) -> c_int
pub unsafe fn last_index_of_q_reg_exp_int2( &self, rx: impl CastInto<Ref<QRegExp>>, from: c_int ) -> c_int
This function overloads lastIndexOf().
Calls C++ function: int QStringList::lastIndexOf(QRegExp& rx, int from = …) const
.
This function overloads lastIndexOf().
Returns the index position of the last exact match of rx in the list, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
By default, this function is case sensitive.
If an item matched, the rx regular expression will contain the matched objects (see QRegExp::matchedLength, QRegExp::cap).
This function was introduced in Qt 4.5.
See also indexOf(), contains(), and QRegExp::exactMatch().
sourcepub unsafe fn last_index_of_q_regular_expression_int(
&self,
re: impl CastInto<Ref<QRegularExpression>>,
from: c_int
) -> c_int
pub unsafe fn last_index_of_q_regular_expression_int( &self, re: impl CastInto<Ref<QRegularExpression>>, from: c_int ) -> c_int
This is an overloaded function.
Calls C++ function: int QStringList::lastIndexOf(const QRegularExpression& re, int from = …) const
.
This is an overloaded function.
Returns the index position of the last exact match of re in the list, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
This function was introduced in Qt 5.0.
See also indexOf().
sourcepub unsafe fn last_index_of_q_reg_exp(
&self,
rx: impl CastInto<Ref<QRegExp>>
) -> c_int
pub unsafe fn last_index_of_q_reg_exp( &self, rx: impl CastInto<Ref<QRegExp>> ) -> c_int
Returns the index position of the last exact match of rx in the list, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
Calls C++ function: int QStringList::lastIndexOf(const QRegExp& rx) const
.
Returns the index position of the last exact match of rx in the list, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
By default, this function is case sensitive.
See also indexOf(), contains(), and QRegExp::exactMatch().
sourcepub unsafe fn last_index_of_q_reg_exp2(
&self,
rx: impl CastInto<Ref<QRegExp>>
) -> c_int
pub unsafe fn last_index_of_q_reg_exp2( &self, rx: impl CastInto<Ref<QRegExp>> ) -> c_int
This function overloads lastIndexOf().
Calls C++ function: int QStringList::lastIndexOf(QRegExp& rx) const
.
This function overloads lastIndexOf().
Returns the index position of the last exact match of rx in the list, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
By default, this function is case sensitive.
If an item matched, the rx regular expression will contain the matched objects (see QRegExp::matchedLength, QRegExp::cap).
This function was introduced in Qt 4.5.
See also indexOf(), contains(), and QRegExp::exactMatch().
sourcepub unsafe fn last_index_of_q_regular_expression(
&self,
re: impl CastInto<Ref<QRegularExpression>>
) -> c_int
pub unsafe fn last_index_of_q_regular_expression( &self, re: impl CastInto<Ref<QRegularExpression>> ) -> c_int
This is an overloaded function.
Calls C++ function: int QStringList::lastIndexOf(const QRegularExpression& re) const
.
This is an overloaded function.
Returns the index position of the last exact match of re in the list, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
This function was introduced in Qt 5.0.
See also indexOf().
sourcepub unsafe fn last_index_of_q_string_view_int(
&self,
str: impl CastInto<Ref<QStringView>>,
from: c_int
) -> c_int
Available on cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.
pub unsafe fn last_index_of_q_string_view_int( &self, str: impl CastInto<Ref<QStringView>>, from: c_int ) -> c_int
cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.This is an overloaded function.
Calls C++ function: int QStringList::lastIndexOf(QStringView str, int from = …) const
.
This is an overloaded function.
Returns the index position of the last occurrence of str in the list, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
This function was introduced in Qt 5.13.
sourcepub unsafe fn last_index_of_q_latin1_string_int(
&self,
str: impl CastInto<Ref<QLatin1String>>,
from: c_int
) -> c_int
pub unsafe fn last_index_of_q_latin1_string_int( &self, str: impl CastInto<Ref<QLatin1String>>, from: c_int ) -> c_int
This is an overloaded function.
Calls C++ function: int QStringList::lastIndexOf(QLatin1String str, int from = …) const
.
This is an overloaded function.
Returns the index position of the last occurrence of str in the list, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
This function was introduced in Qt 5.13.
sourcepub unsafe fn last_index_of_q_string_view(
&self,
str: impl CastInto<Ref<QStringView>>
) -> c_int
Available on cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.
pub unsafe fn last_index_of_q_string_view( &self, str: impl CastInto<Ref<QStringView>> ) -> c_int
cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.This is an overloaded function.
Calls C++ function: int QStringList::lastIndexOf(QStringView str) const
.
This is an overloaded function.
Returns the index position of the last occurrence of str in the list, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
This function was introduced in Qt 5.13.
sourcepub unsafe fn last_index_of_q_latin1_string(
&self,
str: impl CastInto<Ref<QLatin1String>>
) -> c_int
pub unsafe fn last_index_of_q_latin1_string( &self, str: impl CastInto<Ref<QLatin1String>> ) -> c_int
This is an overloaded function.
Calls C++ function: int QStringList::lastIndexOf(QLatin1String str) const
.
This is an overloaded function.
Returns the index position of the last occurrence of str in the list, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
This function was introduced in Qt 5.13.
sourcepub unsafe fn new() -> CppBox<QStringList>
pub unsafe fn new() -> CppBox<QStringList>
Constructs an empty string list.
Calls C++ function: [constructor] void QStringList::QStringList()
.
Constructs an empty string list.
sourcepub unsafe fn from_q_string(
i: impl CastInto<Ref<QString>>
) -> CppBox<QStringList>
pub unsafe fn from_q_string( i: impl CastInto<Ref<QString>> ) -> CppBox<QStringList>
Constructs a string list that contains the given string, str. Longer lists are easily created like this:
Calls C++ function: [constructor] void QStringList::QStringList(const QString& i)
.
Constructs a string list that contains the given string, str. Longer lists are easily created like this:
QStringList longerList = (QStringList() << str1 << str2 << str3);
See also append().
sourcepub unsafe fn from_q_list_of_q_string(
l: impl CastInto<Ref<QListOfQString>>
) -> CppBox<QStringList>
pub unsafe fn from_q_list_of_q_string( l: impl CastInto<Ref<QListOfQString>> ) -> CppBox<QStringList>
Constructs a copy of other.
Calls C++ function: [constructor] void QStringList::QStringList(const QList<QString>& l)
.
Constructs a copy of other.
This operation takes constant time, because QStringList is implicitly shared. This makes returning a QStringList from a function very fast. If a shared instance is modified, it will be copied (copy-on-write), and that takes linear time.
See also operator=().
sourcepub unsafe fn new_copy(
other: impl CastInto<Ref<QStringList>>
) -> CppBox<QStringList>
pub unsafe fn new_copy( other: impl CastInto<Ref<QStringList>> ) -> CppBox<QStringList>
The QStringList class provides a list of strings.
Calls C++ function: [constructor] void QStringList::QStringList(const QStringList& other)
.
The QStringList class provides a list of strings.
QStringList inherits from QList<QString>. Like QList, QStringList is implicitly shared. It provides fast index-based access as well as fast insertions and removals. Passing string lists as value parameters is both fast and safe.
All of QList's functionality also applies to QStringList. For example, you can use isEmpty() to test whether the list is empty, and you can call functions like append(), prepend(), insert(), replace(), removeAll(), removeAt(), removeFirst(), removeLast(), and removeOne() to modify a QStringList. In addition, QStringList provides a few convenience functions that make handling lists of strings easier:
Methods from Deref<Target = QListOfQString>§
sourcepub unsafe fn add_assign_q_list_of_q_string(
&self,
l: impl CastInto<Ref<QListOfQString>>
) -> Ref<QListOfQString>
pub unsafe fn add_assign_q_list_of_q_string( &self, l: impl CastInto<Ref<QListOfQString>> ) -> Ref<QListOfQString>
Appends the items of the other list to this list and returns a reference to this list.
Calls C++ function: QList<QString>& QList<QString>::operator+=(const QList<QString>& l)
.
sourcepub unsafe fn add_assign_q_string(
&self,
t: impl CastInto<Ref<QString>>
) -> Ref<QListOfQString>
pub unsafe fn add_assign_q_string( &self, t: impl CastInto<Ref<QString>> ) -> Ref<QListOfQString>
This is an overloaded function.
Calls C++ function: QList<QString>& QList<QString>::operator+=(const QString& t)
.
sourcepub unsafe fn append_q_string(&self, t: impl CastInto<Ref<QString>>)
pub unsafe fn append_q_string(&self, t: impl CastInto<Ref<QString>>)
Inserts value at the end of the list.
Calls C++ function: void QList<QString>::append(const QString& t)
.
Inserts value at the end of the list.
Example:
QList<QString> list; list.append(“one”); list.append(“two”); list.append(“three”); // list: [“one”, “two”, “three”]
This is the same as list.insert(size(), value).
If this list is not shared, this operation is typically very fast (amortized constant time), because QList preallocates extra space on both sides of its internal buffer to allow for fast growth at both ends of the list.
See also operator<<(), prepend(), and insert().
sourcepub unsafe fn append_q_list_of_q_string(
&self,
t: impl CastInto<Ref<QListOfQString>>
)
pub unsafe fn append_q_list_of_q_string( &self, t: impl CastInto<Ref<QListOfQString>> )
This is an overloaded function.
Calls C++ function: void QList<QString>::append(const QList<QString>& t)
.
This is an overloaded function.
Appends the items of the value list to this list.
This function was introduced in Qt 4.5.
See also operator<<() and operator+=().
sourcepub unsafe fn at(&self, i: c_int) -> Ref<QString>
pub unsafe fn at(&self, i: c_int) -> Ref<QString>
Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).
Calls C++ function: const QString& QList<QString>::at(int i) const
.
Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).
This function is very fast (constant time).
See also value() and operator[]().
sourcepub unsafe fn back_mut(&self) -> Ref<QString>
pub unsafe fn back_mut(&self) -> Ref<QString>
sourcepub unsafe fn back(&self) -> Ref<QString>
pub unsafe fn back(&self) -> Ref<QString>
This is an overloaded function.
Calls C++ function: const QString& QList<QString>::back() const
.
This is an overloaded function.
sourcepub unsafe fn begin_mut(&self) -> CppBox<Iterator>
pub unsafe fn begin_mut(&self) -> CppBox<Iterator>
Returns an STL-style iterator pointing to the first item in the list.
Calls C++ function: QList<QString>::iterator QList<QString>::begin()
.
Returns an STL-style iterator pointing to the first item in the list.
See also constBegin() and end().
sourcepub unsafe fn begin(&self) -> CppBox<ConstIterator>
pub unsafe fn begin(&self) -> CppBox<ConstIterator>
This is an overloaded function.
Calls C++ function: QList<QString>::const_iterator QList<QString>::begin() const
.
This is an overloaded function.
sourcepub unsafe fn cbegin(&self) -> CppBox<ConstIterator>
pub unsafe fn cbegin(&self) -> CppBox<ConstIterator>
Returns a const STL-style iterator pointing to the first item in the list.
Calls C++ function: QList<QString>::const_iterator QList<QString>::cbegin() const
.
Returns a const STL-style iterator pointing to the first item in the list.
This function was introduced in Qt 5.0.
sourcepub unsafe fn cend(&self) -> CppBox<ConstIterator>
pub unsafe fn cend(&self) -> CppBox<ConstIterator>
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list.
Calls C++ function: QList<QString>::const_iterator QList<QString>::cend() const
.
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list.
This function was introduced in Qt 5.0.
sourcepub unsafe fn clear(&self)
pub unsafe fn clear(&self)
Removes all items from the list.
Calls C++ function: void QList<QString>::clear()
.
Removes all items from the list.
See also removeAll().
sourcepub unsafe fn const_begin(&self) -> CppBox<ConstIterator>
pub unsafe fn const_begin(&self) -> CppBox<ConstIterator>
Returns a const STL-style iterator pointing to the first item in the list.
Calls C++ function: QList<QString>::const_iterator QList<QString>::constBegin() const
.
Returns a const STL-style iterator pointing to the first item in the list.
sourcepub unsafe fn const_end(&self) -> CppBox<ConstIterator>
pub unsafe fn const_end(&self) -> CppBox<ConstIterator>
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list.
Calls C++ function: QList<QString>::const_iterator QList<QString>::constEnd() const
.
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list.
See also constBegin() and end().
sourcepub unsafe fn const_first(&self) -> Ref<QString>
pub unsafe fn const_first(&self) -> Ref<QString>
Returns a const reference to the first item in the list. The list must not be empty. If the list can be empty, call isEmpty() before calling this function.
Calls C++ function: const QString& QList<QString>::constFirst() const
.
sourcepub unsafe fn const_last(&self) -> Ref<QString>
pub unsafe fn const_last(&self) -> Ref<QString>
Returns a reference to the last item in the list. The list must not be empty. If the list can be empty, call isEmpty() before calling this function.
Calls C++ function: const QString& QList<QString>::constLast() const
.
Returns a reference to the last item in the list. The list must not be empty. If the list can be empty, call isEmpty() before calling this function.
This function was introduced in Qt 5.6.
See also constFirst(), isEmpty(), and last().
sourcepub unsafe fn contains(&self, t: impl CastInto<Ref<QString>>) -> bool
pub unsafe fn contains(&self, t: impl CastInto<Ref<QString>>) -> bool
Returns true
if the list contains an occurrence of value; otherwise returns false
.
Calls C++ function: bool QList<QString>::contains(const QString& t) const
.
sourcepub unsafe fn copy_from(
&self,
l: impl CastInto<Ref<QListOfQString>>
) -> Ref<QListOfQString>
pub unsafe fn copy_from( &self, l: impl CastInto<Ref<QListOfQString>> ) -> Ref<QListOfQString>
Assigns other to this list and returns a reference to this list.
Calls C++ function: QList<QString>& QList<QString>::operator=(const QList<QString>& l)
.
Assigns other to this list and returns a reference to this list.
sourcepub unsafe fn count_1a(&self, t: impl CastInto<Ref<QString>>) -> c_int
pub unsafe fn count_1a(&self, t: impl CastInto<Ref<QString>>) -> c_int
Returns the number of occurrences of value in the list.
Calls C++ function: int QList<QString>::count(const QString& t) const
.
sourcepub unsafe fn count_0a(&self) -> c_int
pub unsafe fn count_0a(&self) -> c_int
Calls C++ function: void QList<QString>::detachShared()
.
sourcepub unsafe fn empty(&self) -> bool
pub unsafe fn empty(&self) -> bool
sourcepub unsafe fn end_mut(&self) -> CppBox<Iterator>
pub unsafe fn end_mut(&self) -> CppBox<Iterator>
Returns an STL-style iterator pointing to the imaginary item after the last item in the list.
Calls C++ function: QList<QString>::iterator QList<QString>::end()
.
Returns an STL-style iterator pointing to the imaginary item after the last item in the list.
sourcepub unsafe fn end(&self) -> CppBox<ConstIterator>
pub unsafe fn end(&self) -> CppBox<ConstIterator>
This is an overloaded function.
Calls C++ function: QList<QString>::const_iterator QList<QString>::end() const
.
This is an overloaded function.
sourcepub unsafe fn ends_with(&self, t: impl CastInto<Ref<QString>>) -> bool
pub unsafe fn ends_with(&self, t: impl CastInto<Ref<QString>>) -> bool
Returns true
if this list is not empty and its last item is equal to value; otherwise returns false
.
Calls C++ function: bool QList<QString>::endsWith(const QString& t) const
.
sourcepub unsafe fn erase_1a(
&self,
pos: impl CastInto<Ref<Iterator>>
) -> CppBox<Iterator>
pub unsafe fn erase_1a( &self, pos: impl CastInto<Ref<Iterator>> ) -> CppBox<Iterator>
Removes the item associated with the iterator pos from the list, and returns an iterator to the next item in the list (which may be end()).
Calls C++ function: QList<QString>::iterator QList<QString>::erase(QList<QString>::iterator pos)
.
sourcepub unsafe fn erase_2a(
&self,
first: impl CastInto<Ref<Iterator>>,
last: impl CastInto<Ref<Iterator>>
) -> CppBox<Iterator>
pub unsafe fn erase_2a( &self, first: impl CastInto<Ref<Iterator>>, last: impl CastInto<Ref<Iterator>> ) -> CppBox<Iterator>
This is an overloaded function.
Calls C++ function: QList<QString>::iterator QList<QString>::erase(QList<QString>::iterator first, QList<QString>::iterator last)
.
This is an overloaded function.
Removes all the items from begin up to (but not including) end. Returns an iterator to the same item that end referred to before the call.
sourcepub unsafe fn first_mut(&self) -> Ref<QString>
pub unsafe fn first_mut(&self) -> Ref<QString>
Returns a reference to the first item in the list. The list must not be empty. If the list can be empty, call isEmpty() before calling this function.
Calls C++ function: QString& QList<QString>::first()
.
Returns a reference to the first item in the list. The list must not be empty. If the list can be empty, call isEmpty() before calling this function.
See also constFirst(), last(), and isEmpty().
sourcepub unsafe fn first(&self) -> Ref<QString>
pub unsafe fn first(&self) -> Ref<QString>
This is an overloaded function.
Calls C++ function: const QString& QList<QString>::first() const
.
This is an overloaded function.
sourcepub unsafe fn front_mut(&self) -> Ref<QString>
pub unsafe fn front_mut(&self) -> Ref<QString>
sourcepub unsafe fn front(&self) -> Ref<QString>
pub unsafe fn front(&self) -> Ref<QString>
This is an overloaded function.
Calls C++ function: const QString& QList<QString>::front() const
.
This is an overloaded function.
sourcepub unsafe fn index(&self, i: c_int) -> Ref<QString>
pub unsafe fn index(&self, i: c_int) -> Ref<QString>
This is an overloaded function.
Calls C++ function: const QString& QList<QString>::operator[](int i) const
.
This is an overloaded function.
Same as at(). This function runs in constant time.
sourcepub unsafe fn index_mut(&self, i: c_int) -> Ref<QString>
pub unsafe fn index_mut(&self, i: c_int) -> Ref<QString>
Returns the item at index position i as a modifiable reference. i must be a valid index position in the list (i.e., 0 <= i < size()).
Calls C++ function: QString& QList<QString>::operator[](int i)
.
Returns the item at index position i as a modifiable reference. i must be a valid index position in the list (i.e., 0 <= i < size()).
If this function is called on a list that is currently being shared, it will trigger a copy of all elements. Otherwise, this function runs in constant time. If you do not want to modify the list you should use QList::at().
sourcepub unsafe fn index_of_2a(
&self,
t: impl CastInto<Ref<QString>>,
from: c_int
) -> c_int
pub unsafe fn index_of_2a( &self, t: impl CastInto<Ref<QString>>, from: c_int ) -> c_int
Returns the index position of the first occurrence of value in the list, searching forward from index position from. Returns -1 if no item matched.
Calls C++ function: int QList<QString>::indexOf(const QString& t, int from = …) const
.
Returns the index position of the first occurrence of value in the list, searching forward from index position from. Returns -1 if no item matched.
Example:
QList<QString> list; list << “A” << “B” << “C” << “B” << “A”; list.indexOf(“B”); // returns 1 list.indexOf(“B”, 1); // returns 1 list.indexOf(“B”, 2); // returns 3 list.indexOf(“X”); // returns -1
This function requires the value type to have an implementation of operator==()
.
Note that QList uses 0-based indexes, just like C++ arrays. Negative indexes are not supported with the exception of the value mentioned above.
See also lastIndexOf() and contains().
sourcepub unsafe fn index_of_1a(&self, t: impl CastInto<Ref<QString>>) -> c_int
pub unsafe fn index_of_1a(&self, t: impl CastInto<Ref<QString>>) -> c_int
Returns the index position of the first occurrence of value in the list, searching forward from index position from. Returns -1 if no item matched.
Calls C++ function: int QList<QString>::indexOf(const QString& t) const
.
Returns the index position of the first occurrence of value in the list, searching forward from index position from. Returns -1 if no item matched.
Example:
QList<QString> list; list << “A” << “B” << “C” << “B” << “A”; list.indexOf(“B”); // returns 1 list.indexOf(“B”, 1); // returns 1 list.indexOf(“B”, 2); // returns 3 list.indexOf(“X”); // returns -1
This function requires the value type to have an implementation of operator==()
.
Note that QList uses 0-based indexes, just like C++ arrays. Negative indexes are not supported with the exception of the value mentioned above.
See also lastIndexOf() and contains().
sourcepub unsafe fn insert_int_q_string(
&self,
i: c_int,
t: impl CastInto<Ref<QString>>
)
pub unsafe fn insert_int_q_string( &self, i: c_int, t: impl CastInto<Ref<QString>> )
Inserts value at index position i in the list. If i <= 0, the value is prepended to the list. If i >= size(), the value is appended to the list.
Calls C++ function: void QList<QString>::insert(int i, const QString& t)
.
sourcepub unsafe fn insert_iterator_q_string(
&self,
before: impl CastInto<Ref<Iterator>>,
t: impl CastInto<Ref<QString>>
) -> CppBox<Iterator>
pub unsafe fn insert_iterator_q_string( &self, before: impl CastInto<Ref<Iterator>>, t: impl CastInto<Ref<QString>> ) -> CppBox<Iterator>
This is an overloaded function.
Calls C++ function: QList<QString>::iterator QList<QString>::insert(QList<QString>::iterator before, const QString& t)
.
This is an overloaded function.
Inserts value in front of the item pointed to by the iterator before. Returns an iterator pointing at the inserted item. Note that the iterator passed to the function will be invalid after the call; the returned iterator should be used instead.
sourcepub unsafe fn is_detached(&self) -> bool
pub unsafe fn is_detached(&self) -> bool
Calls C++ function: bool QList<QString>::isDetached() const
.
sourcepub unsafe fn is_empty(&self) -> bool
pub unsafe fn is_empty(&self) -> bool
Returns true
if the list contains no items; otherwise returns false.
Calls C++ function: bool QList<QString>::isEmpty() const
.
Returns true
if the list contains no items; otherwise returns false.
See also size().
Calls C++ function: bool QList<QString>::isSharedWith(const QList<QString>& other) const
.
sourcepub unsafe fn last_mut(&self) -> Ref<QString>
pub unsafe fn last_mut(&self) -> Ref<QString>
Returns a reference to the last item in the list. The list must not be empty. If the list can be empty, call isEmpty() before calling this function.
Calls C++ function: QString& QList<QString>::last()
.
sourcepub unsafe fn last(&self) -> Ref<QString>
pub unsafe fn last(&self) -> Ref<QString>
This is an overloaded function.
Calls C++ function: const QString& QList<QString>::last() const
.
This is an overloaded function.
sourcepub unsafe fn last_index_of_2a(
&self,
t: impl CastInto<Ref<QString>>,
from: c_int
) -> c_int
pub unsafe fn last_index_of_2a( &self, t: impl CastInto<Ref<QString>>, from: c_int ) -> c_int
Returns the index position of the last occurrence of value in the list, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
Calls C++ function: int QList<QString>::lastIndexOf(const QString& t, int from = …) const
.
Returns the index position of the last occurrence of value in the list, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
Example:
QList<QString> list; list << “A” << “B” << “C” << “B” << “A”; list.lastIndexOf(“B”); // returns 3 list.lastIndexOf(“B”, 3); // returns 3 list.lastIndexOf(“B”, 2); // returns 1 list.lastIndexOf(“X”); // returns -1
This function requires the value type to have an implementation of operator==()
.
Note that QList uses 0-based indexes, just like C++ arrays. Negative indexes are not supported with the exception of the value mentioned above.
See also indexOf().
sourcepub unsafe fn last_index_of_1a(&self, t: impl CastInto<Ref<QString>>) -> c_int
pub unsafe fn last_index_of_1a(&self, t: impl CastInto<Ref<QString>>) -> c_int
Returns the index position of the last occurrence of value in the list, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
Calls C++ function: int QList<QString>::lastIndexOf(const QString& t) const
.
Returns the index position of the last occurrence of value in the list, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
Example:
QList<QString> list; list << “A” << “B” << “C” << “B” << “A”; list.lastIndexOf(“B”); // returns 3 list.lastIndexOf(“B”, 3); // returns 3 list.lastIndexOf(“B”, 2); // returns 1 list.lastIndexOf(“X”); // returns -1
This function requires the value type to have an implementation of operator==()
.
Note that QList uses 0-based indexes, just like C++ arrays. Negative indexes are not supported with the exception of the value mentioned above.
See also indexOf().
sourcepub unsafe fn length(&self) -> c_int
pub unsafe fn length(&self) -> c_int
This function is identical to count().
Calls C++ function: int QList<QString>::length() const
.
sourcepub unsafe fn mid_2a(&self, pos: c_int, length: c_int) -> CppBox<QListOfQString>
pub unsafe fn mid_2a(&self, pos: c_int, length: c_int) -> CppBox<QListOfQString>
Returns a sub-list which includes elements from this list, starting at position pos. If length is -1 (the default), all elements from pos are included; otherwise length elements (or all remaining elements if there are less than length elements) are included.
Calls C++ function: QList<QString> QList<QString>::mid(int pos, int length = …) const
.
Returns a sub-list which includes elements from this list, starting at position pos. If length is -1 (the default), all elements from pos are included; otherwise length elements (or all remaining elements if there are less than length elements) are included.
sourcepub unsafe fn mid_1a(&self, pos: c_int) -> CppBox<QListOfQString>
pub unsafe fn mid_1a(&self, pos: c_int) -> CppBox<QListOfQString>
Returns a sub-list which includes elements from this list, starting at position pos. If length is -1 (the default), all elements from pos are included; otherwise length elements (or all remaining elements if there are less than length elements) are included.
Calls C++ function: QList<QString> QList<QString>::mid(int pos) const
.
Returns a sub-list which includes elements from this list, starting at position pos. If length is -1 (the default), all elements from pos are included; otherwise length elements (or all remaining elements if there are less than length elements) are included.
sourcepub unsafe fn move_(&self, from: c_int, to: c_int)
pub unsafe fn move_(&self, from: c_int, to: c_int)
Moves the item at index position from to index position to.
Calls C++ function: void QList<QString>::move(int from, int to)
.
Moves the item at index position from to index position to.
Example:
QList<QString> list; list << “A” << “B” << “C” << “D” << “E” << “F”; list.move(1, 4); // list: [“A”, “C”, “D”, “E”, “B”, “F”]
This is the same as insert(to, takeAt(from)).This function assumes that both from and to are at least 0 but less than size(). To avoid failure, test that both from and to are at least 0 and less than size().
sourcepub unsafe fn pop_back(&self)
pub unsafe fn pop_back(&self)
This function is provided for STL compatibility. It is equivalent to removeLast(). The list must not be empty. If the list can be empty, call isEmpty() before calling this function.
Calls C++ function: void QList<QString>::pop_back()
.
This function is provided for STL compatibility. It is equivalent to removeLast(). The list must not be empty. If the list can be empty, call isEmpty() before calling this function.
sourcepub unsafe fn pop_front(&self)
pub unsafe fn pop_front(&self)
This function is provided for STL compatibility. It is equivalent to removeFirst(). The list must not be empty. If the list can be empty, call isEmpty() before calling this function.
Calls C++ function: void QList<QString>::pop_front()
.
This function is provided for STL compatibility. It is equivalent to removeFirst(). The list must not be empty. If the list can be empty, call isEmpty() before calling this function.
sourcepub unsafe fn prepend(&self, t: impl CastInto<Ref<QString>>)
pub unsafe fn prepend(&self, t: impl CastInto<Ref<QString>>)
Inserts value at the beginning of the list.
Calls C++ function: void QList<QString>::prepend(const QString& t)
.
Inserts value at the beginning of the list.
Example:
QList<QString> list; list.prepend(“one”); list.prepend(“two”); list.prepend(“three”); // list: [“three”, “two”, “one”]
This is the same as list.insert(0, value).
If this list is not shared, this operation is typically very fast (amortized constant time), because QList preallocates extra space on both sides of its internal buffer to allow for fast growth at both ends of the list.
sourcepub unsafe fn push_back(&self, t: impl CastInto<Ref<QString>>)
pub unsafe fn push_back(&self, t: impl CastInto<Ref<QString>>)
sourcepub unsafe fn push_front(&self, t: impl CastInto<Ref<QString>>)
pub unsafe fn push_front(&self, t: impl CastInto<Ref<QString>>)
sourcepub unsafe fn remove_all(&self, t: impl CastInto<Ref<QString>>) -> c_int
pub unsafe fn remove_all(&self, t: impl CastInto<Ref<QString>>) -> c_int
Removes all occurrences of value in the list and returns the number of entries removed.
Calls C++ function: int QList<QString>::removeAll(const QString& t)
.
sourcepub unsafe fn remove_at(&self, i: c_int)
pub unsafe fn remove_at(&self, i: c_int)
Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).
Calls C++ function: void QList<QString>::removeAt(int i)
.
Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).
See also takeAt(), removeFirst(), removeLast(), and removeOne().
sourcepub unsafe fn remove_first(&self)
pub unsafe fn remove_first(&self)
sourcepub unsafe fn remove_last(&self)
pub unsafe fn remove_last(&self)
sourcepub unsafe fn remove_one(&self, t: impl CastInto<Ref<QString>>) -> bool
pub unsafe fn remove_one(&self, t: impl CastInto<Ref<QString>>) -> bool
Removes the first occurrence of value in the list and returns true on success; otherwise returns false
.
Calls C++ function: bool QList<QString>::removeOne(const QString& t)
.
Removes the first occurrence of value in the list and returns true on success; otherwise returns false
.
Example:
QList<QString> list; list << “sun” << “cloud” << “sun” << “rain”; list.removeOne(“sun”); // list: [“cloud”, ,“sun”, “rain”]
This function requires the value type to have an implementation of operator==()
.
This function was introduced in Qt 4.4.
sourcepub unsafe fn replace(&self, i: c_int, t: impl CastInto<Ref<QString>>)
pub unsafe fn replace(&self, i: c_int, t: impl CastInto<Ref<QString>>)
Replaces the item at index position i with value. i must be a valid index position in the list (i.e., 0 <= i < size()).
Calls C++ function: void QList<QString>::replace(int i, const QString& t)
.
Replaces the item at index position i with value. i must be a valid index position in the list (i.e., 0 <= i < size()).
See also operator[]() and removeAt().
sourcepub unsafe fn reserve(&self, size: c_int)
pub unsafe fn reserve(&self, size: c_int)
Reserve space for alloc elements.
Calls C++ function: void QList<QString>::reserve(int size)
.
Reserve space for alloc elements.
If alloc is smaller than the current size of the list, nothing will happen.
Use this function to avoid repetetive reallocation of QList's internal data if you can predict how many elements will be appended. Note that the reservation applies only to the internal pointer array.
This function was introduced in Qt 4.7.
sourcepub unsafe fn set_sharable(&self, sharable: bool)
pub unsafe fn set_sharable(&self, sharable: bool)
Calls C++ function: void QList<QString>::setSharable(bool sharable)
.
sourcepub unsafe fn size(&self) -> c_int
pub unsafe fn size(&self) -> c_int
Returns the number of items in the list.
Calls C++ function: int QList<QString>::size() const
.
sourcepub unsafe fn starts_with(&self, t: impl CastInto<Ref<QString>>) -> bool
pub unsafe fn starts_with(&self, t: impl CastInto<Ref<QString>>) -> bool
Returns true
if this list is not empty and its first item is equal to value; otherwise returns false
.
Calls C++ function: bool QList<QString>::startsWith(const QString& t) const
.
sourcepub unsafe fn swap_1a(&self, other: impl CastInto<Ref<QListOfQString>>)
pub unsafe fn swap_1a(&self, other: impl CastInto<Ref<QListOfQString>>)
Swaps list other with this list. This operation is very fast and never fails.
Calls C++ function: void QList<QString>::swap(QList<QString>& other)
.
Swaps list other with this list. This operation is very fast and never fails.
This function was introduced in Qt 4.8.
sourcepub unsafe fn swap_2a(&self, i: c_int, j: c_int)
pub unsafe fn swap_2a(&self, i: c_int, j: c_int)
Exchange the item at index position i with the item at index position j. This function assumes that both i and j are at least 0 but less than size(). To avoid failure, test that both i and j are at least 0 and less than size().
Calls C++ function: void QList<QString>::swap(int i, int j)
.
Exchange the item at index position i with the item at index position j. This function assumes that both i and j are at least 0 but less than size(). To avoid failure, test that both i and j are at least 0 and less than size().
Example:
QList<QString> list; list << “A” << “B” << “C” << “D” << “E” << “F”; list.swap(1, 4); // list: [“A”, “E”, “C”, “D”, “B”, “F”]
See also move().
sourcepub unsafe fn swap_items_at(&self, i: c_int, j: c_int)
Available on cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.
pub unsafe fn swap_items_at(&self, i: c_int, j: c_int)
cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Exchange the item at index position i with the item at index position j. This function assumes that both i and j are at least 0 but less than size(). To avoid failure, test that both i and j are at least 0 and less than size().
Calls C++ function: void QList<QString>::swapItemsAt(int i, int j)
.
Exchange the item at index position i with the item at index position j. This function assumes that both i and j are at least 0 but less than size(). To avoid failure, test that both i and j are at least 0 and less than size().
Example:
QList<QString> list; list << “A” << “B” << “C” << “D” << “E” << “F”; list.swapItemsAt(1, 4); // list: [“A”, “E”, “C”, “D”, “B”, “F”]
This function was introduced in Qt 5.13.
See also move().
sourcepub unsafe fn take_at(&self, i: c_int) -> CppBox<QString>
pub unsafe fn take_at(&self, i: c_int) -> CppBox<QString>
Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).
Calls C++ function: QString QList<QString>::takeAt(int i)
.
sourcepub unsafe fn take_first(&self) -> CppBox<QString>
pub unsafe fn take_first(&self) -> CppBox<QString>
Removes the first item in the list and returns it. This is the same as takeAt(0). This function assumes the list is not empty. To avoid failure, call isEmpty() before calling this function.
Calls C++ function: QString QList<QString>::takeFirst()
.
Removes the first item in the list and returns it. This is the same as takeAt(0). This function assumes the list is not empty. To avoid failure, call isEmpty() before calling this function.
If this list is not shared, this operation takes constant time.
If you don't use the return value, removeFirst() is more efficient.
See also takeLast(), takeAt(), and removeFirst().
sourcepub unsafe fn take_last(&self) -> CppBox<QString>
pub unsafe fn take_last(&self) -> CppBox<QString>
Removes the last item in the list and returns it. This is the same as takeAt(size() - 1). This function assumes the list is not empty. To avoid failure, call isEmpty() before calling this function.
Calls C++ function: QString QList<QString>::takeLast()
.
Removes the last item in the list and returns it. This is the same as takeAt(size() - 1). This function assumes the list is not empty. To avoid failure, call isEmpty() before calling this function.
If this list is not shared, this operation takes constant time.
If you don't use the return value, removeLast() is more efficient.
See also takeFirst(), takeAt(), and removeLast().
sourcepub unsafe fn value_1a(&self, i: c_int) -> CppBox<QString>
pub unsafe fn value_1a(&self, i: c_int) -> CppBox<QString>
Returns the value at index position i in the list.
Calls C++ function: QString QList<QString>::value(int i) const
.
Returns the value at index position i in the list.
If the index i is out of bounds, the function returns a default-constructed value. If you are certain that the index is going to be within bounds, you can use at() instead, which is slightly faster.
See also at() and operator[]().
sourcepub unsafe fn value_2a(
&self,
i: c_int,
default_value: impl CastInto<Ref<QString>>
) -> CppBox<QString>
pub unsafe fn value_2a( &self, i: c_int, default_value: impl CastInto<Ref<QString>> ) -> CppBox<QString>
This is an overloaded function.
Calls C++ function: QString QList<QString>::value(int i, const QString& defaultValue) const
.
This is an overloaded function.
If the index i is out of bounds, the function returns defaultValue.
Trait Implementations§
source§impl Add<Ref<QStringList>> for &QStringList
impl Add<Ref<QStringList>> for &QStringList
source§fn add(self, other: Ref<QStringList>) -> CppBox<QStringList>
fn add(self, other: Ref<QStringList>) -> CppBox<QStringList>
Returns a string list that is the concatenation of this string list with the other string list.
Calls C++ function: QStringList QStringList::operator+(const QStringList& other) const
.
Returns a string list that is the concatenation of this string list with the other string list.
See also append().
§type Output = CppBox<QStringList>
type Output = CppBox<QStringList>
+
operator.source§impl CppDeletable for QStringList
impl CppDeletable for QStringList
source§unsafe fn delete(&self)
unsafe fn delete(&self)
The QStringList class provides a list of strings.
Calls C++ function: [destructor] void QStringList::~QStringList()
.
The QStringList class provides a list of strings.
QStringList inherits from QList<QString>. Like QList, QStringList is implicitly shared. It provides fast index-based access as well as fast insertions and removals. Passing string lists as value parameters is both fast and safe.
All of QList's functionality also applies to QStringList. For example, you can use isEmpty() to test whether the list is empty, and you can call functions like append(), prepend(), insert(), replace(), removeAll(), removeAt(), removeFirst(), removeLast(), and removeOne() to modify a QStringList. In addition, QStringList provides a few convenience functions that make handling lists of strings easier:
source§impl Deref for QStringList
impl Deref for QStringList
source§fn deref(&self) -> &QListOfQString
fn deref(&self) -> &QListOfQString
Calls C++ function: QList<QString>* static_cast<QList<QString>*>(QStringList* ptr)
.
§type Target = QListOfQString
type Target = QListOfQString
source§impl Shl<Ref<QListOfQString>> for &QStringList
impl Shl<Ref<QListOfQString>> for &QStringList
source§fn shl(self, l: Ref<QListOfQString>) -> Ref<QStringList>
fn shl(self, l: Ref<QListOfQString>) -> Ref<QStringList>
This is an overloaded function.
Calls C++ function: QStringList& QStringList::operator<<(const QList<QString>& l)
.
This is an overloaded function.
Appends the other string list to the string list and returns a reference to the latter string list.
This function was introduced in Qt 5.4.
§type Output = Ref<QStringList>
type Output = Ref<QStringList>
<<
operator.source§impl Shl<Ref<QString>> for &QStringList
impl Shl<Ref<QString>> for &QStringList
source§fn shl(self, str: Ref<QString>) -> Ref<QStringList>
fn shl(self, str: Ref<QString>) -> Ref<QStringList>
Appends the given string, str, to this string list and returns a reference to the string list.
Calls C++ function: QStringList& QStringList::operator<<(const QString& str)
.
Appends the given string, str, to this string list and returns a reference to the string list.
See also append().
§type Output = Ref<QStringList>
type Output = Ref<QStringList>
<<
operator.source§impl Shl<Ref<QStringList>> for &QStringList
impl Shl<Ref<QStringList>> for &QStringList
source§fn shl(self, l: Ref<QStringList>) -> Ref<QStringList>
fn shl(self, l: Ref<QStringList>) -> Ref<QStringList>
This is an overloaded function.
Calls C++ function: QStringList& QStringList::operator<<(const QStringList& l)
.
This is an overloaded function.
Appends the other string list to the string list and returns a reference to the latter string list.
§type Output = Ref<QStringList>
type Output = Ref<QStringList>
<<
operator.source§impl StaticDowncast<QStringList> for QListOfQString
impl StaticDowncast<QStringList> for QListOfQString
source§unsafe fn static_downcast(ptr: Ptr<QListOfQString>) -> Ptr<QStringList>
unsafe fn static_downcast(ptr: Ptr<QListOfQString>) -> Ptr<QStringList>
Calls C++ function: QStringList* static_cast<QStringList*>(QList<QString>* ptr)
.
source§impl StaticUpcast<QListOfQString> for QStringList
impl StaticUpcast<QListOfQString> for QStringList
source§unsafe fn static_upcast(ptr: Ptr<QStringList>) -> Ptr<QListOfQString>
unsafe fn static_upcast(ptr: Ptr<QStringList>) -> Ptr<QListOfQString>
Calls C++ function: QList<QString>* static_cast<QList<QString>*>(QStringList* ptr)
.