mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-02 16:28:51 +02:00
[Panorama Viewer] make repeater working with c++
This commit is contained in:
parent
d8018191ed
commit
edfcb2bb75
1 changed files with 47 additions and 18 deletions
|
@ -26,6 +26,7 @@ AliceVision.PanoramaViewer {
|
|||
(root.sourceSize.width <= 0))
|
||||
return Image.Null;
|
||||
root.defaultControlPoints();
|
||||
updateSfmPath();
|
||||
return Image.Ready;
|
||||
}
|
||||
|
||||
|
@ -60,28 +61,27 @@ AliceVision.PanoramaViewer {
|
|||
root.setSfmPath(sfmPath);
|
||||
}
|
||||
|
||||
property var paths: ["L:/IMAC/IMAC2/PTUT/22_190902_GDGM_F1_sph150/HDM_1306.JPG", "L:/IMAC/IMAC2/PTUT/22_190902_GDGM_F1_sph150/HDM_1313.JPG"]
|
||||
|
||||
|
||||
property var pathList : []
|
||||
property var idList : []
|
||||
|
||||
Item {
|
||||
id: panoImages
|
||||
width: root.width
|
||||
height: root.height
|
||||
|
||||
function setSource() {
|
||||
if (repeater.model === 0)
|
||||
return
|
||||
// function setSource() {
|
||||
// if (repeater.model === 0)
|
||||
// return
|
||||
|
||||
// var width = repeater.itemAt(0).width;
|
||||
// var height = repeater.itemAt(0).height;
|
||||
//// var width = repeater.itemAt(0).width;
|
||||
//// var height = repeater.itemAt(0).height;
|
||||
|
||||
for (let i = 0; i < repeater.model; i++) {
|
||||
console.warn(repeater.itemAt(i))
|
||||
// repeater.itemAt(i).x = root.getVertex(i).x - (width / 2);
|
||||
// repeater.itemAt(i).y = root.getVertex(i).y - (height / 2);
|
||||
}
|
||||
}
|
||||
// for (let i = 0; i < repeater.model; i++) {
|
||||
// console.warn(repeater.itemAt(i))
|
||||
//// repeater.itemAt(i).x = root.getVertex(i).x - (width / 2);
|
||||
//// repeater.itemAt(i).y = root.getVertex(i).y - (height / 2);
|
||||
// }
|
||||
// }
|
||||
|
||||
Component {
|
||||
id: imgPano
|
||||
|
@ -90,7 +90,7 @@ AliceVision.PanoramaViewer {
|
|||
active: root.status
|
||||
visible: (floatOneLoader.status === Loader.Ready)
|
||||
//anchors.centerIn: parent
|
||||
property string cSource: Filepath.stringToUrl(root.paths[index].toString())
|
||||
property string cSource: Filepath.stringToUrl(root.pathList[index].toString())
|
||||
onActiveChanged: {
|
||||
if(active) {
|
||||
setSource("FloatImage.qml", {
|
||||
|
@ -98,7 +98,6 @@ AliceVision.PanoramaViewer {
|
|||
'index' : index
|
||||
})
|
||||
console.warn(cSource)
|
||||
console.warn(root.source)
|
||||
} else {
|
||||
// Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
|
||||
setSource("", {})
|
||||
|
@ -106,16 +105,46 @@ AliceVision.PanoramaViewer {
|
|||
}
|
||||
onLoaded: {
|
||||
//console.warn(repeater.itemAt(index))
|
||||
repeater.itemAt(index).x = repeater.itemAt(0).width + 50* index
|
||||
repeater.itemAt(index).x = repeater.itemAt(0).width + 100* index
|
||||
}
|
||||
}
|
||||
}
|
||||
Repeater {
|
||||
id: repeater
|
||||
model: 2
|
||||
model: 0
|
||||
delegate: imgPano
|
||||
|
||||
}
|
||||
Connections {
|
||||
target: root
|
||||
onImagesDataChanged: {
|
||||
//We receive the map<ImgPath, idView> from C++
|
||||
console.warn("IMAGES DATA CHANGED ! " + imagesData)
|
||||
|
||||
//Resetting arrays to avoid problem with push
|
||||
pathList = []
|
||||
idList = []
|
||||
|
||||
//Iterating through the map
|
||||
for (var path in imagesData) {
|
||||
console.warn("Object item:", path, "=", imagesData[path])
|
||||
root.pathList.push(path)
|
||||
root.idList.push(imagesData[path])
|
||||
}
|
||||
console.warn(root.pathList.length)
|
||||
|
||||
//Changing the repeater model (number of elements)
|
||||
panoImages.updateRepeater()
|
||||
|
||||
}
|
||||
}
|
||||
function updateRepeater() {
|
||||
if(repeater.model !== root.pathList.length){
|
||||
repeater.model = 0;
|
||||
}
|
||||
//console.warn(imagesData.length)
|
||||
repeater.model = root.pathList.length;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue