Qt 5.8 QML Image async long delay



  • Hi,

    after I updated Qt 5.7 to Qt 5.8, I noticed loading of images over HTTP became very slow. I'm running the application on RPi, but the same thing happens on Linux Ubuntu. Reverting to Qt 5.7 the problem is solved. Consider this QML snippet:

    main.qml

    import QtQuick 2.0
    import QtQuick.Controls 1.0
    
    ApplicationWindow {
        visible: true
        width: 1350
        height: 800
        title: qsTr("Qt Quick Controls 1.0")
    
        GridView {
            id: grid
            width: parent.width
            height: cellHeight
    
            cellWidth: 225
            cellHeight: 320
    
            focus: true
    
            model: 20
            delegate: Card {
                pic: (index > 5) ? "http://www.planwallpaper.com/static/images/nasas-images-of-most-remarkable-events-you-cant-miss.jpg" : "https://d36tnp772eyphs.cloudfront.net/blogs/1/2015/04/lion-photo.jpg"
    
            }
    
            Keys.onReturnPressed: time.running = false;
        }
    
        Timer {
            id: time
            interval: 1
            running: true
            repeat: true
            property double count: 0.0
            property double time0: 0.0
            onTriggered: {
                if(time0 == 0.0) time0 = Date.now();
                txt.text = "elapsed time (ms): " + (Date.now() - time0);
                for(grid.currentIndex = 0; grid.currentIndex < 20; grid.currentIndex++)
                        count += grid.currentItem.load;
                if(count == 20.0)
                    time.running = false;
                else count = 0.0
            }
        }
    
        Text {
            id: txt
            anchors.bottom: parent.bottom
            anchors.right: parent.right
            font.pixelSize: 30
        }
    }
    

    Card.qml

    import QtQuick 2.0
    
    Item {
        id: cardItem
        width: 235
        height: 320
        property string pic
        property double load: cardImage.progress
    
        Image {
            id: cardImage
            anchors.fill: cardItem
            source: pic
        }
    }
    

    What I noticed too, if I set asynchronous: true on images loaded over qrc, the same thing happens - those have a big delay too. My first guess is that something has changed in how Qt handles async image loading, but I can't find anything in the changelogs.

    Any help is appreciated. Thanks.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Looks like a regression. You should take a look at the bug report system to see if it's something known. If not please consider opening a new report providing a minimal compilable example.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.