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 |
Public Member Functions inherited from QGraphicsLayout | |
QGraphicsLayout (QGraphicsLayoutItem *parent) | |
~QGraphicsLayout () | |
void | activate () |
virtual int | count () const =0 |
virtual void | getContentsMargins (qreal *left, qreal *top, qreal *right, qreal *bottom) const |
virtual void | invalidate () |
bool | isActivated () const |
virtual QGraphicsLayoutItem * | itemAt (int i) const =0 |
virtual void | removeAt (int index)=0 |
void | setContentsMargins (qreal left, qreal top, qreal right, qreal bottom) |
virtual void | updateGeometry () |
virtual void | widgetEvent (QEvent *e) |
Public Member Functions inherited from QGraphicsLayoutItem | |
QGraphicsLayoutItem (QGraphicsLayoutItem *parent, bool isLayout) | |
virtual | ~QGraphicsLayoutItem () |
QRectF | contentsRect () const |
QSizeF | effectiveSizeHint (Qt::SizeHint which, const QSizeF &constraint) const |
QRectF | geometry () const |
QGraphicsItem * | graphicsItem () const |
bool | isLayout () const |
qreal | maximumHeight () const |
QSizeF | maximumSize () const |
qreal | maximumWidth () const |
qreal | minimumHeight () const |
QSizeF | minimumSize () const |
qreal | minimumWidth () const |
bool | ownedByLayout () const |
QGraphicsLayoutItem * | parentLayoutItem () const |
qreal | preferredHeight () const |
QSizeF | preferredSize () const |
qreal | preferredWidth () const |
void | setMaximumHeight (qreal height) |
void | setMaximumSize (const QSizeF &size) |
void | setMaximumSize (qreal w, qreal h) |
void | setMaximumWidth (qreal width) |
void | setMinimumHeight (qreal height) |
void | setMinimumSize (const QSizeF &size) |
void | setMinimumSize (qreal w, qreal h) |
void | setMinimumWidth (qreal width) |
void | setParentLayoutItem (QGraphicsLayoutItem *parent) |
void | setPreferredHeight (qreal height) |
void | setPreferredSize (const QSizeF &size) |
void | setPreferredSize (qreal w, qreal h) |
void | setPreferredWidth (qreal width) |
void | setSizePolicy (const QSizePolicy &policy) |
void | setSizePolicy (QSizePolicy::Policy hPolicy, QSizePolicy::Policy vPolicy, QSizePolicy::ControlType controlType) |
QSizePolicy | sizePolicy () const |
Additional Inherited Members | |
Static Public Member Functions inherited from QGraphicsLayout | |
bool | instantInvalidatePropagation () |
void | setInstantInvalidatePropagation (bool enable) |
Protected Member Functions inherited from QGraphicsLayout | |
void | addChildLayoutItem (QGraphicsLayoutItem *layoutItem) |
Protected Member Functions inherited from QGraphicsLayoutItem | |
void | setGraphicsItem (QGraphicsItem *item) |
void | setOwnedByLayout (bool ownership) |
virtual QSizeF | sizeHint (Qt::SizeHint which, const QSizeF &constraint) const =0 |
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.
|
virtual |
Reimplemented from QGraphicsLayoutItem.
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-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:43:01 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.