Skip to content

Commit 30f82e5

Browse files
fix(dialog): update my schedule icon theme sync and scroll behavior
1. 在主题切换后同步刷新我的日程弹窗图标,确保左上角应用图标跟随系统主题变化。 2. 优化日程内容区域高度与滚动条显示逻辑,内容未超出可视区域时关闭滚动条和滚动效果。 3. 在内容超出显示区域时保留垂直滚动能力,避免完整内容被截断。 1. Refresh the My Schedule dialog icon when the theme changes so the top-left app icon stays in sync with the system theme. 2. Refine the schedule content height and scrollbar logic so scrolling stays disabled when the content fits in the visible area. 3. Keep vertical scrolling available only when the content exceeds the visible area to avoid truncating longer content. PMS: BUG-368849 PMS: BUG-368851 Log: - Updated the My Schedule dialog icon when the theme changes. - Disabled unnecessary scrolling when schedule content fits in the visible area.
1 parent 0eee8e8 commit 30f82e5

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

src/calendar-client/src/dialog/myscheduleview.cpp

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,21 @@ void CMyScheduleView::slotAutoFeed(const QFont &font)
9595
resultStr += str;
9696
}
9797

98-
if (strList.count() * h > 100) {
98+
const int scheduleContentH = strList.count() * h;
99+
const bool needScroll = scheduleContentH > 100;
100+
if (needScroll) {
99101
m_scheduleLabelH = 100;
100102
} else {
101103
int minH = 17;
102-
m_scheduleLabelH = strList.count() * h;
104+
m_scheduleLabelH = scheduleContentH;
103105
m_scheduleLabelH = m_scheduleLabelH >= minH ? m_scheduleLabelH : minH;
104106
}
105107
//更新控件高度
106108
area->setFixedHeight(m_scheduleLabelH);
109+
area->setVerticalScrollBarPolicy(needScroll ? Qt::ScrollBarAsNeeded : Qt::ScrollBarAlwaysOff);
110+
area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
107111
m_scheduleLabel->setText(resultStr);
112+
m_scheduleLabel->setFixedHeight(needScroll ? scheduleContentH : m_scheduleLabelH);
108113

109114
m_timeLabelH = 26;
110115
if (m_scheduleInfo->lunnar()) {
@@ -185,6 +190,11 @@ void CMyScheduleView::setLabelTextColor(const int type)
185190
setPaletteTextColor(m_timeLabel, timeColor);
186191
}
187192

193+
void CMyScheduleView::updateDialogIcon()
194+
{
195+
setIcon(QIcon::fromTheme("dde-calendar"));
196+
}
197+
188198
/**
189199
* @brief setPaletteTextColor 设置调色板颜色
190200
* @param widget 需要设置的widget
@@ -301,8 +311,7 @@ void CMyScheduleView::initUI()
301311
m_Title->setAlignment(Qt::AlignCenter);
302312
DFontSizeManager::instance()->bind(m_Title, DFontSizeManager::T5, QFont::DemiBold);
303313
//设置日期图标
304-
QIcon t_icon(CDynamicIcon::getInstance()->getPixmap());
305-
setIcon(t_icon);
314+
updateDialogIcon();
306315
m_Title->setText(tr("My Event"));
307316
m_Title->move(90, 0); // center x: (400-220)/2
308317

@@ -315,6 +324,8 @@ void CMyScheduleView::initUI()
315324
area->setFocusPolicy(Qt::FocusPolicy::NoFocus);
316325
area->setFrameShape(QFrame::NoFrame);
317326
area->setFixedWidth(363);
327+
area->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
328+
area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
318329
area->setBackgroundRole(QPalette::Window);
319330
area->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
320331
area->setWidgetResizable(true);
@@ -379,6 +390,9 @@ void CMyScheduleView::initConnection()
379390
QObject::connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged,
380391
this,
381392
&CMyScheduleView::setLabelTextColor);
393+
QObject::connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged,
394+
this,
395+
&CMyScheduleView::updateDialogIcon);
382396
//如果为节假日日程
383397
if (CScheduleOperation::isFestival(m_scheduleInfo)) {
384398
qCDebug(ClientLogger) << "Adding close button for festival schedule";

src/calendar-client/src/dialog/myscheduleview.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public slots:
4949
//界面初始化
5050
void initUI();
5151
void initConnection();
52+
void updateDialogIcon();
5253
//设置label文字颜色
5354
void setLabelTextColor(const int type);
5455
//设置调色板颜色

0 commit comments

Comments
 (0)