6.0.0-rc4Source

QPartialOrdering Class

The QPartialOrdering class represents the result of a comparison that allows for unordered results. More…

Header#include <QPartialOrdering>
CMaketarget_link_libraries(app PRIVATE Nt::Core)
ModuleNt Core C++ Classes

List of all members, including inherited members

Static Public Members

const QPartialOrderingLess
const QPartialOrderingEquivalent
const QPartialOrderingGreater
const QPartialOrderingUnordered

Detailed Description

A comparison of two values gives one of Less, Equivalent, Greater or Unordered; the last happens for values such as a NaN that have no order relative to anything. The result is compared with a literal 0, the same way as the result of std::partial_ordering:

QPartialOrdering order = compare(a, b);
if (order < 0)
    qDebug() << "a comes first";
else if (order == QPartialOrdering::Unordered)
    qDebug() << "a and b cannot be compared";

Every comparison against 0 is false for Unordered, except !=.

Differences from Qt

There are no conversions to and from std::partial_ordering, because Nt is built as C++17 and that type is C++20. The Qt::partial_ordering, Qt::weak_ordering and Qt::strong_ordering classes are not provided.

Member Variable Documentation

[static] const QPartialOrdering QPartialOrdering::Equivalent

The operands are equivalent.

[static] const QPartialOrdering QPartialOrdering::Greater

The left operand is ordered after the right one.

[static] const QPartialOrdering QPartialOrdering::Less

The left operand is ordered before the right one.

[static] const QPartialOrdering QPartialOrdering::Unordered

The operands have no order relative to each other.