diff options
-rw-r--r-- | src/plugins/coreplugin/manhattanstyle.cpp | 5 | ||||
-rw-r--r-- | src/plugins/coreplugin/manhattanstyle.h | 8 | ||||
-rw-r--r-- | src/plugins/texteditor/basetexteditor.cpp | 12 |
3 files changed, 22 insertions, 3 deletions
diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index 33361bd4b8..e7315d933e 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -134,6 +134,11 @@ ManhattanStyle::~ManhattanStyle() d = 0; } +QStyle *ManhattanStyle::systemStyle() const +{ + return d->style; +} + // Draws a CSS-like border image where the defined borders are not stretched void drawCornerImage(const QImage &img, QPainter *painter, QRect rect, int left = 0, int top = 0, int right = 0, diff --git a/src/plugins/coreplugin/manhattanstyle.h b/src/plugins/coreplugin/manhattanstyle.h index 9a19051983..ea07803e46 100644 --- a/src/plugins/coreplugin/manhattanstyle.h +++ b/src/plugins/coreplugin/manhattanstyle.h @@ -30,6 +30,8 @@ #ifndef MANHATTANSTYLE_H #define MANHATTANSTYLE_H +#include "core_global.h" + #include <QStyle> #include <QWindowsStyle> @@ -40,15 +42,17 @@ QT_END_NAMESPACE class ManhattanStylePrivate; -class ManhattanStyle : public QWindowsStyle +class CORE_EXPORT ManhattanStyle : public QWindowsStyle { - Q_OBJECT; + Q_OBJECT public: ManhattanStyle(const QString &); ~ManhattanStyle(); + QStyle *systemStyle() const; + void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const; void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const; void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = 0) const; diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 6a635c32de..1b6765683a 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -41,6 +41,7 @@ #ifndef TEXTEDITOR_STANDALONE #include <coreplugin/coreconstants.h> #include <coreplugin/editormanager/editormanager.h> +#include <coreplugin/manhattanstyle.h> #include <extensionsystem/pluginmanager.h> #include <find/basetextfind.h> #include <texteditor/fontsettings.h> @@ -2415,7 +2416,16 @@ void BaseTextEditor::drawFoldingMarker(QPainter *painter, const QPalette &pal, if (hovered) opt.palette.setBrush(QPalette::Window, pal.highlight()); - style()->drawPrimitive(QStyle::PE_IndicatorBranch, &opt, painter, this); + QStyle *s = style(); + + if (ManhattanStyle *ms = qobject_cast<ManhattanStyle*>(s)) + s = ms->systemStyle(); + + // QGtkStyle needs a small correction to draw the marker in the right place + if (qstrcmp(s->metaObject()->className(), "QGtkStyle") == 0) + opt.rect.translate(-2, 0); + + s->drawPrimitive(QStyle::PE_IndicatorBranch, &opt, painter, this); } void BaseTextEditor::slotModificationChanged(bool m) |