diff --git a/deepin-system-monitor-main/compact_cpu_monitor.cpp b/deepin-system-monitor-main/compact_cpu_monitor.cpp index 4e298f5a..99e674a8 100644 --- a/deepin-system-monitor-main/compact_cpu_monitor.cpp +++ b/deepin-system-monitor-main/compact_cpu_monitor.cpp @@ -170,10 +170,10 @@ void CompactCpuMonitor::resizeEvent(QResizeEvent *event) void CompactCpuMonitor::resizeItemRect() { m_detailButton->setFixedSize(m_detailButton->fontMetrics().width(m_detailButton->text()) + 12, m_detailButton->fontMetrics().height() + 4); - const QSize &detailtextSize = m_detailButton->size(); - //additonPoses to align with the cpu text - int additionPosX=3; - int additionPoxY=3; + const QSize &detailtextSize = m_detailButton->size(); + // additonPoses to align with the cpu text + int additionPosX = 3; + int additionPoxY = 3; m_detailButton->setGeometry(this->width() - detailtextSize.width() + additionPosX, additionPoxY, detailtextSize.width(), detailtextSize.height()); } @@ -258,6 +258,7 @@ void CompactCpuMonitor::paintEvent(QPaintEvent *) dashes << 2 << space; gridPen.setDashPattern(dashes); gridPen.setColor(frameColor); + gridPen.setWidth(0); painter.setPen(gridPen); int gridLineX = gridX; diff --git a/deepin-system-monitor-main/compact_disk_monitor.cpp b/deepin-system-monitor-main/compact_disk_monitor.cpp index 0830e751..bcd47359 100644 --- a/deepin-system-monitor-main/compact_disk_monitor.cpp +++ b/deepin-system-monitor-main/compact_disk_monitor.cpp @@ -193,7 +193,7 @@ void CompactDiskMonitor::paintEvent(QPaintEvent *) qreal space = 2; dashes << 2 << space; gridPen.setColor(frameColor); - gridPen.setWidth(penSize); + gridPen.setWidth(0); gridPen.setDashPattern(dashes); painter.setPen(gridPen); diff --git a/deepin-system-monitor-main/compact_network_monitor.cpp b/deepin-system-monitor-main/compact_network_monitor.cpp index 2aa27886..917d275a 100644 --- a/deepin-system-monitor-main/compact_network_monitor.cpp +++ b/deepin-system-monitor-main/compact_network_monitor.cpp @@ -220,7 +220,7 @@ void CompactNetworkMonitor::paintEvent(QPaintEvent *) qreal space = 2; dashes << 2 << space; gridPen.setColor(m_frameColor); - gridPen.setWidth(penSize); + gridPen.setWidth(0); gridPen.setDashPattern(dashes); painter.setPen(gridPen); diff --git a/deepin-system-monitor-main/gui/base/base_detail_item_delegate.cpp b/deepin-system-monitor-main/gui/base/base_detail_item_delegate.cpp index d21ad2c4..79b4b2b7 100644 --- a/deepin-system-monitor-main/gui/base/base_detail_item_delegate.cpp +++ b/deepin-system-monitor-main/gui/base/base_detail_item_delegate.cpp @@ -36,14 +36,19 @@ void BaseDetailItemDelegate::paint(QPainter *painter, { QBrush background; QColor backgroundColor; - if(DApplicationHelper::instance()->themeType()==Dtk::Gui::DGuiApplicationHelper::ColorType::LightType){ - backgroundColor=QColor(0,0,0); + if (DApplicationHelper::instance()->themeType() == Dtk::Gui::DGuiApplicationHelper::ColorType::LightType) + { + backgroundColor = QColor(0, 0, 0); backgroundColor.setAlphaF(0); - if (!(index.row() & 1)) backgroundColor.setAlphaF(0.03); - }else{ - backgroundColor=QColor(255,255,255); + if (!(index.row() & 1)) + backgroundColor.setAlphaF(0.03); + } + else + { + backgroundColor = QColor(255, 255, 255); backgroundColor.setAlphaF(0); - if (!(index.row() & 1)) backgroundColor.setAlphaF(0.03); + if (!(index.row() & 1)) + backgroundColor.setAlphaF(0.03); } background = backgroundColor; painter->save(); @@ -55,7 +60,8 @@ void BaseDetailItemDelegate::paint(QPainter *painter, painter->setBrush(background); painter->drawRect(option.rect); - if (index.isValid()) { + if (index.isValid()) + { const auto <extpalette = index.data(Qt::TextColorRole).value(); painter->setPen(ltextpalette); diff --git a/deepin-system-monitor-main/gui/base/base_header_view.cpp b/deepin-system-monitor-main/gui/base/base_header_view.cpp index 2ee644fb..f04529e4 100644 --- a/deepin-system-monitor-main/gui/base/base_header_view.cpp +++ b/deepin-system-monitor-main/gui/base/base_header_view.cpp @@ -35,13 +35,17 @@ 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{ + 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) { + if (hasFocus() && m_focusReason == Qt::TabFocusReason) + { QPainter painter(viewport()); painter.setRenderHint(QPainter::Antialiasing); @@ -53,7 +57,7 @@ void BaseHeaderView::paintEvent(QPaintEvent *event) QStyleOptionFocusRect o; o.QStyleOption::operator=(option); // need take scroll offset into consideration - QRect focusRect {rect.x() - offset(), rect.y(), length() - sectionPosition(0), rect.height()}; + QRect focusRect{rect.x() - offset(), rect.y(), length() - sectionPosition(0), rect.height()}; o.rect = style->visualRect(layoutDirection(), rect, focusRect); style->drawPrimitive(DStyle::PE_FrameFocusRect, &o, &painter); } diff --git a/deepin-system-monitor-main/gui/chart_view_widget.cpp b/deepin-system-monitor-main/gui/chart_view_widget.cpp index 00fa91db..511d8f39 100644 --- a/deepin-system-monitor-main/gui/chart_view_widget.cpp +++ b/deepin-system-monitor-main/gui/chart_view_widget.cpp @@ -238,6 +238,7 @@ void ChartViewWidget::drawBackPixmap() dashes << space << space; gridPen.setDashPattern(dashes); gridPen.setColor(frameColor); + gridPen.setWidth(0); painter.setPen(gridPen); int gridLineX = gridX; diff --git a/deepin-system-monitor-main/gui/cpu_detail_widget.cpp b/deepin-system-monitor-main/gui/cpu_detail_widget.cpp index b08caf6a..ae6ef7d6 100644 --- a/deepin-system-monitor-main/gui/cpu_detail_widget.cpp +++ b/deepin-system-monitor-main/gui/cpu_detail_widget.cpp @@ -296,6 +296,7 @@ void CPUDetailGrapTableItem::drawBackground(QPainter &painter, const QRect &grap dashes << space << space; gridPen.setDashPattern(dashes); gridPen.setColor(frameColor); + gridPen.setWidth(0); painter.setPen(gridPen); int section = 10; diff --git a/deepin-system-monitor-main/gui/netif_summary_view_widget.h b/deepin-system-monitor-main/gui/netif_summary_view_widget.h index cdaa9aa6..c0229a63 100644 --- a/deepin-system-monitor-main/gui/netif_summary_view_widget.h +++ b/deepin-system-monitor-main/gui/netif_summary_view_widget.h @@ -95,14 +95,24 @@ class NetInfoDetailItemDelegate : public QStyledItemDelegate const QStyleOptionViewItem &option, const QModelIndex &index) const { - const auto &palette =DApplicationHelper::instance()->applicationPalette(); - QColor backgroundColor = palette.color(DPalette::Active,DPalette::Background); - QBrush background = backgroundColor; - - if (!(index.row() & 1)){ - QColor backgroundObviousColor = palette.color(DPalette::Active,DPalette::ItemBackground); - background = backgroundObviousColor; + const auto &palette = DApplicationHelper::instance()->applicationPalette(); + QBrush background; + QColor backgroundColor; + if (DApplicationHelper::instance()->themeType() == Dtk::Gui::DGuiApplicationHelper::ColorType::LightType) + { + backgroundColor = QColor(0, 0, 0); + backgroundColor.setAlphaF(0); + if (!(index.row() & 1)) + backgroundColor.setAlphaF(0.03); + } + else + { + backgroundColor = QColor(255, 255, 255); + backgroundColor.setAlphaF(0); + if (!(index.row() & 1)) + backgroundColor.setAlphaF(0.03); } + background = backgroundColor; painter->save(); QPainterPath clipPath; @@ -113,7 +123,8 @@ class NetInfoDetailItemDelegate : public QStyledItemDelegate painter->setBrush(background); painter->drawRect(option.rect); - if (index.isValid()) { + if (index.isValid()) + { QRect textRect = option.rect; textRect.setX(textRect.x() + LEFTMARGIN); @@ -124,28 +135,35 @@ class NetInfoDetailItemDelegate : public QStyledItemDelegate ShowInfo stInfo = index.data(Qt::UserRole).value(); - if (index.column() == 1 && stInfo.eType != ShowInfo::Normal) { + if (index.column() == 1 && stInfo.eType != ShowInfo::Normal) + { // 绘制第2列IPV QStringList listKey; QStringList listValue = stInfo.strValue.split("/"); - if (stInfo.eType == ShowInfo::IPV4) { + if (stInfo.eType == ShowInfo::IPV4) + { listKey << QApplication::translate("NetInfoDetailItemDelegate", "IP address:") << QApplication::translate("NetInfoDetailItemDelegate", "Netmask:") << QApplication::translate("NetInfoDetailItemDelegate", "Broadcast:"); - } else { + } + else + { listKey << QApplication::translate("NetInfoDetailItemDelegate", "IP address:") << QApplication::translate("NetInfoDetailItemDelegate", "Prefixlen:") << QApplication::translate("NetInfoDetailItemDelegate", "Scope:"); } - if ((listKey.count() == listValue.count()) && (listValue.count() == 3)) { + if ((listKey.count() == listValue.count()) && (listValue.count() == 3)) + { // 获取key最宽的数值 QFontMetrics fm(painter->font()); int iMaxW = fm.width(listKey[0]); - for (int i = 1; i < listKey.count(); ++i) { + for (int i = 1; i < listKey.count(); ++i) + { if (iMaxW < fm.width(listKey[i])) iMaxW = fm.width(listKey[i]); } // 绘制内容 - for (int i = 0; i < listKey.count(); ++i) { + for (int i = 0; i < listKey.count(); ++i) + { // 绘制IPV标题 QRect titleRect; titleRect.setX(textRect.x()); @@ -163,16 +181,18 @@ class NetInfoDetailItemDelegate : public QStyledItemDelegate painter->drawText(valueRect, Qt::AlignLeft | Qt::AlignVCenter, listValue[i]); } } - - } else if (index.column() == 0 && stInfo.eType != ShowInfo::Normal) { + } + else if (index.column() == 0 && stInfo.eType != ShowInfo::Normal) + { // 绘制第1列IPV textRect.setY(textRect.y() + TOPMARGIN); painter->drawText(textRect, Qt::AlignLeft | Qt::AlignTop, stInfo.strKey); - } else { + } + else + { // 其余左对齐、垂直居中 painter->drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, index.data(Qt::DisplayRole).toString()); } - } painter->restore(); } diff --git a/deepin-system-monitor-main/gui/process_table_view.cpp b/deepin-system-monitor-main/gui/process_table_view.cpp index a54f59a2..4cab4373 100644 --- a/deepin-system-monitor-main/gui/process_table_view.cpp +++ b/deepin-system-monitor-main/gui/process_table_view.cpp @@ -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) diff --git a/deepin-system-monitor-main/gui/system_service_table_view.cpp b/deepin-system-monitor-main/gui/system_service_table_view.cpp index 7cb12de4..addaabfa 100644 --- a/deepin-system-monitor-main/gui/system_service_table_view.cpp +++ b/deepin-system-monitor-main/gui/system_service_table_view.cpp @@ -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(); @@ -443,7 +443,8 @@ void SystemServiceTableView::initUI(bool settingsLoaded) setContextMenuPolicy(Qt::CustomContextMenu); // set service table default style when backup settings can not be loaded - if (!settingsLoaded) { + if (!settingsLoaded) + { setColumnWidth(SystemServiceTableModel::kSystemServiceNameColumn, 200); setColumnHidden(SystemServiceTableModel::kSystemServiceNameColumn, false); setColumnWidth(SystemServiceTableModel::kSystemServiceLoadStateColumn, 100); @@ -495,35 +496,36 @@ void SystemServiceTableView::initUI(bool settingsLoaded) m_headerContextMenu = new DMenu(this); // load state column action m_loadStateHeaderAction = m_headerContextMenu->addAction( - DApplication::translate("Service.Table.Header", kSystemServiceLoadState)); + DApplication::translate("Service.Table.Header", kSystemServiceLoadState)); m_loadStateHeaderAction->setCheckable(true); // active state column action m_activeStateHeaderAction = m_headerContextMenu->addAction( - DApplication::translate("Service.Table.Header", kSystemServiceActiveState)); + DApplication::translate("Service.Table.Header", kSystemServiceActiveState)); m_activeStateHeaderAction->setCheckable(true); // sub state column action m_subStateHeaderAction = m_headerContextMenu->addAction( - DApplication::translate("Service.Table.Header", kSystemServiceSubState)); + DApplication::translate("Service.Table.Header", kSystemServiceSubState)); m_subStateHeaderAction->setCheckable(true); // state column action m_stateHeaderAction = m_headerContextMenu->addAction( - DApplication::translate("Service.Table.Header", kSystemServiceState)); + DApplication::translate("Service.Table.Header", kSystemServiceState)); m_stateHeaderAction->setCheckable(true); // description column action m_descriptionHeaderAction = m_headerContextMenu->addAction( - DApplication::translate("Service.Table.Header", kSystemServiceDescription)); + DApplication::translate("Service.Table.Header", kSystemServiceDescription)); m_descriptionHeaderAction->setCheckable(true); // pid column m_pidHeaderAction = m_headerContextMenu->addAction( - DApplication::translate("Service.Table.Header", kSystemServicePID)); + DApplication::translate("Service.Table.Header", kSystemServicePID)); m_pidHeaderAction->setCheckable(true); // startup mode column m_startupModeHeaderAction = m_headerContextMenu->addAction( - DApplication::translate("Service.Table.Header", kSystemServiceStartupMode)); + DApplication::translate("Service.Table.Header", kSystemServiceStartupMode)); m_startupModeHeaderAction->setCheckable(true); // set default checkable state when backup settings load without success - if (!settingsLoaded) { + if (!settingsLoaded) + { m_loadStateHeaderAction->setChecked(false); m_activeStateHeaderAction->setChecked(true); m_subStateHeaderAction->setChecked(true); @@ -566,8 +568,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