summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews/qitemdelegate.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-07-16 19:13:13 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-07-17 11:49:16 (GMT)
commit1aa43fc4af995374c577a951fd2054d696aa3b14 (patch)
tree45b78871f99212a3100d879d3a52cf5ee0b4c7a4 /src/gui/itemviews/qitemdelegate.cpp
parent8ab072aff0527d3ef3e44cf1ceba7dca985a6f94 (diff)
downloadQt-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/itemviews/qitemdelegate.cpp')
-rw-r--r--src/gui/itemviews/qitemdelegate.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp
index a285113..336ca79 100644
--- a/src/gui/itemviews/qitemdelegate.cpp
+++ b/src/gui/itemviews/qitemdelegate.cpp
@@ -861,6 +861,8 @@ void QItemDelegate::drawBackground(QPainter *painter,
/*!
\internal
+
+ Code duplicated in QCommonStylePrivate::viewItemLayout
*/
void QItemDelegate::doLayout(const QStyleOptionViewItem &option,
@@ -882,8 +884,10 @@ void QItemDelegate::doLayout(const QStyleOptionViewItem &option,
int w, h;
textRect->adjust(-textMargin, 0, textMargin, 0); // add width padding
- if (textRect->height() == 0 && !hasPixmap)
+ if (textRect->height() == 0 && (!hasPixmap || !hint)) {
+ //if there is no text, we still want to have a decent height for the item sizeHint and the editor size
textRect->setHeight(option.fontMetrics.height());
+ }
QSize pm(0, 0);
if (hasPixmap) {