summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsanchorlayout.cpp
diff options
context:
space:
mode:
authorFrans Englich <frans.englich@nokia.com>2009-10-20 14:18:25 (GMT)
committerFrans Englich <frans.englich@nokia.com>2009-10-20 14:18:25 (GMT)
commit9bdc0a2d18bcc4938d79079e184a05acd5f43b22 (patch)
treeb4cff4d92d9239cc30c2c9bbf040b2493af66b26 /src/gui/graphicsview/qgraphicsanchorlayout.cpp
parent147c524e703d4727d03c5f2ea3f98ace25905b73 (diff)
parent76ef766a32cdcfd9cd64cf1d288c92a2b2040c15 (diff)
downloadQt-9bdc0a2d18bcc4938d79079e184a05acd5f43b22.zip
Qt-9bdc0a2d18bcc4938d79079e184a05acd5f43b22.tar.gz
Qt-9bdc0a2d18bcc4938d79079e184a05acd5f43b22.tar.bz2
Merge commit 'qt/4.6' into mmfphonon
Diffstat (limited to 'src/gui/graphicsview/qgraphicsanchorlayout.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp
index ffbb67c..c39e8a6 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp
@@ -118,6 +118,23 @@ QGraphicsAnchor::~QGraphicsAnchor()
}
/*!
+ Sets the size policy of the anchor to \a policy.
+*/
+void QGraphicsAnchor::setSizePolicy(QSizePolicy::Policy policy)
+{
+ Q_D(QGraphicsAnchor);
+ d->setSizePolicy(policy);
+}
+/*!
+ Returns the size policy of the anchor. The default size policy is QSizePolicy::Fixed
+*/
+QSizePolicy::Policy QGraphicsAnchor::sizePolicy() const
+{
+ Q_D(const QGraphicsAnchor);
+ return d->sizePolicy;
+}
+
+/*!
\property QGraphicsAnchor::spacing
\brief the space between items in the QGraphicsAnchorLayout.
@@ -306,6 +323,13 @@ void QGraphicsAnchorLayout::addAnchors(QGraphicsLayoutItem *firstItem,
void QGraphicsAnchorLayout::setHorizontalSpacing(qreal spacing)
{
Q_D(QGraphicsAnchorLayout);
+
+ // ### We don't support negative spacing yet
+ if (spacing < 0) {
+ spacing = 0;
+ qWarning() << "QGraphicsAnchorLayout does not support negative spacing.";
+ }
+
d->spacings[0] = spacing;
invalidate();
}
@@ -318,6 +342,13 @@ void QGraphicsAnchorLayout::setHorizontalSpacing(qreal spacing)
void QGraphicsAnchorLayout::setVerticalSpacing(qreal spacing)
{
Q_D(QGraphicsAnchorLayout);
+
+ // ### We don't support negative spacing yet
+ if (spacing < 0) {
+ spacing = 0;
+ qWarning() << "QGraphicsAnchorLayout does not support negative spacing.";
+ }
+
d->spacings[1] = spacing;
invalidate();
}
@@ -327,11 +358,23 @@ void QGraphicsAnchorLayout::setVerticalSpacing(qreal spacing)
If an item is anchored with no spacing associated with the anchor, it will use the default
spacing.
+
+ Currently QGraphicsAnchorLayout does not support negative default spacings.
+
\sa setHorizontalSpacing(), setVerticalSpacing()
*/
void QGraphicsAnchorLayout::setSpacing(qreal spacing)
{
Q_D(QGraphicsAnchorLayout);
+
+ // ### Currently we do not support negative anchors inside the graph.
+ // To avoid those being created by a negative spacing, we must
+ // make this test.
+ if (spacing < 0) {
+ spacing = 0;
+ qWarning() << "QGraphicsAnchorLayout does not support negative spacing.";
+ }
+
d->spacings[0] = d->spacings[1] = spacing;
invalidate();
}