116 disconnect(m_model, SIGNAL(filterProgressChanged(
int)),
118 disconnect(m_model, SIGNAL(rebuildProgressChanged(
int)),
120 disconnect(m_model, SIGNAL(sortProgressChanged(
int)),
122 disconnect(m_model, SIGNAL(filterProgressRangeChanged(
int,
int)),
124 disconnect(m_model, SIGNAL(rebuildProgressRangeChanged(
int,
int)),
126 disconnect(m_model, SIGNAL(sortProgressRangeChanged(
int,
int)),
128 disconnect(m_model, SIGNAL(filterCountsChanged(
int,
int)),
130 disconnect(
this, SIGNAL(requestedGlobalSelection(
bool)),
131 m_model, SLOT(setGlobalSelection(
bool)));
132 disconnect(m_model, SIGNAL(m_modelModified()),
133 this, SLOT(update()));
138 connect(m_model, SIGNAL(filterProgressChanged(
int)),
140 connect(m_model, SIGNAL(rebuildProgressChanged(
int)),
142 connect(m_model, SIGNAL(sortProgressChanged(
int)),
144 connect(m_model, SIGNAL(filterProgressRangeChanged(
int,
int)),
146 connect(m_model, SIGNAL(rebuildProgressRangeChanged(
int,
int)),
148 connect(m_model, SIGNAL(sortProgressRangeChanged(
int,
int)),
150 connect(m_model, SIGNAL(filterCountsChanged(
int,
int)),
152 connect(
this, SIGNAL(requestedGlobalSelection(
bool)),
153 m_model, SLOT(setGlobalSelection(
bool)));
154 connect(m_model, SIGNAL(modelModified()),
this, SLOT(update()));
158 for (
int i = 0; i < m_columns->size(); i++) {
159 disconnect((*m_columns)[i], SIGNAL(visibilityChanged()),
160 this, SLOT(update()));
164 m_columns = m_model->getColumns();
166 for (
int i = 0; i < m_columns->size(); i++)
167 connect((*m_columns)[i], SIGNAL(visibilityChanged()),
this, SLOT(update()));
463 int visibleColWidth = -m_horizontalOffset;
466 for (
int i = 0; i < visibleCols.size(); i++)
467 visibleColWidth += visibleCols[i]->getWidth() - 1;
469 QRect rect(0, 0, qMin(width(), visibleColWidth), rowHeight);
471 int x = rect.center().x();
472 QLinearGradient gradient(x, rect.top(), x, rect.bottom());
475 bool selected =
false;
476 QColor color = selected ? palette().highlight().color() :
477 palette().button().color();
480 int adjustment = 110;
481 gradient.setColorAt(0, color.lighter(adjustment));
482 gradient.setColorAt(1, color.darker(adjustment));
483 painter->fillRect(rect, gradient);
487 QBrush brush = painter->brush();
488 QPainter::CompositionMode compMode = painter->compositionMode();
489 painter->setCompositionMode(QPainter::CompositionMode_SourceOver);
492 painter->setBrush(QBrush(QColor(0, 70, 100, 30)));
493 paintProgress(painter, rect, m_filterProgressMin, m_filterProgressMax,
494 m_filterProgress,
false);
497 painter->setBrush(QBrush(QColor(100, 70, 0, 30)));
498 paintProgress(painter, rect, m_rebuildProgressMin, m_rebuildProgressMax,
499 m_rebuildProgress,
false);
502 painter->setBrush(QBrush(QColor(0, 100, 0, 30)));
503 paintProgress(painter, rect, m_sortProgressMin, m_sortProgressMax,
504 m_sortProgress,
true);
508 painter->setBrush(brush);
509 painter->setCompositionMode(compMode);
511 for (
int i = 0; i < visibleCols.size(); i++) {
514 QString columnText = visibleCol->getTitle();
515 QRect columnRect(
getColumnRect(visibleCols.indexOf(visibleCol)));
516 QPen pen(palette().dark().color().darker(150));
517 pen.setCapStyle(Qt::RoundCap);
518 painter->setPen(pen);
519 painter->drawLine(columnRect.topLeft() + QPoint(0, 1),
520 columnRect.bottomLeft() + QPoint(0, 1));
522 painter->drawLine(columnRect.topLeft() + QPoint(1, 0),
523 columnRect.topRight() - QPoint(0, 0));
525 painter->drawLine(columnRect.topLeft() + QPoint(1, 1),
526 columnRect.topRight() + QPoint(0, 1));
528 painter->drawLine(columnRect.bottomLeft() + QPoint(1, 1),
529 columnRect.bottomRight() + QPoint(0, 1));
531 painter->drawLine(columnRect.bottomLeft() + QPoint(1, 1),
532 columnRect.bottomRight() + QPoint(0, 1));
534 painter->drawLine(columnRect.topRight() + QPoint(0, 1),
535 columnRect.bottomRight() - QPoint(0, 0));
537 painter->setPen(selected ? palette().highlightedText().color() :
538 palette().buttonText().color());
540 QRect textRect(columnRect.x(),
542 columnRect.width() - (SORT_ARROW_MARGIN * 2 + ARROW_WIDTH),
543 columnRect.height());
544 painter->drawText(textRect , Qt::AlignCenter | Qt::TextSingleLine,
547 if (visibleCol == visibleCols.getSortingOrder()[0] &&
548 visibleCol->getWidth() >= SORT_ARROW_MARGIN * 2 + ARROW_WIDTH) {
550 QRect arrowRect(textRect.right() + 1,
552 SORT_ARROW_MARGIN * 2 + ARROW_WIDTH,
556 QPoint left(arrowRect.left() + SORT_ARROW_MARGIN,
557 arrowRect.center().y() - ((ARROW_HEIGHT - 1) / 2));
559 int yOffSet = ((ARROW_HEIGHT - 1) / 2);
560 if (ARROW_HEIGHT % 2 == 0)
562 QPoint center(left.x() + ((ARROW_WIDTH - 1) / 2),
563 arrowRect.center().y() + yOffSet);
565 QPoint right(center.x() + ((ARROW_WIDTH - 1) / 2),
566 arrowRect.center().y() - ((ARROW_HEIGHT - 1) / 2));
568 if (!visibleCol->sortAscending()) {
570 left.setY(center.y());
571 center.setY(right.y());
572 right.setY(left.y());
575 if (m_model->sortingOn()) {
576 painter->drawLine(left, center);
577 painter->drawLine(center, right);
582 columnRect.moveLeft(columnRect.right());