@@ -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" ;
0 commit comments