Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@
#include "ui_mainwindow.h"
#include "configuration.h"

#include <QDebug>

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you add these includes? They even seem to repeat?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh whoops, I had a function in there to do some debugging but then i removed it. You can remove the includes

#include <QWidget>
#include <QLayout>
#include <QLayoutItem>

#include <QDebug>
#include <QWidget>
#include <QLayout>
#include <QLayoutItem>
#include <QTabWidget>

MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
, ui(new Ui::MainWindow)
, m_processRefreshService(new OS::ProcessRefreshService(this))
Expand Down
44 changes: 24 additions & 20 deletions src/perf/sidepanelitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

#include <QPainter>
#include <QPaintEvent>
#include <QStyle>
#include <QStyleOption>
#include <QVBoxLayout>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <QEnterEvent>
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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 ────────────────────────────────────────────────────────────────────
Expand Down
9 changes: 8 additions & 1 deletion src/performancewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <QPalette>
#include <QPainter>
#include <QRegularExpression>
#include <QScrollArea>
#include <QSplitter>
#include <QSplitterHandle>

Expand Down Expand Up @@ -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);

Expand Down
Loading