}
void TrackRenderer::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const {
- if (index.column() == 0) {
+ QString value = index.data().toString();
+ if (value.startsWith("##")) {
+ value.remove("##");
int x1, y1, x2, y2;
option.rect.getCoords(&x1, &y1, &x2, &y2);
- QImage image(":/icons/"+_icons_theme+"/arrow_r.png");
+ QImage image(":/icons/"+_icons_theme+"/"+value);
x1 += (x2 - x1 - image.width())/2;
y1 += (y2 - y1 - image.width())/2;
painter->drawImage(x1, y1, image);
} else {
- QString value = index.data().toString();
QStringList meta = value.split("#_#");
QFont f = painter->font();
QSize TrackRenderer::sizeHint(const QStyleOptionViewItem &/*option*/, const QModelIndex &/*index*/) const {
return QSize(QApplication::desktop()->geometry().width(), 80);
}
+
+void TrackRenderer::setActiveTrackColor(QString color) {
+ QColor c;
+ if (color == "blue") {
+ c = QColor::fromRgb(100, 150, 220);
+ } else if (color == "black") {
+ c = QColor::fromRgb(0, 0, 0);
+ } else if (color == "magenta") {
+ c = QColor::fromRgb(150, 80, 150);
+ } else if (color == "red") {
+ c = QColor::fromRgb(220, 100, 100);
+ } else if (color == "yellow") {
+ c = QColor::fromRgb(220, 220, 100);
+ } else if (color == "white") {
+ c = QColor::fromRgb(255, 255, 255);
+ } else if (color == "dark") {
+ c = QColor::fromRgb(70, 70, 70);
+ } else if (color == "light") {
+ c = QColor::fromRgb(200, 200, 200);
+ }
+ _spen = QPen(c);
+}