QtCraft API C++ classes QML types Handbook

QcTidyTreeLayout Namespace

A tidy layout of a tree read from left to right (decision E-924; the advancement tree): a node's column is its depth, children follow their parent in one column further right in the order of their indices, and every parent stands halfway between its first and its last child. More...

Header: #include <clientcore/player/QcTidyTreeLayout.h>

Classes

struct Layout
struct Place

Functions

QcTidyTreeLayout::Layout layout(const QList<qsizetype> &parents, qsizetype root)

Detailed Description

Each subtree is pushed up against the ones before it as far as their outlines allow (the contours of Reingold and Tilford, without spreading the subtrees between), so two nodes in one column are always at least one row apart and a deep branch can sit beside the leaves of a shallow one. The result depends on the tree alone: the same parents give the same places.

Classes

class Layout

The places of a tree and its size. More...

class Place

Where a node of the tree stands. More...

Function Documentation

QcTidyTreeLayout::Layout QcTidyTreeLayout::layout(const QList<qsizetype> &parents, qsizetype root)

Returns the places of the tree below root; parents holds at i the index of node i's parent, -1 for a root. Indices outside the list and loops are not followed (each node is placed at most once).