aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Brauch <svenbrauch@googlemail.com>2014-01-24 14:12:32 (GMT)
committerSven Brauch <svenbrauch@googlemail.com>2014-01-24 14:12:32 (GMT)
commit86f26238e78399a1bbff4583de29d21459b032ec (patch)
tree3442d11ebd2e578a432387c6feeb45dce554123f
parentabdfa809c6056941f0194911ac6a41c035919703 (diff)
expanding tree widget: take the TextAlignment data role into account
forward-port of a1baa43a7060 from the kate repo
-rw-r--r--src/completion/expandingtree/expandingdelegate.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/completion/expandingtree/expandingdelegate.cpp b/src/completion/expandingtree/expandingdelegate.cpp
index 608c90e..2b7693b 100644
--- a/src/completion/expandingtree/expandingdelegate.cpp
+++ b/src/completion/expandingtree/expandingdelegate.cpp
@@ -264,14 +264,15 @@ void ExpandingDelegate::drawDisplay(QPainter *painter, const QStyleOptionViewIte
QTextOption to;
- to.setAlignment(m_cachedAlignment);
+ to.setAlignment( static_cast<Qt::Alignment>(m_cachedAlignment | option.displayAlignment) );
to.setWrapMode(QTextOption::WrapAnywhere);
layout.setTextOption(to);
layout.beginLayout();
QTextLine line = layout.createLine();
- line.setLineWidth(rect.width());
+ // Leave some extra space when the text is right-aligned
+ line.setLineWidth(rect.width() - (option.displayAlignment == Qt::AlignRight ? 8 : 0));
layout.endLayout();
//We need to do some hand layouting here