QSortPolicy Class | Qt 3D 5.12.6

Qt 5.12 | Qt 3D | C++ Classes | QSortPolicy

Qt 5.12.6 Reference Documentation

# QSortPolicy Class

(Qt3DRender::QSortPolicy)

Provides storage for the sort types to be used. More...

Header: | #include <QSortPolicy>
qmake: | QT += 3drender
Since: | Qt 5.7
Instantiated By: | SortPolicy
Inherits: | Qt3DRender::QFrameGraphNode

- List of all members, including inherited members
- Obsolete members

## Public Types

enum | SortType { StateChangeCost, BackToFront, Material, FrontToBack }

## Properties

- sortTypes : QVector<int>

- 3 properties inherited from Qt3DCore::QNode
- 1 property inherited from QObject

## Public Functions

| QSortPolicy(Qt3DCore::QNode *parent = nullptr)
QVector<Qt3DRender::QSortPolicy::SortType> | sortTypes() const
QVector<int> | sortTypesInt() const

- 1 public function inherited from Qt3DRender::QFrameGraphNode
- 13 public functions inherited from Qt3DCore::QNode
- 31 public functions inherited from QObject

## Public Slots

void | setSortTypes(const QVector<Qt3DRender::QSortPolicy::SortType> &sortTypes)
void | setSortTypes(const QVector<int> &sortTypesInt)

- 3 public slots inherited from Qt3DCore::QNode
- 1 public slot inherited from QObject

## Signals

void | sortTypesChanged(const QVector<Qt3DRender::QSortPolicy::SortType> &sortTypes)
void | sortTypesChanged(const QVector<int> &sortTypes)

- 4 signals inherited from Qt3DCore::QNode
- 2 signals inherited from QObject

## Static Public Members

const QMetaObject | staticMetaObject

- 9 static public members inherited from QObject

### Additional Inherited Members

- 1 protected function inherited from Qt3DRender::QFrameGraphNode
- 2 protected functions inherited from Qt3DCore::QNode
- 9 protected functions inherited from QObject

## Detailed Description

Provides storage for the sort types to be used.

A Qt3DRender::QSortPolicy class stores the sorting type used by the FrameGraph. The sort types determine how drawable entities are sorted before drawing to determine the drawing order. When QSortPolicy is present in the FrameGraph, the sorting mechanism is determined by the sortTypes list. Multiple sort types can be used simultaneously. If QSortPolicy is not present in the FrameGraph, entities are drawn in the order they appear in the entity hierarchy.

## Member Type Documentation

### enum QSortPolicy::SortType

This enum type describes the available sort types.

Constant | Value | Description
--- | --- | ---
`Qt3DRender::QSortPolicy::StateChangeCost` | `(1 << 0)` | sort the objects so as to minimize the cost of changing from the currently rendered state
`Qt3DRender::QSortPolicy::BackToFront` | `(1 << 1)` | sort the objects from back to front based on inverted z order. More accurately, the sorting key is the z component of the projection of the camera-to-object-center vector onto the camera's view vector.
`Qt3DRender::QSortPolicy::Material` | `(1 << 2)` | sort the objects based on their material value
`Qt3DRender::QSortPolicy::FrontToBack` | `(1 << 3)` | sort the objects from front to back. The opposite of BackToFront.

## Property Documentation

### sortTypes : QVector<int>

Specifies the sorting types to be used.

Access functions:

QVector<int> | sortTypesInt() const
void | setSortTypes(const QVector<Qt3DRender::QSortPolicy::SortType> &sortTypes)
void | setSortTypes(const QVector<int> &sortTypesInt)

Notifier signal:

void | sortTypesChanged(const QVector<Qt3DRender::QSortPolicy::SortType> &sortTypes)
void | sortTypesChanged(const QVector<int> &sortTypes)

## Member Function Documentation

### QSortPolicy::QSortPolicy(Qt3DCore::QNode *parent = nullptr)

Constructs QSortPolicy with given parent.

### QVector<Qt3DRender::QSortPolicy::SortType> QSortPolicy::sortTypes() const

Returns the current sort types in use

See also setSortTypes().