From 781266bf180c84f229798c0d420d4fc3a7a1d29b Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 22 Nov 2013 09:44:28 -0800 Subject: 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 --- qt-ui/groupedlineedit.cpp | 37 ++++++++++++++++++++++--------------- 1 file 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include 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); } -- cgit v1.2.3-70-g09d2