mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-05-04 23:55:08 -04:00
Store database icons as QImage instead of QIcon.
This has the advantage that they can be used without a running X server. Add methods to retrieve QPixmaps that are converted from the stored QImages and cached by QPixmapCache.
This commit is contained in:
parent
fdf600e09a
commit
00aafa69f5
15 changed files with 137 additions and 60 deletions
|
@ -105,11 +105,13 @@ void TestKeePass2XmlReader::testCustomIcons()
|
|||
QCOMPARE(m_db->metadata()->customIcons().size(), 1);
|
||||
Uuid uuid = Uuid::fromBase64("++vyI+daLk6omox4a6kQGA==");
|
||||
QVERIFY(m_db->metadata()->customIcons().contains(uuid));
|
||||
QIcon icon = m_db->metadata()->customIcon(uuid);
|
||||
QImage img = icon.pixmap(16, 16).toImage();
|
||||
QImage icon = m_db->metadata()->customIcon(uuid);
|
||||
QCOMPARE(icon.width(), 16);
|
||||
QCOMPARE(icon.height(), 16);
|
||||
|
||||
for (int x=0; x<16; x++) {
|
||||
for (int y=0; y<16; y++) {
|
||||
QRgb rgb = img.pixel(x, y);
|
||||
QRgb rgb = icon.pixel(x, y);
|
||||
QCOMPARE(qRed(rgb), 128);
|
||||
QCOMPARE(qGreen(rgb), 0);
|
||||
QCOMPARE(qBlue(rgb), 128);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue