[][src]Struct qt_core::QCollator

#[repr(C)]pub struct QCollator { /* fields omitted */ }

The QCollator class compares strings according to a localized collation algorithm.

C++ class: QCollator.

C++ documentation:

The QCollator class compares strings according to a localized collation algorithm.

QCollator is initialized with a QLocale and an optional collation strategy. It tries to initialize the collator with the specified values. The collator can then be used to compare and sort strings in a locale dependent fashion.

A QCollator object can be used together with template based sorting algorithms such as std::sort to sort a list of QStrings.

In addition to the locale and collation strategy, several optional flags can be set that influence the result of the collation.

Methods

impl QCollator[src]

pub unsafe fn call_2_q_string(
    &self,
    s1: impl CastInto<Ref<QString>>,
    s2: impl CastInto<Ref<QString>>
) -> bool
[src]

Calls C++ function: bool QCollator::operator()(const QString& s1, const QString& s2) const.

pub unsafe fn call_2_q_string_view(
    &self,
    s1: impl CastInto<Ref<QStringView>>,
    s2: impl CastInto<Ref<QStringView>>
) -> bool
[src]

This is supported on cpp_lib_version="5.14.0" only.

Calls C++ function: bool QCollator::operator()(QStringView s1, QStringView s2) const.

pub unsafe fn case_sensitivity(&self) -> CaseSensitivity[src]

Returns case sensitivity of the collator.

Calls C++ function: Qt::CaseSensitivity QCollator::caseSensitivity() const.

C++ documentation:

Returns case sensitivity of the collator.

See also setCaseSensitivity().

pub unsafe fn compare_2_q_string(
    &self,
    s1: impl CastInto<Ref<QString>>,
    s2: impl CastInto<Ref<QString>>
) -> c_int
[src]

Compares s1 with s2. Returns an integer less than, equal to, or greater than zero depending on whether s1 is smaller, equal or larger than s2.

Calls C++ function: int QCollator::compare(const QString& s1, const QString& s2) const.

C++ documentation:

Compares s1 with s2. Returns an integer less than, equal to, or greater than zero depending on whether s1 is smaller, equal or larger than s2.

pub unsafe fn compare_2_q_string_ref(
    &self,
    s1: impl CastInto<Ref<QStringRef>>,
    s2: impl CastInto<Ref<QStringRef>>
) -> c_int
[src]

This is an overloaded function.

Calls C++ function: int QCollator::compare(const QStringRef& s1, const QStringRef& s2) const.

C++ documentation:

This is an overloaded function.

Compares s1 with s2. Returns an integer less than, equal to, or greater than zero depending on whether s1 is smaller, equal or larger than s2.

pub unsafe fn compare_q_char_int_q_char_int(
    &self,
    s1: impl CastInto<Ptr<QChar>>,
    len1: c_int,
    s2: impl CastInto<Ptr<QChar>>,
    len2: c_int
) -> c_int
[src]

This is an overloaded function.

Calls C++ function: int QCollator::compare(const QChar* s1, int len1, const QChar* s2, int len2) const.

C++ documentation:

This is an overloaded function.

Compares s1 with s2. len1 and len2 specify the length of the QChar arrays pointer to by s1 and s2.

Returns an integer less than, equal to, or greater than zero depending on whether s1 is smaller, equal or larger than s2.

pub unsafe fn compare_2_q_string_view(
    &self,
    s1: impl CastInto<Ref<QStringView>>,
    s2: impl CastInto<Ref<QStringView>>
) -> c_int
[src]

This is supported on cpp_lib_version="5.14.0" only.

Compares s1 with s2.

Calls C++ function: int QCollator::compare(QStringView s1, QStringView s2) const.

C++ documentation:

Compares s1 with s2.

Returns an integer less than, equal to, or greater than zero depending on whether s1 sorts before, with or after s2.

This function was introduced in Qt 5.13.

pub unsafe fn copy_from(
    &self,
    arg1: impl CastInto<Ref<QCollator>>
) -> Ref<QCollator>
[src]

Assigns other to this collator.

Calls C++ function: QCollator& QCollator::operator=(const QCollator& arg1).

C++ documentation:

Assigns other to this collator.

pub unsafe fn ignore_punctuation(&self) -> bool[src]

Returns true if punctuation characters and symbols are ignored when determining sort order.

Calls C++ function: bool QCollator::ignorePunctuation() const.

C++ documentation:

Returns true if punctuation characters and symbols are ignored when determining sort order.

See also setIgnorePunctuation().

pub unsafe fn locale(&self) -> CppBox<QLocale>[src]

Returns the locale of the collator.

Calls C++ function: QLocale QCollator::locale() const.

C++ documentation:

Returns the locale of the collator.

See also setLocale().

pub unsafe fn new_1a(locale: impl CastInto<Ref<QLocale>>) -> CppBox<QCollator>[src]

Constructs a QCollator from locale. If locale is not specified the system's default locale is used.

Calls C++ function: [constructor] void QCollator::QCollator(const QLocale& locale = …).

C++ documentation:

Constructs a QCollator from locale. If locale is not specified the system's default locale is used.

See also setLocale().

pub unsafe fn new_0a() -> CppBox<QCollator>[src]

The QCollator class compares strings according to a localized collation algorithm.

Calls C++ function: [constructor] void QCollator::QCollator().

C++ documentation:

The QCollator class compares strings according to a localized collation algorithm.

QCollator is initialized with a QLocale and an optional collation strategy. It tries to initialize the collator with the specified values. The collator can then be used to compare and sort strings in a locale dependent fashion.

A QCollator object can be used together with template based sorting algorithms such as std::sort to sort a list of QStrings.

In addition to the locale and collation strategy, several optional flags can be set that influence the result of the collation.

pub unsafe fn new_copy(arg1: impl CastInto<Ref<QCollator>>) -> CppBox<QCollator>[src]

Creates a copy of other.

Calls C++ function: [constructor] void QCollator::QCollator(const QCollator& arg1).

C++ documentation:

Creates a copy of other.

pub unsafe fn numeric_mode(&self) -> bool[src]

Returns true if numeric sorting is enabled, false otherwise.

Calls C++ function: bool QCollator::numericMode() const.

C++ documentation:

Returns true if numeric sorting is enabled, false otherwise.

See also setNumericMode().

pub unsafe fn set_case_sensitivity(&self, cs: CaseSensitivity)[src]

Sets the case sensitivity of the collator.

Calls C++ function: void QCollator::setCaseSensitivity(Qt::CaseSensitivity cs).

C++ documentation:

Sets the case sensitivity of the collator.

See also caseSensitivity().

pub unsafe fn set_ignore_punctuation(&self, on: bool)[src]

If on is set to true, punctuation characters and symbols are ignored when determining sort order.

Calls C++ function: void QCollator::setIgnorePunctuation(bool on).

C++ documentation:

If on is set to true, punctuation characters and symbols are ignored when determining sort order.

The default is locale dependent.

Note: This method is not currently supported if Qt is configured to not use ICU on Linux.

See also ignorePunctuation().

pub unsafe fn set_locale(&self, locale: impl CastInto<Ref<QLocale>>)[src]

Sets the locale of the collator to locale.

Calls C++ function: void QCollator::setLocale(const QLocale& locale).

C++ documentation:

Sets the locale of the collator to locale.

See also locale().

pub unsafe fn set_numeric_mode(&self, on: bool)[src]

Enables numeric sorting mode when on is set to true.

Calls C++ function: void QCollator::setNumericMode(bool on).

C++ documentation:

Enables numeric sorting mode when on is set to true.

This will enable proper sorting of numeric digits, so that e.g. 100 sorts after 99.

By default this mode is off.

Note: On Windows, this functionality makes use of the ICU library. If Qt was compiled without ICU support, it falls back to code using native Windows API, which only works from Windows 7 onwards. On older versions of Windows, it will not work and a warning will be emitted at runtime.

See also numericMode().

pub unsafe fn sort_key(
    &self,
    string: impl CastInto<Ref<QString>>
) -> CppBox<QCollatorSortKey>
[src]

Returns a sortKey for string.

Calls C++ function: QCollatorSortKey QCollator::sortKey(const QString& string) const.

C++ documentation:

Returns a sortKey for string.

Creating the sort key is usually somewhat slower, than using the compare() methods directly. But if the string is compared repeatedly (e.g. when sorting a whole list of strings), it's usually faster to create the sort keys for each string and then sort using the keys.

pub unsafe fn swap(&self, other: impl CastInto<Ref<QCollator>>)[src]

Swaps this collator with other. This function is very fast and never fails.

Calls C++ function: void QCollator::swap(QCollator& other).

C++ documentation:

Swaps this collator with other. This function is very fast and never fails.

Trait Implementations

impl CppDeletable for QCollator[src]

unsafe fn delete(&self)[src]

Destroys the collator.

Calls C++ function: [destructor] void QCollator::~QCollator().

C++ documentation:

Destroys the collator.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.