diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-11-22 09:44:28 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-11-22 09:44:28 -0800 |
commit | 781266bf180c84f229798c0d420d4fc3a7a1d29b (patch) | |
tree | 7145efcd634edff8859b8213b02738798cf477f8 | |
parent | a3ddb16d8820039313d316689e2e6e0b2db02528 (diff) | |
download | subsurface-781266bf180c84f229798c0d420d4fc3a7a1d29b.tar.gz |
Work around QPlainTextEdit / QPainter bug on Mac
Actually, it's not so much "work around", it's just "disable our eye candy" for
tags on Mac. This is quite frustrating. When we do anything that has the
QPainter touch the widget from our GroupedLineEdit::paintEvent() path then the
QPlainTextEdit::paintEvent() doesn't render the text of the tags.
Fixes #298
Sort of.
But I guess tag text without eye candy is better than eye candy without tag text.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-ui/groupedlineedit.cpp | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/qt-ui/groupedlineedit.cpp b/qt-ui/groupedlineedit.cpp index 800b842b5..72eb59d41 100644 --- a/qt-ui/groupedlineedit.cpp +++ b/qt-ui/groupedlineedit.cpp @@ -28,19 +28,21 @@ #include "groupedlineedit.h" -#include <QtGui/QStyleOptionFrameV3> -#include <QtGui/QFontMetrics> -#include <QtGui/QApplication> -#include <QtGui/QScrollBar> -#include <QtGui/QTextDocument> -#include <QtGui/QTextBlock> -#include <QtGui/QTextLayout> -#include <QtGui/QTextLine> -#include <QtGui/QPainter> -#include <QtGui/QPainterPath> -#include <QtGui/QBrush> -#include <QtGui/QColor> -#include <QtGui/QPalette> +#include <QFontMetrics> +#include <QStyleOptionFrameV3> +#include <QFontMetrics> +#include <QApplication> +#include <QScrollBar> +#include <QTextDocument> +#include <QTextBlock> +#include <QTextLayout> +#include <QTextLine> +#include <QPainter> +#include <QPainterPath> +#include <QBrush> +#include <QColor> +#include <QPalette> +#include <QDebug> struct GroupedLineEdit::Private { struct Block { @@ -175,7 +177,12 @@ void GroupedLineEdit::keyPressEvent(QKeyEvent *e) void GroupedLineEdit::paintEvent(QPaintEvent *e) { - +#if !defined __APPLE__ + // for reasons we don't understand, yet, touching the painter + // here (even drawing the fill rect) causes the QPlainTextEdit + // paintEvent to not draw the text on MacOS. + // So as a workaround until this is better understood we need + // to disable the eye candy QTextLine line = document()->findBlock(0).layout()->lineAt(0); QPainter painter(viewport()); @@ -203,6 +210,6 @@ void GroupedLineEdit::paintEvent(QPaintEvent *e) painter.setBrush(i.next().lighter(180)); painter.drawPath(path); } - +#endif QPlainTextEdit::paintEvent(e); } |