Skip to content
Snippets Groups Projects
Commit 273564b1 authored by konstantin.kukharenko's avatar konstantin.kukharenko
Browse files

Merge branch 'develop' into features-2997

parents 030cdf58 bca1afe6
No related branches found
No related tags found
1 merge request!19Features 2997
This commit is part of merge request !19. Comments created here will be created in the context of that merge request.
......@@ -20,5 +20,7 @@
<file>Device.qml</file>
<file>widgets/DapRadioButton.qml</file>
<file>widgets/DapRadioButtonForm.ui.qml</file>
<file>widgets/DapScrollView.qml</file>
<file>widgets/DapScrollViewForm.ui.qml</file>
</qresource>
</RCC>
......@@ -86,7 +86,6 @@ ComboBox
{
anchors.fill: parent
color: parent.popup.visible ? hilightTopColor : normalTopColor
radius: 2 * pt
height: parent.height
}
......@@ -129,7 +128,7 @@ ComboBox
anchors.fill: parent
}
DropShadow
DropShadow
{
anchors.fill: parent
source: contentCorner
......@@ -143,18 +142,10 @@ ComboBox
//Shadow effect for the top element.
DropShadow
{
anchors.fill: if (topEffect)
parent
source: if (topEffect)
background
verticalOffset: if (topEffect)
9 * pt
else 0
samples: if (topEffect)
13 * pt
else 0
color: if (topEffect)
dapComboBox.popup.visible ? colorDropShadow : colorTopNormalDropShadow
else "#000000"
anchors.fill: topEffect ? parent : null
source: topEffect ? background : null
verticalOffset: topEffect ? 9 * pt : 0
samples: topEffect ? 13 * pt : 0
color: topEffect ? (dapComboBox.popup.visible ? colorDropShadow : colorTopNormalDropShadow) : "#000000"
}
}
import QtQuick 2.4
DapScrollViewForm
{
// All the logic (including state names and vars) was taken from master branch
// Var for current pos while scrolling (in function updateY())
property var contentPos: 0.0
// Connect to new ListView if changed
onViewDataChanged:
{
viewData.contentYChanged.connect(updateY)
}
// Changes position of arrows when scroll
function updateY()
{
if (viewData.atYBeginning)
{
scrollButton.state = "goUp"
}
else if (viewData.atYEnd)
{
scrollButton.state = "goDown"
}
else if (contentPos > viewData.contentItem.y)
{
scrollButton.state = "goUp"
}
else
{
scrollButton.state = "goDown"
}
contentPos = viewData.contentItem.y
}
onEntered:
{
scrollButton.visible = true;
}
onExited:
{
scrollButton.visible = false;
}
scrollButton.onEntered:
{
if (scrollButton.state === "goUp")
{
scrollButtonImage.source = scrollDownButtonHoveredImageSource
}
else if (scrollButton.state === "goDown")
{
scrollButtonImage.source = scrollUpButtonHoveredImageSource
}
}
scrollButton.onExited:
{
if (scrollButton.state === "goUp")
{
scrollButtonImage.source = scrollDownButtonImageSource
}
else if (scrollButton.state === "goDown")
{
scrollButtonImage.source = scrollUpButtonImageSource
}
}
scrollButton.onClicked:
{
if(scrollButton.state === "goUp")
{
viewData.positionViewAtEnd();
scrollButton.state = "goDown";
}
else if(scrollButton.state === "goDown")
{
viewData.positionViewAtBeginning();
scrollButton.state = "goUp";
}
}
scrollButton.states:
[
State
{
name: "goDown"
PropertyChanges
{
target: scrollButton
onStateChanged:
{
scrollButton.anchors.top = undefined
scrollButton.anchors.bottom = parent.bottom
scrollButton.exited()
}
}
},
State
{
name: "goUp"
PropertyChanges
{
target: scrollButton
onStateChanged:
{
scrollButton.anchors.bottom = undefined
scrollButton.anchors.top = parent.top
scrollButton.exited()
}
}
}
]
scrollButton.state: "goUp"
}
import QtQuick 2.4
MouseArea
{
id: dapScrollMouseArea
// Icons for scroll button
property string scrollDownButtonImageSource
property string scrollDownButtonHoveredImageSource
property string scrollUpButtonImageSource
property string scrollUpButtonHoveredImageSource
// ListView to attach the scroll button
property ListView viewData
property alias scrollMouseArea: dapScrollMouseArea
property alias scrollButton: dapScrollButton
property alias scrollButtonImage: dapScrollButtonImage
anchors.fill: parent
hoverEnabled: true
MouseArea
{
id: dapScrollButton
width: 36 * pt
height: width
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.bottomMargin: 10 * pt
anchors.topMargin: 10 * pt
anchors.rightMargin: 10 * pt
hoverEnabled: true
visible: false
Image
{
id: dapScrollButtonImage
anchors.fill: parent
fillMode: Image.PreserveAspectFit
source: scrollDownButtonImageSource
sourceSize.height: parent.height
sourceSize.width: parent.width
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment