[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: release critical upstream issues
From:       Daniel Teske <teske () squorn ! de>
Date:       2007-12-01 17:10:50
Message-ID: 200712011810.50975.teske () squorn ! de
[Download RAW message or body]

Patch for designer. Hopefully correct.
It would be nice if someone could try it out, before i commit that to qt-copy/patches.

daniel

["p" (text/x-diff)]

--- //depot/qt/4.3/tools/designer/src/lib/shared/qdesigner_taskmenu.cpp#6	Fri Nov 30 \
                16:15:35 GMT 2007
+++ /home/dteske/dev/qt-4.3/tools/designer/src/lib/shared/qdesigner_taskmenu.cpp	Fri \
Nov 30 16:15:35 GMT 2007 @@ -322,7 +322,7 @@
         editor->setFocus();
 
         if (dlg.exec()) {
-            const QString text = editor->text(Qt::RichText);
+            const QString text = editor->text(Qt::AutoText);
             fw->cursor()->setWidgetProperty(m_widget, propertyName, QVariant(text));
         }
     }
@@ -362,11 +362,11 @@
 
     const QString oldScript = item->script();
     QString newScript = oldScript;
-   
+
     ScriptDialog scriptDialog(fw);
     if (!scriptDialog.editScript(newScript))
         return;
-    
+
     // compile list of selected objects
     ScriptCommand::ObjectList objects;
     objects += (QWidget *)m_widget;
@@ -383,7 +383,7 @@
         delete scriptCommand;
         return;
     }
-    
-    fw->commandHistory()->push(scriptCommand); 
+
+    fw->commandHistory()->push(scriptCommand);
 }
 } // namespace qdesigner_internal
--- //depot/qt/4.3/tools/designer/src/lib/shared/qdesigner_taskmenu_p.h#2	Fri Nov 30 \
                16:15:35 GMT 2007
+++ /home/dteske/dev/qt-4.3/tools/designer/src/lib/shared/qdesigner_taskmenu_p.h	Fri \
                Nov 30 16:15:35 GMT 2007
--- //depot/qt/4.3/tools/designer/src/lib/shared/richtexteditor.cpp#1	Fri Nov 30 \
                16:15:35 GMT 2007
+++ /home/dteske/dev/qt-4.3/tools/designer/src/lib/shared/richtexteditor.cpp	Fri Nov \
30 16:15:35 GMT 2007 @@ -286,17 +286,20 @@
 
 QString RichTextEditor::text(Qt::TextFormat format) const
 {
-    bool richtext = true;
-
-    if (format == Qt::PlainText)
-        richtext = false;
-    else if (format != Qt::RichText)
-        richtext = detectFormat() == Qt::RichText;
-
-    if (richtext)
+    switch (format) {
+    case Qt::LogText:
+    case Qt::PlainText:
+        return toPlainText();
+    case Qt::RichText:
         return toHtml();
-    else
-        return toPlainText();
+    case Qt::AutoText:
+        break;
+    }
+    const QString html = toHtml();
+    const QString plain = toPlainText();
+    QTextEdit tester;
+    tester.setPlainText(plain);
+    return tester.toHtml() == html ? plain : html;
 }
 
 RichTextEditorDialog::RichTextEditorDialog(QWidget *parent)
--- //depot/qt/4.3/tools/designer/src/lib/shared/richtexteditor_p.h#1	Fri Nov 30 \
                16:15:35 GMT 2007
+++ /home/dteske/dev/qt-4.3/tools/designer/src/lib/shared/richtexteditor_p.h	Fri Nov \
30 16:15:35 GMT 2007 @@ -46,7 +46,7 @@
     void setFontBold(bool b);
     void setFontPointSize(double);
     void setText(const QString &text);
-    QString text(Qt::TextFormat format) const;
+    QString text(Qt::TextFormat format = Qt::AutoText) const;
 
 signals:
     void textChanged();



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic