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 @@
...
@@ -20,6 +20,7 @@
import
QtQuick
2.6
import
QtQuick
2.6
import
QtQuick
.
Controls
1.0
//needed for the Stack attached property
import
QtQuick
.
Controls
1.0
//needed for the Stack attached property
import
QtQuick
.
Controls
.
Nemo
1.0
import
QtQuick
.
Controls
.
Nemo
1.0
import
QtQuick
.
Controls
.
Styles
.
Nemo
1.0
import
QtQuick
.
Layouts
1.0
import
QtQuick
.
Layouts
1.0
Page
{
Page
{
...
...
src/controls/qml/TimePicker.qml
View file @
c1c563aa
...
@@ -37,7 +37,8 @@ Item{
...
@@ -37,7 +37,8 @@ Item{
width
:
400
width
:
400
height
:
width
height
:
width
property
date
date
:
new
Date
();
property
int
hours
:
18
property
int
minutes
:
12
Rectangle
{
Rectangle
{
anchors.fill
:
parent
anchors.fill
:
parent
...
@@ -57,38 +58,39 @@ Item{
...
@@ -57,38 +58,39 @@ Item{
var
hour_end_angle
=
getHourAngle
()
var
hour_end_angle
=
getHourAngle
()
var
minute_radius
=
canvas
.
width
/
2
*
0.8
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 */
/*Draw hours */
context
.
beginPath
()
;
context
.
beginPath
()
context
.
arc
(
centerX
,
centerY
,
hour_radius
,
-
0.5
*
Math
.
PI
,
hour_end_angle
,
false
)
;
context
.
arc
(
centerX
,
centerY
,
hour_radius
,
-
0.5
*
Math
.
PI
,
hour_end_angle
,
false
)
context
.
lineWidth
=
Theme
.
itemHeightExtraSmall
/
2
;
context
.
lineWidth
=
Theme
.
itemHeightExtraSmall
/
2
context
.
strokeStyle
=
Theme
.
accentColor
;
context
.
strokeStyle
=
Theme
.
accentColor
context
.
globalAlpha
=
1
;
context
.
globalAlpha
=
1
context
.
stroke
();
context
.
stroke
();
/*Draw subhours if time AM*/
/*Draw subhours if time AM*/
if
(
date
.
getHours
()
>
12
)
if
(
timePicker
.
hours
>
12
)
{
{
context
.
beginPath
()
;
context
.
beginPath
()
context
.
arc
(
centerX
,
centerY
,
hour_radius
,
0
,
2
*
Math
.
PI
,
false
)
;
context
.
arc
(
centerX
,
centerY
,
hour_radius
,
0
,
2
*
Math
.
PI
,
false
)
context
.
lineWidth
=
Theme
.
itemHeightExtraSmall
/
2
;
context
.
lineWidth
=
Theme
.
itemHeightExtraSmall
/
2
context
.
strokeStyle
=
Theme
.
accentColor
;
context
.
strokeStyle
=
Theme
.
accentColor
context
.
globalAlpha
=
0.5
;
context
.
globalAlpha
=
0.5
context
.
stroke
()
;
context
.
stroke
()
}
}
/*Draw minute*/
/*Draw minute*/
context
.
beginPath
();
context
.
beginPath
();
context
.
arc
(
centerX
,
centerY
,
minute_radius
,
-
0.5
*
Math
.
PI
,
minute_end_angle
,
false
)
;
context
.
arc
(
centerX
,
centerY
,
minute_radius
,
-
0.5
*
Math
.
PI
,
minute_end_angle
,
false
)
context
.
lineWidth
=
Theme
.
itemHeightExtraSmall
/
5
;
context
.
lineWidth
=
Theme
.
itemHeightExtraSmall
/
5
context
.
strokeStyle
=
Theme
.
accentColor
;
context
.
strokeStyle
=
Theme
.
accentColor
context
.
globalAlpha
=
0.5
;
context
.
globalAlpha
=
0.5
context
.
stroke
()
;
context
.
stroke
()
}
}
}
}
Label
{
Label
{
id
:
hourLabel
id
:
hourLabel
text
:
timePicker
.
date
.
getHours
()
text
:
timePicker
.
hours
font.pixelSize
:
Theme
.
itemHeightExtraSmall
/
2
font.pixelSize
:
Theme
.
itemHeightExtraSmall
/
2
font.bold
:
true
font.bold
:
true
x
:
canvas
.
width
/
2
-
hourLabel
.
contentWidth
-
Theme
.
itemHeightExtraSmall
/
10
x
:
canvas
.
width
/
2
-
hourLabel
.
contentWidth
-
Theme
.
itemHeightExtraSmall
/
10
...
@@ -97,27 +99,96 @@ Item{
...
@@ -97,27 +99,96 @@ Item{
Label
{
Label
{
id
:
minuteLabel
id
:
minuteLabel
text
:
timePicker
.
date
.
getMinutes
()
text
:
timePicker
.
minutes
font.pixelSize
:
Theme
.
itemHeightExtraSmall
/
5
font.pixelSize
:
Theme
.
itemHeightExtraSmall
/
5
x
:
canvas
.
width
/
2
-
minuteLabel
.
contentWidth
-
Theme
.
itemHeightExtraSmall
/
10
x
:
canvas
.
width
/
2
-
minuteLabel
.
contentWidth
-
Theme
.
itemHeightExtraSmall
/
10
y
:
canvas
.
width
/
2
-
canvas
.
width
/
2
*
0.8
-
Theme
.
itemHeightExtraSmall
/
5
/
2
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
()
function
getHourAngle
()
{
{
var
hour
=
timePicker
.
date
.
getHours
();
var
hour
=
timePicker
.
hours
if
(
hour
>
12
)
if
(
hour
>
12
)
{
{
hour
=
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
()
function
getMinuteAngle
()
{
{
var
minute
=
timePicker
.
date
.
getMinutes
()
var
minute
=
timePicker
.
minutes
return
2
*
Math
.
PI
/
60
*
minute
-
0.5
*
Math
.
PI
;
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
...
@@ -20,4 +20,5 @@ SpinBoxStyle 1.0 SpinBoxStyle.qml
TabViewStyle 1.0 TabViewStyle.qml
TabViewStyle 1.0 TabViewStyle.qml
TableViewStyle 1.0 TableViewStyle.qml
TableViewStyle 1.0 TableViewStyle.qml
TextFieldStyle 1.0 TextFieldStyle.qml
TextFieldStyle 1.0 TextFieldStyle.qml
TextAreaStyle 1.0 TextAreaStyle.qml
IconButtonStyle 1.0 IconButtonStyle.qml
IconButtonStyle 1.0 IconButtonStyle.qml
src/styles/styles.pro
View file @
c1c563aa
...
@@ -25,6 +25,7 @@ QML_FILES = \
...
@@ -25,6 +25,7 @@ QML_FILES = \
qml
/
TableViewStyle
.
qml
\
qml
/
TableViewStyle
.
qml
\
qml
/
TabViewStyle
.
qml
\
qml
/
TabViewStyle
.
qml
\
qml
/
TextFieldStyle
.
qml
\
qml
/
TextFieldStyle
.
qml
\
qml
/
TextAreaStyle
.
qml
\
qml
/
ToolBarStyle
.
qml
\
qml
/
ToolBarStyle
.
qml
\
qml
/
ToolButtonStyle
.
qml
\
qml
/
ToolButtonStyle
.
qml
\
qml
/
IconButtonStyle
.
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