改进农历算法

master
feiyangqingyun 2020-06-07 10:35:20 +08:00
parent 4464105fce
commit 1b416bdbf8
2 changed files with 4 additions and 5 deletions

View File

@ -10,6 +10,9 @@ LunarCalendarItem::LunarCalendarItem(QWidget *parent) : QWidget(parent)
{ {
hover = false; hover = false;
pressed = false; pressed = false;
listDayName << "*" << "初一" << "初二" << "初三" << "初四" << "初五" << "初六" << "初七" << "初八" << "初九" << "初十"
<< "十一" << "十二" << "十三" << "十四" << "十五" << "十六" << "十七" << "十八" << "十九" << "二十"
<< "廿一" << "廿二" << "廿三" << "廿四" << "廿五" << "廿六" << "廿七" << "廿八" << "廿九" << "三十";
select = false; select = false;
showLunar = true; showLunar = true;
@ -200,11 +203,6 @@ void LunarCalendarItem::drawLunar(QPainter *painter)
painter->save(); painter->save();
QStringList listDayName;
listDayName << "*" << "初一" << "初二" << "初三" << "初四" << "初五" << "初六" << "初七" << "初八" << "初九" << "初十"
<< "十一" << "十二" << "十三" << "十四" << "十五" << "十六" << "十七" << "十八" << "十九" << "二十"
<< "廿一" << "廿二" << "廿三" << "廿四" << "廿五" << "廿六" << "廿七" << "廿八" << "廿九" << "三十";
//判断当前农历文字是否节日,是节日且是当月则用农历节日颜色显示 //判断当前农历文字是否节日,是节日且是当月则用农历节日颜色显示
bool exist = (!listDayName.contains(lunar) && dayType != DayType_MonthPre && dayType != DayType_MonthNext); bool exist = (!listDayName.contains(lunar) && dayType != DayType_MonthPre && dayType != DayType_MonthNext);

View File

@ -81,6 +81,7 @@ protected:
private: private:
bool hover; //鼠标是否悬停 bool hover; //鼠标是否悬停
bool pressed; //鼠标是否按下 bool pressed; //鼠标是否按下
QStringList listDayName; //农历日期
bool select; //是否选中 bool select; //是否选中
bool showLunar; //显示农历 bool showLunar; //显示农历