Fix multiline textedit not expanding on OS X
[quassel.git] / src / uisupport / multilineedit.cpp
index 7e89f49..848e12c 100644 (file)
@@ -55,6 +55,9 @@ MultiLineEdit::MultiLineEdit(QWidget *parent)
     setLineWrapEnabled(false);
     reset();
 
+    // Prevent QTextHtmlImporter::appendNodeText from eating whitespace
+    document()->setDefaultStyleSheet("span { white-space: pre-wrap; }");
+
     connect(this, SIGNAL(textChanged()), this, SLOT(on_textChanged()));
 
     _mircColorMap["00"] = "#ffffff";
@@ -173,7 +176,11 @@ void MultiLineEdit::updateSizeHint()
     opt.lineWidth = lineWidth();
     opt.midLineWidth = midLineWidth();
     opt.state |= QStyle::State_Sunken;
-    QSize s = style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(100, h).expandedTo(QApplication::globalStrut()), this);
+    QWidget *widget = this;
+#ifdef Q_OS_MAC
+    widget = 0;
+#endif
+    QSize s = style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(100, h).expandedTo(QApplication::globalStrut()), widget);
     if (s != _sizeHint) {
         _sizeHint = s;
         updateGeometry();