X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/ed2d352c42a6d517d4f29b3582c0e00aa34fe647..e57f6215659ee36877c7c36c9e3fcba0ba5d03a0:/src/kitemviews/private/kitemlistroleeditor.cpp diff --git a/src/kitemviews/private/kitemlistroleeditor.cpp b/src/kitemviews/private/kitemlistroleeditor.cpp index f305fadac..895a97aea 100644 --- a/src/kitemviews/private/kitemlistroleeditor.cpp +++ b/src/kitemviews/private/kitemlistroleeditor.cpp @@ -18,6 +18,7 @@ KItemListRoleEditor::KItemListRoleEditor(QWidget *parent) setAcceptRichText(false); enableFindReplace(false); document()->setDocumentMargin(0); + setCheckSpellingEnabled(false); if (parent) { parent->installEventFilter(this); @@ -139,6 +140,10 @@ void KItemListRoleEditor::autoAdjustSize() { const qreal frameBorder = 2 * frameWidth(); + const auto originalSize = size(); + auto newSize = originalSize; + + document()->adjustSize(); const qreal requiredWidth = document()->size().width(); const qreal availableWidth = size().width() - frameBorder; if (requiredWidth > availableWidth) { @@ -146,7 +151,7 @@ void KItemListRoleEditor::autoAdjustSize() if (parentWidget() && pos().x() + newWidth > parentWidget()->width()) { newWidth = parentWidget()->width() - pos().x(); } - resize(newWidth, size().height()); + newSize.setWidth(newWidth); } const qreal requiredHeight = document()->size().height(); @@ -156,8 +161,15 @@ void KItemListRoleEditor::autoAdjustSize() if (parentWidget() && pos().y() + newHeight > parentWidget()->height()) { newHeight = parentWidget()->height() - pos().y(); } - resize(size().width(), newHeight); + newSize.setHeight(newHeight); + } + + if (originalSize != newSize) { + resize(newSize); } + // reset the document width to the widget width + // to allow alignment to be properly rendered + document()->setTextWidth(newSize.width()); } void KItemListRoleEditor::emitRoleEditingFinished(EditResultDirection direction)