diff options
-rw-r--r-- | src/declarative/fx/qfxitem.cpp | 6 | ||||
-rw-r--r-- | src/declarative/fx/qfxtext.cpp | 6 | ||||
-rw-r--r-- | src/declarative/fx/qfxtext_p.h | 2 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index dd51aa6..5fbd816 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -262,6 +262,8 @@ void QFxContents::calcHeight() QList<QGraphicsItem *> children = m_item->childItems(); for (int i = 0; i < children.count(); ++i) { QFxItem *child = qobject_cast<QFxItem *>(children.at(i)); + if(!child)//### Should this be ignoring non-QFxItem graphicsobjects? + continue; qreal y = child->y(); if (y + child->height() > bottom) bottom = y + child->height(); @@ -288,6 +290,8 @@ void QFxContents::calcWidth() QList<QGraphicsItem *> children = m_item->childItems(); for (int i = 0; i < children.count(); ++i) { QFxItem *child = qobject_cast<QFxItem *>(children.at(i)); + if(!child)//### Should this be ignoring non-QFxItem graphicsobjects? + continue; qreal x = child->x(); if (x + child->width() > right) right = x + child->width(); @@ -309,6 +313,8 @@ void QFxContents::setItem(QFxItem *item) QList<QGraphicsItem *> children = m_item->childItems(); for (int i = 0; i < children.count(); ++i) { QFxItem *child = qobject_cast<QFxItem *>(children.at(i)); + if(!child)//### Should this be ignoring non-QFxItem graphicsobjects? + continue; connect(child, SIGNAL(heightChanged()), this, SLOT(calcHeight())); connect(child, SIGNAL(yChanged()), this, SLOT(calcHeight())); connect(child, SIGNAL(widthChanged()), this, SLOT(calcWidth())); diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index c4e534e..a76b8e6 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -467,8 +467,12 @@ void QFxTextPrivate::updateSize() Q_Q(QFxText); if (q->isComponentComplete()) { QFontMetrics fm(font); - int dy = q->height(); + if (text.isEmpty()) { + q->setImplicitHeight(fm.height()); + return; + } + int dy = q->height(); QString tmp; QSize size(0, 0); diff --git a/src/declarative/fx/qfxtext_p.h b/src/declarative/fx/qfxtext_p.h index 95b566c..8b24c66 100644 --- a/src/declarative/fx/qfxtext_p.h +++ b/src/declarative/fx/qfxtext_p.h @@ -71,7 +71,7 @@ public: QFxTextPrivate() : color((QRgb)0), style(QFxText::Normal), imgDirty(true), hAlign(QFxText::AlignLeft), vAlign(QFxText::AlignTop), elideMode(Qt::ElideNone), - dirty(false), wrap(false), richText(false), singleline(false), control(0), doc(0), + dirty(true), wrap(false), richText(false), singleline(false), control(0), doc(0), format(QFxText::AutoText) { } |