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:
Daniel Teske
2012-02-29 13:27:02 +01:00
parent 9ca38374ea
commit 407e1eaa9f
3 changed files with 20 additions and 4 deletions

View File

@@ -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;