pub struct QStringList { /* private fields */ }Expand description
The QStringList class provides a list of strings.
Qt Documentation: QStringList
Implementations§
Source§impl QStringList
impl QStringList
Sourcepub fn contains(&self, str: &QString, cs: CaseSensitivity) -> bool
pub fn contains(&self, str: &QString, cs: CaseSensitivity) -> bool
Returns true if the list contains the string str; otherwise returns false.
If cs is CaseSensitivity::CaseSensitive, the search is case-sensitive; otherwise the comparison is case-insensitive.
Sourcepub fn filter(&self, str: &QString, cs: CaseSensitivity) -> QStringList
pub fn filter(&self, str: &QString, cs: CaseSensitivity) -> QStringList
Returns a list of all the strings containing the substring str.
If cs is CaseSensitivity::CaseSensitive, the search is case-sensitive; otherwise the comparison is case-insensitive.
Sourcepub fn join(&self, separator: &QString) -> QString
pub fn join(&self, separator: &QString) -> QString
Joins all the string list’s strings into a single string with each element
separated by the given separator (which can be an empty string).
Sourcepub fn sort(&mut self, cs: CaseSensitivity)
pub fn sort(&mut self, cs: CaseSensitivity)
Sorts the list of strings in ascending order.
If cs is CaseSensitivity::CaseSensitive, the string comparison is case-sensitive; otherwise the comparison is case-insensitive.
Sourcepub fn replace_in_strings(
&mut self,
before: &QString,
after: &QString,
cs: CaseSensitivity,
) -> &mut QStringList
pub fn replace_in_strings( &mut self, before: &QString, after: &QString, cs: CaseSensitivity, ) -> &mut QStringList
Returns a string list where every string has had the before text replaced with the after text wherever the before text is found.
Note: If you use an empty before argument, the after argument will be inserted before and after each character of the string.
If cs is CaseSensitivity::CaseSensitive, the string comparison is case-sensitive; otherwise the comparison is case-insensitive.
Source§impl QStringList
impl QStringList
Sourcepub fn remove_duplicates(&mut self) -> isize
pub fn remove_duplicates(&mut self) -> isize
This function removes duplicate entries from a list. The entries do not have to be sorted. They will retain their original order.
Returns the number of removed entries.
Methods from Deref<Target = QList<QString>>§
pub fn cxx_clear(&mut self)
pub fn cxx_contains(&self, arg0: &QString) -> bool
Sourcepub fn append_clone(&mut self, value: &T)
pub fn append_clone(&mut self, value: &T)
Inserts value at the end of the list.
The value is a reference here so it can be opaque or trivial but note that the value is copied when being appended into the list.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Removes all elements from the list.
In Qt 6, the capacity is preserved. In Qt 5, this function releases the memory used by the list.
Sourcepub fn contains(&self, value: &T) -> bool
pub fn contains(&self, value: &T) -> bool
Returns true if the list contains an occurrence of value; otherwise returns false.
Sourcepub fn get(&self, index: isize) -> Option<&T>
pub fn get(&self, index: isize) -> Option<&T>
Returns the item at index position index in the list, or None if index is out of bounds (i.e. index < 0 || index >= self.len()).
Sourcepub fn index_of(&self, value: &T) -> isize
pub fn index_of(&self, value: &T) -> isize
Returns the index position of the first occurrence of value in the list. Returns -1 if no item matched.
Sourcepub fn insert_clone(&mut self, pos: isize, value: &T)
pub fn insert_clone(&mut self, pos: isize, value: &T)
Inserts item value into the list at index position pos.
The value is a reference here so it can be opaque or trivial but note that the value is copied when being inserted into the list.
Sourcepub fn iter(&self) -> Iter<'_, T>
pub fn iter(&self) -> Iter<'_, T>
An iterator visiting all elements in arbitrary order.
The iterator element type is &'a T.
Sourcepub fn remove(&mut self, pos: isize)
pub fn remove(&mut self, pos: isize)
Removes the element at index position pos.
Element removal will preserve the list’s capacity and not reduce the amount of allocated memory.
Sourcepub fn reserve(&mut self, size: isize)
pub fn reserve(&mut self, size: isize)
Attempts to allocate memory for at least size elements.
If you know in advance how large the list will be, you should call this function to prevent reallocations and memory fragmentation. If you resize the list often, you are also likely to get better performance.
If in doubt about how much space shall be needed, it is usually better to use an upper bound as size, or a high estimate of the most likely size, if a strict upper bound would be much bigger than this. If size is an underestimate, the list will grow as needed once the reserved size is exceeded, which may lead to a larger allocation than your best overestimate would have and will slow the operation that triggers it.
Trait Implementations§
Source§impl Clone for QStringList
impl Clone for QStringList
Source§impl Debug for QStringList
impl Debug for QStringList
Source§impl Deref for QStringList
impl Deref for QStringList
Source§impl DerefMut for QStringList
impl DerefMut for QStringList
Source§impl<'de> Deserialize<'de> for QStringList
Available on crate feature serde only.
impl<'de> Deserialize<'de> for QStringList
serde only.Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl Display for QStringList
impl Display for QStringList
Source§impl Drop for QStringList
impl Drop for QStringList
impl Eq for QStringList
Source§impl ExternType for QStringList
impl ExternType for QStringList
Source§impl From<&QString> for QStringList
impl From<&QString> for QStringList
Source§impl From<&QStringList> for QList<QString>
impl From<&QStringList> for QList<QString>
Source§fn from(list: &QStringList) -> Self
fn from(list: &QStringList) -> Self
Converts a QStringList into a QList<QString>.
Source§impl<'a> FromIterator<&'a QString> for QStringList
impl<'a> FromIterator<&'a QString> for QStringList
Source§impl FromIterator<QString> for QStringList
impl FromIterator<QString> for QStringList
Source§impl PartialEq for QStringList
impl PartialEq for QStringList
Source§impl QVariantValue for QStringList
impl QVariantValue for QStringList
Source§impl Serialize for QStringList
Available on crate feature serde only.
impl Serialize for QStringList
serde only.