rgriebl / brickstore

An offline BrickLink inventory management tool.
https://www.brickstore.dev/
GNU General Public License v3.0
116 stars 26 forks source link

QML extension: PriceGuide missing properties #903

Closed strawberrymetropolis closed 1 day ago

strawberrymetropolis commented 3 months ago

Describe the bug When receiving the priceGuideUpdated signal, the passed priceGuide.item is incomplete, for example missing the id property.

To Reproduce

function onPriceGuideUpdated(priceGuide) {
    if ([
        BrickLink.UpdateStatus.Ok,
        BrickLink.UpdateStatus.UpdateFailed
    ].includes(priceGuide.updateStatus)) {
        console.info(priceGuide.item)
        console.info(priceGuide.item.id)
    }
}

Output in the Developer Console:

INFO qml: QVariant(const BrickLink::Item*, 0x716cd386ee58)
INFO qml: undefined

Expected behavior Receiving a complete item with all properties as documented here.

System information Ubuntu 22.04.4 LTS BrickStore 2024.5.2 (build: 1261)

rgriebl commented 3 months ago

The documentation is wrong here. The item and color properties are actually the raw C++ pointers and you have to convert them via let item = BrickLink.item(pg.item) to something QML/JS understands first (same for color). It's a bit unfortunate, but I didn't want to sacrifice any performance and memory consumption by blindly wrapping everything, even if it's not used at all. I leave this one open, so I don't forget to fix the docs.

strawberrymetropolis commented 3 months ago

Thanks for the super-fast response @rgriebl !