修复日历控件BUG
parent
2dd4ed9a07
commit
bccc16b269
|
@ -440,17 +440,19 @@ QString LunarCalendarInfo::getSolarTerms(int year, int month, int day)
|
||||||
{
|
{
|
||||||
QString strSolarTerms;
|
QString strSolarTerms;
|
||||||
int dayTemp = 0;
|
int dayTemp = 0;
|
||||||
|
//24节气对应表在1970年以后指定?
|
||||||
int index = (year - 1970) * 12 + month - 1;
|
int index = (year - 1970) * 12 + month - 1;
|
||||||
|
if (index < 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
if (day < 15) {
|
if (day < 15) {
|
||||||
dayTemp = 15 - day;
|
dayTemp = 15 - day;
|
||||||
|
|
||||||
if ((chineseTwentyFourData.at(index) >> 4) == dayTemp) {
|
if ((chineseTwentyFourData.at(index) >> 4) == dayTemp) {
|
||||||
strSolarTerms = listSolarTerm.at(2 * (month - 1));
|
strSolarTerms = listSolarTerm.at(2 * (month - 1));
|
||||||
}
|
}
|
||||||
} else if (day > 15) {
|
} else if (day > 15) {
|
||||||
dayTemp = day - 15;
|
dayTemp = day - 15;
|
||||||
|
|
||||||
if ((chineseTwentyFourData.at(index) & 0x0f) == dayTemp) {
|
if ((chineseTwentyFourData.at(index) & 0x0f) == dayTemp) {
|
||||||
strSolarTerms = listSolarTerm.at(2 * (month - 1) + 1);
|
strSolarTerms = listSolarTerm.at(2 * (month - 1) + 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue