Commit f23e4543 authored by Alessandro Portale's avatar Alessandro Portale
Browse files

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's avatarThomas Hartmann <thomas.hartmann@qt.io>
parent f1b50837
......@@ -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<QMouseEvent *>(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".
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment