mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 15:15:50 +08:00
committed by
Mathew Sutcliffe
parent
0518e680c3
commit
67a5dbfe48
@@ -43,6 +43,23 @@ namespace BlackMisc
|
||||
return this->convertToQString();
|
||||
}
|
||||
|
||||
/*
|
||||
* Return backing streamable object (if any)
|
||||
*/
|
||||
const CValueObject *CValueObject::fromQVariant(const QVariant &qv)
|
||||
{
|
||||
if (!qv.isValid()) return nullptr;
|
||||
QVariant::Type t = qv.type();
|
||||
uint ut = qv.userType();
|
||||
if (t != QVariant::UserType) return nullptr; // not a user type
|
||||
if (ut <= QVariant::UserType) return nullptr; // complex Qt type
|
||||
if (qv.canConvert<QDBusArgument>()) return nullptr; // not unstreamed yet
|
||||
|
||||
// this cast cannot be dynamic, so the aboce conditions are crucical
|
||||
const CValueObject *vo = static_cast<const CValueObject *>(qv.constData());
|
||||
return vo;
|
||||
}
|
||||
|
||||
/*
|
||||
* from DBus
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user