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
c1c563aa
Commit
c1c563aa
authored
Jan 17, 2018
by
Sergey Chupligin
Committed by
Sergey Chupligin
Apr 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TextArea] Add TextAreaStyle
parent
61fc979a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
131 additions
and
26 deletions
+131
-26
LiveCoding.qml
examples/touch/content/LiveCoding.qml
+1
-0
TimePicker.qml
src/controls/qml/TimePicker.qml
+97
-26
TextAreaStyle.qml
src/styles/qml/TextAreaStyle.qml
+31
-0
qmldir
src/styles/qml/qmldir
+1
-0
styles.pro
src/styles/styles.pro
+1
-0
No files found.
examples/touch/content/LiveCoding.qml
View file @
c1c563aa
...
...
@@ -20,6 +20,7 @@
import
QtQuick
2.6
import
QtQuick
.
Controls
1.0
//needed for the Stack attached property
import
QtQuick
.
Controls
.
Nemo
1.0
import
QtQuick
.
Controls
.
Styles
.
Nemo
1.0
import
QtQuick
.
Layouts
1.0
Page
{
...
...
src/controls/qml/TimePicker.qml
View file @
c1c563aa
...
...
@@ -37,7 +37,8 @@ Item{
width
:
400
height
:
width
property
date
date
:
new
Date
();
property
int
hours
:
18
property
int
minutes
:
12
Rectangle
{
anchors.fill
:
parent
...
...
@@ -57,38 +58,39 @@ Item{
var
hour_end_angle
=
getHourAngle
()
var
minute_radius
=
canvas
.
width
/
2
*
0.8
var
minute_end_angle
=
getMinuteAngle
()
;
var
minute_end_angle
=
getMinuteAngle
()
context
.
clearRect
(
0
,
0
,
canvas
.
width
,
canvas
.
height
)
/*Draw hours */
context
.
beginPath
()
;
context
.
arc
(
centerX
,
centerY
,
hour_radius
,
-
0.5
*
Math
.
PI
,
hour_end_angle
,
false
)
;
context
.
lineWidth
=
Theme
.
itemHeightExtraSmall
/
2
;
context
.
strokeStyle
=
Theme
.
accentColor
;
context
.
globalAlpha
=
1
;
context
.
beginPath
()
context
.
arc
(
centerX
,
centerY
,
hour_radius
,
-
0.5
*
Math
.
PI
,
hour_end_angle
,
false
)
context
.
lineWidth
=
Theme
.
itemHeightExtraSmall
/
2
context
.
strokeStyle
=
Theme
.
accentColor
context
.
globalAlpha
=
1
context
.
stroke
();
/*Draw subhours if time AM*/
if
(
date
.
getHours
()
>
12
)
if
(
timePicker
.
hours
>
12
)
{
context
.
beginPath
()
;
context
.
arc
(
centerX
,
centerY
,
hour_radius
,
0
,
2
*
Math
.
PI
,
false
)
;
context
.
lineWidth
=
Theme
.
itemHeightExtraSmall
/
2
;
context
.
strokeStyle
=
Theme
.
accentColor
;
context
.
globalAlpha
=
0.5
;
context
.
stroke
()
;
context
.
beginPath
()
context
.
arc
(
centerX
,
centerY
,
hour_radius
,
0
,
2
*
Math
.
PI
,
false
)
context
.
lineWidth
=
Theme
.
itemHeightExtraSmall
/
2
context
.
strokeStyle
=
Theme
.
accentColor
context
.
globalAlpha
=
0.5
context
.
stroke
()
}
/*Draw minute*/
context
.
beginPath
();
context
.
arc
(
centerX
,
centerY
,
minute_radius
,
-
0.5
*
Math
.
PI
,
minute_end_angle
,
false
)
;
context
.
lineWidth
=
Theme
.
itemHeightExtraSmall
/
5
;
context
.
strokeStyle
=
Theme
.
accentColor
;
context
.
globalAlpha
=
0.5
;
context
.
stroke
()
;
context
.
arc
(
centerX
,
centerY
,
minute_radius
,
-
0.5
*
Math
.
PI
,
minute_end_angle
,
false
)
context
.
lineWidth
=
Theme
.
itemHeightExtraSmall
/
5
context
.
strokeStyle
=
Theme
.
accentColor
context
.
globalAlpha
=
0.5
context
.
stroke
()
}
}
Label
{
id
:
hourLabel
text
:
timePicker
.
date
.
getHours
()
text
:
timePicker
.
hours
font.pixelSize
:
Theme
.
itemHeightExtraSmall
/
2
font.bold
:
true
x
:
canvas
.
width
/
2
-
hourLabel
.
contentWidth
-
Theme
.
itemHeightExtraSmall
/
10
...
...
@@ -97,27 +99,96 @@ Item{
Label
{
id
:
minuteLabel
text
:
timePicker
.
date
.
getMinutes
()
text
:
timePicker
.
minutes
font.pixelSize
:
Theme
.
itemHeightExtraSmall
/
5
x
:
canvas
.
width
/
2
-
minuteLabel
.
contentWidth
-
Theme
.
itemHeightExtraSmall
/
10
y
:
canvas
.
width
/
2
-
canvas
.
width
/
2
*
0.8
-
Theme
.
itemHeightExtraSmall
/
5
/
2
}
Component
.
onCompleted
:
console
.
log
(
date
)
MouseArea
{
anchors.fill
:
parent
onPressed
:
{
var
minute_rad_max
=
canvas
.
width
/
2
*
0.8
+
Theme
.
itemHeightExtraSmall
/
10
;
var
minute_rad_min
=
canvas
.
width
/
2
*
0.8
-
Theme
.
itemHeightExtraSmall
/
10
;
var
hour_rad_max
=
canvas
.
width
/
2
*
0.8
-
1.5
*
Theme
.
itemHeightExtraSmall
/
4
-
Theme
.
itemHeightExtraSmall
/
5
/
2
+
Theme
.
itemHeightExtraSmall
/
2
var
hour_rad_min
=
canvas
.
width
/
2
*
0.8
-
1.5
*
Theme
.
itemHeightExtraSmall
/
4
-
Theme
.
itemHeightExtraSmall
/
5
/
2
-
Theme
.
itemHeightExtraSmall
/
2
var
clickRad
=
Math
.
sqrt
(
Math
.
pow
((
mouseX
-
canvas
.
width
/
2
),
2
)
+
Math
.
pow
((
mouseY
-
canvas
.
width
/
2
),
2
))
/*If inside min circle*/
if
(
clickRad
<=
minute_rad_max
&&
clickRad
>=
hour_rad_min
)
{
var
ang
=
getAngle
(
mouseX
,
mouseY
)
if
(
clickRad
>=
minute_rad_min
)
{
var
cur_min
=
Math
.
round
(
60
*
ang
/
360
)
timePicker
.
minutes
=
Math
.
round
(
60
*
ang
/
360
)
}
else
if
(
clickRad
<=
hour_rad_max
&&
clickRad
>=
hour_rad_min
)
{
if
(
timePicker
.
hours
>=
12
)
{
timePicker
.
hours
=
Math
.
round
(
12
*
ang
/
360
)
+
12
}
else
{
timePicker
.
hours
=
Math
.
round
(
12
*
ang
/
360
)
}
}
}
}
}
Component
.
onCompleted
:
{
if
(
hours
>
23
||
hours
<
0
)
{
console
.
warn
(
"
[TimePicker] Uncorrect hours value
"
)
hours
=
0
}
if
(
minutes
>
59
||
minutes
<
0
)
{
console
.
warn
(
"
[TimePicker] Uncorrect minutes value
"
)
minutes
=
0
}
}
onMinutesChanged
:
{
canvas
.
requestPaint
()
}
onHoursChanged
:
{
if
(
timePicker
.
hours
==
24
)
{
timePicker
.
hours
=
0
}
canvas
.
requestPaint
()
}
function
getHourAngle
()
{
var
hour
=
timePicker
.
date
.
getHours
();
var
hour
=
timePicker
.
hours
if
(
hour
>
12
)
{
hour
=
hour
-
12
}
return
2
*
Math
.
PI
/
12
*
hour
-
0.5
*
Math
.
PI
;
return
2
*
Math
.
PI
/
12
*
hour
-
0.5
*
Math
.
PI
}
function
getMinuteAngle
()
{
var
minute
=
timePicker
.
date
.
getMinutes
()
return
2
*
Math
.
PI
/
60
*
minute
-
0.5
*
Math
.
PI
;
var
minute
=
timePicker
.
minutes
return
2
*
Math
.
PI
/
60
*
minute
-
0.5
*
Math
.
PI
}
function
getAngle
(
x
,
y
)
{
var
a
=
(
Math
.
atan
((
y
-
canvas
.
width
/
2
)
/
(
x
-
canvas
.
width
/
2
))
*
180
)
/
Math
.
PI
+
90
if
(
x
<
canvas
.
width
/
2
)
{
a
+=
180
}
return
a
}
}
src/styles/qml/TextAreaStyle.qml
0 → 100644
View file @
c1c563aa
/*
* Copyright (C) 2013 Andrea Bernabei <and.bernabei@gmail.com>
* Copyright (C) 2018 Chupligin Sergey <neochapay@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
import
QtQuick
2.6
import
QtQuick
.
Controls
.
Styles
1.4
import
QtQuick
.
Controls
.
Nemo
1.0
TextAreaStyle
{
id
:
nemoStyle
textColor
:
Theme
.
textColor
selectionColor
:
Theme
.
accentColor
selectedTextColor
:
Theme
.
textColor
backgroundColor
:
Theme
.
backgroundColor
}
src/styles/qml/qmldir
View file @
c1c563aa
...
...
@@ -20,4 +20,5 @@ SpinBoxStyle 1.0 SpinBoxStyle.qml
TabViewStyle 1.0 TabViewStyle.qml
TableViewStyle 1.0 TableViewStyle.qml
TextFieldStyle 1.0 TextFieldStyle.qml
TextAreaStyle 1.0 TextAreaStyle.qml
IconButtonStyle 1.0 IconButtonStyle.qml
src/styles/styles.pro
View file @
c1c563aa
...
...
@@ -25,6 +25,7 @@ QML_FILES = \
qml
/
TableViewStyle
.
qml
\
qml
/
TabViewStyle
.
qml
\
qml
/
TextFieldStyle
.
qml
\
qml
/
TextAreaStyle
.
qml
\
qml
/
ToolBarStyle
.
qml
\
qml
/
ToolButtonStyle
.
qml
\
qml
/
IconButtonStyle
.
qml
...
...
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