diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-07-16 19:13:13 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-07-17 11:49:16 (GMT) |
commit | 1aa43fc4af995374c577a951fd2054d696aa3b14 (patch) | |
tree | 45b78871f99212a3100d879d3a52cf5ee0b4c7a4 /src/gui/styles/qcommonstyle.cpp | |
parent | 8ab072aff0527d3ef3e44cf1ceba7dca985a6f94 (diff) | |
download | Qt-1aa43fc4af995374c577a951fd2054d696aa3b14.zip Qt-1aa43fc4af995374c577a951fd2054d696aa3b14.tar.gz Qt-1aa43fc4af995374c577a951fd2054d696aa3b14.tar.bz2 |
Fixes: ItemView text editor is not visible with empty text and icons
It was not visible wicause its height was 0
Task-number: 257481
Reviewed-by: mbm
Diffstat (limited to 'src/gui/styles/qcommonstyle.cpp')
-rw-r--r-- | src/gui/styles/qcommonstyle.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 29176c3..aba89bc 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -1182,8 +1182,14 @@ void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewIt } } -/* Set sizehint to false to layout the elements inside opt->rect. Set sizehint to true to ignore - opt->rect and return rectangles in infinite space */ +/*! \internal + compute the position for the different component of an item (pixmap, text, checkbox) + + Set sizehint to false to layout the elements inside opt->rect. Set sizehint to true to ignore + opt->rect and return rectangles in infinite space + + Code duplicated in QItemDelegate::doLayout +*/ void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItemV4 *opt, QRect *checkRect, QRect *pixmapRect, QRect *textRect, bool sizehint) const { @@ -1204,8 +1210,10 @@ void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItemV4 *opt, QRe int y = opt->rect.top(); int w, h; - if (textRect->height() == 0 && !hasPixmap) + if (textRect->height() == 0 && (!hasPixmap || !sizehint)) { + //if there is no text, we still want to have a decent height for the item sizeHint and the editor size textRect->setHeight(opt->fontMetrics.height()); + } QSize pm(0, 0); if (hasPixmap) { |