diff --git a/share/qtcreator/debugger/qttypes.py b/share/qtcreator/debugger/qttypes.py index 28241ea1efc..093ccf0e4e6 100644 --- a/share/qtcreator/debugger/qttypes.py +++ b/share/qtcreator/debugger/qttypes.py @@ -270,23 +270,24 @@ def qdump__QStandardItem(d, value): def qdump__QDate(d, value): jd = value.pointer() - if jd: - d.putValue(jd, 'juliandate') - d.putExpandable() - if d.isExpanded(): - with Children(d): - if d.canCallLocale(): - d.putCallItem('toString', '@QString', value, 'toString', - d.enumExpression('DateFormat', 'TextDate')) - d.putCallItem('(ISO)', '@QString', value, 'toString', - d.enumExpression('DateFormat', 'ISODate')) + if not jd: + d.putValue('(invalid)') + return + d.putValue(jd, 'juliandate') + d.putExpandable() + if d.isExpanded(): + with Children(d): + if d.canCallLocale(): + d.putCallItem('toString', '@QString', value, 'toString', + d.enumExpression('DateFormat', 'TextDate')) + d.putCallItem('(ISO)', '@QString', value, 'toString', + d.enumExpression('DateFormat', 'ISODate')) + if d.qtVersion() < 0x060000: d.putCallItem('(SystemLocale)', '@QString', value, 'toString', d.enumExpression('DateFormat', 'SystemLocaleDate')) d.putCallItem('(Locale)', '@QString', value, 'toString', d.enumExpression('DateFormat', 'LocaleDate')) - d.putFields(value) - else: - d.putValue('(invalid)') + d.putFields(value) def qdump__QTime(d, value): @@ -301,7 +302,7 @@ def qdump__QTime(d, value): d.enumExpression('DateFormat', 'TextDate')) d.putCallItem('(ISO)', '@QString', value, 'toString', d.enumExpression('DateFormat', 'ISODate')) - if d.canCallLocale(): + if d.canCallLocale() and d.qtVersion() < 0x060000: d.putCallItem('(SystemLocale)', '@QString', value, 'toString', d.enumExpression('DateFormat', 'SystemLocaleDate')) d.putCallItem('(Locale)', '@QString', value, 'toString', @@ -419,10 +420,11 @@ def qdump__QDateTime(d, value): d.enumExpression('DateFormat', 'ISODate')) d.putCallItem('toUTC', '@QDateTime', value, 'toTimeSpec', d.enumExpression('TimeSpec', 'UTC')) - d.putCallItem('(SystemLocale)', '@QString', value, 'toString', - d.enumExpression('DateFormat', 'SystemLocaleDate')) - d.putCallItem('(Locale)', '@QString', value, 'toString', - d.enumExpression('DateFormat', 'LocaleDate')) + if d.qtVersion() < 0x060000: + d.putCallItem('(SystemLocale)', '@QString', value, 'toString', + d.enumExpression('DateFormat', 'SystemLocaleDate')) + d.putCallItem('(Locale)', '@QString', value, 'toString', + d.enumExpression('DateFormat', 'LocaleDate')) d.putCallItem('toLocalTime', '@QDateTime', value, 'toTimeSpec', d.enumExpression('TimeSpec', 'LocalTime')) d.putFields(value) diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 5c0f56e288b..9adf8543c33 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -2276,14 +2276,18 @@ void tst_Dumpers::dumper_data() + Check("d1.(ISO)", "\"1980-01-01\"", "@QString") % NeedsInferiorCall + Check("d1.toString", "\"Tue Jan 1 1980\"", "@QString") % NeedsInferiorCall + CheckType("d1.(Locale)", "@QString") % NeedsInferiorCall + % QtVersion(0, 0x5ffff) // Gone in Qt6 + CheckType("d1.(SystemLocale)", "@QString") % NeedsInferiorCall + % QtVersion(0, 0x5ffff) // Gone in Qt6 + Check("t0", "(invalid)", "@QTime") + Check("t1", "13:15:32", "@QTime") + Check("t1.(ISO)", "\"13:15:32\"", "@QString") % NeedsInferiorCall + Check("t1.toString", "\"13:15:32\"", "@QString") % NeedsInferiorCall + CheckType("t1.(Locale)", "@QString") % NeedsInferiorCall + % QtVersion(0, 0x5ffff) // Gone in Qt6 + CheckType("t1.(SystemLocale)", "@QString") % NeedsInferiorCall + % QtVersion(0, 0x5ffff) // Gone in Qt6 + Check("dt0", "(invalid)", "@QDateTime") + Check("dt1", Value4("Tue Jan 1 13:15:32 1980"), "@QDateTime") @@ -2291,7 +2295,9 @@ void tst_Dumpers::dumper_data() + Check("dt1.(ISO)", "\"1980-01-01T13:15:32Z\"", "@QString") % NeedsInferiorCall + CheckType("dt1.(Locale)", "@QString") % NeedsInferiorCall + % QtVersion(0, 0x5ffff) // Gone in Qt6 + CheckType("dt1.(SystemLocale)", "@QString") % NeedsInferiorCall + % QtVersion(0, 0x5ffff) // Gone in Qt6 + Check("dt1.toString", Value4("\"Tue Jan 1 13:15:32 1980\""), "@QString") % NeedsInferiorCall + Check("dt1.toString",