qdate

How to display a selected date and a number in Qt

寵の児 提交于 2019-12-10 17:49:34
问题 I'm currently working with the QCalendarWidget and I need some ideas to accomplish the following. What would be the best way to add the selecteDate from a QCalendarWidget and a number to some sort of table. What I want is basically to have a list of dates with a number attached to each date, these numbers will be added together and the result will be displayed in a QLabel, I also want to be able to delete rows and again update the QLabel every time a row is deleted. I also want to be able to

QDate - wrong year

落爺英雄遲暮 提交于 2019-12-02 03:18:37
问题 I have the following situation: QDate fixDate = QDate::fromString(QString("270912"), "ddMMyy"); the year returned is 1912 . I do not understand why and how get the correct year. Thanks in advance 回答1: Two-digit year is always interpretating as 19xx . So You can pass YYYY or just add 100 to years. 回答2: As described in the docs: For any field that is not represented in the format the following defaults are used: Year 1900 Month 1 Day 1 // For example: QDate::fromString("1.30", "M.d"); //

QDate - wrong year

爱⌒轻易说出口 提交于 2019-12-02 01:29:01
I have the following situation: QDate fixDate = QDate::fromString(QString("270912"), "ddMMyy"); the year returned is 1912 . I do not understand why and how get the correct year. Thanks in advance Dmitry Melnikov Two-digit year is always interpretating as 19xx . So You can pass YYYY or just add 100 to years. As described in the docs : For any field that is not represented in the format the following defaults are used: Year 1900 Month 1 Day 1 // For example: QDate::fromString("1.30", "M.d"); // January 30 1900 QDate::fromString("20000110", "yyyyMMdd"); // January 10, 2000 (Excuse the formatting,