Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Refreshing remote Image source without flickering (resp. empty image during refresh)

$
0
0
My current way too complicated solution: import QtQuick 2.2   Rectangle {     id: container     property int imageVisible: 1     property string initialSource     property int fillmode       color: "transparent"       Image {         id: image1         anchors.fill: parent         fillMode: fillmode         clip: true         visible: imageVisible === 1         source: initialSource     }       Image {         id: image2         anchors.fill: parent         fillMode: fillmode         clip: true         visible: imageVisible === 2     }       function setSource(source){         var imageNew = imageVisible === 1 ? image2 : image1;         var imageOld = imageVisible === 2 ? image2 : image1;           imageNew.source = source;           function finishImage(){             if(imageNew.status === Component.Ready) {                 imageVisible = imageVisible === 1 ? 2 : 1;             }         }           if (imageNew.status === Component.Loading){             imageNew.statusChanged.connect(finishImage);         }         else {             finishImage();         }     } }

Viewing all articles
Browse latest Browse all 4972

Trending Articles