liblancelot
#include <NodeLayout.h>
Classes | |
class | NodeCoordinate |
Public Member Functions | |
NodeLayout (QGraphicsLayoutItem *parent=0) | |
virtual | ~NodeLayout () |
void | addItem (QGraphicsLayoutItem *item) |
void | addItem (QGraphicsLayoutItem *item, NodeCoordinate topLeft, NodeCoordinate bottomRight) |
void | addItem (QGraphicsLayoutItem *item, NodeCoordinate node, qreal xr=0, qreal yr=0) |
L_Override int | count () const |
L_Override QGraphicsLayoutItem * | itemAt (int i) const |
L_Override void | removeAt (int index) |
L_Override void | setGeometry (const QRectF &rect) |
L_Override QSizeF | sizeHint (Qt::SizeHint which, const QSizeF &constraint=QSizeF()) const |
Detailed Description
Node layout has an advanced layouting mechanism.
Every item's position is defined by two nodes - one for top-left corner, and the other one for bottom-right corner.
Each node is defined by a pair of relative (xr, yr) and a pair of absolute (xa, ya) coordinates. The calculated node coordinates depend on the size and position of the NodeLayout object in the following manner: x = layoutLeft + (xr * layoutWidth) + xa y = layoutTop + (yr * layoutHeight) + ya
Alternatively, the item's position can be defined by using one node and one pair of relative coordinates (xr, yr). In that case, the item is sized following the sizeHint(). The relative coordinates (this time they are relative to the item's geometry, not the layout's) specify what point of the item will be bound to the defined node.
Definition at line 51 of file NodeLayout.h.
Constructor & Destructor Documentation
|
explicit |
Creates a new Lancelot::NodeLayout.
- Parameters
-
parent parent layout item
Definition at line 179 of file NodeLayout.cpp.
|
virtual |
Destroys this Lancelot::NodeLayout.
Definition at line 184 of file NodeLayout.cpp.
Member Function Documentation
void Lancelot::NodeLayout::addItem | ( | QGraphicsLayoutItem * | item | ) |
Adds item at top-left corner, with automatic sizing (using sizeHint of the item)
Definition at line 209 of file NodeLayout.cpp.
void Lancelot::NodeLayout::addItem | ( | QGraphicsLayoutItem * | item, |
NodeCoordinate | topLeft, | ||
NodeCoordinate | bottomRight | ||
) |
Adds item with specified top-left and bottom right corners.
Definition at line 214 of file NodeLayout.cpp.
void Lancelot::NodeLayout::addItem | ( | QGraphicsLayoutItem * | item, |
NodeCoordinate | node, | ||
qreal | xr = 0 , |
||
qreal | yr = 0 |
||
) |
Adds item with automatic sizing turned on.
xr and yr specify which point of the item is bound to node coordinate. Those are relative coordinates so (0, 0) represent top left corner, (0.5, 0.5) represent the center of the item etc.
Definition at line 225 of file NodeLayout.cpp.
int Lancelot::NodeLayout::count | ( | ) | const |
Definition at line 237 of file NodeLayout.cpp.
QGraphicsLayoutItem * Lancelot::NodeLayout::itemAt | ( | int | i | ) | const |
Definition at line 242 of file NodeLayout.cpp.
void Lancelot::NodeLayout::removeAt | ( | int | index | ) |
Definition at line 251 of file NodeLayout.cpp.
void Lancelot::NodeLayout::setGeometry | ( | const QRectF & | rect | ) |
Definition at line 260 of file NodeLayout.cpp.
QSizeF Lancelot::NodeLayout::sizeHint | ( | Qt::SizeHint | which, |
const QSizeF & | constraint = QSizeF() |
||
) | const |
Definition at line 189 of file NodeLayout.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Mon Oct 13 2014 22:55:07 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.