comparison src/grapher.cpp @ 397:61bde1f0ff0a item_appearance_adjustments

Replace DateItems (background items for date shading) with a date range list in the scene and dedicated rendering for it in the graphics view: this way we can ensure the shading spans the full width and the dates are always visible
author Chris Cannam
date Wed, 25 May 2011 14:32:32 +0100
parents 6718bbc073b4
children b1f0fa991c49
comparison
equal deleted inserted replaced
396:1e73b5911631 397:61bde1f0ff0a
15 COPYING included with this distribution for more information. 15 COPYING included with this distribution for more information.
16 */ 16 */
17 17
18 #include "grapher.h" 18 #include "grapher.h"
19 #include "connectionitem.h" 19 #include "connectionitem.h"
20 #include "dateitem.h"
21 #include "debug.h" 20 #include "debug.h"
22 #include "changesetscene.h" 21 #include "changesetscene.h"
23 22
24 #include <QSettings> 23 #include <QSettings>
25 24
579 QString date = m_rowDates[row]; 578 QString date = m_rowDates[row];
580 n++; 579 n++;
581 580
582 if (date != prevDate) { 581 if (date != prevDate) {
583 if (prevDate != "") { 582 if (prevDate != "") {
584 DateItem *item = new DateItem(); 583 m_scene->addDateRange(prevDate, changeRow, n, even);
585 item->setDateString(prevDate);
586 item->setCols(datemincol, datemaxcol - datemincol + 1);
587 item->setRows(changeRow, n);
588 item->setEven(even);
589 item->setZValue(-2);
590 m_scene->addDateItem(item);
591 even = !even; 584 even = !even;
592 } 585 }
593 prevDate = date; 586 prevDate = date;
594 changeRow = row; 587 changeRow = row;
595 n = 0; 588 n = 0;
596 } 589 }
597 } 590 }
598 591
599 if (n > 0) { 592 if (n > 0) {
600 DateItem *item = new DateItem(); 593 m_scene->addDateRange(prevDate, changeRow, n+1, even);
601 item->setDateString(prevDate);
602 item->setCols(datemincol, datemaxcol - datemincol + 1);
603 item->setRows(changeRow, n+1);
604 item->setEven(even);
605 item->setZValue(-2);
606 m_scene->addDateItem(item);
607 even = !even; 594 even = !even;
608 } 595 }
609 } 596
610 597 m_scene->itemAddCompleted();
598 }
599