From 2de20ac00d662cbe11e4772181b8f5ab9ea7db64 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Mon, 1 Aug 2022 11:43:24 -0300 Subject: [PATCH] UI: Revamp empty state of SourcesTree The empty state of the SourcesTree widget looks rather busy, with multiple icons and text without spacing. Revamp that state to use a single, faded-out, 32px icon, add some spacing between the icon and the text, and put the icon above the text. --- UI/data/themes/Dark/no_sources.svg | 20 +++----------------- UI/forms/images/no_sources.svg | 20 +++----------------- UI/source-tree.cpp | 18 ++++++++++-------- 3 files changed, 16 insertions(+), 42 deletions(-) diff --git a/UI/data/themes/Dark/no_sources.svg b/UI/data/themes/Dark/no_sources.svg index be6ad559a..3c7bd7c76 100644 --- a/UI/data/themes/Dark/no_sources.svg +++ b/UI/data/themes/Dark/no_sources.svg @@ -1,18 +1,4 @@ - - - - - - - - - - - - - - - - - + + + diff --git a/UI/forms/images/no_sources.svg b/UI/forms/images/no_sources.svg index 55eb49203..1342254f0 100644 --- a/UI/forms/images/no_sources.svg +++ b/UI/forms/images/no_sources.svg @@ -1,18 +1,4 @@ - - - - - - - - - - - - - - - - - + + + diff --git a/UI/source-tree.cpp b/UI/source-tree.cpp index 167b6f385..dc81627dc 100644 --- a/UI/source-tree.cpp +++ b/UI/source-tree.cpp @@ -1721,22 +1721,24 @@ void SourceTree::paintEvent(QPaintEvent *event) } QRectF iconRect = iconNoSources.viewBoxF(); + iconRect.setSize(QSizeF(32.0, 32.0)); QSizeF iconSize = iconRect.size(); QSizeF textSize = textNoSources.size(); QSizeF thisSize = size(); + const qreal spacing = 16.0; - qreal totalHeight = textSize.height() + iconSize.height(); + qreal totalHeight = + iconSize.height() + spacing + textSize.height(); - qreal x = thisSize.width() / 2.0 - textSize.width() / 2.0; + qreal x = thisSize.width() / 2.0 - iconSize.width() / 2.0; qreal y = thisSize.height() / 2.0 - totalHeight / 2.0; - p.drawStaticText(x, y, textNoSources); - - x = thisSize.width() / 2.0 - iconSize.width() / 2.0; - y += textSize.height(); - iconRect.moveTo(x, y); - + iconRect.moveTo(std::round(x), std::round(y)); iconNoSources.render(&p, iconRect); + + x = thisSize.width() / 2.0 - textSize.width() / 2.0; + y += spacing + iconSize.height(); + p.drawStaticText(x, y, textNoSources); } else { QListView::paintEvent(event); }