HAL
hal::PlacementHint Class Reference

The PlacementHint class object provides hints for the layouter how new box objects are placed on a view. In standard mode placement is done using the most compact squere-like arrangement. Alternatively new box objects can be placed to the left or right to a node which serves as 'origin'. More...

#include <gui_def.h>

Collaboration diagram for hal::PlacementHint:
Collaboration graph

Public Types

enum  PlacementModeType { Standard = 0 , PreferLeft = 1 , PreferRight = 2 , GridPosition = 3 }
 The PlacementModeType enum either most compact arrangement (Standard) or to the left or right of given origin. More...
 

Public Member Functions

 PlacementHint (PlacementModeType mod=Standard, const Node &orign=Node())
 PlacementHint standard constructor. More...
 
 PlacementHint (const GridPlacement &gridPlc)
 PlacementHint constructor for grid placement. More...
 
PlacementModeType mode () const
 mode getter for placement mode type More...
 
Node preferredOrigin () const
 preferredOrigin getter for placement origin if any. More...
 
bool operator< (const PlacementHint &rhs) const
 operator < provide an order structure for placement hints More...
 
bool operator== (const PlacementHint &rhs) const
 operator == test whether two placement hints are equal More...
 
void addGridPosition (const Node &nd, const QPoint &p)
 
const QHash< Node, QPoint > & gridPosition () const
 

Detailed Description

The PlacementHint class object provides hints for the layouter how new box objects are placed on a view. In standard mode placement is done using the most compact squere-like arrangement. Alternatively new box objects can be placed to the left or right to a node which serves as 'origin'.

Definition at line 195 of file gui_def.h.

Member Enumeration Documentation

◆ PlacementModeType

The PlacementModeType enum either most compact arrangement (Standard) or to the left or right of given origin.

Enumerator
Standard 
PreferLeft 
PreferRight 
GridPosition 

Definition at line 202 of file gui_def.h.

Constructor & Destructor Documentation

◆ PlacementHint() [1/2]

hal::PlacementHint::PlacementHint ( PlacementModeType  mod = Standard,
const Node orign = Node() 
)
inline

PlacementHint standard constructor.

Parameters
modplacement mode must be either Standard or PreferLeft or PreferRight
orignnode to start from when PreferLeft or PreferRight are set

Definition at line 209 of file gui_def.h.

◆ PlacementHint() [2/2]

hal::PlacementHint::PlacementHint ( const GridPlacement gridPlc)
inline

PlacementHint constructor for grid placement.

Parameters
gridPlcHash node to position

Definition at line 216 of file gui_def.h.

Member Function Documentation

◆ addGridPosition()

void hal::PlacementHint::addGridPosition ( const Node nd,
const QPoint p 
)
inline

Assigns a given node the given position. Stores it internally.

Parameters
nd- The node.
p- The position

Definition at line 263 of file gui_def.h.

References QHash::insert().

Referenced by hal::ActionFoldModule::exec(), hal::ActionRemoveItemsFromObject::exec(), hal::ActionUnfoldModule::exec(), hal::GraphContextManager::openNetEndpointsInView(), and hal::GraphContext::unfoldModule().

◆ gridPosition()

const QHash<Node,QPoint>& hal::PlacementHint::gridPosition ( ) const
inline

Get the data structure containing the node - position assignments.

Returns
The QHash that maps nodes to positions.

Definition at line 273 of file gui_def.h.

Referenced by hal::StandardGraphLayouter::add(), and hal::ActionAddItemsToObject::writeToXml().

◆ mode()

PlacementModeType hal::PlacementHint::mode ( ) const
inline

mode getter for placement mode type

Returns
either Standard or PreferLeft or PreferRight

Definition at line 223 of file gui_def.h.

Referenced by hal::GraphContext::add(), hal::StandardGraphLayouter::add(), hal::GraphContext::unfoldModule(), and hal::ActionAddItemsToObject::writeToXml().

◆ operator<()

bool hal::PlacementHint::operator< ( const PlacementHint rhs) const
inline

operator < provide an order structure for placement hints

Parameters
rhsthe other placement hint to compare with
Returns
true if placement hint is 'smaller' according to test

Definition at line 238 of file gui_def.h.

◆ operator==()

bool hal::PlacementHint::operator== ( const PlacementHint rhs) const
inline

operator == test whether two placement hints are equal

Parameters
rhsthe other placement hint to compare with
Returns
true if placement hints have same placement mode type and origin

Definition at line 252 of file gui_def.h.

◆ preferredOrigin()

Node hal::PlacementHint::preferredOrigin ( ) const
inline

preferredOrigin getter for placement origin if any.

Returns
the Node object

It can be tested by preferredOrigin().isNull if no origin has been set.

Definition at line 231 of file gui_def.h.

Referenced by hal::StandardGraphLayouter::add(), and hal::ActionAddItemsToObject::writeToXml().


The documentation for this class was generated from the following file: