Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › MultiResolutionImage source property binding

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #10268

    spike

    Hi,

    I’m having trouble with the MultiResolutionImage component. Two examples, where the first one works fine, but the second doesn’t.

    // Works fine, it's selecting "qrc://+hd2/MyImage.png" respectively.
    MultiResolutionImage {
      id: image
      source: "qrc:/MyImage.png"
    }
    
    // This doesn't work at all. It's not changing the source depending on resolution.
    MultiResolutionImage {
      id: image
      source: myObject.image // "qrc:/MyImage.png"
    }
    

    Either I’m too stupid to see my mistake or it’s a bug.

    #10351

    Günther
    Felgo Team

    Hi supaiku,

    can you provide more information on the second case (where it doesn’t work)?

    What does myObject.image refer to? Is it a string property that contains the image source?
    Do you have access to this property in the context of the MultiResolutionImage?

    Best,
    GT

    #10373

    spike

    Hi,

    well the property contains what the comment says. :p It’s content is a string to the qrc location.

    The MultiResolutionImage is loading a source, but not from a “+hd/+hd2” folder as in the first example. It works if I put the exact same string into the source, but not if the source is provided by a property binding.

     

    MyObject is a simple JavaScript object.

    • This reply was modified 8 years, 7 months ago by  supaiku.
    #10382

    Günther
    Felgo Team

    Hi,

    I just tried both examples on my end, and everything works fine. I just happened to have one problem at first, when I created the “myObject” javascript-object as a QML property and used the wrong syntax:

    // correct
    property var myObject: {
            "image": "qrc:/MyImage.png"
    }
    
    // wrong
    property var myObject: {
            image: "qrc:/MyImage.png"
    }

    Maybe that’s also your problem?

    If not, can you please provide some log output or hints to the error that you are facing?

    Best,
    GT

    • This reply was modified 8 years, 7 months ago by  GT.
    #10447

    spike

    qrc:

    <RCC>
        <qresource prefix="/assets">
            <file alias="pic.png">assets/pic.png</file>
        </qresource>
        <qresource prefix="/assets/+hd">
            <file alias="pic.png">assets/+hd/pic.png</file>
        </qresource>
        <qresource prefix="/assets/+hd2">
            <file alias="pic.png">assets/+hd2/pic.png</file>
        </qresource>
    </RCC>
    

     

    MultiResolutionImage {
      source: jsonObject().source
      onSourceChanged: {
        console.log("Source: %1".arg(source))
      }
    }
    
    function jsonObject() {
      return { source: "qrc:/assets/pic.png" }
    }
    
    

     

    This is 100% reproducable.

    • This reply was modified 8 years, 7 months ago by  supaiku.
    #10472

    Alex
    Felgo Team

    Hi,

    it works for me if I define my resources like that:

    <RCC>
        <qresource prefix="/">
            <file>qml</file>
    		<file>assets</file>
    		<file>assets/+hd</file>
    		<file>assets/+hd2</file>
        </qresource>
    </RCC>
    

    Cheers,
    Alex

    • This reply was modified 8 years, 7 months ago by  Alex.
    • This reply was modified 8 years, 7 months ago by  Alex.
    #10475

    spike

    Hi,

     

    if I use the same example I posted above with the qrc you posted, it still doesn’t work. 🙁

    #10476

    Alex
    Felgo Team

    Hi,

    can you please send a full project containing the issue to support@felgo.com? Maybe there are still inconsistencies regarding the project structure or something else.

    Cheers,
    Alex

    #10684

    spike

    Hi,

     

    any progress?

    #10685

    Alex
    Felgo Team

    Hi Joshua,

    I already sent you an answer to your mail on September 16th, didn’t you receive it? I’ll resend it now just to make sure.

    Cheers,
    Alex

    #10698

    spike

    Ah, nope. I didn’t get any mail… Thanks. You helped me a lot. 🙂

Viewing 11 posts - 1 through 11 (of 11 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded