File tree 1 file changed +37
-16
lines changed
1 file changed +37
-16
lines changed Original file line number Diff line number Diff line change @@ -130,22 +130,43 @@ QVariant Cell::readValue() const
130
130
return QVariant ();
131
131
}
132
132
133
- if ( vDT.type () == QVariant::DateTime )
134
- {
135
- ret = vDT;
136
- }
137
- else if ( vDT.type () == QVariant::Date )
138
- {
139
- ret = vDT;
140
- }
141
- else if ( vDT.type () == QVariant::Time )
142
- {
143
- ret = vDT;
144
- }
145
- else
146
- {
147
- return QVariant ();
148
- }
133
+ // https://github.com/QtExcel/QXlsx/issues/171
134
+ // https://www.qt.io/blog/whats-new-in-qmetatype-qvariant
135
+ #if QT_VERSION >= 0x060000 // Qt 6.0 or over
136
+ if ( vDT.metaType ().id () == QMetaType::QDateTime )
137
+ {
138
+ ret = vDT;
139
+ }
140
+ else if ( vDT.metaType ().id () == QMetaType::QDate )
141
+ {
142
+ ret = vDT;
143
+ }
144
+ else if ( vDT.metaType ().id () == QMetaType::QTime )
145
+ {
146
+ ret = vDT;
147
+ }
148
+ else
149
+ {
150
+ return QVariant ();
151
+ }
152
+ #else
153
+ if ( vDT.type () == QVariant::DateTime )
154
+ {
155
+ ret = vDT;
156
+ }
157
+ else if ( vDT.type () == QVariant::Date )
158
+ {
159
+ ret = vDT;
160
+ }
161
+ else if ( vDT.type () == QVariant::Time )
162
+ {
163
+ ret = vDT;
164
+ }
165
+ else
166
+ {
167
+ return QVariant ();
168
+ }
169
+ #endif
149
170
150
171
// QDateTime dt = dateTime();
151
172
// ret = dt;
You can’t perform that action at this time.
0 commit comments