summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsanchorlayout.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove warning. (Forgot to commit this together with my previous commits)Jan-Arve Sæther2009-11-131-1/+1
|
* QGAL: Move size information from AnchorData to QGraphicsAnchorPrivateEduardo M. Fleury2009-11-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To solve the spacing persistency bug, this commit saves the preferredSize (spacing) information inside QGraphicsAnchorPrivate. The problem started when we could not rely on "AnchorData->prefSize" to keep the spacing information for user-defined anchors. This happens because that member can be overriden if the spacing is negative (anchor is inverted) or its sizePolicy is of type "Ignored" (it is overriden by minSize). Then, to decide where to store it, we aimed to make something similar to what happens with item-internal anchors. Those can rely on their items to get fresh information regarding their size, so we decided that user-anchors (that don't have items, but do have QGraphicsAnchors) could read such information from there. This refactory also reduced the deep indirection that existed in the "QGraphicsAnchor->setSpacing" call. Previously it would call internal layout methods to do some black magic, that's now gone. As the spacing information is now stored in the anchor itself, it can do pretty much all the work and, after that, just invalidate the layout. Also, moved information like "AnchorData->hasSize" to QGAnchor as its pretty much related to the preferredSize information itself. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
* Group the spacing functions together, and add a sizePolicy property.Jan-Arve Sæther2009-10-211-1/+2
| | | | Improve the documentation for size policy.
* API addition: Make it possible to set the size policy of an anchor.Jan-Arve Sæther2009-10-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | After this commit, when you modify the spacing of an anchor you are effectively modifying the preferred size of the anchor, since all anchors (except internal ones) have their minimumSizeHint to 0 and maximumSizeHint to QWIDGETSIZE_MAX. I also changed the sizeHintsFromItem to be more generic so that I could use it for anchors. (Thus, it was renamed to "internalSizeHints"). It now only takes care of setting the min/pref/exp/maxSize of AnchorData based on the anchor/item size hint and their size policies. As a consequence of all of this, setFixedSize changed behaviour and became setPreferredSize (since setSpacing is basically setPreferredSize). The implementation of that now only sets the prefSize. The patch also has an unrelated fix for IgnoreFlag, where it will (again) return the minimumSize for sizeHint(Qt::PreferredSize) instead of the maximumSize. This was to be more consistent with qgridlayoutengine.cpp. The docs are not very clear on this behaviour unfortunately. This API change has been discussed. Reviewed-by: alexis
* Doc: silence more qdoc warnings.Volker Hilsheimer2009-10-031-1/+1
| | | | | Mark QGraphicsAnchor::unsetSpacing as reset function of the spacing property.
* After some discussion we decided to remove hasConflicts() from the API.Jan-Arve Sæther2009-09-291-1/+0
| | | | | | | | hasConflicts() does only make sense for a tool/editor of the layout, and how this function would help the tool is only guesswork at the moment. We keep the private API though, in order to let the autotests we inherited from Orbit pass.
* Implement hasConflicts().Jan-Arve Sæther2009-09-171-0/+1
|
* API change. This will get rid of the ugly setAnchorSpacing() method.Jan-Arve Sæther2009-09-141-45/+28
| | | | | | | | | | | | | | | | | | | | Say hello to QGraphicsAnchor, move the spacing (and removeAnchor) functionality over to that class. This also opens up for a cleaner API when we add support for size policies or min/pref/max sizes for anchors. Also remove - addLeftAndRightAnchors() - addTopAndBottomAnchors() - addAllAnchors() in favor of - addAnchors(itemA, itemB, Qt::Orientations) API change discussed with Caio and Andreas. Reviewed-by: Alexis
* Update license headers again.Jason McDonald2009-09-091-4/+4
| | | | Reviewed-by: Trust Me
* Update tech preview license header for files that are new in 4.6.Jason McDonald2009-08-311-13/+13
| | | | Reviewed-by: Trust Me
* Fix obsolete license headers.Jason McDonald2009-08-211-2/+2
| | | | Reviewed-by: Trust Me
* Implement the functions we added in the API review:Jan-Arve Sæther2009-08-191-4/+5
| | | | | | | | | Those are: * setAnchorSpacing() * anchorSpacing() * unsetAnchorSpacing() Autotests for the two last ones are missing though..
* update API to what was agreed on the API review meeting yesterday:Jan-Arve Sæther2009-08-191-77/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | The changes are: * Move enums in QGraphicsAnchorLayout::Edge to Qt::AnchorPoint. Prefix them with Anchor since they are not edges in general. * Rename anchor() to addAnchor() * Rename anchorCorner() -> addCornerAnchors() * Rename anchorWidth() -> addLeftAndRightAnchors() * Rename anchorHeight() -> addTopAndBottomAnchors() * Rename anchorGeometry() -> addAllAnchors() * remove the overloads that take a spacing argument, and add setAnchorSpacing() to accommodate for that. * Added anchorSpacing() (implementation missing) * Added unsetAnchorSpacing(). (implementation missing) * made sizeHint() protected. Updated all examples and autotest to reflect this API change.
* Clean up public API: move dumpGraph() to private API.Jan-Arve Sæther2009-08-171-4/+0
| | | | Hopefully we won't need it more...
* Small change in the "spacing API".Jan-Arve Sæther2009-08-171-2/+5
| | | | | | | | | | | | | | | | In order to be consistent with QGraphicsGridLayout(QGGL), we remove the void setSpacing(Qt::Orientations ); qreal spacing(Qt::Orientations ); in favor to void setHorizontalSpacing(qreal spacing); void setVerticalSpacing(qreal spacing); void setSpacing(qreal spacing); qreal horizontalSpacing() const; qreal verticalSpacing() const; The API for setting and retrieving spacings should now be the same as in QGGL.
* Update Anchor Layout APIArtur Duque de Souza2009-08-121-19/+51
| | | | | | | | More user friendly API for anchor layouts. Changed method names and also provided more methods to receive spacing. Signed-off-by: Artur Duque de Souza <artur.souza@openbossa.org> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
* Add QGraphicsLayout::anchor() overloads and query the default spacing.Jan-Arve Sæther2009-07-221-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes several related issues: 1. QGAL::anchor() had a spacing argument that defaulted to 0. That made it impossible to know if the user meant that the spacing should be 0 or if the spacing should be picked from the style. Instead we have to overload anchor, so now we have one function that does not take spacing as an argument. That one will create an anchor where the spacing is queried from the style. The other overload allows the user to explicitly set the spacing, thus the default spacing is ignored. 2. Make sure we pick up the spacing correctly from the style if needed. setAnchorSizeHintsFromDefaults() will set the correct spacing on anchors that was created without specifying a spacing value. 3. Add QGAL::anchor(Qt::Corner, ...) convenience function with an overload (for the same reason as explained in 1.) 4. Added QGraphicsAnchorLayoutPrivate::anchor() as a helper function that is called from all the 4 public API anchor() functions so that we don't need to have duplicate code for argument checking etc. 5. Fix autotests. They assumed that anchor() without a spacing argument created a spacing of 0.
* QGraphicsAnchorLayout: Add convencience "fill" methodsEduardo M. Fleury2009-07-221-0/+36
| | | | | | | | | | | | | | | Adding "fillWidth()", "fillHeight()" and "fill()". These convenience methods simplify the creation of anchor setups where some items are meant to use the full width and/or height of the layout. For instance, instead of creating four anchors (bottom, top, left, right) between an item and the layout, to make it use the full layout area, the user can call layout->fill(item). It is also possible to make an item assume the same width or height of another item, calling layout->fill(firstItem, secondItem). Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
* QGraphicsAnchorLayout: Fix QGraphicsItem reparent codeEduardo M. Fleury2009-07-221-2/+1
| | | | | | | Using QGraphicsLayoutPrivate methods for proper reparenting of items. This makes it work in cases where nested layouts are used. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
* QGraphicsAnchorLayout: Apply Jan-Arve's patchEduardo M. Fleury2009-07-221-4/+5
| | | | | | Applying the patch sent by email. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
* QGraphicsAnchorLayout: Making private class inherit from QGraphicsLayoutPrivateJesus Sanchez-Palencia2009-07-221-1/+0
| | | | Signed-off-by: Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
* QGraphicsAnchorLayout: Adding QGraphicsAnchorLayout public and private classesJesus Sanchez-Palencia2009-07-221-0/+109
This is a total re-written implementation of QGraphicsAnchorLayout using a numerical approach. We use QGraph and QSimplex in order to achieve this. This first commit gives us a just ready-to-use qgraphicslayout, but the private class still need to inherit from qgraphicslayoutprivate. Optimizations and documentation are all work in progress. Signed-off-by: Anselmo Lacerda S. de Melo <anselmo.melo@openbossa.org> Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Signed-off-by: Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>