Skip to main content

QStringList

Struct QStringList 

Source
pub struct QStringList { /* private fields */ }
Expand description

The QStringList class provides a list of strings.

Qt Documentation: QStringList

Implementations§

Source§

impl QStringList

Source

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.

Source

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.

Source

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).

Source

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.

Source

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

Source

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>>§

Source

pub fn cxx_clear(&mut self)

Source

pub fn cxx_contains(&self, arg0: &QString) -> bool

Source

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.

Source

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.

Source

pub fn contains(&self, value: &T) -> bool

Returns true if the list contains an occurrence of value; otherwise returns false.

Source

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()).

Source

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.

Source

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.

Source

pub fn is_empty(&self) -> bool

Returns true if the list has size 0; otherwise returns false.

Source

pub fn iter(&self) -> Iter<'_, T>

An iterator visiting all elements in arbitrary order. The iterator element type is &'a T.

Source

pub fn len(&self) -> isize

Returns the number of items in the list.

Source

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.

Source

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.

Source

pub fn append(&mut self, value: T)

Inserts value at the end of the list.

Source

pub fn insert(&mut self, pos: isize, value: T)

Inserts item value into the list at index position pos.

Trait Implementations§

Source§

impl Clone for QStringList

Source§

fn clone(&self) -> Self

Constructs a copy of other.

1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for QStringList

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for QStringList

Source§

fn default() -> Self

Constructs an empty list.

Source§

impl Deref for QStringList

Source§

type Target = QList<QString>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for QStringList

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<'de> Deserialize<'de> for QStringList

Available on crate feature serde only.
Source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for QStringList

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for QStringList

Source§

fn drop(&mut self)

Destroys the list.

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Eq for QStringList

Source§

impl ExternType for QStringList

Source§

type Id = (Q, S, t, r, i, n, g, L, i, s, t)

A type-level representation of the type’s C++ namespace and type name. Read more
Source§

type Kind = Trivial

Source§

impl From<&QList<QString>> for QStringList

Source§

fn from(list: &QList<QString>) -> Self

Converts a QList<QString> into QStringList.

Source§

impl From<&QString> for QStringList

Source§

fn from(string: &QString) -> Self

Constructs a string list that contains the given string.

Source§

impl From<&QStringList> for QList<QString>

Source§

fn from(list: &QStringList) -> Self

Converts a QStringList into a QList<QString>.

Source§

impl<'a> FromIterator<&'a QString> for QStringList

Source§

fn from_iter<I: IntoIterator<Item = &'a QString>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl FromIterator<QString> for QStringList

Source§

fn from_iter<I: IntoIterator<Item = QString>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl PartialEq for QStringList

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl QVariantValue for QStringList

Source§

fn can_convert(variant: &QVariant) -> bool

Source§

fn construct(value: &Self) -> QVariant

Source§

fn value_or_default(variant: &QVariant) -> Self

Source§

impl Serialize for QStringList

Available on crate feature serde only.
Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl Upcast<QList<QString>> for QStringList

Source§

fn upcast(&self) -> &T

Upcast a reference to self to a reference to the base class
Source§

fn upcast_mut(&mut self) -> &mut T

Upcast a mutable reference to sell to a mutable reference to the base class
Source§

fn upcast_pin(self: Pin<&mut Self>) -> Pin<&mut T>

Upcast a pinned mutable reference to self to a pinned mutable reference to the base class

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.