--runtime warnings

This commit is contained in:
Aleix Pol 2014-07-11 19:51:42 +02:00
parent e008a5d7d4
commit 054a38b9d0

View File

@ -127,11 +127,15 @@ void TimeTracker::propertyChanged()
QMetaProperty prop = mo->property(i); QMetaProperty prop = mo->property(i);
if (prop.notifySignalIndex() == senderSignalIndex()) { if (prop.notifySignalIndex() == senderSignalIndex()) {
QString val; QString val;
QVariant var = prop.read(parent()); if (prop.type() < QVariant::UserType) {
if(var.canConvert<QString>()) { QVariant var = prop.read(parent());
val = var.toString(); if(var.canConvert<QString>()) {
} else { val = var.toString();
val = QString("<unknown %1>").arg(var.typeName()); }
}
if (val.isEmpty()) {
val = QString("<unknown %1>").arg(prop.typeName());
} }
m_history.events.append(TimeEvent { QDateTime::currentDateTime(), QString("property %1 changed to %2").arg(prop.name()).arg(val)}); m_history.events.append(TimeEvent { QDateTime::currentDateTime(), QString("property %1 changed to %2").arg(prop.name()).arg(val)});
break; break;