diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 23bc0c9..0860760 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -20,6 +20,17 @@ #include "ui_mainwindow.h" #include "configuration.h" +#include +#include +#include +#include + +#include +#include +#include +#include +#include + MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) , m_processRefreshService(new OS::ProcessRefreshService(this)) diff --git a/src/perf/sidepanelitem.cpp b/src/perf/sidepanelitem.cpp index c79f374..6c6615a 100644 --- a/src/perf/sidepanelitem.cpp +++ b/src/perf/sidepanelitem.cpp @@ -23,6 +23,8 @@ #include #include +#include +#include #include #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #include @@ -90,20 +92,30 @@ void SidePanelItem::paintEvent(QPaintEvent *event) const QRect r = this->rect(); - // Background - QColor bg; - if (this->m_selected) - { - bg = scheme->SidePanelItemSelectedBackgroundColor; - } else if (this->m_hovered) - { - bg = scheme->SidePanelItemHoverBackgroundColor; - } else - { - bg = scheme->SidePanelItemBackgroundColor; + // Selection bg + + QStyleOptionViewItem option; + option.initFrom(this); + + if (this->m_selected) { + option.state |= QStyle::State_Selected; + + // If window loses focus, drop State_Active to trigger the GRAY look + if (this->isActiveWindow() && this->hasFocus()) { + option.state |= QStyle::State_Active; + } + } else { + // Not selected, but window must be active to show the BLUE hover look + if (this->isActiveWindow()) { + option.state |= QStyle::State_Active; + } } - p.fillRect(r, bg); + if (this->m_hovered) { + option.state |= QStyle::State_MouseOver; + } + + style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, &p, nullptr); // Title/subtitle (single row): elide both sides to prevent overlap. QFont titleFont = this->font(); @@ -141,14 +153,6 @@ void SidePanelItem::paintEvent(QPaintEvent *event) Qt::AlignRight | Qt::AlignVCenter, subText); } - - // Selection border - if (this->m_selected) - { - p.setPen(QPen(scheme->SidePanelItemSelectedBorderColor, 2)); - p.setBrush(Qt::NoBrush); - p.drawRect(r.adjusted(1, 1, -1, -1)); - } } // ── Events ──────────────────────────────────────────────────────────────────── diff --git a/src/performancewidget.cpp b/src/performancewidget.cpp index d78a85f..c5ed2ed 100644 --- a/src/performancewidget.cpp +++ b/src/performancewidget.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -187,7 +188,13 @@ void PerformanceWidget::setupLayout() this->m_splitter = new PerformanceSplitter(this); this->m_splitter->setChildrenCollapsible(false); this->m_splitter->addWidget(this->m_sidePanel); - this->m_splitter->addWidget(this->m_stack); + + auto *scrollArea = new QScrollArea; + scrollArea->setFrameShape(QFrame::NoFrame); + scrollArea->setWidgetResizable(true); + scrollArea->setWidget(this->m_stack); + this->m_splitter->addWidget(scrollArea); + this->m_splitter->setStretchFactor(0, 0); this->m_splitter->setStretchFactor(1, 1);