Skip to content

Commit

Permalink
fix: Fix log items did not response click
Browse files Browse the repository at this point in the history
The QButtonGroup's signal buttonClicked change to idClicked, that cause the log items do not response click.

Log: Fix log items did not response click.
  • Loading branch information
re2zero authored and deepin-bot[bot] committed Feb 10, 2025
1 parent b2ad3d6 commit 11c35f2
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 23 deletions.
4 changes: 0 additions & 4 deletions application/displaycontent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,29 +105,25 @@ void DisplayContent::initUI()
noResultLabel = new DLabel(this);
DPalette pa = DPaletteHelper::instance()->palette(noResultLabel);
pa.setBrush(DPalette::WindowText, pa.color(DPalette::TextTips));
// DGuiApplicationHelper::instance()->setPalette(noResultLabel, pa);
noResultLabel->setPalette(pa);
noResultLabel->setText(DApplication::translate("SearchBar", "No search results"));
DFontSizeManager::instance()->bind(noResultLabel, DFontSizeManager::T4);
noResultLabel->setAlignment(Qt::AlignCenter);

//notAuditLabel
notAuditLabel = new DLabel(this);
// DGuiApplicationHelper::instance()->setPalette(notAuditLabel, pa);
notAuditLabel->setPalette(pa);
notAuditLabel->setText(DApplication::translate("Warning", "Security level for the current system: high\n audit only administrators can view the audit log"));
DFontSizeManager::instance()->bind(notAuditLabel, DFontSizeManager::T4);
notAuditLabel->setAlignment(Qt::AlignCenter);

noCoredumpctlLabel = new DLabel(this);
// DGuiApplicationHelper::instance()->setPalette(noCoredumpctlLabel, pa);
noCoredumpctlLabel->setPalette(pa);
noCoredumpctlLabel->setText(DApplication::translate("Waring", "Unable to obtain crash information, please install systemd-coredump."));
DFontSizeManager::instance()->bind(noCoredumpctlLabel, DFontSizeManager::T4);
noCoredumpctlLabel->setAlignment(Qt::AlignCenter);

noPermissionLabel = new DLabel(this);
// DGuiApplicationHelper::instance()->setPalette(noPermissionLabel, pa);
noPermissionLabel->setPalette(pa);
noPermissionLabel->setText(DApplication::translate("Warning", "You do not have permission to view it"));
DFontSizeManager::instance()->bind(noPermissionLabel, DFontSizeManager::T4);
Expand Down
1 change: 0 additions & 1 deletion application/exportprogressdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ ExportProgressDlg::ExportProgressDlg(DWidget *parent)
DFontSizeManager::instance()->bind(txtLabel, DFontSizeManager::T6);
DPalette pa = DPaletteHelper::instance()->palette(txtLabel);
pa.setBrush(DPalette::WindowText, pa.color(DPalette::BrightText));
// DGuiApplicationHelper::instance()->setPalette(txtLabel, pa);
txtLabel->setPalette(pa);
QVBoxLayout *pVLayouttxt = new QVBoxLayout();
pVLayouttxt->setContentsMargins(0, 0, 0, 10);
Expand Down
13 changes: 4 additions & 9 deletions application/filtercontent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,11 @@ void FilterContent::initUI()
*/
void FilterContent::initConnections()
{
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
connect(m_btnGroup, SIGNAL(buttonClicked(int)), this, SLOT(slot_buttonClicked(int)));
#else
connect(m_btnGroup, &QButtonGroup::idClicked, this, &FilterContent::slot_buttonClicked);
#endif
connect(exportBtn, &DPushButton::clicked, this, &FilterContent::slot_exportButtonClicked);
connect(cbx_dnf_lv, SIGNAL(currentIndexChanged(int)), this, SLOT(slot_cbxDnfLvIdxChanged(int)));

Expand Down Expand Up @@ -625,21 +629,12 @@ void FilterContent::updateWordWrap()
QFontMetrics periodMetrics(periodLabel->font());
QFontMetrics metrics(standFont);

#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
periodLabel->setText(QFontMetrics(periodLabel->font()).elidedText(DApplication::translate("Label", "Period:"), Qt::ElideRight, 1 + periodMetrics.width(DApplication::translate("Label", "Period:"))));
m_todayBtn->setText(QFontMetrics(m_todayBtn->font()).elidedText(DApplication::translate("Button", "Today"), Qt::ElideRight, 1 + metrics.width(DApplication::translate("Button", "Today"))));
m_threeDayBtn->setText(QFontMetrics(m_threeDayBtn->font()).elidedText(DApplication::translate("Button", "3 days"), Qt::ElideRight, 1 + metrics.width(DApplication::translate("Button", "3 days"))));
m_lastWeekBtn->setText(QFontMetrics(m_lastWeekBtn->font()).elidedText(DApplication::translate("Button", "1 week"), Qt::ElideRight, 1 + metrics.width(DApplication::translate("Button", "1 week"))));
m_lastMonthBtn->setText(QFontMetrics(m_lastMonthBtn->font()).elidedText(DApplication::translate("Button", "1 month"), Qt::ElideRight, 1 + metrics.width(DApplication::translate("Button", "1 month"))));
m_threeMonthBtn->setText(QFontMetrics(m_threeMonthBtn->font()).elidedText(DApplication::translate("Button", "3 months"), Qt::ElideRight, 1 + metrics.width(DApplication::translate("Button", "3 months"))));
#else
periodLabel->setText(QFontMetrics(periodLabel->font()).elidedText(DApplication::translate("Label", "Period:"), Qt::ElideRight, 1 + periodMetrics.horizontalAdvance(DApplication::translate("Label", "Period:"))));
m_todayBtn->setText(QFontMetrics(m_todayBtn->font()).elidedText(DApplication::translate("Button", "Today"), Qt::ElideRight, 1 + metrics.horizontalAdvance(DApplication::translate("Button", "Today"))));
m_threeDayBtn->setText(QFontMetrics(m_threeDayBtn->font()).elidedText(DApplication::translate("Button", "3 days"), Qt::ElideRight, 1 + metrics.horizontalAdvance(DApplication::translate("Button", "3 days"))));
m_lastWeekBtn->setText(QFontMetrics(m_lastWeekBtn->font()).elidedText(DApplication::translate("Button", "1 week"), Qt::ElideRight, 1 + metrics.horizontalAdvance(DApplication::translate("Button", "1 week"))));
m_lastMonthBtn->setText(QFontMetrics(m_lastMonthBtn->font()).elidedText(DApplication::translate("Button", "1 month"), Qt::ElideRight, 1 + metrics.horizontalAdvance(DApplication::translate("Button", "1 month"))));
m_threeMonthBtn->setText(QFontMetrics(m_threeMonthBtn->font()).elidedText(DApplication::translate("Button", "3 months"), Qt::ElideRight, 1 + metrics.horizontalAdvance(DApplication::translate("Button", "3 months"))));
#endif
} else {
periodLabel->setText(DApplication::translate("Label", "Period:"));
m_allBtn->setText(DApplication::translate("Button", "All"));
Expand Down
1 change: 0 additions & 1 deletion application/loglistview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ void LogListView::paintEvent(QPaintEvent *event)
pa.setBrush(DPalette::ItemBackground, pa.color(DPalette::Base));
// pa.setBrush(DPalette::Background, pa.color(DPalette::Base));
this->setPalette(pa);
// DGuiApplicationHelper::instance()->setPalette(this, pa);

this->setAutoFillBackground(true);

Expand Down
8 changes: 1 addition & 7 deletions application/logviewheaderview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,7 @@ int LogViewHeaderView::sectionSizeHint(int logicalIndex) const
return -1;
}
QString buf = model()->headerData(logicalIndex, Qt::Horizontal, Qt::DisplayRole).toString();
int textWidth;

#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
textWidth = fm.horizontalAdvance(buf); // 使用 horizontalAdvance 方法
#else
textWidth = fm.width(buf); // 使用 width 方法
#endif
int textWidth = fm.horizontalAdvance(buf);

if (sortIndicatorSection() == logicalIndex) {
return textWidth + margin * 3 + 8;
Expand Down
3 changes: 2 additions & 1 deletion application/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,10 @@ int main(int argc, char *argv[])
LogApplication a(argc, argv);

qputenv("DTK_USE_SEMAPHORE_SINGLEINSTANCE", "1");

#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
//高分屏支持
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
a.setAutoActivateWindows(true);
a.loadTranslator();
a.setOrganizationName("deepin");
Expand Down

0 comments on commit 11c35f2

Please sign in to comment.