summaryrefslogtreecommitdiff
path: root/src/mainwindow.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.cc')
-rw-r--r--src/mainwindow.cc34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index cb68039..711370f 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -125,10 +125,42 @@ void MainWindow::readDatabase()
image = QImage(QSize({64,64}), QImage::Format_RGBA8888);
image.fill(0);
}
- listItem->setData(Qt::UserRole, item.id);
+ image = image.scaled({64,64});
+ QString mark;
+ QColor mark_color;
+ switch(item.db)
+ {
+ case DatabaseSource::KRecipes:
+ mark_color = QColor(0,0,200);
+ mark = "K";
+ break;
+ case DatabaseSource::Gourmet:
+ mark_color = QColor(100,100,25);
+ mark = "G";
+ break;
+ case DatabaseSource::Qookie:
+ mark_color = QColor(200,0,0);
+ mark = "Q";
+ break;
+ }
+
+ QPainter painter(&image);
+ auto font = painter.font();
+ font.setBold(true);
+ font.setPixelSize(12);
+ painter.setFont(font);
+ painter.setPen(Qt::transparent);
+ painter.setBrush(QColor(255, 255, 255, 180));
+ painter.drawEllipse(QRect{-7,-6,20,20});
+ painter.setPen(mark_color);
+ painter.drawText(0, 10, mark);
+
+ QIcon icon;
icon.addPixmap(QPixmap::fromImage(image));
listItem->setIcon(icon);
+
+ listItem->setData(Qt::UserRole, (double)item.id);
listWidget->addItem(listItem);
}
}