mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fix: 修复任务栏日期插件显示贴近底部问题
日期显示位置太贴近任务栏底部,不美观,将日期上调 Log: 修复任务栏日期插件显示贴近底部问题,稍微上调 Bug: https://pms.uniontech.com/zentao/bug-view-79942.html Change-Id: I4fa87c5acbea3ed4034392b0bce17fbfcf7de922
This commit is contained in:
parent
8ce063e3ab
commit
d3fec481cc
@ -198,15 +198,15 @@ void DatetimeWidget::paintEvent(QPaintEvent *e)
|
|||||||
QString dateStr = current.toString(format);
|
QString dateStr = current.toString(format);
|
||||||
|
|
||||||
if (position == Dock::Top || position == Dock::Bottom) {
|
if (position == Dock::Top || position == Dock::Bottom) {
|
||||||
timeRect.setBottom(rect().top() + QFontMetrics(m_timeFont).boundingRect(timeStr).height() + 6);
|
timeRect.setBottom(rect().top() + QFontMetrics(m_timeFont).boundingRect(timeStr).height());
|
||||||
dateRect.setTop(timeRect.bottom() - 4);
|
dateRect.setTop(timeRect.bottom() - 5);//此处的5只是试验效果所写的值
|
||||||
} else {
|
} else {
|
||||||
timeRect.setBottom(rect().center().y() + m_timeOffset);
|
timeRect.setBottom(rect().center().y() + m_timeOffset);
|
||||||
dateRect.setTop(timeRect.bottom());
|
dateRect.setTop(timeRect.bottom());
|
||||||
}
|
}
|
||||||
painter.setFont(m_timeFont);
|
painter.setFont(m_timeFont);
|
||||||
painter.drawText(timeRect, Qt::AlignCenter, timeStr);
|
painter.drawText(timeRect, Qt::AlignBottom | Qt::AlignHCenter, timeStr);
|
||||||
|
|
||||||
painter.setFont(m_dateFont);
|
painter.setFont(m_dateFont);
|
||||||
painter.drawText(dateRect, Qt::AlignCenter, dateStr);
|
painter.drawText(dateRect, Qt::AlignTop | Qt::AlignHCenter, dateStr);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user