Always prefer breaking at word boundaries

An overlong word containing a hyphen could be broken anywhere, instead of after
the hyphen.

Example: compare the line breaking of

   aaaaa-aaaaa-aaaaa-aaaaa

with

   aaa aaaaa-aaaaa-aaaaa-aaaaa

(with a very narrow window)

This also improves Chinese text in some situations (#10299)
This commit is contained in:
Guillaume Munch 2016-11-06 15:14:29 +01:00
parent b30f8d3c4b
commit 50ccbd2eab

View File

@ -303,7 +303,8 @@ bool GuiFontMetrics::breakAt(docstring & s, int & x, bool const rtl, bool const
tl.setText(qs);
tl.setFont(font_);
QTextOption to;
to.setWrapMode(force ? QTextOption::WrapAnywhere : QTextOption::WordWrap);
to.setWrapMode(force ? QTextOption::WrapAtWordBoundaryOrAnywhere
: QTextOption::WordWrap);
tl.setTextOption(to);
tl.beginLayout();
QTextLine line = tl.createLine();