Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qtquickcontrols-nemo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NemoMobile
qtquickcontrols-nemo
Commits
e8d87ece
Commit
e8d87ece
authored
Feb 12, 2017
by
Sergey Chupligin
Committed by
Aleksi Suomalainen
Mar 02, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SelectRoller] Add GlacierRollerItem
parent
f9f34745
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
82 deletions
+105
-82
SelectRollerPage.qml
examples/touch/content/SelectRollerPage.qml
+14
-39
GlacierRoller.qml
src/controls/GlacierRoller.qml
+30
-42
GlacierRollerItem.qml
src/controls/GlacierRollerItem.qml
+58
-0
controls.pro
src/controls/controls.pro
+2
-1
qmldir
src/controls/qmldir
+1
-0
No files found.
examples/touch/content/SelectRollerPage.qml
View file @
e8d87ece
...
...
@@ -45,26 +45,13 @@ Page {
clip
:
true
model
:
animalsModel
label
:
qsTr
(
"
Choose your favorite animal
"
)
delegate
:
Text
{
delegate
:
GlacierRollerItem
{
Text
{
height
:
simpleRoller
.
itemHeight
text
:
name
color
:
"
white
"
font.pixelSize
:
32
font.bold
:
(
simpleRoller
.
active
&&
ListView
.
view
.
currentIndex
===
index
)
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
if
(
!
simpleRoller
.
active
)
{
simpleRoller
.
active
=
true
;
}
else
{
simpleRoller
.
currentIndex
=
index
simpleRoller
.
active
=
false
}
}
font.bold
:
(
simpleRoller
.
activated
&&
simpleRoller
.
currentIndex
===
index
)
}
}
}
...
...
@@ -80,26 +67,14 @@ Page {
clip
:
true
model
:
animalsModel
label
:
qsTr
(
"
Choose your second favorite animal
"
)
delegate
:
Text
{
delegate
:
GlacierRollerItem
{
Text
{
height
:
simpleRoller2
.
itemHeight
text
:
name
color
:
"
white
"
font.pixelSize
:
32
font.bold
:
(
simpleRoller2
.
active
&&
ListView
.
view
.
currentIndex
===
index
)
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
if
(
!
simpleRoller2
.
active
)
{
simpleRoller2
.
active
=
true
;
}
else
{
simpleRoller2
.
currentIndex
=
index
simpleRoller2
.
active
=
false
}
}
font.bold
:
(
simpleRoller2
.
activated
&&
simpleRoller2
.
currentIndex
===
index
)
}
}
}
...
...
src/controls/GlacierRoller.qml
View file @
e8d87ece
...
...
@@ -5,12 +5,11 @@ Item {
property
alias
model
:
view
.
model
property
alias
label
:
label
.
text
property
alias
delegate
:
view
.
delegate
property
int
currentIndex
:
-
1
property
int
activateSize
:
5
property
int
itemHeight
:
40
property
alias
itemHeight
:
view
.
itemHeight
property
bool
activ
e
:
false
property
bool
activ
ated
:
false
signal
clicked
();
signal
select
(
int
currentItem
);
...
...
@@ -50,11 +49,13 @@ Item {
z
:
2
}
List
View
{
Path
View
{
id
:
view
property
int
itemHeight
:
40
property
bool
showRow
:
false
interactive
:
activ
e
width
:
parent
.
width
interactive
:
activ
ated
width
:
parent
.
width
-
60
height
:
40
clip
:
true
...
...
@@ -65,58 +66,45 @@ Item {
leftMargin
:
30
}
snapMode
:
ListView
.
SnapToItem
Image
{
id
:
arrowDown
source
:
"
images/glacierroller-icon-arrow-down.svg
"
width
:
itemHeight
/
4
height
:
width
sourceSize.width
:
width
sourceSize.height
:
height
pathItemCount
:
height
/
itemHeight
preferredHighlightBegin
:
0.5
preferredHighlightEnd
:
0.5
dragMargin
:
view
.
width
x
:
view
.
currentItem
.
width
+
25
anchors
{
verticalCenter
:
view
.
verticalCenter
path
:
Path
{
startX
:
view
.
width
/
2
;
startY
:
0
PathLine
{
x
:
view
.
width
/
2
;
y
:
view
.
pathItemCount
*
itemHeight
}
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
active
=
true
}
}
}
snapMode
:
PathView
.
SnapToItem
}
Component.onCompleted
:
{
if
(
activ
e
)
if
(
activ
ated
)
{
view
.
showRow
=
false
bottomLine
.
opacity
=
1
topLine
.
opacity
=
1
view
.
height
=
itemHeight
*
activateSize
arrowDown
.
visible
=
false
}
else
{
view
.
showRow
=
true
bottomLine
.
opacity
=
0
topLine
.
opacity
=
0
view
.
height
=
itemHeight
arrowDown
.
visible
=
true
}
}
onCurrentIndexChanged
:
{
view
.
currentIndex
=
currentIndex
arrowDown
.
x
=
view
.
currentItem
.
width
+
25
}
onActiv
e
Changed
:
{
if
(
activ
e
)
onActiv
ated
Changed
:
{
if
(
activ
ated
)
{
arrowDown
.
visible
=
false
view
.
showRow
=
false
activateAnimations
.
start
()
}
else
...
...
@@ -128,18 +116,18 @@ Item {
ParallelAnimation
{
id
:
activateAnimations
NumberAnimation
{
target
:
bottomLine
;
property
:
"
opacity
"
;
to
:
1
;
duration
:
40
0
}
NumberAnimation
{
target
:
topLine
;
property
:
"
opacity
"
;
to
:
1
;
duration
:
40
0
}
NumberAnimation
{
target
:
view
;
property
:
"
height
"
;
to
:
itemHeight
*
activateSize
;
duration
:
40
0
}
NumberAnimation
{
target
:
bottomLine
;
property
:
"
opacity
"
;
to
:
1
;
duration
:
25
0
}
NumberAnimation
{
target
:
topLine
;
property
:
"
opacity
"
;
to
:
1
;
duration
:
25
0
}
NumberAnimation
{
target
:
view
;
property
:
"
height
"
;
to
:
itemHeight
*
activateSize
;
duration
:
25
0
}
}
ParallelAnimation
{
id
:
deActivateAnimations
NumberAnimation
{
target
:
bottomLine
;
property
:
"
opacity
"
;
to
:
0
;
duration
:
40
0
}
NumberAnimation
{
target
:
topLine
;
property
:
"
opacity
"
;
to
:
0
;
duration
:
40
0
}
NumberAnimation
{
target
:
view
;
property
:
"
height
"
;
to
:
itemHeight
;
duration
:
40
0
}
NumberAnimation
{
target
:
bottomLine
;
property
:
"
opacity
"
;
to
:
0
;
duration
:
25
0
}
NumberAnimation
{
target
:
topLine
;
property
:
"
opacity
"
;
to
:
0
;
duration
:
25
0
}
NumberAnimation
{
target
:
view
;
property
:
"
height
"
;
to
:
itemHeight
;
duration
:
25
0
}
onStopped
:
{
arrowDown
.
visible
=
true
view
.
showRow
=
true
}
}
}
src/controls/GlacierRollerItem.qml
0 → 100644
View file @
e8d87ece
import
QtQuick
2.0
Rectangle
{
id
:
glacierRollerItem
color
:
"
transparent
"
width
:
parent
.
width
height
:
parent
.
itemHeight
property
alias
cWidth
:
dataLine
.
width
default
property
alias
contentItem
:
dataLine
.
children
Rectangle
{
id
:
dataLine
width
:
childrenRect
.
width
height
:
parent
.
height
color
:
"
transparent
"
}
Image
{
id
:
arrowDown
source
:
"
images/glacierroller-icon-arrow-down.svg
"
width
:
glacierRollerItem
.
height
/
4
height
:
width
sourceSize.width
:
width
sourceSize.height
:
height
visible
:
glacierRollerItem
.
parent
.
showRow
anchors
{
verticalCenter
:
dataLine
.
verticalCenter
left
:
dataLine
.
right
leftMargin
:
width
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
glacierRollerItem
.
parent
.
parent
.
activated
=
true
}
}
}
MouseArea
{
anchors.fill
:
dataLine
onClicked
:
{
if
(
!
glacierRollerItem
.
parent
.
parent
.
activated
)
{
glacierRollerItem
.
parent
.
parent
.
activated
=
true
;
}
else
{
glacierRollerItem
.
parent
.
parent
.
currentIndex
=
index
glacierRollerItem
.
parent
.
parent
.
activated
=
false
}
}
}
}
src/controls/controls.pro
View file @
e8d87ece
...
...
@@ -20,7 +20,8 @@ QML_FILES += \
Slider
.
qml
\
ListView
.
qml
\
ListViewItemWithActions
.
qml
\
GlacierRoller
.
qml
GlacierRoller
.
qml
\
GlacierRollerItem
.
qml
OTHER_FILES
+=
qmldir
\
$$
QML_FILES
...
...
src/controls/qmldir
View file @
e8d87ece
...
...
@@ -22,6 +22,7 @@ Slider 1.0 Slider.qml
ListView 1.0 ListView.qml
ListViewItemWithActions 1.0 ListViewItemWithActions.qml
GlacierRoller 1.0 GlacierRoller.qml
GlacierRollerItem 1.0 GlacierRollerItem.qml
# MIRRORED CONTROLS:
# These are the controls that we take directly from official QQC.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment