Commit 358a3553 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Fixed faked transparency of folding makers with Plastique style

Plastique is manually blending with the background color, so make sure
we set the background to the highlight color when the folding marker is
hovered.
parent 1458a136
...@@ -2348,10 +2348,10 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e) ...@@ -2348,10 +2348,10 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e)
bool active = blockNumber == extraAreaHighlightCollapseBlockNumber; bool active = blockNumber == extraAreaHighlightCollapseBlockNumber;
bool drawStart = drawBox && active; bool drawStart = drawBox && active;
bool drawEnd = blockNumber == extraAreaHighlightCollapseEndBlockNumber || (drawStart && !endIsVisible); bool drawEnd = blockNumber == extraAreaHighlightCollapseEndBlockNumber || (drawStart && !endIsVisible);
bool hovered = blockNumber >= extraAreaHighlightCollapseBlockNumber
&& blockNumber <= extraAreaHighlightCollapseEndBlockNumber;
if ( blockNumber >= extraAreaHighlightCollapseBlockNumber if (hovered) {
&& blockNumber <= extraAreaHighlightCollapseEndBlockNumber) {
QRect box = QRect(extraAreaWidth + 1, top, collapseBoxWidth - 2, collapseBoxWidth); QRect box = QRect(extraAreaWidth + 1, top, collapseBoxWidth - 2, collapseBoxWidth);
drawRectBox(&painter, box, drawStart, drawEnd, pal); drawRectBox(&painter, box, drawStart, drawEnd, pal);
} }
...@@ -2360,7 +2360,7 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e) ...@@ -2360,7 +2360,7 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e)
bool expanded = nextBlock.isVisible(); bool expanded = nextBlock.isVisible();
QRect box(extraAreaWidth + collapseBoxWidth/4, top + collapseBoxWidth/4, QRect box(extraAreaWidth + collapseBoxWidth/4, top + collapseBoxWidth/4,
2 * (collapseBoxWidth/4) + 1, 2 * (collapseBoxWidth/4) + 1); 2 * (collapseBoxWidth/4) + 1, 2 * (collapseBoxWidth/4) + 1);
drawFoldingMarker(&painter, box, expanded, active); drawFoldingMarker(&painter, pal, box, expanded, active, hovered);
} }
} }
...@@ -2404,8 +2404,11 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e) ...@@ -2404,8 +2404,11 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e)
} }
} }
void BaseTextEditor::drawFoldingMarker(QPainter *painter, const QRect &rect, void BaseTextEditor::drawFoldingMarker(QPainter *painter, const QPalette &pal,
bool expanded, bool hovered) const const QRect &rect,
bool expanded,
bool active,
bool hovered) const
{ {
QStyleOptionViewItemV2 opt; QStyleOptionViewItemV2 opt;
opt.rect = rect; opt.rect = rect;
...@@ -2414,9 +2417,12 @@ void BaseTextEditor::drawFoldingMarker(QPainter *painter, const QRect &rect, ...@@ -2414,9 +2417,12 @@ void BaseTextEditor::drawFoldingMarker(QPainter *painter, const QRect &rect,
if (expanded) if (expanded)
opt.state |= QStyle::State_Open; opt.state |= QStyle::State_Open;
if (hovered) if (active)
opt.state |= QStyle::State_MouseOver | QStyle::State_Enabled | QStyle::State_Selected; opt.state |= QStyle::State_MouseOver | QStyle::State_Enabled | QStyle::State_Selected;
if (hovered)
opt.palette.setBrush(QPalette::Window, pal.highlight());
style()->drawPrimitive(QStyle::PE_IndicatorBranch, &opt, painter, this); style()->drawPrimitive(QStyle::PE_IndicatorBranch, &opt, painter, this);
} }
......
...@@ -511,8 +511,11 @@ private: ...@@ -511,8 +511,11 @@ private:
void moveLineUpDown(bool up); void moveLineUpDown(bool up);
void saveCurrentCursorPositionForNavigation(); void saveCurrentCursorPositionForNavigation();
void drawFoldingMarker(QPainter *painter, const QRect &rect, void drawFoldingMarker(QPainter *painter, const QPalette &pal,
bool expanded, bool hovered) const; const QRect &rect,
bool expanded,
bool active,
bool hovered) const;
void toggleBlockVisible(const QTextBlock &block); void toggleBlockVisible(const QTextBlock &block);
QRect collapseBox(); QRect collapseBox();
......
Markdown is supported
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