diff options
Diffstat (limited to 'src/declarative/fx/qfxitem.cpp')
-rw-r--r-- | src/declarative/fx/qfxitem.cpp | 57 |
1 files changed, 25 insertions, 32 deletions
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 17fe36a..3e29f13 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -261,24 +261,10 @@ void QFxContents::setItem(QFxItem *item) */ /*! - \fn void QFxItem::baselineChanged() - - This signal is emitted when the baseline of the item changes. - - The baseline may change in response to a change to the baselineOffset - property or due to the geometry of the item changing. -*/ - -/*! \fn void QFxItem::baselineOffsetChanged() - This signal is emitted when the baseline of the item is changed - via the baselineOffset property. - - The baseline corresponds to the baseline of the text contained in - the item. It is useful for aligning the text in items placed - beside each other. The default baseline is positioned at - 2/3 of the height of the item. + This signal is emitted when the baseline offset of the item + is changed. */ /*! @@ -288,24 +274,12 @@ void QFxContents::setItem(QFxItem *item) */ /*! - \fn void QFxItem::rightChanged() - - This signal is emitted when the right coordinate of the item changes. -*/ - -/*! \fn void QFxItem::topChanged() This signal is emitted when the top coordinate of the item changes. */ /*! - \fn void QFxItem::bottomChanged() - - This signal is emitted when the bottom coordinate of the item changes. -*/ - -/*! \fn void QFxItem::widthChanged() This signal is emitted when the width of the item changes. @@ -1284,6 +1258,15 @@ QFxAnchorLine QFxItem::verticalCenter() const } /*! + \internal +*/ +QFxAnchorLine QFxItem::baseline() const +{ + Q_D(const QFxItem); + return d->anchorLines()->baseline; +} + +/*! \property QFxItem::top One of the anchor lines of the item. @@ -1338,6 +1321,7 @@ QFxAnchorLine QFxItem::verticalCenter() const \qmlproperty AnchorLine Item::right \qmlproperty AnchorLine Item::horizontalCenter \qmlproperty AnchorLine Item::verticalCenter + \qmlproperty AnchorLine Item::baseline The anchor lines of the item. @@ -1351,6 +1335,7 @@ QFxAnchorLine QFxItem::verticalCenter() const \qmlproperty AnchorLine Item::anchors.right \qmlproperty AnchorLine Item::anchors.horizontalCenter \qmlproperty AnchorLine Item::anchors.verticalCenter + \qmlproperty AnchorLine Item::anchors.baseline \qmlproperty Item Item::anchors.fill @@ -1410,20 +1395,19 @@ QFxAnchorLine QFxItem::verticalCenter() const /*! \property QFxItem::baselineOffset - \brief The position of the item's baseline in global (scene) coordinates. + \brief The position of the item's baseline in local coordinates. The baseline of a Text item is the imaginary line on which the text sits. Controls containing text usually set their baseline to the baseline of their text. - For non-text items, a default baseline offset of two-thirds of the - item's height is used to determine the baseline. + For non-text items, a default baseline offset of 0 is used. */ int QFxItem::baselineOffset() const { Q_D(const QFxItem); if (!d->_baselineOffset.isValid()) { - return height()*2/3; //### default baseline is 2/3 of the way to the bottom of the item + return 0; } else return d->_baselineOffset; } @@ -1439,6 +1423,11 @@ void QFxItem::setBaselineOffset(int offset) d->_baselineOffset = offset; emit baselineOffsetChanged(); + + for(int ii = 0; ii < d->dependantAnchors.count(); ++ii) { + QFxAnchors *anchor = d->dependantAnchors.at(ii); + anchor->d_func()->updateVerticalAnchors(); + } } /*! @@ -1674,6 +1663,7 @@ void QFxItem::setKeepMouseGrab(bool keep) */ void QFxItem::activeFocusChanged(bool flag) { + Q_UNUSED(flag); emit activeFocusChanged(); } @@ -1683,6 +1673,7 @@ void QFxItem::activeFocusChanged(bool flag) */ void QFxItem::focusChanged(bool flag) { + Q_UNUSED(flag); emit focusChanged(); } @@ -2102,6 +2093,8 @@ QFxItemPrivate::AnchorLines::AnchorLines(QFxItem *q) bottom.anchorLine = QFxAnchorLine::Bottom; vCenter.item = q; vCenter.anchorLine = QFxAnchorLine::VCenter; + baseline.item = q; + baseline.anchorLine = QFxAnchorLine::Baseline; } QT_END_NAMESPACE |