forked from qt-creator/qt-creator
Marks: If there are more then 3 marks, paint the highest priority
Also make the mark area 2 pixels wider so that 3 marks fit. And adjust the priorities of marks, so that bookmarks and breakpoints are visible even if there are multiple tasks on the line. Change-Id: Ie8e3e7fa4db262c4243fb61772b6373ea283f1c9 Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
@@ -3682,7 +3682,7 @@ int BaseTextEditorWidget::extraAreaWidth(int *markWidthPtr) const
|
||||
int markWidth = 0;
|
||||
|
||||
if (d->m_marksVisible) {
|
||||
markWidth += documentLayout->maxMarkWidthFactor * fm.lineSpacing();
|
||||
markWidth += documentLayout->maxMarkWidthFactor * fm.lineSpacing() + 2;
|
||||
|
||||
// if (documentLayout->doubleMarkCount)
|
||||
// markWidth += fm.lineSpacing() / 3;
|
||||
@@ -3797,7 +3797,23 @@ void BaseTextEditorWidget::extraAreaPaintEvent(QPaintEvent *e)
|
||||
if (TextBlockUserData *userData = static_cast<TextBlockUserData*>(block.userData())) {
|
||||
if (d->m_marksVisible) {
|
||||
int xoffset = 0;
|
||||
foreach (ITextMark *mark, userData->marks()) {
|
||||
TextMarks marks = userData->marks();
|
||||
TextMarks::const_iterator it = marks.constBegin();
|
||||
if (marks.size() > 3) {
|
||||
// We want the 3 with the highest priority so iterate from the back
|
||||
int count = 0;
|
||||
it = marks.constEnd() - 1;
|
||||
while (it != marks.constBegin()) {
|
||||
if ((*it)->visible())
|
||||
++count;
|
||||
if (count == 3)
|
||||
break;
|
||||
--it;
|
||||
}
|
||||
}
|
||||
TextMarks::const_iterator end = marks.constEnd();
|
||||
for ( ; it != end; ++it) {
|
||||
ITextMark *mark = *it;
|
||||
if (!mark->visible())
|
||||
continue;
|
||||
const int height = fmLineSpacing - 1;
|
||||
|
||||
Reference in New Issue
Block a user