Skip to content
Snippets Groups Projects
Commit 43d8780f authored by littletux89@gmail.com's avatar littletux89@gmail.com
Browse files

Merge branch 'develop' into features-3005

parents 57caaca1 5b93902e
No related branches found
No related tags found
6 merge requests!50Features 3819,!33Master,!28Features 3048,!27Features 3048,!26Features 3048,!23Features 3048
......@@ -22,5 +22,6 @@
<file>widgets/DapRadioButtonForm.ui.qml</file>
<file>widgets/DapScrollView.qml</file>
<file>widgets/DapScrollViewForm.ui.qml</file>
<file>widgets/DapScrollViewHandling.qml</file>
</qresource>
</RCC>
......@@ -8,6 +8,15 @@ import QtQuick.Controls 2.0
Rectangle
{
id: frameRightPanel
///@detalis Signal initiating switching to the previous displayed form.
signal nextActivated (var parametrsRightPanel)
///@detalis Signal initiating switching to the previous displayed form.
signal previousActivated (var parametrsRightPanel)
///@detalis Next display right panel.
property string dapNextRightPanel
///@detalis Previous display right panel.
property string dapPreviousRightPanel
///@detalis Right panel widget.
property alias dapFrame: frameRightPanel
///@detalis Right pane title widget.
......@@ -20,8 +29,7 @@ Rectangle
property Item dapContentItemData
///@detalis dapRightPanelWidth External property for possibility to hiding RightPanel
property int dapRightPanelWidth
anchors.fill: parent
width: dapRightPanelWidth
// Install right panel title
......
......@@ -2,120 +2,38 @@ import QtQuick 2.4
DapScrollViewForm
{
// All the logic (including state names and vars) was taken from master branch
//Default
scrollButtonImage.source: scrollButtonArrowUp ? scrollUpButtonImageSource : scrollDownButtonImageSource
x: parent.width - width - scrollButtonRightMargin
y: scrollButtonArrowUp ? scrollButtonTopMargin : parent.height - height - scrollButtonBottomMargin
// 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;
}
//If mouse pointer go into scrollButton
scrollButton.onEntered:
{
if (scrollButton.state === "goUp")
{
scrollButtonImage.source = scrollDownButtonHoveredImageSource
}
else if (scrollButton.state === "goDown")
{
scrollButtonImage.source = scrollUpButtonHoveredImageSource
}
scrollButtonImage.source = scrollButtonArrowUp ? scrollUpButtonHoveredImageSource :
scrollDownButtonHoveredImageSource;
mouseAtArrow = true;
}
//If mouse pointer go out scrollButton
scrollButton.onExited:
{
if (scrollButton.state === "goUp")
{
scrollButtonImage.source = scrollDownButtonImageSource
}
else if (scrollButton.state === "goDown")
{
scrollButtonImage.source = scrollUpButtonImageSource
}
scrollButtonImage.source = scrollButtonArrowUp ? scrollUpButtonImageSource :
scrollDownButtonImageSource;
mouseAtArrow = false;
}
//Change listView visible position on scrollButton click
scrollButton.onClicked:
{
if(scrollButton.state === "goUp")
{
viewData.positionViewAtEnd();
scrollButton.state = "goDown";
}
else if(scrollButton.state === "goDown")
{
viewData.positionViewAtBeginning();
scrollButton.state = "goUp";
}
scrollButtonArrowUp ? viewData.positionViewAtBeginning() : viewData.positionViewAtEnd();
}
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"
//Change arrow image then arrow direction is need to change
onScrollButtonArrowUpChanged:
{
scrollButtonImage.source = scrollButtonArrowUp ? scrollUpButtonImageSource :
scrollDownButtonImageSource;
}
}
......@@ -2,45 +2,50 @@ import QtQuick 2.4
MouseArea
{
id: dapScrollMouseArea
// Icons for scroll button
///@detalis scrollDownButtonImageSource Icons for non-focus scroll button with down arrow
property string scrollDownButtonImageSource
///@detalis scrollDownButtonHoveredImageSource Icons for focus scroll button with down arrow
property string scrollDownButtonHoveredImageSource
///@detalis scrollUpButtonImageSource Icons for non-focus scroll button with up arrow
property string scrollUpButtonImageSource
///@detalis scrollUpButtonHoveredImageSource Icons for focus scroll button with up arrow
property string scrollUpButtonHoveredImageSource
// ListView to attach the scroll button
property ListView viewData
property alias scrollMouseArea: dapScrollMouseArea
///@detalis viewData Flicable item to attach the scroll button
property Flickable viewData
///@detalis scrollButton ScrollButton reference
property alias scrollButton: dapScrollButton
///@detalis scrollButtonImage ScrollButtonImage reference
property alias scrollButtonImage: dapScrollButtonImage
///@detalis scrollButtonTopMargin Top Margin from parent.top
property int scrollButtonTopMargin
///@detalis scrollButtonBottomMargin Bottom Margin from parent.top
property int scrollButtonBottomMargin
///@detalis scrollButtonLeftMargin Left Margin from parent.top
property int scrollButtonLeftMargin
///@detalis scrollButtonRightMargin Right Margin from parent.top
property int scrollButtonRightMargin
///@detalis scrollButtonArrowUp Sign of arrow direction on scrollButton
property bool scrollButtonArrowUp
///@detalis scrollButtonVisible Sign of visibility of scrollButton
property bool scrollButtonVisible
///@detalis mouseAtArrow Sign of mouse pointer position into scrollButton
property bool mouseAtArrow
id: dapScrollButton
width: 36 * pt
height: width
anchors.fill: parent
hoverEnabled: true
propagateComposedEvents: true
visible: scrollButtonVisible
MouseArea
Image
{
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
}
id: dapScrollButtonImage
anchors.fill: parent
fillMode: Image.PreserveAspectFit
sourceSize.height: parent.height
sourceSize.width: parent.width
visible: parent.visible
}
}
import QtQuick 2.0
MouseArea
{
id: dapScrollMouseArea
///@detalis scrollDirectionUp Direction of arrow at scrollButton
property bool scrollDirectionUp: true
///@detalis scrollVisible Is scrollButton need
property bool scrollVisible: false
///@detalis scrollMouseAtArrow Is mouse above the scrollButton
property bool scrollMouseAtArrow: false
///@detalis viewData Flickable to attach the scroll button
property Flickable viewData
anchors.fill: parent
//To use entered and exited signals
hoverEnabled: true
//If mouse pointer go to parent area
onEntered:
{
//ScrollButton is needed to be visible only if list lenght more than its height
scrollVisible = viewData.contentHeight > viewData.height;
//If user see the first element
if(viewData.atYBeginning)
scrollDirectionUp = false;
//If user see the last element
if(viewData.atYEnd)
scrollDirectionUp = true;
}
//If mouse pointer go out the parent area
onExited:
{
//Because mouse can be out the parent area but at scrollButton; in this case scrollButton vust be visible
scrollVisible = false || scrollMouseAtArrow;
}
//If user use a wheel
//Most mouse types work in steps of 15 degrees,
//in which case the delta value is a multiple of 120;
//i.e., 120 units * 1/8 = 15 degrees.
onWheel:
{
//If wheel was rotated up/right
if(wheel.angleDelta.y > 0)
{
if(!viewData.atYBeginning)
{
scrollDirectionUp = true;
//Cause MouseArea get all mouse event this string is need to flick listView
viewData.flick(0, wheel.angleDelta.y * 3 * pt);
}
else
scrollDirectionUp = false;
}
//If wheel was rotated down/left
else if(wheel.angleDelta.y < 0)
{
if(!viewData.atYEnd)
{
scrollDirectionUp = false;
//Cause MouseArea get all mouse event this string is need to flick listView
viewData.flick(0, wheel.angleDelta.y * 3 * pt);
}
else
scrollDirectionUp = true;
}
}
//If mouse not at scrollButton it is need to chamge visibility
onScrollMouseAtArrowChanged:
{
if(!scrollMouseAtArrow)
scrollVisible = containsMouse;
}
//AutoUpdate on addind string to model
Component.onCompleted:
{
viewData.onContentHeightChanged.connect(onEntered);
}
}
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