summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/declarative/listview/dynamic.qml4
-rw-r--r--src/declarative/fx/qfxtext.cpp21
2 files changed, 12 insertions, 13 deletions
diff --git a/examples/declarative/listview/dynamic.qml b/examples/declarative/listview/dynamic.qml
index dde24f6..52c3c0b 100644
--- a/examples/declarative/listview/dynamic.qml
+++ b/examples/declarative/listview/dynamic.qml
@@ -59,8 +59,8 @@ Item {
id: FruitDelegate
Item {
width: parent.width; height: 55
- Text { id: Label; font.pixelSize: 24; text: name }
- Text { font.pixelSize: 24; text: '$'+Number(cost).toFixed(2); anchors.right: ItemButtons.left }
+ Text { id: Label; font.pixelSize: 24; text: name; elide: "ElideRight"; anchors.right: Cost.left; anchors.left:parent.left }
+ Text { id: Cost; font.pixelSize: 24; text: '$'+Number(cost).toFixed(2); anchors.right: ItemButtons.left }
Row {
anchors.top: Label.bottom
spacing: 5
diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp
index c60aaf2..5b10289 100644
--- a/src/declarative/fx/qfxtext.cpp
+++ b/src/declarative/fx/qfxtext.cpp
@@ -466,9 +466,6 @@ void QFxTextPrivate::updateSize()
{
Q_Q(QFxText);
if (q->isComponentComplete()) {
- if (text.isEmpty()) {
- return;
- }
QFontMetrics fm(font);
int dy = q->height();
@@ -633,15 +630,17 @@ QPixmap QFxTextPrivate::wrappedTextImage(bool drawStyle)
//paint text
QPixmap img(size);
- img.fill(Qt::transparent);
- QPainter p(&img);
- if (drawStyle) {
- p.setPen(styleColor);
+ if (!size.isEmpty()) {
+ img.fill(Qt::transparent);
+ QPainter p(&img);
+ if (drawStyle) {
+ p.setPen(styleColor);
+ }
+ else
+ p.setPen(color);
+ p.setFont(font);
+ layout.draw(&p, QPointF(0, 0));
}
- else
- p.setPen(color);
- p.setFont(font);
- layout.draw(&p, QPointF(0, 0));
return img;
}