Commit 3b1e1231 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Fixed position of folding markers with QGtkStyle

Not a brilliant solution, but it works. Changing the style itself would
cause problems in other places where the PE_IndicatorBranch is drawn.

Reviewed-by: Jens Bache-Wiig
parent cbd6259d
......@@ -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,
......@@ -30,6 +30,8 @@
#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
ManhattanStyle(const QString &);
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;
......@@ -41,6 +41,7 @@
#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)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment