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
4df4d8f1
Commit
4df4d8f1
authored
Oct 09, 2017
by
Chupligin Sergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DatePicker] Add listing and signals
parent
157b66b4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
DatePicker.qml
src/controls/DatePicker.qml
+53
-0
No files found.
src/controls/DatePicker.qml
View file @
4df4d8f1
...
...
@@ -42,6 +42,9 @@ Item {
property
var
monthNames
:
[
qsTr
(
"
January
"
),
qsTr
(
"
February
"
),
qsTr
(
"
March
"
),
qsTr
(
"
April
"
),
qsTr
(
"
May
"
),
qsTr
(
"
June
"
),
qsTr
(
"
July
"
),
qsTr
(
"
August
"
),
qsTr
(
"
September
"
),
qsTr
(
"
October
"
),
qsTr
(
"
November
"
),
qsTr
(
"
December
"
)];
signal
monthChanged
()
signal
dateSelect
(
var
date
)
Item
{
id
:
header
width
:
parent
.
width
...
...
@@ -64,6 +67,24 @@ Item {
topMargin
:
(
Theme
.
itemHeightLarge
-
Theme
.
itemHeightMedium
)
/
2
}
source
:
"
image://theme/caret-left
"
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
var
newDate
=
currentDate
;
if
(
newDate
.
getMonth
()
==
1
)
{
newDate
.
setFullYear
(
currentDate
.
getFullYear
()
-
1
)
newDate
.
setMonth
(
12
)
}
else
{
newDate
.
setMonth
(
currentDate
.
getMonth
()
-
1
)
}
datePicker
.
currentDate
=
newDate
monthChanged
()
}
}
}
Label
{
...
...
@@ -86,6 +107,24 @@ Item {
topMargin
:
(
Theme
.
itemHeightLarge
-
Theme
.
itemHeightMedium
)
/
2
}
source
:
"
image://theme/caret-right
"
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
var
newDate
=
currentDate
;
if
(
newDate
.
getMonth
()
==
12
)
{
newDate
.
setFullYear
(
currentDate
.
getFullYear
()
+
1
)
newDate
.
setMonth
(
1
)
}
else
{
newDate
.
setMonth
(
currentDate
.
getMonth
()
+
1
)
}
datePicker
.
currentDate
=
newDate
monthChanged
()
}
}
}
}
...
...
@@ -215,6 +254,14 @@ Item {
color
:
setColor
(
model
)
font.pixelSize
:
(
parent
.
height
*
0.45
<
Theme
.
fontSizeLarge
)
?
parent
.
height
*
0.45
:
Theme
.
fontSizeLarge
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
datePicker
.
dateSelect
(
model
.
dateOfDay
)
}
}
}
Component.onCompleted
:
{
...
...
@@ -223,6 +270,12 @@ Item {
}
}
onMonthChanged
:
{
dateModel
.
selectedDate
=
datePicker
.
currentDate
dateModel
.
clear
()
dateModel
.
fillModel
()
}
ListModel
{
id
:
dateModel
...
...
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