Skip to content

Commit

Permalink
fix:the min width of the table headers is narrow
Browse files Browse the repository at this point in the history
the min width of the table headers is narrow in
program process,system service and user parts

Log: the min width of the table headers is narrow in
program process and system service parts

Bug: https://pms.uniontech.com/bug-view-241857.html
  • Loading branch information
lJxDabab committed Feb 21, 2024
1 parent 37f7b58 commit c548a78
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
6 changes: 5 additions & 1 deletion deepin-system-monitor-main/gui/base/base_header_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ QSize BaseHeaderView::sizeHint() const
void BaseHeaderView::paintEvent(QPaintEvent *event)
{
DHeaderView::paintEvent(event);

if(DApplicationHelper::instance()->themeType()==Dtk::Gui::DGuiApplicationHelper::ColorType::LightType){
setStyleSheet("border-radius: 8px;border: 1px solid white;");
}else{
setStyleSheet("border-radius: 8px;border: 1px solid rgba(0,0,0,12);");
}
// draw focus
if (hasFocus() && m_focusReason == Qt::TabFocusReason) {
QPainter painter(viewport());
Expand Down
3 changes: 2 additions & 1 deletion deepin-system-monitor-main/gui/base/base_table_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ BaseTableView::BaseTableView(DWidget *parent)
m_headerView->setContextMenuPolicy(Qt::CustomContextMenu);
// header view focus policy
m_headerView->setFocusPolicy(Qt::StrongFocus);

// header section context min width
m_headerView->setMinimumSectionSize(120);
// not allowing expanding/collpasing top-level items
setRootIsDecorated(false);
// items are not expandable
Expand Down
22 changes: 11 additions & 11 deletions deepin-system-monitor-main/gui/process_table_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ void ProcessTableView::onThemeTypeChanged()
palette.setColor(DPalette::Text, palette.color(DPalette::PlaceholderText));
m_notFoundLabel->setPalette(palette);

palette.setColor(DPalette::Button, palette.color(DPalette::Base));
header()->setPalette(palette);
// palette.setColor(DPalette::Button, palette.color(DPalette::Base));
// header()->setPalette(palette);
}

QString ProcessTableView::getProcessName(int pid)
Expand Down Expand Up @@ -443,23 +443,23 @@ void ProcessTableView::initUI(bool settingsLoaded)
palette.setColor(DPalette::Text, labelColor);
m_notFoundLabel->setPalette(palette);
m_notFoundLabel->setVisible(false);

// header view options
// header view instance
auto *hdr = header();
// header section movable
header()->setSectionsMovable(true);
hdr->setSectionsMovable(true);
// header section clickable
header()->setSectionsClickable(true);
hdr->setSectionsClickable(true);
// header section resizable
header()->setSectionResizeMode(DHeaderView::Interactive);
hdr->setSectionResizeMode(DHeaderView::Interactive);
// stretch last header section
header()->setStretchLastSection(true);
hdr->setStretchLastSection(true);
// show sort indicator on sort column
header()->setSortIndicatorShown(true);
hdr->setSortIndicatorShown(true);
// header section default alignment
header()->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
hdr->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
// header section context menu policy
header()->setContextMenuPolicy(Qt::CustomContextMenu);

hdr->setContextMenuPolicy(Qt::CustomContextMenu);
// table options
setSortingEnabled(true);
// only single row selection allowed
Expand Down
8 changes: 4 additions & 4 deletions deepin-system-monitor-main/gui/system_service_table_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ void SystemServiceTableView::initUI(bool settingsLoaded)
m_noMatchingResultLabel->setPalette(palette);
m_noMatchingResultLabel->setVisible(false);

palette.setColor(DPalette::Button, palette.color(DPalette::Base));
header()->setPalette(palette);
// palette.setColor(DPalette::Button, palette.color(DPalette::Base));
// header()->setPalette(palette);

// header view instance
auto *hdr = header();
Expand Down Expand Up @@ -566,8 +566,8 @@ void SystemServiceTableView::initConnections()
m_noMatchingResultLabel->setPalette(palette);
}

palette.setColor(DPalette::Button, palette.color(DPalette::Base));
header()->setPalette(palette);
// palette.setColor(DPalette::Button, palette.color(DPalette::Base));
// header()->setPalette(palette);

auto pa = DApplicationHelper::instance()->applicationPalette();
// set spinner color
Expand Down

0 comments on commit c548a78

Please sign in to comment.