Commit 8e2173bb authored by Christoph Cullmann's avatar Christoph Cullmann

Merge branch 'search_margin' into 'master'

search: make item margin configurable

See merge request kde/kate!12
parents 25e0e30e bfb25779
......@@ -27,6 +27,10 @@
#include <QTextCharFormat>
#include <KLocalizedString>
// make list spacing resemble the default list spacing
// (which would not be the case with default QTextDocument margin)
static const int s_ItemMargin = 1;
SPHtmlDelegate::SPHtmlDelegate( QObject* parent )
: QStyledItemDelegate(parent)
{}
......@@ -39,7 +43,7 @@ void SPHtmlDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option
initStyleOption(&options, index);
QTextDocument doc;
//doc.setDocumentMargin(0);
doc.setDocumentMargin(s_ItemMargin);
doc.setHtml(index.data().toString());
painter->save();
......@@ -67,7 +71,7 @@ void SPHtmlDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option
QSize SPHtmlDelegate::sizeHint(const QStyleOptionViewItem& /*option*/, const QModelIndex& index) const
{
QTextDocument doc;
//doc.setDocumentMargin(0);
doc.setDocumentMargin(s_ItemMargin);
doc.setHtml(index.data().toString());
//qDebug() << doc.toPlainText() << doc.size().toSize();
return doc.size().toSize() + QSize(30, 0); // add margin for the check-box
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment