diff options
author | Janne Koskinen <janne.p.koskinen@digia.com> | 2010-12-08 10:25:29 (GMT) |
---|---|---|
committer | Janne Koskinen <janne.p.koskinen@digia.com> | 2010-12-09 08:20:11 (GMT) |
commit | f9057f290bc89884d32ec88bddc8de6e0a3b3f7f (patch) | |
tree | f21c66f859d2c8658dccb7d15d970c1badbe7ba8 /src/gui/widgets | |
parent | f48a99165e0f3a63b3b144e1a7c7ce586bfc96c4 (diff) | |
download | Qt-f9057f290bc89884d32ec88bddc8de6e0a3b3f7f.zip Qt-f9057f290bc89884d32ec88bddc8de6e0a3b3f7f.tar.gz Qt-f9057f290bc89884d32ec88bddc8de6e0a3b3f7f.tar.bz2 |
QLabel wordwrap to respect maximumSize
80 characters width can be longer than maximum size of QLabel.
Restrict to max size.
Task-number: QT-4354
Reviewed-by: Sami Merila
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qlabel.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp index 42be03b..011b07a 100644 --- a/src/gui/widgets/qlabel.cpp +++ b/src/gui/widgets/qlabel.cpp @@ -682,7 +682,7 @@ QSize QLabelPrivate::sizeForWidth(int w) const bool tryWidth = (w < 0) && (align & Qt::TextWordWrap); if (tryWidth) - w = fm.averageCharWidth() * 80; + w = qMin(fm.averageCharWidth() * 80, q->maximumSize().width()); else if (w < 0) w = 2000; w -= (hextra + contentsMargin.width()); |