fix: 修复任务栏日期插件显示贴近底部问题

日期显示位置太贴近任务栏底部,不美观,将日期上调

Log: 修复任务栏日期插件显示贴近底部问题,稍微上调
Bug: https://pms.uniontech.com/zentao/bug-view-79942.html
Change-Id: I4fa87c5acbea3ed4034392b0bce17fbfcf7de922
This commit is contained in:
yanghongwei 2021-05-18 22:49:15 +08:00
parent 8ce063e3ab
commit d3fec481cc

View File

@ -198,15 +198,15 @@ void DatetimeWidget::paintEvent(QPaintEvent *e)
QString dateStr = current.toString(format);
if (position == Dock::Top || position == Dock::Bottom) {
timeRect.setBottom(rect().top() + QFontMetrics(m_timeFont).boundingRect(timeStr).height() + 6);
dateRect.setTop(timeRect.bottom() - 4);
timeRect.setBottom(rect().top() + QFontMetrics(m_timeFont).boundingRect(timeStr).height());
dateRect.setTop(timeRect.bottom() - 5);//此处的5只是试验效果所写的值
} else {
timeRect.setBottom(rect().center().y() + m_timeOffset);
dateRect.setTop(timeRect.bottom());
}
painter.setFont(m_timeFont);
painter.drawText(timeRect, Qt::AlignCenter, timeStr);
painter.drawText(timeRect, Qt::AlignBottom | Qt::AlignHCenter, timeStr);
painter.setFont(m_dateFont);
painter.drawText(dateRect, Qt::AlignCenter, dateStr);
painter.drawText(dateRect, Qt::AlignTop | Qt::AlignHCenter, dateStr);
}