简体   繁体   中英

Printing the value of a property

I want to print the value of a QProperty.

QDebug << node->metaObject()->superClass()->property(i).name();
QDebug << node->metaObject()->superCalss()->property(i).read(node)

However read returns a QVariant altough I just want to get the value as string.

How to do that?

   QDebug << QVariant::toString(node->metaObject()->superCalss()->property(i).read(node));

doesn't work BTW

I'm new to Qt BTW

尝试:

node->metaObject()->superCalss()->property(i).read(node).toString()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM