fix work of viewPort widget

This commit is contained in:
Andrei Yankovich 2020-10-10 17:58:08 +03:00
parent 003d49c9a9
commit cb5069cb74
5 changed files with 10 additions and 23 deletions

View File

@ -15,7 +15,7 @@ Page {
id: viewgroundItem
anchors.right: parent.right
// anchors.top: parent.top
anchors.top: parent.top
anchors.bottom: parent.bottom
width: parent.width / 2
height: parent.height / 2
@ -26,7 +26,6 @@ Page {
source: modelData
viewground: viewgroundItem
// height: root.height / 3
title: "Test ViewPortPage"
text: "Test ViewPortPage. General text and <i>html code</i>"
width: viewPort.width

View File

@ -14,10 +14,11 @@ Page {
delegate: Component {
ViewPortPage {
source: modelData
viewground: root
viewground: viewPort
listView: viewPort
width: viewPort.width
height: root.height / 3
contentX: viewPort.contentX
contentY: viewPort.contentY
title: "Test ViewPortPage"
text: "Test ViewPortPage. General text and <i>html code</i>"
}

View File

@ -34,34 +34,20 @@ ViewSolutionsControl {
width: (viewPortDelegatW)? viewPortDelegatW: 0
height: (viewPortDelegatH)? viewPortDelegatH: 0
Flickable {
id: flickable
contentY: -(listView.contentY - delegateItem.y + viewground.y)
contentX: -(listView.contentX - delegateItem.x + viewground.x)
onContentXChanged: {
console.log(contentX)
}
contentWidth: 2000//image.width
contentHeight: image.height
Item {
clip: true
interactive: false
Image {
id: image;
source: delegateItem.source
fillMode: Image.PreserveAspectFit
x:0
y:0
x:(listView.contentX - delegateItem.x + viewground.x)
y:(listView.contentY - delegateItem.y + viewground.y)
width: viewground.width;
height: viewground.height;
}
anchors.fill: parent
anchors.margins: imageMrgin
}
}

View File

@ -48,7 +48,7 @@ ViewPortPage {
gradient: Gradient {
GradientStop {
position: 0.50;
color: "#0f"+ baseColor;
color: "#ff"+ baseColor;
}
GradientStop {

View File

@ -35,6 +35,7 @@ ViewPortDelegatBase {
border.color: "#" + baseColor
border.width: 0
radius: height * 0.05
}
content: Item {