File Info

Rev. efeab20e689880041b1ce76d479bb22c776d3f74
Size 2,530 bytes
Time 2020-07-04 19:41:12
Author simphone
Log Message

simphone 0.8.1

Content

diff -urb qtbase/src/widgets/styles/qcommonstyle.cpp qtbase/src/widgets/styles/qcommonstyle.cpp
--- qtbase/src/widgets/styles/qcommonstyle.cpp
+++ qtbase/src/widgets/styles/qcommonstyle.cpp
@@ -825,7 +825,11 @@
     case Qt::DisplayRole:
         if (option->features & QStyleOptionViewItem::HasDisplay) {
             QTextOption textOption;
+#if 0
             textOption.setWrapMode(QTextOption::WordWrap);
+#else /* simphone patch: see the comment in QCommonStylePrivate::viewItemDrawText */
+            textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
+#endif
             QTextLayout textLayout(option->text, option->font);
             textLayout.setTextOption(textOption);
             const bool wrapText = option->features & QStyleOptionViewItem::WrapText;
@@ -872,7 +876,15 @@
     QRect textRect = rect.adjusted(textMargin, 0, -textMargin, 0); // remove width padding
     const bool wrapText = option->features & QStyleOptionViewItem::WrapText;
     QTextOption textOption;
+#if 0
     textOption.setWrapMode(wrapText ? QTextOption::WordWrap : QTextOption::ManualWrap);
+#else
+    /* QTextOption::WordWrap is completely broken (at least with QTableWidget) and should NOT be used.
+       but the Qt API doesn't provide a way to change the word wrapping type of an item view.
+
+       simphone patch: take the easy way out and always use QTextOption::WrapAtWordBoundaryOrAnywhere. */
+    textOption.setWrapMode(wrapText ? QTextOption::WrapAtWordBoundaryOrAnywhere : QTextOption::ManualWrap);
+#endif
     textOption.setTextDirection(option->direction);
     textOption.setAlignment(QStyle::visualAlignment(option->direction, option->displayAlignment));
     QTextLayout textLayout(option->text, option->font);
diff -urb qtbase/src/widgets/widgets/qwidgettextcontrol.cpp qtbase/src/widgets/widgets/qwidgettextcontrol.cpp
--- qtbase/src/widgets/widgets/qwidgettextcontrol.cpp
+++ qtbase/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -120,10 +120,12 @@
 #else
       interactionFlags(Qt::TextEditable),
 #endif
-      dragEnabled(true),
 #ifndef QT_NO_DRAGANDDROP
-      mousePressed(false), mightStartDrag(false),
+      dragEnabled(true),
+#else /* simphone patch: dragEnabled must be initialized to false or else it fucks up QPlainTextEdit and possibly other things too */
+      dragEnabled(false),
 #endif
+      mousePressed(false), mightStartDrag(false),
       lastSelectionPosition(0), lastSelectionAnchor(0),
       ignoreAutomaticScrollbarAdjustement(false),
       overwriteMode(false),
Show on old repository browser