summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormae <qt-info@nokia.com>2010-11-02 13:47:45 +0100
committermae <qt-info@nokia.com>2010-11-02 13:48:32 +0100
commit8415d0faa05e8a17bcc18faeade2f03f8c6705dd (patch)
tree0fec568667571af7a2c4fde1dcc91ec0b12c9902
parentb4df5861a3db21450ef901ecd038972437b7b593 (diff)
downloadqt-creator-8415d0faa05e8a17bcc18faeade2f03f8c6705dd.tar.gz
Fix painting order
text on top of seach results on top of find scope on top of ifdefed out lines.
-rw-r--r--src/plugins/texteditor/basetexteditor.cpp65
1 files changed, 43 insertions, 22 deletions
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index e96298cf03..811557a57d 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -2429,19 +2429,6 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
}
}
- if (!d->m_findScopeStart.isNull() && d->m_findScopeVerticalBlockSelectionFirstColumn < 0) {
-
- TextEditorOverlay *overlay = new TextEditorOverlay(this);
- overlay->addOverlaySelection(d->m_findScopeStart.position(),
- d->m_findScopeEnd.position(),
- d->m_searchScopeFormat.foreground().color(),
- d->m_searchScopeFormat.background().color(),
- TextEditorOverlay::ExpandBegin);
- overlay->setAlpha(false);
- overlay->paint(&painter, e->rect());
- delete overlay;
- }
-
int blockSelectionIndex = -1;
if (d->m_inBlockSelectionMode
@@ -2486,11 +2473,40 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
} // end first pass
+ { // extra pass for ifdefed out blocks
+ QTextBlock blockIDO = block;
+ QPointF offsetIDO = offset;
+ while (blockIDO.isValid()) {
+
+ QRectF r = blockBoundingRect(blockIDO).translated(offsetIDO);
+
+ if (r.bottom() >= er.top() && r.top() <= er.bottom()) {
+ if (BaseTextDocumentLayout::ifdefedOut(blockIDO)) {
+ QRectF rr = r;
+ rr.setRight(viewportRect.width() - offset.x());
+ if (lineX > 0)
+ rr.setRight(qMin(lineX, rr.right()));
+ painter.fillRect(rr, d->m_ifdefedOutFormat.background());
+ }
+ }
+ offsetIDO.ry() += r.height();
+
+ if (offsetIDO.y() > viewportRect.height())
+ break;
+
+ blockIDO = blockIDO.next();
+ if (!blockIDO.isVisible()) {
+ // invisible blocks do have zero line count
+ blockIDO = doc->findBlockByLineNumber(blockIDO.firstLineNumber());
+ }
+
+ }
+ }
+
// possible extra pass for the block selection find scope
if (!d->m_findScopeStart.isNull() && d->m_findScopeVerticalBlockSelectionFirstColumn >= 0) {
QTextBlock blockFS = block;
QPointF offsetFS = offset;
-
while (blockFS.isValid()) {
QRectF r = blockBoundingRect(blockFS).translated(offsetFS);
@@ -2552,6 +2568,19 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
}
}
+ if (!d->m_findScopeStart.isNull() && d->m_findScopeVerticalBlockSelectionFirstColumn < 0) {
+
+ TextEditorOverlay *overlay = new TextEditorOverlay(this);
+ overlay->addOverlaySelection(d->m_findScopeStart.position(),
+ d->m_findScopeEnd.position(),
+ d->m_searchScopeFormat.foreground().color(),
+ d->m_searchScopeFormat.background().color(),
+ TextEditorOverlay::ExpandBegin);
+ overlay->setAlpha(false);
+ overlay->paint(&painter, e->rect());
+ delete overlay;
+ }
+
d->m_searchResultOverlay->fill(&painter,
@@ -2565,14 +2594,6 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
if (r.bottom() >= er.top() && r.top() <= er.bottom()) {
- if (BaseTextDocumentLayout::ifdefedOut(block)) {
- QRectF rr = r;
- rr.setRight(viewportRect.width() - offset.x());
- if (lineX > 0)
- rr.setRight(qMin(lineX, rr.right()));
- painter.fillRect(rr, d->m_ifdefedOutFormat.background());
- }
-
QTextLayout *layout = block.layout();
QTextOption option = layout->textOption();