diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-08-19 01:51:36 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-08-19 01:51:36 (GMT) |
commit | 75485a22fdcd2d072ec8c8275e6c6fcb8c09057a (patch) | |
tree | e4137dea08639edc891b45c94778f97604075d2b | |
parent | 4f3f840520cb33913bd52618230e51231595a31e (diff) | |
parent | 56ccc5fdf6e2136df9c97b3ecdf7d1003549b546 (diff) | |
download | Qt-75485a22fdcd2d072ec8c8275e6c6fcb8c09057a.zip Qt-75485a22fdcd2d072ec8c8275e6c6fcb8c09057a.tar.gz Qt-75485a22fdcd2d072ec8c8275e6c6fcb8c09057a.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
30 files changed, 269 insertions, 734 deletions
diff --git a/doc/src/declarative/pics/BorderImage.png b/doc/src/declarative/pics/BorderImage.png Binary files differnew file mode 100644 index 0000000..651dd8a --- /dev/null +++ b/doc/src/declarative/pics/BorderImage.png diff --git a/doc/src/declarative/pics/spacing_a.png b/doc/src/declarative/pics/spacing_a.png Binary files differindex ff07e2e..c0fe895 100644 --- a/doc/src/declarative/pics/spacing_a.png +++ b/doc/src/declarative/pics/spacing_a.png diff --git a/doc/src/declarative/pics/spacing_b.png b/doc/src/declarative/pics/spacing_b.png Binary files differindex 94304ee..24cf640 100644 --- a/doc/src/declarative/pics/spacing_b.png +++ b/doc/src/declarative/pics/spacing_b.png diff --git a/examples/declarative/border-image/example.qml b/examples/declarative/border-image/example.qml new file mode 100644 index 0000000..10daf47 --- /dev/null +++ b/examples/declarative/border-image/example.qml @@ -0,0 +1,31 @@ +import Qt 4.6 + +Rect { + id: Page + color: "white" + width: 520; height: 280 + + HorizontalPositioner { + anchors.centerIn: parent + spacing: 50 +//! [0] + BorderImage { + width: 180; height: 180 + border.left: 30; border.top: 30 + border.right: 30; border.bottom: 30 + horizontalTileMode: "Stretch" + verticalTileMode: "Stretch" + source: "colors.png" + } + + BorderImage { + width: 180; height: 180 + border.left: 30; border.top: 30 + border.right: 30; border.bottom: 30 + horizontalTileMode: "Round" + verticalTileMode: "Round" + source: "colors.png" + } +//! [0] + } +} diff --git a/examples/declarative/layouts/Button.qml b/examples/declarative/layouts/Button.qml new file mode 100644 index 0000000..de11dc9 --- /dev/null +++ b/examples/declarative/layouts/Button.qml @@ -0,0 +1,20 @@ +import Qt 4.6 +Rect { border.color: "black"; color: "steelblue"; radius: 5; width: pix.width + text.width + 13; height: pix.height + 10; id: page + property string text + property string icon + signal clicked + Image { id: pix; x: 5; y:5; source: parent.icon} + Text { id: text; text: page.text; color: "white"; x:pix.width+pix.x+3; anchors.verticalCenter: pix.verticalCenter;} + MouseRegion{ id:mr; anchors.fill: parent; onClicked: {parent.focus = true; page.clicked()}} + + states: + State{ name:"pressed"; when:mr.pressed + SetProperties {target:text; x: 5} + SetProperties {target:pix; x:text.x+text.width + 3} + } + + transitions: + Transition{ + NumberAnimation{ properties:"x,left"; easing:"easeInOutQuad"; duration:200 } + } +} diff --git a/examples/declarative/layouts/add.png b/examples/declarative/layouts/add.png Binary files differnew file mode 100644 index 0000000..f29d84b --- /dev/null +++ b/examples/declarative/layouts/add.png diff --git a/examples/declarative/layouts/del.png b/examples/declarative/layouts/del.png Binary files differnew file mode 100644 index 0000000..1d753a3 --- /dev/null +++ b/examples/declarative/layouts/del.png diff --git a/examples/declarative/layouts/layouts.qml b/examples/declarative/layouts/layouts.qml new file mode 100644 index 0000000..1f6b956 --- /dev/null +++ b/examples/declarative/layouts/layouts.qml @@ -0,0 +1,25 @@ +import Qt 4.6 + +Item { id: resizable + width:400; height:400; + GraphicsObjectContainer{ + anchors.fill:parent + QGraphicsWidget{ + geometry:{ "0,0," + parent.width.toString() + "x" + parent.height.toString(); } + layout: QGraphicsLinearLayout{ + LayoutItem{ + minimumSize: "100x100" + maximumSize: "300x300" + preferredSize: "100x100" + Rect { color: "yellow"; anchors.fill: parent } + } + LayoutItem{ + minimumSize: "100x100" + maximumSize: "400x400" + preferredSize: "200x200" + Rect { color: "green"; anchors.fill: parent } + } + } + } + } +} diff --git a/examples/declarative/layouts/positioners.qml b/examples/declarative/layouts/positioners.qml new file mode 100644 index 0000000..44f9509 --- /dev/null +++ b/examples/declarative/layouts/positioners.qml @@ -0,0 +1,51 @@ +import Qt 4.6 +Rect { width: 420; height: 420; id:page; color:"white" + VerticalPositioner { id: layout1; y:0; //width: 100; height:250; + move: Transition{ NumberAnimation {properties: "y"; easing: "easeOutBounce" }} + add: Transition{ NumberAnimation { properties: "y"; from: 500; duration:500; easing: "easeOutQuad"}} + remove: Transition { NumberAnimation { properties:"y"; to: 500; duration:500; easing: "easeInQuad"}} + Rect { color: "red"; width: 100; height: 50; border.color: "black"; radius: 15 } + Rect { id: blueV1; color: "lightsteelblue"; width: 100; height: 50; border.color: "black"; radius: 15 + //opacity: Behavior{ NumberAnimation {}} + } + Rect { color: "green"; width: 100; height: 50; border.color: "black"; radius: 15 } + Rect { id: blueV2; color: "lightsteelblue"; width: 100; height: 50; border.color: "black"; radius: 15 + //opacity: Behavior{ NumberAnimation {}} + } + Rect { color: "orange"; width: 100; height: 50; border.color: "black"; radius: 15 } + } + HorizontalPositioner { id: layout2; y:300; + move: Transition{ NumberAnimation {properties: "x"; easing: "easeOutBounce" }} + add: Transition{ NumberAnimation { properties: "x"; from: 500; duration:500; easing: "easeOutQuad"} + NumberAnimation { properties: "opacity"; from: 0; duration: 500;}} + remove: Transition { NumberAnimation { properties: "x"; to: 500; duration:500; easing: "easeInQuad"} + NumberAnimation { properties: "opacity"; from: 1; duration: 500}} + Rect { color: "red"; width: 50; height: 100; border.color: "black"; radius: 15 } + Rect { id: blueH1; color: "lightsteelblue"; width: 50; height: 100; border.color: "black"; radius: 15 } + Rect { color: "green"; width: 50; height: 100; border.color: "black"; radius: 15 } + Rect { id: blueH2; color: "lightsteelblue"; width: 50; height: 100; border.color: "black"; radius: 15 } + Rect { color: "orange"; width: 50; height: 100; border.color: "black"; radius: 15 } + } + Button { text: "Remove"; icon: "del.png"; x: 135; y:90; + onClicked: {blueH2.opacity=0; blueH1.opacity=0; blueV1.opacity=0; blueV2.opacity=0; blueG1.opacity=0; blueG2.opacity=0; blueG3.opacity=0;} + } + Button { text: "Add"; icon: "add.png"; x: 145; y:140; + onClicked: {blueH2.opacity=1; blueH1.opacity=1; blueV1.opacity=1; blueV2.opacity=1; blueG1.opacity=1; blueG2.opacity=1; blueG3.opacity=1;} + } + GridPositioner { x:260; y:0; columns:3 + remove: Transition { NumberAnimation{ properties: "opacity"; from: 1; to: 0; duration: 500} + NumberAnimation{properties: "x,y"; easing: "easeOutBounce"} } + move: Transition { NumberAnimation{ properties: "x,y"; easing: "easeOutBounce" }} + add: Transition { NumberAnimation{ properties: "opacity"; from: 0; to: 1; duration: 500} + NumberAnimation{properties: "x,y"; easing: "easeOutBounce"} } + Rect { color: "red"; width: 50; height: 100; border.color: "black"; radius: 15 } + Rect { id: blueG1; color: "lightsteelblue"; width: 50; height: 100; border.color: "black"; radius: 15 } + Rect { color: "green"; width: 50; height: 100; border.color: "black"; radius: 15 } + Rect { id: blueG2; color: "lightsteelblue"; width: 50; height: 100; border.color: "black"; radius: 15 } + Rect { color: "orange"; width: 50; height: 100; border.color: "black"; radius: 15 } + Rect { id: blueG3; color: "lightsteelblue"; width: 50; height: 100; border.color: "black"; radius: 15 } + Rect { color: "red"; width: 50; height: 100; border.color: "black"; radius: 15 } + Rect { color: "green"; width: 50; height: 100; border.color: "black"; radius: 15 } + Rect { color: "orange"; width: 50; height: 100; border.color: "black"; radius: 15 } + } +} diff --git a/src/declarative/fx/qfxborderimage.cpp b/src/declarative/fx/qfxborderimage.cpp index 67b05fd..16677e0 100644 --- a/src/declarative/fx/qfxborderimage.cpp +++ b/src/declarative/fx/qfxborderimage.cpp @@ -52,32 +52,20 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,BorderImage,QFxBorderImage) /*! \qmlclass BorderImage QFxBorderImage - \brief The BorderImage element allows you use an image as a border. + \brief The BorderImage element provides an image that can be used as a border. \inherits Item - Example: - \qml - BorderImage { border.left: 20; border.right: 10 - border.top: 14; border.bottom: 14 - width: 160; height: 160 - source: "pics/qtlogo.png" - } - \endqml + \snippet examples/declarative/border-image/example.qml 0 + + \image BorderImage.png + + \sa examples/declarative/border-image */ /*! \internal \class QFxBorderImage BorderImage \brief The QFxBorderImage class provides an image item that you can add to a QFxView. - - \ingroup group_coreitems - - Example: - \qml - BorderImage { source: "pics/star.png" } - \endqml - - A QFxBorderImage object can be instantiated in Qml using the tag \l BorderImage. */ QFxBorderImage::QFxBorderImage(QFxItem *parent) @@ -272,8 +260,6 @@ QFxScaleGrid *QFxBorderImage::border() \o Repeat - Tile the image until there is no more space. May crop the last image. \o Round - Like Repeat, but scales the images down to ensure that the last image is not cropped. \endlist - - \sa examples/declarative/border-image */ QFxBorderImage::TileMode QFxBorderImage::horizontalTileMode() const { diff --git a/src/declarative/fx/qfxpath.cpp b/src/declarative/fx/qfxpath.cpp index aff8a6d..26fafc5 100644 --- a/src/declarative/fx/qfxpath.cpp +++ b/src/declarative/fx/qfxpath.cpp @@ -114,12 +114,6 @@ QFxPath::~QFxPath() \qmlproperty real Path::startY This property holds the starting position of the path. */ - -/*! - \property QFxPath::startX - \brief the starting x position of the path. -*/ - qreal QFxPath::startX() const { Q_D(const QFxPath); @@ -132,12 +126,6 @@ void QFxPath::setStartX(qreal x) d->startX = x; } - -/*! - \property QFxPath::startY - \brief the starting y position of the path. -*/ - qreal QFxPath::startY() const { Q_D(const QFxPath); @@ -292,7 +280,7 @@ void QFxPath::componentComplete() QSet<QString> attrs; // First gather up all the attributes foreach (QFxPathElement *pathElement, d->_pathElements) { - if (QFxPathAttribute *attribute = + if (QFxPathAttribute *attribute = qobject_cast<QFxPathAttribute *>(pathElement)) attrs.insert(attribute->name()); } @@ -304,7 +292,7 @@ void QFxPath::componentComplete() connect(pathElement, SIGNAL(changed()), this, SLOT(processPath())); } -QPainterPath QFxPath::path() const +QPainterPath QFxPath::path() const { Q_D(const QFxPath); return d->_path; @@ -431,9 +419,9 @@ qreal QFxPath::attributeAt(const QString &name, qreal percent) const if (point.percent == percent) { return point.values.value(name); } else if (point.percent > percent) { - qreal lastValue = + qreal lastValue = ii?(d->_attributePoints.at(ii - 1).values.value(name)):0; - qreal lastPercent = + qreal lastPercent = ii?(d->_attributePoints.at(ii - 1).percent):0; qreal curValue = point.values.value(name); qreal curPercent = point.percent; @@ -723,11 +711,6 @@ void QFxPathQuad::addToPath(QPainterPath &path) Defines the position of the first control point. */ - -/*! - \property QFxPathCubic::control1X - \brief the x position of the first control point. -*/ qreal QFxPathCubic::control1X() const { return _control1X; @@ -741,10 +724,6 @@ void QFxPathCubic::setControl1X(qreal x) } } -/*! - \property QFxPathCubic::control1Y - \brief the y position of the first control point. -*/ qreal QFxPathCubic::control1Y() const { return _control1Y; @@ -764,11 +743,6 @@ void QFxPathCubic::setControl1Y(qreal y) Defines the position of the second control point. */ - -/*! - \property QFxPathCubic::control2X - \brief the x position of the second control point. -*/ qreal QFxPathCubic::control2X() const { return _control2X; @@ -782,10 +756,6 @@ void QFxPathCubic::setControl2X(qreal x) } } -/*! - \property QFxPathCubic::control2Y - \brief the y position of the second control point. -*/ qreal QFxPathCubic::control2Y() const { return _control2Y; diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp index 45ff51c..469e9f3 100644 --- a/src/declarative/fx/qfxpathview.cpp +++ b/src/declarative/fx/qfxpathview.cpp @@ -70,9 +70,9 @@ public: QFxPathView::attachedProperties.remove(parent()); } - QVariant value(const QByteArray &name) const - { - return mo->value(name); + QVariant value(const QByteArray &name) const + { + return mo->value(name); } void setValue(const QByteArray &name, const QVariant &val) { @@ -138,14 +138,6 @@ QFxPathView::~QFxPathView() For large or dynamic datasets the model is usually provided by a C++ model object. Models can also be created directly in XML, using the ListModel element. */ - -/*! - \property QFxPathView::model - \brief the model providing data for the view. - - The model must be either a \l QListModelInterface or - \l QFxVisualModel subclass. -*/ QVariant QFxPathView::model() const { Q_D(const QFxPathView); @@ -282,14 +274,8 @@ void QFxPathViewPrivate::setOffset(qreal o) /*! \qmlproperty real PathView::snapPosition - This property holds the position (0-100) the current item snaps to. -*/ - -/*! - \property QFxPathView::snapPosition - \brief sets the position (0-100) the current item snaps to. - This property determines the position the nearest item will snap to. + This property determines the position (0-100) the nearest item will snap to. */ qreal QFxPathView::snapPosition() const { @@ -332,15 +318,6 @@ void QFxPathView::setDragMargin(qreal dragMargin) Here is an example delegate: \snippet doc/src/snippets/declarative/pathview/pathview.qml 1 */ - -/*! - \property QFxPathView::delegate - \brief the component to use to render the items. - - The delegate is a component that the view will instantiate and destroy - as needed to display the items. - -*/ QmlComponent *QFxPathView::delegate() const { Q_D(const QFxPathView); @@ -366,10 +343,6 @@ void QFxPathView::setDelegate(QmlComponent *c) } /*! - \property QFxPathView::pathItemCount - \brief the number of items visible on the path at any one time - */ -/*! \qmlproperty int PathView::pathItemCount This property holds the number of items visible on the path at any one time */ diff --git a/src/declarative/fx/qfxpositioners.cpp b/src/declarative/fx/qfxpositioners.cpp index df733b4..1eb88fe 100644 --- a/src/declarative/fx/qfxpositioners.cpp +++ b/src/declarative/fx/qfxpositioners.cpp @@ -56,6 +56,19 @@ QT_BEGIN_NAMESPACE \internal \class QFxBasePositioner \ingroup group_layouts + \brief The QFxBasePositioner class provides a base for QFx layouts. + + To create a QFx Positioner, simply subclass QFxBasePositioner and implement + doLayout(), which is automatically called when the layout might need + updating. + + It is strongly recommended that in your implementation of doLayout() + that you use the move, remove and add transitions when those conditions + arise. You can use the applyAdd, applyMove and applyRemove functions + to do this easily. + + Note also that the subclass is responsible for adding the + spacing in between items. */ QFxBasePositioner::QFxBasePositioner(AutoUpdateType at, QFxItem *parent) : QFxItem(*(new QFxBasePositionerPrivate), parent) @@ -83,22 +96,7 @@ void QFxBasePositioner::setSpacing(int s) if (s==d->_spacing) return; d->_spacing = s; - preLayout(); -} - -int QFxBasePositioner::margin() const -{ - Q_D(const QFxBasePositioner); - return d->_margin; -} - -void QFxBasePositioner::setMargin(int s) -{ - Q_D(QFxBasePositioner); - if (s==d->_margin) - return; - d->_margin = s; - preLayout(); + prePositioning(); } QmlTransition *QFxBasePositioner::move() const @@ -137,31 +135,13 @@ void QFxBasePositioner::setRemove(QmlTransition *remove) d->removeTransition = remove; } -QFxItem *QFxBasePositioner::layoutItem() const -{ - Q_D(const QFxBasePositioner); - return d->_layoutItem; -} - -/*! - \internal -*/ -void QFxBasePositioner::setLayoutItem(QFxItem *li) -{ - Q_D(QFxBasePositioner); - if (li == d->_layoutItem) - return; - d->_layoutItem = li; - emit layoutItemChanged(); -} - void QFxBasePositioner::componentComplete() { QFxItem::componentComplete(); #ifdef Q_ENABLE_PERFORMANCE_LOG - QFxPerfTimer<QFxPerf::BaseLayoutComponentComplete> cc; + QFxPerfTimer<QFxPerf::BasepositionerComponentComplete> cc; #endif - preLayout(); + prePositioning(); } QVariant QFxBasePositioner::itemChange(GraphicsItemChange change, @@ -169,7 +149,7 @@ QVariant QFxBasePositioner::itemChange(GraphicsItemChange change, { if (change == ItemChildAddedChange || change == ItemChildRemovedChange) { - preLayout(); + prePositioning(); } return QFxItem::itemChange(change, value); @@ -189,7 +169,7 @@ bool QFxBasePositioner::event(QEvent *e) } /*! - Items that have just been added to the layout. This includes invisible items + Items that have just been added to the positioner. This includes invisible items that have turned visible. */ QSet<QFxItem *>* QFxBasePositioner::newItems() @@ -199,7 +179,7 @@ QSet<QFxItem *>* QFxBasePositioner::newItems() } /*! - Items that are visible in the layout, not including ones that have just been added. + Items that are visible in the positioner, not including ones that have just been added. */ QSet<QFxItem *>* QFxBasePositioner::items() { @@ -208,7 +188,7 @@ QSet<QFxItem *>* QFxBasePositioner::items() } /*! - Items that have just left the layout. This includes visible items + Items that have just left the positioner. This includes visible items that have turned invisible. */ QSet<QFxItem *>* QFxBasePositioner::leavingItems() @@ -217,7 +197,7 @@ QSet<QFxItem *>* QFxBasePositioner::leavingItems() return &d->_leavingItems; } -void QFxBasePositioner::preLayout() +void QFxBasePositioner::prePositioning() { Q_D(QFxBasePositioner); if (!isComponentComplete() || d->_movingItem) @@ -235,13 +215,13 @@ void QFxBasePositioner::preLayout() continue; if (!d->_items.contains(child)){ QObject::connect(child, SIGNAL(visibleChanged()), - this, SLOT(preLayout())); + this, SLOT(prePositioning())); QObject::connect(child, SIGNAL(opacityChanged()), - this, SLOT(preLayout())); + this, SLOT(prePositioning())); QObject::connect(child, SIGNAL(heightChanged()), - this, SLOT(preLayout())); + this, SLOT(prePositioning())); QObject::connect(child, SIGNAL(widthChanged()), - this, SLOT(preLayout())); + this, SLOT(prePositioning())); d->_items += child; } if (child->opacity() == 0.0){ @@ -259,59 +239,18 @@ void QFxBasePositioner::preLayout() if (!allItems.contains(child)){ if (!deletedItems.contains(child)) { QObject::disconnect(child, SIGNAL(opacityChanged()), - this, SLOT(preLayout())); + this, SLOT(prePositioning())); QObject::disconnect(child, SIGNAL(heightChanged()), - this, SLOT(preLayout())); + this, SLOT(prePositioning())); QObject::disconnect(child, SIGNAL(widthChanged()), - this, SLOT(preLayout())); + this, SLOT(prePositioning())); } d->_items -= child; } } d->_animated.clear(); - doLayout(); - //Set the layout's size to be the rect containing all children - //d->aut determines whether a dimension is sum or max - //Also sets the margin - qreal width=0; - qreal height=0; - qreal maxWidth=0; - qreal maxHeight=0; - foreach(QFxItem *item, d->_items){ - if (item->opacity() != 0.0){ - if (!d->_animated.contains(item)){ - setMovingItem(item); - QPointF p(item->x(), item->y()); - if(d->aut & Horizontal) - p.setX(p.x() + d->_margin); - if(d->aut & Vertical) - p.setY(p.y() + d->_margin); - item->setPos(p); - setMovingItem(0); - } - maxWidth = qMax(maxWidth, item->width()); - maxHeight = qMax(maxHeight, item->height()); - width = qMax(width, item->x() + item->width()); - height = qMax(height, item->y() + item->height()); - } - } - width += d->_margin; - height+= d->_margin; - - if(d->aut & Both){ - setImplicitHeight(int(height)); - setImplicitWidth(int(width)); - }else if (d->aut & Horizontal){ - setImplicitWidth(int(width)); - setImplicitHeight(int(maxHeight)); - } else if (d->aut & Vertical){ - setImplicitHeight(int(height)); - setImplicitWidth(int(maxWidth)); - }else{ - setImplicitHeight(int(maxHeight)); - setImplicitWidth(int(maxWidth)); - } - setLayoutItem(0); + doPositioning(); + finishApplyTransitions(); } void QFxBasePositioner::applyTransition(const QList<QPair<QString, QVariant> >& changes, QFxItem* target, QmlStateOperation::ActionList &actions) @@ -319,17 +258,10 @@ void QFxBasePositioner::applyTransition(const QList<QPair<QString, QVariant> >& Q_D(QFxBasePositioner); if (!target) return; - setLayoutItem(target); for (int ii=0; ii<changes.size(); ++ii){ QVariant val = changes[ii].second; - if (d->_margin && - (changes[ii].first == QLatin1String("x") || - changes[ii].first == QLatin1String("y"))) { - val = QVariant(val.toInt() + d->_margin); - } - actions << Action(target, changes[ii].first, val); } @@ -340,6 +272,9 @@ void QFxBasePositioner::applyTransition(const QList<QPair<QString, QVariant> >& void QFxBasePositioner::finishApplyTransitions() { Q_D(QFxBasePositioner); + // Note that if a transition is not set the transition manager will + // apply the changes directly, in the case someone uses applyAdd/Move/Remove + // without testing add()/move()/remove(). d->addTransitionManager.transition(d->addActions, d->addTransition); d->moveTransitionManager.transition(d->moveActions, d->moveTransition); d->removeTransitionManager.transition(d->removeActions, d->removeTransition); @@ -354,7 +289,7 @@ void QFxBasePositioner::setMovingItem(QFxItem *i) } /*! - Applies the layout's add transition to the \a target item.\a changes is a list of property,value + Applies the positioner's add transition to the \a target item.\a changes is a list of property,value pairs which will be changed on the target using the add transition. */ void QFxBasePositioner::applyAdd(const QList<QPair<QString, QVariant> >& changes, QFxItem* target) @@ -364,7 +299,7 @@ void QFxBasePositioner::applyAdd(const QList<QPair<QString, QVariant> >& changes } /*! - Applies the layout's move transition to the \a target.\a changes is a list of property,value pairs + Applies the positioner's move transition to the \a target.\a changes is a list of property,value pairs which will be changed on the target using the move transition. */ void QFxBasePositioner::applyMove(const QList<QPair<QString, QVariant> >& changes, QFxItem* target) @@ -374,7 +309,7 @@ void QFxBasePositioner::applyMove(const QList<QPair<QString, QVariant> >& change } /*! - Applies the layout's remove transition to the \a target item.\a changes is a list of + Applies the positioner's remove transition to the \a target item.\a changes is a list of property,value pairs which will be changed on the target using the remove transition. */ void QFxBasePositioner::applyRemove(const QList<QPair<QString, QVariant> >& changes, QFxItem* target) @@ -389,13 +324,13 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,VerticalPositioner,QFxVerticalPo \brief The VerticalPositioner item lines up its children vertically. \inherits Item - The VerticalPositioner item arranges its child items so that they are vertically - aligned and not overlapping. Spacing between items can be added, as can a margin around all the items. + The VerticalPositioner item positions its child items so that they are vertically + aligned and not overlapping. Spacing between items can be added. - The below example lays out differently shaped rectangles using a VerticalPositioner. + The below example positions differently shaped rectangles using a VerticalPositioner. \table \row - \o \image verticalLayout_example.png + \o \image verticalpositioner_example.png \o \qml VerticalPositioner { @@ -408,13 +343,13 @@ VerticalPositioner { \endtable VerticalPositioner also provides for transitions to be set when items are added, moved, - or removed in the layout. Adding and removing apply both to items which are deleted - or have their position in the document changed so as to no longer be children of the layout, + or removed in the positioner. Adding and removing apply both to items which are deleted + or have their position in the document changed so as to no longer be children of the positioner, as well as to items which have their opacity set to or from zero so as to appear or disappear. \table \row - \o \image verticalLayout_transition.gif + \o \image verticalpositioner_transition.gif \o \qml VerticalPositioner { @@ -431,22 +366,20 @@ VerticalPositioner { */ /*! \qmlproperty Transition VerticalPositioner::remove - This property holds the transition to apply when removing an item from the layout. + This property holds the transition to apply when removing an item from the positioner. The transition is only applied to the removed items. - Removed can mean that either the object has been deleted or reparented, and thus is now longer a child of the layout, or that the object has had its opacity set to zero, and thus is no longer visible. + Removed can mean that either the object has been deleted or reparented, and thus is now longer a child of the positioner, or that the object has had its opacity set to zero, and thus is no longer visible. Note that if the item counts as removed because its opacity is zero it will not be visible during the transition unless you set the opacity in the transition, like in the below example. \table \row - \o \image layout-remove.gif + \o \image positioner-remove.gif \o \qml VerticalPositioner { - id: layout remove: Transition { NumberAnimation { - target: layout.item properties: "opacity" from: 1 to: 0 @@ -460,20 +393,18 @@ VerticalPositioner { */ /*! \qmlproperty Transition VerticalPositioner::add - This property holds the transition to be applied when adding an item to the layout. + This property holds the transition to be applied when adding an item to the positioner. The transition will only be applied to the added item(s). - Added can mean that either the object has been created or reparented, and thus is now a child or the layout, or that the object has had its opacity increased from zero, and thus is now visible. + Added can mean that either the object has been created or reparented, and thus is now a child or the positioner, or that the object has had its opacity increased from zero, and thus is now visible. \table \row - \o \image layout-add.gif + \o \image positioner-add.gif \o \qml VerticalPositioner { - id: layout add: Transition { NumberAnimation { - target: layout.item properties: "opacity" from: 0 to: 1 @@ -487,17 +418,16 @@ VerticalPositioner { */ /*! \qmlproperty Transition VerticalPositioner::move - This property holds the transition to apply when moving an item within the layout. + This property holds the transition to apply when moving an item within the positioner. - This can happen when other items are added or removed from the layout, or when items resize themselves. + This can happen when other items are added or removed from the positioner, or when items resize themselves. \table \row - \o \image layout-move.gif + \o \image positioner-move.gif \o \qml VerticalPositioner { - id: layout move: Transition { NumberAnimation { properties: "y" @@ -509,28 +439,15 @@ VerticalPositioner { \endtable */ /*! - \qmlproperty Item VerticalPositioner::item - - The item that is currently being laid out. Used to target transitions that apply - only to the item being laid out, such as in the add transition. - -*/ -/*! \qmlproperty int VerticalPositioner::spacing - \qmlproperty int VerticalPositioner::margin - - spacing and margin allow you to control the empty space surrounding - items in layouts. spacing is the amount in pixels left empty between each adjacent - item. margin is the amount in pixels which will be left empty - around the inside edge of the layout. Both default to 0. + item, and defaults to 0. The below example places a GridPositioner containing a red, a blue and a - green rectangle on a gray background. The area the grid layout - occupies is colored white. The top layout has a spacing of 2 and a - margin of 5, the bottom layout has the defaults of no margin or - spacing. + green rectangle on a gray background. The area the grid positioner + occupies is colored white. The top positioner has the default of no spacing, + and the bottom positioner has its spacing set to 2. \image spacing_a.png \image spacing_b.png @@ -540,14 +457,14 @@ VerticalPositioner { \internal \class QFxVerticalPositioner \brief The QFxVerticalPositioner class lines up items vertically. - \ingroup group_layouts + \ingroup group_positioners */ QFxVerticalPositioner::QFxVerticalPositioner(QFxItem *parent) : QFxBasePositioner(Vertical, parent) { } -void QFxVerticalPositioner::doLayout() +void QFxVerticalPositioner::doPositioning() { int voffset = 0; @@ -581,9 +498,6 @@ void QFxVerticalPositioner::doLayout() voffset += child->height(); voffset += spacing(); } - finishApplyTransitions(); - setMovingItem(this); - setMovingItem(0); } QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,HorizontalPositioner,QFxHorizontalPositioner) @@ -592,7 +506,14 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,HorizontalPositioner,QFxHorizont \brief The HorizontalPositioner item lines up its children horizontally. \inherits Item - The HorizontalPositioner item arranges its child items so that they are horizontally aligned and not overlapping. Spacing can be added between the items, and a margin around all items can also be added. It also provides for transitions to be set when items are added, moved, or removed in the layout. Adding and removing apply both to items which are deleted or have their position in the document changed so as to no longer be children of the layout, as well as to items which have their opacity set to or from zero so as to appear or disappear. + The HorizontalPositioner item positions its child items so that they are + horizontally aligned and not overlapping. Spacing can be added between the + items, and a margin around all items can also be added. It also provides for + transitions to be set when items are added, moved, or removed in the + positioner. Adding and removing apply both to items which are deleted or have + their position in the document changed so as to no longer be children of the + positioner, as well as to items which have their opacity set to or from zero + so as to appear or disappear. The below example lays out differently shaped rectangles using a HorizontalPositioner. \qml @@ -603,23 +524,22 @@ HorizontalPositioner { Rect { color: "blue"; width: 50; height: 20 } } \endqml - \image horizontalLayout_example.png + \image horizontalpositioner_example.png */ /*! \qmlproperty Transition HorizontalPositioner::remove - This property holds the transition to apply when removing an item from the layout. + This property holds the transition to apply when removing an item from the positioner. + The transition will only be applied to the removed item(s). - Removed can mean that either the object has been deleted or reparented, and thus is now longer a child of the layout, or that the object has had its opacity set to zero, and thus is no longer visible. + Removed can mean that either the object has been deleted or reparented, and thus is now longer a child of the positioner, or that the object has had its opacity set to zero, and thus is no longer visible. Note that if the item counts as removed because its opacity is zero it will not be visible during the transition unless you set the opacity in the transition, like in the below example. \qml HorizontalPositioner { - id: layout remove: Transition { NumberAnimation { - target: layout.item properties: "opacity" from: 1 to: 0 @@ -632,16 +552,15 @@ HorizontalPositioner { */ /*! \qmlproperty Transition HorizontalPositioner::add - This property holds the transition to apply when adding an item to the layout. + This property holds the transition to apply when adding an item to the positioner. + The transition will only be applied to the added item(s). - Added can mean that either the object has been created or reparented, and thus is now a child or the layout, or that the object has had its opacity increased from zero, and thus is now visible. + Added can mean that either the object has been created or reparented, and thus is now a child or the positioner, or that the object has had its opacity increased from zero, and thus is now visible. \qml HorizontalPositioner { - id: layout add: Transition { NumberAnimation { - target: layout.item properties: "opacity" from: 0 to: 1 @@ -654,13 +573,13 @@ HorizontalPositioner { */ /*! \qmlproperty Transition HorizontalPositioner::move - This property holds the transition to apply when moving an item within the layout. + This property holds the transition to apply when moving an item within the positioner. - This can happen when other items are added or removed from the layout, or when items resize themselves. + This can happen when other items are added or removed from the positioner, or when items resize themselves. \qml HorizontalPositioner { - id: layout + id: positioner move: Transition { NumberAnimation { properties: "x" @@ -672,33 +591,15 @@ HorizontalPositioner { */ /*! - \qmlproperty Item HorizontalPositioner::item - - The item that is currently being laid out. Used to target transitions that apply - only to the item being laid out, such as in the add transition. - -*/ -/*! - \qmlproperty int HorizontalPositioner::spacing - - The spacing, in pixels, left empty between each adjacent item. -*/ -/*! - \qmlproperty int HorizontalPositioner::margin - - The margin size, in pixels, which will be left empty around the inside edge of the layout. -*/ -/*! \qmlproperty int HorizontalPositioner::spacing - \qmlproperty int HorizontalPositioner::margin - spacing and margin allow you to control the empty space surrounding items in layouts. - - spacing is the amount in pixels left empty between each adjacent item. - margin is the amount in pixels which will be left empty around the inside edge of the layout. - Both default to 0. + spacing is the amount in pixels left empty between each adjacent + item, and defaults to 0. - The below example places a GridPositioner containing a red, a blue and a green rectangle on a gray background. The area the grid layout occupies is colored white. The top layout has a spacing of 2 and a margin of 5, the bottom layout has the defaults of no margin or spacing. + The below example places a GridPositioner containing a red, a blue and a + green rectangle on a gray background. The area the grid positioner + occupies is colored white. The top positioner has the default of no spacing, + and the bottom positioner has its spacing set to 2. \image spacing_a.png \image spacing_b.png @@ -708,14 +609,14 @@ HorizontalPositioner { \internal \class QFxHorizontalPositioner \brief The QFxHorizontalPositioner class lines up items horizontally. - \ingroup group_layouts + \ingroup group_positioners */ QFxHorizontalPositioner::QFxHorizontalPositioner(QFxItem *parent) : QFxBasePositioner(Horizontal, parent) { } -void QFxHorizontalPositioner::doLayout() +void QFxHorizontalPositioner::doPositioning() { int hoffset = 0; @@ -748,7 +649,6 @@ void QFxHorizontalPositioner::doLayout() hoffset += child->width(); hoffset += spacing(); } - finishApplyTransitions(); } QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,GridPositioner,QFxGridPositioner) @@ -758,20 +658,19 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,GridPositioner,QFxGridPositioner \brief The GridPositioner item positions its children in a grid. \inherits Item - The GridPositioner item arranges its child items so that they are + The GridPositioner item positions its child items so that they are aligned in a grid and are not overlapping. Spacing can be added - between the items, and a margin around all the items can also be - defined. It also provides for transitions to be set when items are - added, moved, or removed in the layout. Adding and removing apply + between the items. It also provides for transitions to be set when items are + added, moved, or removed in the positioner. Adding and removing apply both to items which are deleted or have their position in the - document changed so as to no longer be children of the layout, as + document changed so as to no longer be children of the positioner, as well as to items which have their opacity set to or from zero so as to appear or disappear. The GridPositioner defaults to using four columns, and as many rows as are necessary to fit all the child items. The number of rows and/or the number of columns can be constrained by setting the rows - or columns properties. The grid layout calculates a grid with + or columns properties. The grid positioner calculates a grid with rectangular cells of sufficient size to hold all items, and then places the items in the cells, going across then down, and positioning each item at the (0,0) corner of the cell. The below @@ -796,10 +695,11 @@ GridPositioner { */ /*! \qmlproperty Transition GridPositioner::remove - This property holds the transition to apply when removing an item from the layout. + This property holds the transition to apply when removing an item from the positioner. + The transition is only applied to the removed item(s). Removed can mean that either the object has been deleted or - reparented, and thus is now longer a child of the layout, or that + reparented, and thus is now longer a child of the positioner, or that the object has had its opacity set to zero, and thus is no longer visible. @@ -809,10 +709,8 @@ GridPositioner { \qml GridPositioner { - id: layout remove: Transition { NumberAnimation { - target: layout.item properties: "opacity" from: 1 to: 0 @@ -825,19 +723,18 @@ GridPositioner { */ /*! \qmlproperty Transition GridPositioner::add - This property holds the transition to apply when adding an item to the layout. + This property holds the transition to apply when adding an item to the positioner. + The transition is only applied to the added item(s). Added can mean that either the object has been created or - reparented, and thus is now a child or the layout, or that the + reparented, and thus is now a child or the positioner, or that the object has had its opacity increased from zero, and thus is now visible. \qml GridPositioner { - id: layout add: Transition { NumberAnimation { - target: layout.item properties: "opacity" from: 0 to: 1 @@ -850,14 +747,13 @@ GridPositioner { */ /*! \qmlproperty Transition GridPositioner::move - This property holds the transition to apply when moving an item within the layout. + This property holds the transition to apply when moving an item within the positioner. - This can happen when other items are added or removed from the layout, or + This can happen when other items are added or removed from the positioner, or when items resize themselves. \qml GridPositioner { - id: layout move: Transition { NumberAnimation { properties: "x,y" @@ -869,29 +765,15 @@ GridPositioner { */ /*! - \qmlproperty Item GridPositioner::item - - The item that is currently being laid out. Used to target - transitions that apply only to the item being laid out, such as in - the add transition. - -*/ -/*! \qmlproperty int GridPositioner::spacing - \qmlproperty int GridPositioner::margin - - spacing and margin allow you to control the empty space surrounding - items in layouts. spacing is the amount in pixels left empty between each adjacent - item. margin is the amount in pixels which will be left empty - around the inside edge of the layout. Both default to 0. + item, and defaults to 0. The below example places a GridPositioner containing a red, a blue and a - green rectangle on a gray background. The area the grid layout - occupies is colored white. The top layout has a spacing of 2 and a - margin of 5, the bottom layout has the defaults of no margin or - spacing. + green rectangle on a gray background. The area the grid positioner + occupies is colored white. The top positioner has the default of no spacing, + and the bottom positioner has its spacing set to 2. \image spacing_a.png \image spacing_b.png @@ -929,13 +811,13 @@ QFxGridPositioner::QFxGridPositioner(QFxItem *parent) : many rows some rows will be of zero width. */ -void QFxGridPositioner::doLayout() +void QFxGridPositioner::doPositioning() { int c=_columns,r=_rows;//Actual number of rows/columns int numVisible = items()->size() + newItems()->size(); if (_columns==-1 && _rows==-1){ c = 4; - r = (numVisible+2)/3; + r = (numVisible+3)/4; }else if (_rows==-1){ r = (numVisible+(_columns-1))/_columns; }else if (_columns==-1){ @@ -1002,10 +884,9 @@ void QFxGridPositioner::doLayout() xoffset=0; curRow++; if (curRow>=r) - return; + break; } } - finishApplyTransitions(); } QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxpositioners.h b/src/declarative/fx/qfxpositioners.h index 6acb393..9560925 100644 --- a/src/declarative/fx/qfxpositioners.h +++ b/src/declarative/fx/qfxpositioners.h @@ -60,11 +60,9 @@ class Q_DECLARATIVE_EXPORT QFxBasePositioner : public QFxItem Q_OBJECT Q_PROPERTY(int spacing READ spacing WRITE setSpacing) - Q_PROPERTY(int margin READ margin WRITE setMargin) Q_PROPERTY(QmlTransition *move READ move WRITE setMove) Q_PROPERTY(QmlTransition *add READ add WRITE setAdd) Q_PROPERTY(QmlTransition *remove READ remove WRITE setRemove) - Q_PROPERTY(QFxItem *item READ layoutItem NOTIFY layoutItemChanged) public: enum AutoUpdateType { None = 0x0, Horizontal = 0x1, Vertical = 0x2, Both = 0x3 }; QFxBasePositioner(AutoUpdateType, QFxItem *parent); @@ -72,9 +70,6 @@ public: int spacing() const; void setSpacing(int); - int margin() const; - void setMargin(int); - QmlTransition *move() const; void setMove(QmlTransition *); @@ -84,8 +79,6 @@ public: QmlTransition *remove() const; void setRemove(QmlTransition *); - QFxItem *layoutItem() const; - protected: virtual void componentComplete(); virtual QVariant itemChange(GraphicsItemChange, const QVariant &); @@ -102,11 +95,10 @@ Q_SIGNALS: void layoutItemChanged(); protected Q_SLOTS: - virtual void doLayout()=0; - void setLayoutItem(QFxItem *); + virtual void doPositioning()=0; private Q_SLOTS: - void preLayout(); + void prePositioning(); protected: QFxBasePositioner(QFxBasePositionerPrivate &dd, AutoUpdateType at, QFxItem *parent); @@ -125,7 +117,7 @@ class Q_DECLARATIVE_EXPORT QFxVerticalPositioner : public QFxBasePositioner public: QFxVerticalPositioner(QFxItem *parent=0); protected Q_SLOTS: - virtual void doLayout(); + virtual void doPositioning(); private: Q_DISABLE_COPY(QFxVerticalPositioner) }; @@ -136,7 +128,7 @@ class Q_DECLARATIVE_EXPORT QFxHorizontalPositioner: public QFxBasePositioner public: QFxHorizontalPositioner(QFxItem *parent=0); protected Q_SLOTS: - virtual void doLayout(); + virtual void doPositioning(); private: Q_DISABLE_COPY(QFxHorizontalPositioner) }; @@ -155,7 +147,7 @@ public: int columns() const {return _columns;} void setcolumns(const int columns){_columns = columns;} protected Q_SLOTS: - virtual void doLayout(); + virtual void doPositioning(); private: int _rows; diff --git a/src/declarative/fx/qfxpositioners_p.h b/src/declarative/fx/qfxpositioners_p.h index 53f5dcd..8960952 100644 --- a/src/declarative/fx/qfxpositioners_p.h +++ b/src/declarative/fx/qfxpositioners_p.h @@ -69,8 +69,8 @@ class QFxBasePositionerPrivate : public QFxItemPrivate public: QFxBasePositionerPrivate() : _ep(false), _componentComplete(false), _spacing(0), - _margin(0), aut(QFxBasePositioner::None), moveTransition(0), addTransition(0), - removeTransition(0), _layoutItem(0), _movingItem(0) + aut(QFxBasePositioner::None), moveTransition(0), addTransition(0), + removeTransition(0), _movingItem(0) { } @@ -82,7 +82,6 @@ public: bool _ep; bool _componentComplete; int _spacing; - int _margin; QFxBasePositioner::AutoUpdateType aut; QmlTransition *moveTransition; QmlTransition *addTransition; @@ -92,7 +91,6 @@ public: QSet<QFxItem *> _stableItems; QSet<QFxItem *> _newItems; QSet<QFxItem *> _animated; - QFxItem *_layoutItem; QmlStateOperation::ActionList addActions; QmlStateOperation::ActionList moveActions; QmlStateOperation::ActionList removeActions; diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp index 8f30324..a9d9977 100644 --- a/src/declarative/fx/qfxrepeater.cpp +++ b/src/declarative/fx/qfxrepeater.cpp @@ -80,7 +80,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Repeater,QFxRepeater) \brief The Repeater item allows you to repeat a component based on a data source. - The Repeater item is used when you want to create a large number of + The Repeater item is used when you want to create a large number of similar items. For each entry in the data source, an item is instantiated in a context seeded with data from the data source. If the repeater will be instantiating a large number of instances, it may be more efficient to @@ -93,11 +93,11 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Repeater,QFxRepeater) or object) is available as the \c modelData property. In the case of a Qt model, all roles are available as named properties just like in the view classes. - Items instantiated by the Repeater are inserted, in order, as + Items instantiated by the Repeater are inserted, in order, as children of the Repeater's parent. The insertion starts immediately after the repeater's position in its parent stacking list. This is to allow you to use a Repeater inside a layout. The following QML example shows how - the instantiated items would visually appear stacked between the red and + the instantiated items would visually appear stacked between the red and blue rectangles. \snippet doc/src/snippets/declarative/repeater.qml 0 @@ -115,10 +115,10 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Repeater,QFxRepeater) \ingroup group_utility \qmlclass Repeater - \brief The QFxRepeater class allows you to repeat a component based on a + \brief The QFxRepeater class allows you to repeat a component based on a data source. - The QFxRepeater class is used when you want to create a large number of + The QFxRepeater class is used when you want to create a large number of similar items. For each entry in the data source, an item is instantiated in a context seeded with data from the data source. @@ -133,11 +133,11 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Repeater,QFxRepeater) create that many instances of the component. They will also be assigned an index based on the order they are created. - Items instantiated by the QFxRepeater class are inserted, in order, as + Items instantiated by the QFxRepeater class are inserted, in order, as children of the repeater's parent. The insertion starts immediately after the repeater's position in its parent stacking list. This is to allow you to use a repeater inside a layout. The following QML example shows how - the instantiated items would visually appear stacked between the red and + the instantiated items would visually appear stacked between the red and blue rectangles. \snippet doc/src/snippets/declarative/repeater.qml 0 @@ -161,7 +161,7 @@ QFxRepeater::QFxRepeater(QFxItem *parent) } /*! - \internal + \internal */ QFxRepeater::QFxRepeater(QFxRepeaterPrivate &dd, QFxItem *parent) : QFxItem(dd, parent) @@ -169,7 +169,7 @@ QFxRepeater::QFxRepeater(QFxRepeaterPrivate &dd, QFxItem *parent) } /*! - Destroy the repeater instance. All items it instantiated are also + Destroy the repeater instance. All items it instantiated are also destroyed. */ QFxRepeater::~QFxRepeater() @@ -192,11 +192,6 @@ QFxRepeater::~QFxRepeater() create that many instances of the component. They will also be assigned an index based on the order they are created. */ - -/*! - \property QFxRepeater::dataSource - \brief The source of data for the repeater. - */ QVariant QFxRepeater::dataSource() const { return QVariant(); @@ -215,10 +210,6 @@ void QFxRepeater::setDataSource(const QVariant &v) The component to repeat. */ -/*! - \property QFxRepeater::component - \brief The component to repeat. - */ QmlComponent *QFxRepeater::component() const { Q_D(const QFxRepeater); @@ -261,8 +252,8 @@ QVariant QFxRepeater::itemChange(GraphicsItemChange change, void QFxRepeater::regenerate() { Q_D(QFxRepeater); - - qDeleteAll(d->deletables); + + qDeleteAll(d->deletables); d->deletables.clear(); if (!d->component || !parentItem() || !isComponentComplete()) return; diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index cd34aa0..272102c 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -132,12 +132,6 @@ QFxText::~QFxText() \note \c font.size sets the font's point size (not pixel size). */ - -/*! - \property QFxText::font - \brief the font used to display the text. -*/ - QFont QFxText::font() const { Q_D(const QFxText); @@ -245,16 +239,6 @@ QColor QFxText::color() const \image declarative-textstyle.png */ - -/*! - \property QFxText::style - \brief an additional style of the text to display. - - By default, the text style is Normal. - - \note This property is used to support text styles not natively - handled by QFont or QPainter::drawText(). -*/ QFxText::TextStyle QFxText::style() const { Q_D(const QFxText); @@ -309,13 +293,6 @@ QColor QFxText::styleColor() const \c AlignHCenter. The valid values for \c vAlign are \c AlignTop, \c AlignBottom and \c AlignVCenter. */ - -/*! - \property QFxText::hAlign - \brief the horizontal alignment of the text. - - Valid values are \c AlignLeft, \c AlignRight, and \c AlignHCenter. The default value is \c AlignLeft. -*/ QFxText::HAlignment QFxText::hAlign() const { Q_D(const QFxText); @@ -328,12 +305,6 @@ void QFxText::setHAlign(HAlignment align) d->hAlign = align; } -/*! - \property QFxText::vAlign - \brief the vertical alignment of the text. - - Valid values are \c AlignTop, \c AlignBottom, and \c AlignVCenter. The default value is \c AlignTop. -*/ QFxText::VAlignment QFxText::vAlign() const { Q_D(const QFxText); diff --git a/tests/auto/declarative/layouts/data/grid-margin.qml b/tests/auto/declarative/layouts/data/grid-margin.qml deleted file mode 100644 index a49dc85..0000000 --- a/tests/auto/declarative/layouts/data/grid-margin.qml +++ /dev/null @@ -1,40 +0,0 @@ -import Qt 4.6 - -Item { - width: 640 - height: 480 - GridLayout { - columns: 3 - margin: 8 - Rect { - id: one - color: "red" - width: 50 - height: 50 - } - Rect { - id: two - color: "green" - width: 20 - height: 50 - } - Rect { - id: three - color: "blue" - width: 50 - height: 20 - } - Rect { - id: four - color: "cyan" - width: 50 - height: 50 - } - Rect { - id: five - color: "magenta" - width: 10 - height: 10 - } - } -} diff --git a/tests/auto/declarative/layouts/data/grid-spacing-margin.qml b/tests/auto/declarative/layouts/data/grid-spacing-margin.qml deleted file mode 100644 index d2fe4f6..0000000 --- a/tests/auto/declarative/layouts/data/grid-spacing-margin.qml +++ /dev/null @@ -1,41 +0,0 @@ -import Qt 4.6 - -Item { - width: 640 - height: 480 - GridLayout { - columns: 3 - spacing: 4 - margin: 8 - Rect { - id: one - color: "red" - width: 50 - height: 50 - } - Rect { - id: two - color: "green" - width: 20 - height: 50 - } - Rect { - id: three - color: "blue" - width: 50 - height: 20 - } - Rect { - id: four - color: "cyan" - width: 50 - height: 50 - } - Rect { - id: five - color: "magenta" - width: 10 - height: 10 - } - } -} diff --git a/tests/auto/declarative/layouts/data/grid-spacing.qml b/tests/auto/declarative/layouts/data/grid-spacing.qml index 704e3f2..f8b5620 100644 --- a/tests/auto/declarative/layouts/data/grid-spacing.qml +++ b/tests/auto/declarative/layouts/data/grid-spacing.qml @@ -3,7 +3,7 @@ import Qt 4.6 Item { width: 640 height: 480 - GridLayout { + GridPositioner { columns: 3 spacing: 4 Rect { diff --git a/tests/auto/declarative/layouts/data/grid.qml b/tests/auto/declarative/layouts/data/grid.qml index 2f60f16..2fbc37c 100644 --- a/tests/auto/declarative/layouts/data/grid.qml +++ b/tests/auto/declarative/layouts/data/grid.qml @@ -3,7 +3,7 @@ import Qt 4.6 Item { width: 640 height: 480 - GridLayout { + GridPositioner { columns: 3 Rect { id: one diff --git a/tests/auto/declarative/layouts/data/horizontal-margin.qml b/tests/auto/declarative/layouts/data/horizontal-margin.qml deleted file mode 100644 index a96db02..0000000 --- a/tests/auto/declarative/layouts/data/horizontal-margin.qml +++ /dev/null @@ -1,27 +0,0 @@ -import Qt 4.6 - -Item { - width: 640 - height: 480 - HorizontalLayout { - margin: 10 - Rect { - id: one - color: "red" - width: 50 - height: 50 - } - Rect { - id: two - color: "red" - width: 20 - height: 10 - } - Rect { - id: three - color: "red" - width: 40 - height: 20 - } - } -} diff --git a/tests/auto/declarative/layouts/data/horizontal-spacing-margin.qml b/tests/auto/declarative/layouts/data/horizontal-spacing-margin.qml deleted file mode 100644 index 82957be..0000000 --- a/tests/auto/declarative/layouts/data/horizontal-spacing-margin.qml +++ /dev/null @@ -1,28 +0,0 @@ -import Qt 4.6 - -Item { - width: 640 - height: 480 - HorizontalLayout { - spacing: 5 - margin: 10 - Rect { - id: one - color: "red" - width: 50 - height: 50 - } - Rect { - id: two - color: "red" - width: 20 - height: 10 - } - Rect { - id: three - color: "red" - width: 40 - height: 20 - } - } -} diff --git a/tests/auto/declarative/layouts/data/horizontal-spacing.qml b/tests/auto/declarative/layouts/data/horizontal-spacing.qml index 8c55ae9..25dad8a 100644 --- a/tests/auto/declarative/layouts/data/horizontal-spacing.qml +++ b/tests/auto/declarative/layouts/data/horizontal-spacing.qml @@ -3,7 +3,7 @@ import Qt 4.6 Item { width: 640 height: 480 - HorizontalLayout { + HorizontalPositioner { spacing: 10 Rect { id: one diff --git a/tests/auto/declarative/layouts/data/horizontal.qml b/tests/auto/declarative/layouts/data/horizontal.qml index 286b90b..4bce504 100644 --- a/tests/auto/declarative/layouts/data/horizontal.qml +++ b/tests/auto/declarative/layouts/data/horizontal.qml @@ -3,7 +3,7 @@ import Qt 4.6 Item { width: 640 height: 480 - HorizontalLayout { + HorizontalPositioner { Rect { id: one color: "red" diff --git a/tests/auto/declarative/layouts/data/vertical-margin.qml b/tests/auto/declarative/layouts/data/vertical-margin.qml deleted file mode 100644 index a7e10ea..0000000 --- a/tests/auto/declarative/layouts/data/vertical-margin.qml +++ /dev/null @@ -1,27 +0,0 @@ -import Qt 4.6 - -Item { - width: 640 - height: 480 - VerticalLayout { - margin: 10 - Rect { - id: one - color: "red" - width: 50 - height: 50 - } - Rect { - id: two - color: "red" - width: 20 - height: 10 - } - Rect { - id: three - color: "red" - width: 40 - height: 20 - } - } -} diff --git a/tests/auto/declarative/layouts/data/vertical-spacing-margin.qml b/tests/auto/declarative/layouts/data/vertical-spacing-margin.qml deleted file mode 100644 index 828ae61..0000000 --- a/tests/auto/declarative/layouts/data/vertical-spacing-margin.qml +++ /dev/null @@ -1,28 +0,0 @@ -import Qt 4.6 - -Item { - width: 640 - height: 480 - VerticalLayout { - spacing: 5 - margin: 10 - Rect { - id: one - color: "red" - width: 50 - height: 50 - } - Rect { - id: two - color: "red" - width: 20 - height: 10 - } - Rect { - id: three - color: "red" - width: 40 - height: 20 - } - } -} diff --git a/tests/auto/declarative/layouts/data/vertical-spacing.qml b/tests/auto/declarative/layouts/data/vertical-spacing.qml index 8d3e86f..aa704be 100644 --- a/tests/auto/declarative/layouts/data/vertical-spacing.qml +++ b/tests/auto/declarative/layouts/data/vertical-spacing.qml @@ -3,7 +3,7 @@ import Qt 4.6 Item { width: 640 height: 480 - VerticalLayout { + VerticalPositioner { spacing: 10 Rect { id: one diff --git a/tests/auto/declarative/layouts/data/vertical.qml b/tests/auto/declarative/layouts/data/vertical.qml index 960f10a..0a52126 100644 --- a/tests/auto/declarative/layouts/data/vertical.qml +++ b/tests/auto/declarative/layouts/data/vertical.qml @@ -3,7 +3,7 @@ import Qt 4.6 Item { width: 640 height: 480 - VerticalLayout { + VerticalPositioner { Rect { id: one color: "red" diff --git a/tests/auto/declarative/layouts/tst_layouts.cpp b/tests/auto/declarative/layouts/tst_layouts.cpp index 732551c..466a7de 100644 --- a/tests/auto/declarative/layouts/tst_layouts.cpp +++ b/tests/auto/declarative/layouts/tst_layouts.cpp @@ -13,16 +13,10 @@ public: private slots: void test_horizontal(); void test_horizontal_spacing(); - void test_horizontal_margin(); - void test_horizontal_spacing_margin(); void test_vertical(); void test_vertical_spacing(); - void test_vertical_margin(); - void test_vertical_spacing_margin(); void test_grid(); void test_grid_spacing(); - void test_grid_margin(); - void test_grid_spacing_margin(); private: QFxView *createView(const QString &filename); @@ -82,54 +76,6 @@ void tst_QFxLayouts::test_horizontal_spacing() QCOMPARE(three->y(), 0.0); } -void tst_QFxLayouts::test_horizontal_margin() -{ - QFxView *canvas = createView(SRCDIR "/data/horizontal-margin.qml"); - - canvas->execute(); - qApp->processEvents(); - - QFxRect *one = findItem<QFxRect>(canvas->root(), "one"); - QVERIFY(one != 0); - - QFxRect *two = findItem<QFxRect>(canvas->root(), "two"); - QVERIFY(two != 0); - - QFxRect *three = findItem<QFxRect>(canvas->root(), "three"); - QVERIFY(three != 0); - - QCOMPARE(one->x(), 10.0); - QCOMPARE(one->y(), 10.0); - QCOMPARE(two->x(), 60.0); - QCOMPARE(two->y(), 10.0); - QCOMPARE(three->x(), 80.0); - QCOMPARE(three->y(), 10.0); -} - -void tst_QFxLayouts::test_horizontal_spacing_margin() -{ - QFxView *canvas = createView(SRCDIR "/data/horizontal-spacing-margin.qml"); - - canvas->execute(); - qApp->processEvents(); - - QFxRect *one = findItem<QFxRect>(canvas->root(), "one"); - QVERIFY(one != 0); - - QFxRect *two = findItem<QFxRect>(canvas->root(), "two"); - QVERIFY(two != 0); - - QFxRect *three = findItem<QFxRect>(canvas->root(), "three"); - QVERIFY(three != 0); - - QCOMPARE(one->x(), 10.0); - QCOMPARE(one->y(), 10.0); - QCOMPARE(two->x(), 65.0); - QCOMPARE(two->y(), 10.0); - QCOMPARE(three->x(), 90.0); - QCOMPARE(three->y(), 10.0); -} - void tst_QFxLayouts::test_vertical() { QFxView *canvas = createView(SRCDIR "/data/vertical.qml"); @@ -178,54 +124,6 @@ void tst_QFxLayouts::test_vertical_spacing() QCOMPARE(three->y(), 80.0); } -void tst_QFxLayouts::test_vertical_margin() -{ - QFxView *canvas = createView(SRCDIR "/data/vertical-margin.qml"); - - canvas->execute(); - qApp->processEvents(); - - QFxRect *one = findItem<QFxRect>(canvas->root(), "one"); - QVERIFY(one != 0); - - QFxRect *two = findItem<QFxRect>(canvas->root(), "two"); - QVERIFY(two != 0); - - QFxRect *three = findItem<QFxRect>(canvas->root(), "three"); - QVERIFY(three != 0); - - QCOMPARE(one->x(), 10.0); - QCOMPARE(one->y(), 10.0); - QCOMPARE(two->x(), 10.0); - QCOMPARE(two->y(), 60.0); - QCOMPARE(three->x(), 10.0); - QCOMPARE(three->y(), 70.0); -} - -void tst_QFxLayouts::test_vertical_spacing_margin() -{ - QFxView *canvas = createView(SRCDIR "/data/vertical-spacing-margin.qml"); - - canvas->execute(); - qApp->processEvents(); - - QFxRect *one = findItem<QFxRect>(canvas->root(), "one"); - QVERIFY(one != 0); - - QFxRect *two = findItem<QFxRect>(canvas->root(), "two"); - QVERIFY(two != 0); - - QFxRect *three = findItem<QFxRect>(canvas->root(), "three"); - QVERIFY(three != 0); - - QCOMPARE(one->x(), 10.0); - QCOMPARE(one->y(), 10.0); - QCOMPARE(two->x(), 10.0); - QCOMPARE(two->y(), 65.0); - QCOMPARE(three->x(), 10.0); - QCOMPARE(three->y(), 80.0); -} - void tst_QFxLayouts::test_grid() { QFxView *canvas = createView("data/grid.qml"); @@ -286,67 +184,6 @@ void tst_QFxLayouts::test_grid_spacing() QCOMPARE(five->y(), 54.0); } -void tst_QFxLayouts::test_grid_margin() -{ - QFxView *canvas = createView("data/grid-margin.qml"); - - canvas->execute(); - qApp->processEvents(); - - QFxRect *one = findItem<QFxRect>(canvas->root(), "one"); - QVERIFY(one != 0); - QFxRect *two = findItem<QFxRect>(canvas->root(), "two"); - QVERIFY(two != 0); - QFxRect *three = findItem<QFxRect>(canvas->root(), "three"); - QVERIFY(three != 0); - QFxRect *four = findItem<QFxRect>(canvas->root(), "four"); - QVERIFY(four != 0); - QFxRect *five = findItem<QFxRect>(canvas->root(), "five"); - QVERIFY(five != 0); - - QCOMPARE(one->x(), 8.0); - QCOMPARE(one->y(), 8.0); - QCOMPARE(two->x(), 58.0); - QCOMPARE(two->y(), 8.0); - QCOMPARE(three->x(), 78.0); - QCOMPARE(three->y(), 8.0); - QCOMPARE(four->x(), 8.0); - QCOMPARE(four->y(), 58.0); - QCOMPARE(five->x(), 58.0); - QCOMPARE(five->y(), 58.0); -} - - -void tst_QFxLayouts::test_grid_spacing_margin() -{ - QFxView *canvas = createView("data/grid-spacing-margin.qml"); - - canvas->execute(); - qApp->processEvents(); - - QFxRect *one = findItem<QFxRect>(canvas->root(), "one"); - QVERIFY(one != 0); - QFxRect *two = findItem<QFxRect>(canvas->root(), "two"); - QVERIFY(two != 0); - QFxRect *three = findItem<QFxRect>(canvas->root(), "three"); - QVERIFY(three != 0); - QFxRect *four = findItem<QFxRect>(canvas->root(), "four"); - QVERIFY(four != 0); - QFxRect *five = findItem<QFxRect>(canvas->root(), "five"); - QVERIFY(five != 0); - - QCOMPARE(one->x(), 8.0); - QCOMPARE(one->y(), 8.0); - QCOMPARE(two->x(), 62.0); - QCOMPARE(two->y(), 8.0); - QCOMPARE(three->x(), 86.0); - QCOMPARE(three->y(), 8.0); - QCOMPARE(four->x(), 8.0); - QCOMPARE(four->y(), 62.0); - QCOMPARE(five->x(), 62.0); - QCOMPARE(five->y(), 62.0); -} - QFxView *tst_QFxLayouts::createView(const QString &filename) { QFxView *canvas = new QFxView(0); |