diff --git a/Examples/src/VPGradientPage.qml b/Examples/src/VPGradientPage.qml index 5d6c877..8d522b8 100644 --- a/Examples/src/VPGradientPage.qml +++ b/Examples/src/VPGradientPage.qml @@ -14,16 +14,25 @@ Page { delegate: Component { ViewPortGradientPage { source: modelData - viewground: root - height: root.height / 3 + imagePos: viewPort.layer.sourceRect +// height: root.height / 3 title: "Test ViewPortPage" text: "Test ViewPortPage. General text and html code" - contentX: viewPort.contentX - contentY: viewPort.contentY + width: viewPort.width + listView: viewPort } } + Item { + id: viewgroundItem + + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: parent.bottom + width: parent.width / 2 + } + ScrollBar.vertical: ScrollBar { } diff --git a/ViewSolutions/src/ViewSolutionsModule/ViewPortDelegatBase.qml b/ViewSolutions/src/ViewSolutionsModule/ViewPortDelegatBase.qml index 13381aa..899f841 100644 --- a/ViewSolutions/src/ViewSolutionsModule/ViewPortDelegatBase.qml +++ b/ViewSolutions/src/ViewSolutionsModule/ViewPortDelegatBase.qml @@ -10,7 +10,9 @@ ViewSolutionsControl { property string source: "" property alias imageSource: image - property var viewground: null + property rect imagePos: null + property var listView: null + property int imageMrgin: 5 property var theme: Material.theme @@ -21,8 +23,6 @@ ViewSolutionsControl { property int viewPortDelegatW: 0 property int viewPortDelegatH: 0 - property real contentX: 0 - property real contentY: 0 background: Rectangle { border.color: "black" @@ -30,17 +30,17 @@ ViewSolutionsControl { color: "#00000000" } - width: (viewPortDelegatW)? viewPortDelegatW: (viewground)? viewground.width : 0 - height: (viewPortDelegatH)? viewPortDelegatH: (viewground)?viewground.height * 0.1 : 0 + width: (viewPortDelegatW)? viewPortDelegatW: 0 + height: (viewPortDelegatH)? viewPortDelegatH: 0 Flickable { id: flickable - contentY: -(parent.contentY - delegateItem.y) - contentX: -(parent.contentX - delegateItem.x) + contentY: -(listView.contentY - delegateItem.y) + imagePos.x + contentX: -(listView.contentX - delegateItem.x) + imagePos.y - contentWidth: viewground.width - contentHeight: viewground.height + contentWidth: imagePos.width + contentHeight: imagePos.height clip: true interactive: false @@ -49,7 +49,10 @@ ViewSolutionsControl { source: delegateItem.source fillMode: Image.PreserveAspectFit - anchors.fill: parent + x:0 + y:0 + width: imagePos.width; + height: imagePos.height; } anchors.fill: parent