From f23e45437000323851a3967b8512c2150a70d05a Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Mon, 3 Apr 2017 13:55:47 +0200 Subject: [PATCH] ProjectExplorer: Small welcome page improvement Use the complete height of the (unexpanded) session label for the click- to-open region. Also, give some magic numbers a name. Change-Id: Ie972d669cca943105cdd2e7e99394b61ca0a6e37 Reviewed-by: Thomas Hartmann --- src/plugins/projectexplorer/projectwelcomepage.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/projectexplorer/projectwelcomepage.cpp b/src/plugins/projectexplorer/projectwelcomepage.cpp index f7e442ed5e6..9518891ece7 100644 --- a/src/plugins/projectexplorer/projectwelcomepage.cpp +++ b/src/plugins/projectexplorer/projectwelcomepage.cpp @@ -56,6 +56,7 @@ using namespace Core; using namespace Utils; const int LINK_HEIGHT = 35; +const int SESSION_LINE_HEIGHT = 30; const char PROJECT_BASE_ID[] = "Welcome.OpenRecentProject"; namespace ProjectExplorer { @@ -292,7 +293,7 @@ public: if (isActiveSession && !isDefaultVirgin) fullSessionName = ProjectWelcomePage::tr("%1 (current session)").arg(fullSessionName); - const QRect switchRect = QRect(x, y, rc.width() - 24, firstBase + 3 - y); + const QRect switchRect = QRect(x, y, rc.width() - 24, SESSION_LINE_HEIGHT); const bool switchActive = switchRect.contains(mousePos); painter->setPen(linkColor); painter->setFont(sizedFont(13, option.widget, switchActive)); @@ -350,7 +351,7 @@ public: QSize sizeHint(const QStyleOptionViewItem &, const QModelIndex &idx) const final { - int h = 30; + int h = SESSION_LINE_HEIGHT; QString sessionName = idx.data(Qt::DisplayRole).toString(); if (m_expandedSessions.contains(sessionName)) { QStringList projects = SessionManager::projectsForSessionName(sessionName); @@ -364,7 +365,7 @@ public: { if (ev->type() == QEvent::MouseButtonRelease) { const QPoint pos = static_cast(ev)->pos(); - const QRect rc(option.rect.right() - 24, option.rect.top(), 24, 30); + const QRect rc(option.rect.right() - 24, option.rect.top(), 24, SESSION_LINE_HEIGHT); const QString sessionName = idx.data(Qt::DisplayRole).toString(); if (rc.contains(pos)) { // The expand/collapse "button".