| qgraph_p.h |
!
\internal
If there is an edge between \a first and \a second, it will return a structure
containing the data associated with the edge, otherwise it will return 0.
|
7414 |
- |
| qgraphicsanchorlayout.cpp |
!
\class QGraphicsAnchorLayout
\brief The QGraphicsAnchorLayout class provides a layout where one can anchor widgets
together in Graphics View.
\since 4.6
\ingroup appearance
\ingroup geomanagement
\ingroup graphicsview-api
\inmodule QtWidgets
The anchor layout allows developers to specify how widgets should be placed relative to
each other, and to the layout itself. The specification is made by adding anchors to the
layout by calling addAnchor(), addAnchors() or addCornerAnchors().
Existing anchors in the layout can be accessed with the anchor() function.
Items that are anchored are automatically added to the layout, and if items
are removed, all their anchors will be automatically removed.
\div {class="float-left"}
\inlineimage simpleanchorlayout-example.png
{Three widgets using anchor layout to align to the widget edges}
\caption Using an anchor layout to align simple colored widgets.
\enddiv
Anchors are always set up between edges of an item, where the "center" is also considered to
be an edge. Consider the following example:
\snippet graphicsview/simpleanchorlayout/main.cpp adding anchors
Here, the right edge of item \c a is anchored to the left edge of item \c b and the bottom
edge of item \c a is anchored to the top edge of item \c b, with the result that
item \c b will be placed diagonally to the right and below item \c b.
The addCornerAnchors() function provides a simpler way of anchoring the corners
of two widgets than the two individual calls to addAnchor() shown in the code
above. Here, we see how a widget can be anchored to the top-left corner of the enclosing
layout:
\snippet graphicsview/simpleanchorlayout/main.cpp adding a corner anchor
In cases where anchors are used to match the widths or heights of widgets, it is
convenient to use the addAnchors() function. As with the other functions for specifying
anchors, it can also be used to anchor a widget to a layout.
\section1 Size Hints and Size Policies in an Anchor Layout
QGraphicsAnchorLayout respects each item's size hints and size policies.
Note that there are some properties of QSizePolicy that are \l{Known issues}{not respected}.
\section1 Spacing within an Anchor Layout
The layout may distribute some space between the items. If the spacing has not been
explicitly specified, the actual amount of space will usually be 0.
However, if the first edge is the \e opposite of the second edge (e.g., the right edge
of the first widget is anchored to the left edge of the second widget), the size of the
anchor will be queried from the style through a pixel metric:
\l{QStyle::}{PM_LayoutHorizontalSpacing} for horizontal anchors and
\l{QStyle::}{PM_LayoutVerticalSpacing} for vertical anchors.
If the spacing is negative, the items will overlap to some extent.
\section1 Known Issues
There are some features that QGraphicsAnchorLayout currently does not support.
This might change in the future, so avoid using these features if you want to
avoid any future regressions in behaviour:
\list
\li Stretch factors are not respected.
\li QSizePolicy::ExpandFlag is not respected.
\li Height for width is not respected.
\endlist
\sa QGraphicsLinearLayout, QGraphicsGridLayout, QGraphicsLayout
|
16850 |
- |
| qgraphicsanchorlayout.h |
|
2708 |
- |
| qgraphicsanchorlayout_p.cpp |
|
107556 |
- |
| qgraphicsanchorlayout_p.h |
The public QGraphicsAnchorLayout interface represents an anchorage point
as a pair of a <QGraphicsLayoutItem *> and a <Qt::AnchorPoint>.
Internally though, it has a graph of anchorage points (vertices) and
anchors (edges), represented by the AnchorVertex and AnchorData structs
respectively.
|
18513 |
- |
| qgraphicsgridlayout.cpp |
!
\class QGraphicsGridLayout
\brief The QGraphicsGridLayout class provides a grid layout for managing
widgets in Graphics View.
\since 4.4
\ingroup graphicsview-api
\inmodule QtWidgets
The most common way to use QGraphicsGridLayout is to construct an object
on the heap, passing a parent widget to the constructor, then add widgets
and layouts by calling addItem(). QGraphicsGridLayout automatically computes
the dimensions of the grid as you add items.
\snippet code/src_gui_graphicsview_qgraphicsgridlayout.cpp 0
Alternatively, if you do not pass a parent widget to the layout's constructor,
you will need to call QGraphicsWidget::setLayout() to set this layout as the
top-level layout for that widget, the widget will take ownership of the layout.
The layout takes ownership of the items. In some cases when the layout
item also inherits from QGraphicsItem (such as QGraphicsWidget) there will be a
ambiguity in ownership because the layout item belongs to two ownership hierarchies.
See the documentation of QGraphicsLayoutItem::setOwnedByLayout() how to handle
this.
You can access each item in the layout by calling count() and itemAt(). Calling
removeAt() will remove an item from the layout, without
destroying it.
\section1 Size Hints and Size Policies in QGraphicsGridLayout
QGraphicsGridLayout respects each item's size hints and size policies,
and when a cell in the grid has more space than the items can fill, each item
is arranged according to the layout's alignment for that item. You can set
an alignment for each item by calling setAlignment(), and check the
alignment for any item by calling alignment(). You can also set the alignment
for an entire row or column by calling setRowAlignment() and setColumnAlignment()
respectively. By default, items are aligned to the top left.
\sa QGraphicsLinearLayout, QGraphicsWidget
|
18582 |
- |
| qgraphicsgridlayout.h |
|
3422 |
- |
| qgraphicsgridlayoutengine.cpp |
returns \c true if the size policy returns \c true for either hasHeightForWidth()
or hasWidthForHeight()
|
2438 |
- |
| qgraphicsgridlayoutengine_p.h |
|
3369 |
- |
| qgraphicsitem.cpp |
|
372257 |
- |
| qgraphicsitem.h |
|
37675 |
- |
| qgraphicsitem_p.h |
|
22660 |
- |
| qgraphicsitemanimation.cpp |
!
\class QGraphicsItemAnimation
\brief The QGraphicsItemAnimation class provides simple animation
support for QGraphicsItem.
\since 4.2
\ingroup graphicsview-api
\inmodule QtWidgets
\deprecated
The QGraphicsItemAnimation class animates a QGraphicsItem. You can
schedule changes to the item's transformation matrix at
specified steps. The QGraphicsItemAnimation class has a
current step value. When this value changes the transformations
scheduled at that step are performed. The current step of the
animation is set with the \c setStep() function.
QGraphicsItemAnimation will do a simple linear interpolation
between the nearest adjacent scheduled changes to calculate the
matrix. For instance, if you set the position of an item at values
0.0 and 1.0, the animation will show the item moving in a straight
line between these positions. The same is true for scaling and
rotation.
It is usual to use the class with a QTimeLine. The timeline's
\l{QTimeLine::}{valueChanged()} signal is then connected to the
\c setStep() slot. For example, you can set up an item for rotation
by calling \c setRotationAt() for different step values.
The animations timeline is set with the setTimeLine() function.
An example animation with a timeline follows:
\snippet timeline/main.cpp 0
Note that steps lie between 0.0 and 1.0. It may be necessary to use
\l{QTimeLine::}{setUpdateInterval()}. The default update interval
is 40 ms. A scheduled transformation cannot be removed when set,
so scheduling several transformations of the same kind (e.g.,
rotations) at the same step is not recommended.
\sa QTimeLine, {Graphics View Framework}
|
15950 |
- |
| qgraphicsitemanimation.h |
|
2071 |
- |
| qgraphicslayout.cpp |
|
18446 |
- |
| qgraphicslayout.h |
|
1608 |
- |
| qgraphicslayout_p.cpp |
!
\internal
\a mw is the new parent. all items in the layout will be a child of \a mw.
|
5485 |
- |
| qgraphicslayout_p.h |
|
3431 |
- |
| qgraphicslayoutitem.cpp |
COMBINE_SIZE() is identical to combineSize(), except that it
doesn't evaluate 'size' unless necessary.
|
28217 |
- |
| qgraphicslayoutitem.h |
|
3965 |
- |
| qgraphicslayoutitem_p.h |
|
2068 |
- |
| qgraphicslayoutstyleinfo.cpp |
|
2929 |
- |
| qgraphicslayoutstyleinfo_p.h |
|
1974 |
- |
| qgraphicslinearlayout.cpp |
!
\class QGraphicsLinearLayout
\brief The QGraphicsLinearLayout class provides a horizontal or vertical
layout for managing widgets in Graphics View.
\since 4.4
\ingroup graphicsview-api
\inmodule QtWidgets
The default orientation for a linear layout is Qt::Horizontal. You can
choose a vertical orientation either by calling setOrientation(), or by
passing Qt::Vertical to QGraphicsLinearLayout's constructor.
The most common way to use QGraphicsLinearLayout is to construct an object
on the heap, passing a parent widget to the constructor, then add widgets
and layouts by calling addItem().
\snippet code/src_gui_graphicsview_qgraphicslinearlayout.cpp 0
Alternatively, if you do not pass a parent widget to the layout's constructor,
you will need to call QGraphicsWidget::setLayout() to set this layout as the
top-level layout for that widget, the widget will take ownership of
the layout.
You can add widgets, layouts, stretches (addStretch(), insertStretch() or
setStretchFactor()), and spacings (setItemSpacing()) to a linear
layout. The layout takes ownership of the items. In some cases when the layout
item also inherits from QGraphicsItem (such as QGraphicsWidget) there will be a
ambiguity in ownership because the layout item belongs to two ownership hierarchies.
See the documentation of QGraphicsLayoutItem::setOwnedByLayout() how to handle
this.
You can access each item in the layout by calling count() and itemAt(). Calling
removeAt() or removeItem() will remove an item from the layout, without
destroying it.
\section1 Size Hints and Size Policies in QGraphicsLinearLayout
QGraphicsLinearLayout respects each item's size hints and size policies,
and when the layout contains more space than the items can fill, each item
is arranged according to the layout's alignment for that item. You can set
an alignment for each item by calling setAlignment(), and check the
alignment for any item by calling alignment(). By default, items are
aligned to the top left.
\section1 Spacing within QGraphicsLinearLayout
Between the items, the layout distributes some space. The actual amount of
space depends on the managed widget's current style, but the common
spacing is 4. You can also set your own spacing by calling setSpacing(),
and get the current spacing value by calling spacing(). If you want to
configure individual spacing for your items, you can call setItemSpacing().
\section1 Stretch Factor in QGraphicsLinearLayout
You can assign a stretch factor to each item to control how much space it
will get compared to the other items. By default, two identical widgets
arranged in a linear layout will have the same size, but if the first
widget has a stretch factor of 1 and the second widget has a stretch
factor of 2, the first widget will get 1/3 of the available space, and the
second will get 2/3.
QGraphicsLinearLayout calculates the distribution of sizes by adding up
the stretch factors of all items, and then dividing the available space
accordingly. The default stretch factor is 0 for all items; a factor of 0
means the item does not have any defined stretch factor; effectively this
is the same as setting the stretch factor to 1. The stretch factor only
applies to the available space in the lengthwise direction of the layout
(following its orientation). If you want to control both the item's
horizontal and vertical stretch, you can use QGraphicsGridLayout instead.
\section1 QGraphicsLinearLayout Compared to Other Layouts
QGraphicsLinearLayout is very similar to QVBoxLayout and QHBoxLayout, but
in contrast to these classes, it is used to manage QGraphicsWidget and
QGraphicsLayout instead of QWidget and QLayout.
\sa QGraphicsGridLayout, QGraphicsWidget
|
16707 |
- |
| qgraphicslinearlayout.h |
|
2159 |
- |
| qgraphicsproxywidget.cpp |
|
54645 |
- |
| qgraphicsproxywidget.h |
|
3398 |
- |
| qgraphicsproxywidget_p.h |
|
2306 |
- |
| qgraphicsscene.cpp |
|
247800 |
- |
| qgraphicsscene.h |
|
11626 |
- |
| qgraphicsscene_bsp.cpp |
|
6415 |
- |
| qgraphicsscene_bsp_p.h |
|
1998 |
- |
| qgraphicsscene_p.h |
|
12711 |
- |
| qgraphicsscenebsptreeindex.cpp |
!
\class QGraphicsSceneBspTreeIndex
\brief The QGraphicsSceneBspTreeIndex class provides an implementation of
a BSP indexing algorithm for discovering items in QGraphicsScene.
\since 4.6
\ingroup graphicsview-api
\internal
QGraphicsSceneBspTreeIndex index use a BSP(Binary Space Partitioning)
implementation to discover items quickly. This implementation is
very efficient for static scenes. It has a depth that you can set.
The depth directly affects performance and memory usage; the latter
growing exponentially with the depth of the tree. With an optimal tree
depth, the index can instantly determine the locality of items, even
for scenes with thousands or millions of items. This also greatly improves
rendering performance.
By default, the depth value is 0, in which case Qt will guess a reasonable
default depth based on the size, location and number of items in the
scene. If these parameters change frequently, however, you may experience
slowdowns as the index retunes the depth internally. You can avoid
potential slowdowns by fixating the tree depth through setting this
property.
The depth of the tree and the size of the scene rectangle decide the
granularity of the scene's partitioning. The size of each scene segment is
determined by the following algorithm:
The BSP tree has an optimal size when each segment contains between 0 and
10 items.
\sa QGraphicsScene, QGraphicsView, QGraphicsSceneIndex
|
23636 |
- |
| qgraphicsscenebsptreeindex_p.h |
|
4855 |
- |
| qgraphicssceneevent.cpp |
!
\class QGraphicsSceneEvent
\brief The QGraphicsSceneEvent class provides a base class for all
graphics view related events.
\since 4.2
\ingroup graphicsview-api
\inmodule QtWidgets
When a QGraphicsView receives Qt mouse, keyboard, and drag and
drop events (QMouseEvent, QKeyEvent, QDragEvent, etc.), it
translates them into instances of QGraphicsSceneEvent subclasses
and forwards them to the QGraphicsScene it displays. The scene
then forwards the events to the relevant items.
For example, when a QGraphicsView receives a QMouseEvent of type
MousePress as a response to a user click, the view sends a
QGraphicsSceneMouseEvent of type GraphicsSceneMousePress to the
underlying QGraphicsScene through its
\l{QGraphicsScene::}{mousePressEvent()} function. The default
QGraphicsScene::mousePressEvent() implementation determines which
item was clicked and forwards the event to
QGraphicsItem::mousePressEvent().
\omit ### Beskrive widget() \endomit
Subclasses such as QGraphicsSceneMouseEvent and
QGraphicsSceneContextMenuEvent provide the coordinates from the
original QEvent in screen, scene, and item coordinates (see
\l{QGraphicsSceneMouseEvent::}{screenPos()},
\l{QGraphicsSceneMouseEvent::}{scenePos()}, and
\l{QGraphicsSceneMouseEvent::}{pos()}). The item coordinates are
set by the QGraphicsScene before it forwards the event to the
event to a QGraphicsItem. The mouse events also add the
possibility to retrieve the coordinates from the last event
received by the view (see
\l{QGraphicsSceneMouseEvent::}{lastScreenPos()},
\l{QGraphicsSceneMouseEvent::}{lastScenePos()}, and
\l{QGraphicsSceneMouseEvent::}{lastPos()}).
\sa QEvent
|
46166 |
- |
| qgraphicssceneevent.h |
|
8132 |
- |
| qgraphicssceneindex.cpp |
!
\class QGraphicsSceneIndex
\brief The QGraphicsSceneIndex class provides a base class to implement
a custom indexing algorithm for discovering items in QGraphicsScene.
\since 4.6
\ingroup graphicsview-api
\internal
The QGraphicsSceneIndex class provides a base class to implement
a custom indexing algorithm for discovering items in QGraphicsScene. You
need to subclass it and reimplement addItem, removeItem, estimateItems
and items in order to have an functional indexing.
\sa QGraphicsScene, QGraphicsView
|
23480 |
- |
| qgraphicssceneindex_p.h |
|
5255 |
- |
| qgraphicsscenelinearindex.cpp |
!
\class QGraphicsSceneLinearIndex
\brief The QGraphicsSceneLinearIndex class provides an implementation of
a linear indexing algorithm for discovering items in QGraphicsScene.
\since 4.6
\ingroup graphicsview-api
\internal
QGraphicsSceneLinearIndex index is default linear implementation to discover items.
It basically store all items in a list and return them to the scene.
\sa QGraphicsScene, QGraphicsView, QGraphicsSceneIndex, QGraphicsSceneBspTreeIndex
|
1773 |
- |
| qgraphicsscenelinearindex_p.h |
|
2299 |
- |
| qgraphicstransform.cpp |
!
\class QGraphicsTransform
\brief The QGraphicsTransform class is an abstract base class for building
advanced transformations on QGraphicsItems.
\since 4.6
\ingroup graphicsview-api
\inmodule QtWidgets
As an alternative to QGraphicsItem::transform, QGraphicsTransform lets you
create and control advanced transformations that can be configured
independently using specialized properties.
QGraphicsItem allows you to assign any number of QGraphicsTransform
instances to one QGraphicsItem. Each QGraphicsTransform is applied in
order, one at a time, to the QGraphicsItem it's assigned to.
QGraphicsTransform is particularly useful for animations. Whereas
QGraphicsItem::setTransform() lets you assign any transform directly to an
item, there is no direct way to interpolate between two different
transformations (e.g., when transitioning between two states, each for
which the item has a different arbitrary transform assigned). Using
QGraphicsTransform you can interpolate the property values of each
independent transformation. The resulting operation is then combined into a
single transform which is applied to QGraphicsItem.
Transformations are computed in true 3D space using QMatrix4x4.
When the transformation is applied to a QGraphicsItem, it will be
projected back to a 2D QTransform. When multiple QGraphicsTransform
objects are applied to a QGraphicsItem, all of the transformations
are computed in true 3D space, with the projection back to 2D
only occurring after the last QGraphicsTransform is applied.
The exception to this is QGraphicsRotation, which projects back to
2D after each rotation to preserve the perspective effect around
the X and Y axes.
If you want to create your own configurable transformation, you can create
a subclass of QGraphicsTransform (or any or the existing subclasses), and
reimplement the pure virtual applyTo() function, which takes a pointer to a
QMatrix4x4. Each operation you would like to apply should be exposed as
properties (e.g., customTransform->setVerticalShear(2.5)). Inside you
reimplementation of applyTo(), you can modify the provided transform
respectively.
QGraphicsTransform can be used together with QGraphicsItem::setTransform(),
QGraphicsItem::setRotation(), and QGraphicsItem::setScale().
\sa QGraphicsItem::transform(), QGraphicsScale, QGraphicsRotation
|
15533 |
- |
| qgraphicstransform.h |
|
2867 |
- |
| qgraphicstransform_p.h |
|
1053 |
- |
| qgraphicsview.cpp |
|
136465 |
- |
| qgraphicsview.h |
|
11369 |
- |
| qgraphicsview_p.h |
|
6041 |
- |
| qgraphicswidget.cpp |
|
79517 |
- |
| qgraphicswidget.h |
|
7923 |
- |
| qgraphicswidget_p.cpp |
!
\internal
|
29622 |
- |
| qgraphicswidget_p.h |
|
5285 |
- |
| qsimplex_p.cpp |
!
\internal
\class QSimplex
The QSimplex class is a Linear Programming problem solver based on the two-phase
simplex method.
It takes a set of QSimplexConstraints as its restrictive constraints and an
additional QSimplexConstraint as its objective function. Then methods to maximize
and minimize the problem solution are provided.
The two-phase simplex method is based on the following steps:
First phase:
1.a) Modify the original, complex, and possibly not feasible problem, into a new,
easy to solve problem.
1.b) Set as the objective of the new problem, a feasible solution for the original
complex problem.
1.c) Run simplex to optimize the modified problem and check whether a solution for
the original problem exists.
Second phase:
2.a) Go back to the original problem with the feasibl (but not optimal) solution
found in the first phase.
2.b) Set the original objective.
3.c) Run simplex to optimize the original problem towards its optimal solution.
|
18462 |
- |
| qsimplex_p.h |
!
\internal
Representation of a LP constraint like:
(c1 * X1) + (c2 * X2) + ... = K
or <= K
or >= K
Where (ci, Xi) are the pairs in "variables" and K the real "constant".
|
4502 |
- |