简体   繁体   中英

Call a slot from QML which requires a QImage or QPixmap

I have a slot in my application backend which requires a QImage or QPixmap.

Now I want to call it from my QML frontend by providing a png from the resource file:

sessionManager.createUser("user", "qrc:///src/sessionManager/qml/Assets/user.png")

But if I set a breakpoint in createUser I can see that the passed image is null.

How is the correct way to do this?

I don't know of a way to do this from QML. The correct way to do it would be change your C++ API/create a new one to accept a path to the image and load it there instead.

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