utils enhanced splitStringByWidth()

Split a word only if there is more than 30% free space on the line.

 - reordered parameters, non-const references first
 - extracted logic to function
This commit is contained in:
silverqx
2024-11-14 17:29:39 +01:00
parent 8c12113899
commit 7399159390
3 changed files with 92 additions and 47 deletions

View File

@@ -96,8 +96,8 @@ namespace Orm::Utils
/*! Split a string by the given width (with or w/o splitting words preference). */
static QStringList
splitStringByWidth(QStringView string, int width,
SplitWordsBehavior splitBehavior = cNeverSplitWords);
splitStringByWidth(QStringView string, int maxWidth,
SplitWordsBehavior splitBehavior = cSplitWords30);
/*! Split a string view at the first given character. */
static QList<QStringView>
splitAtFirst(QStringView string, QChar separator,