Skip to content

Commit

Permalink
Scale icon according to text height to fix vertical list synchronizat…
Browse files Browse the repository at this point in the history
…ion.
  • Loading branch information
Kjell Morgenstern authored and KjellMorgenstern committed Dec 12, 2023
1 parent ab2405a commit 29c3381
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/sketch/welcomeview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,6 @@ void WelcomeView::updateRecent() {
auto gotOne = false;

QIcon icon(":/resources/images/icons/WS-fzz-icon.png");
QIcon icon2(":/resources/images/icons/aisler_donut-cloud_logo_icon.png");

for (int i = 0; i < files.size(); ++i) {
QFileInfo finfo(files[i]);
Expand All @@ -702,9 +701,12 @@ void WelcomeView::updateRecent() {
link.chop(1); // Remove the last character
}

QFontMetrics fm(m_recentLinksListWidget->font());
int textHeight = fm.height();
auto pixmap = SqliteReferenceModel().retrieveIcon(fabName);
QIcon icon(pixmap);
itemLinks = new QListWidgetItem(icon, QString("%1 Project").arg(fabName));
QPixmap scaledPixmap = pixmap.scaledToHeight(textHeight, Qt::SmoothTransformation);
QIcon fabIcon(scaledPixmap);
itemLinks = new QListWidgetItem(fabIcon, QString("%1 Project").arg(fabName));
itemLinks->setData(RefRole, link);
itemLinks->setToolTip(link);
} else {
Expand Down

0 comments on commit 29c3381

Please sign in to comment.