Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
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
Valentin Platzgummer
qgroundcontrol
Commits
6bdc8428
Commit
6bdc8428
authored
Apr 05, 2017
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use FocusScope in all the right places
parent
4d9627f8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
118 additions
and
90 deletions
+118
-90
MissionItemEditor.qml
src/PlanView/MissionItemEditor.qml
+14
-3
SectionHeader.qml
src/PlanView/SectionHeader.qml
+36
-28
QGCComboBox.qml
src/QmlControls/QGCComboBox.qml
+4
-1
ToolStrip.qml
src/QmlControls/ToolStrip.qml
+64
-58
No files found.
src/PlanView/MissionItemEditor.qml
View file @
6bdc8428
...
...
@@ -41,9 +41,17 @@ Rectangle {
colorGroupEnabled
:
enabled
}
MouseArea
{
FocusScope
{
id
:
currentItemScope
anchors.fill
:
parent
onClicked
:
_root
.
clicked
()
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
currentItemScope
.
focus
=
true
_root
.
clicked
()
}
}
}
QGCLabel
{
...
...
@@ -72,7 +80,10 @@ Rectangle {
QGCMouseArea
{
fillItem
:
hamburger
visible
:
hamburger
.
visible
onClicked
:
hamburgerMenu
.
popup
()
onClicked
:
{
currentItemScope
.
focus
=
true
hamburgerMenu
.
popup
()
}
Menu
{
id
:
hamburgerMenu
...
...
src/PlanView/SectionHeader.qml
View file @
6bdc8428
...
...
@@ -6,12 +6,11 @@ import QtGraphicalEffects 1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Palette
1.0
QGCMouseArea
{
FocusScope
{
id
:
_root
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
height
:
column
.
height
onClicked
:
checked
=
!
checked
property
alias
text
:
label
.
text
property
bool
checked
:
true
...
...
@@ -27,38 +26,47 @@ QGCMouseArea {
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
true
}
ColumnLayout
{
id
:
column
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
QGCMouseArea
{
anchors.fill
:
parent
Item
{
height
:
_sectionSpacer
width
:
1
visible
:
showSpacer
onClicked
:
{
_root
.
focus
=
true
checked
=
!
checked
}
QGCLabel
{
id
:
label
Layout.fillWidth
:
true
ColumnLayout
{
id
:
column
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
QGCColoredImage
{
id
:
image
width
:
label
.
height
/
2
height
:
width
anchors.right
:
parent
.
right
anchors.verticalCenter
:
parent
.
verticalCenter
source
:
"
/qmlimages/arrow-down.png
"
color
:
qgcPal
.
text
visible
:
!
_root
.
checked
Item
{
height
:
_sectionSpacer
width
:
1
visible
:
showSpacer
}
}
Rectangle
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
height
:
1
color
:
qgcPal
.
text
QGCLabel
{
id
:
label
Layout.fillWidth
:
true
QGCColoredImage
{
id
:
image
width
:
label
.
height
/
2
height
:
width
anchors.right
:
parent
.
right
anchors.verticalCenter
:
parent
.
verticalCenter
source
:
"
/qmlimages/arrow-down.png
"
color
:
qgcPal
.
text
visible
:
!
_root
.
checked
}
}
Rectangle
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
height
:
1
color
:
qgcPal
.
text
}
}
}
}
src/QmlControls/QGCComboBox.qml
View file @
6bdc8428
...
...
@@ -68,7 +68,10 @@ Button {
}
}
onClicked
:
popup
.
toggleShow
()
onClicked
:
{
combo
.
focus
=
true
popup
.
toggleShow
()
}
Component.onCompleted
:
{
if
(
currentIndex
===
-
1
)
{
...
...
src/QmlControls/ToolStrip.qml
View file @
6bdc8428
...
...
@@ -163,71 +163,77 @@ Rectangle {
visible
:
index
==
0
?
_showOptionalElements
:
true
}
Rectangle
{
FocusScope
{
id
:
scope
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
height
:
width
color
:
checked
?
_repeaterPal
.
buttonHighlight
:
_repeaterPal
.
button
QGCColoredImage
{
id
:
button
anchors.fill
:
parent
source
:
_source
sourceSize.height
:
parent
.
height
fillMode
:
Image
.
PreserveAspectFit
mipmap
:
true
smooth
:
true
color
:
checked
?
_repeaterPal
.
buttonHighlightText
:
_repeaterPal
.
buttonText
RotationAnimation
on
rotation
{
id
:
imageRotation
loops
:
Animation
.
Infinite
from
:
0
to
:
360
duration
:
500
running
:
false
}
NumberAnimation
on
opacity
{
id
:
opacityAnimation
running
:
false
from
:
0
to
:
1.0
loops
:
Animation
.
Infinite
duration
:
2000
Rectangle
{
anchors.fill
:
parent
color
:
checked
?
_repeaterPal
.
buttonHighlight
:
_repeaterPal
.
button
QGCColoredImage
{
id
:
button
anchors.fill
:
parent
source
:
_source
sourceSize.height
:
parent
.
height
fillMode
:
Image
.
PreserveAspectFit
mipmap
:
true
smooth
:
true
color
:
checked
?
_repeaterPal
.
buttonHighlightText
:
_repeaterPal
.
buttonText
RotationAnimation
on
rotation
{
id
:
imageRotation
loops
:
Animation
.
Infinite
from
:
0
to
:
360
duration
:
500
running
:
false
}
NumberAnimation
on
opacity
{
id
:
opacityAnimation
running
:
false
from
:
0
to
:
1.0
loops
:
Animation
.
Infinite
duration
:
2000
}
}
}
QGCMouseArea
{
// Size of mouse area is expanded to make touch easier
anchors.leftMargin
:
-
buttonStripColumn
.
anchors
.
margins
anchors.rightMargin
:
-
buttonStripColumn
.
anchors
.
margins
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.top
:
parent
.
top
height
:
parent
.
height
+
(
_showOptionalElements
?
buttonLabel
.
height
+
buttonColumn
.
spacing
:
0
)
visible
:
_buttonEnabled
preventStealing
:
true
onClicked
:
{
if
(
modelData
.
dropPanelComponent
===
undefined
)
{
dropPanel
.
hide
()
if
(
modelData
.
toggle
===
true
)
{
checked
=
!
checked
}
else
{
// dropPanel.hide above will close panel, but we need to do this to clear toggles
uncheckAll
()
}
_root
.
clicked
(
index
,
checked
)
}
else
{
if
(
checked
)
{
dropPanel
.
hide
()
// hide affects checked, so this needs to be duplicated inside not outside if
QGCMouseArea
{
// Size of mouse area is expanded to make touch easier
anchors.leftMargin
:
-
buttonStripColumn
.
anchors
.
margins
anchors.rightMargin
:
-
buttonStripColumn
.
anchors
.
margins
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.top
:
parent
.
top
height
:
parent
.
height
+
(
_showOptionalElements
?
buttonLabel
.
height
+
buttonColumn
.
spacing
:
0
)
visible
:
_buttonEnabled
preventStealing
:
true
onClicked
:
{
scope
.
focus
=
true
if
(
modelData
.
dropPanelComponent
===
undefined
)
{
dropPanel
.
hide
()
if
(
modelData
.
toggle
===
true
)
{
checked
=
!
checked
}
else
{
// dropPanel.hide above will close panel, but we need to do this to clear toggles
uncheckAll
()
}
_root
.
clicked
(
index
,
checked
)
}
else
{
dropPanel
.
hide
()
// hide affects checked, so this needs to be duplicated inside not outside if
uncheckAll
()
checked
=
true
var
panelEdgeTopPoint
=
mapToItem
(
_root
,
width
,
0
)
dropPanel
.
show
(
panelEdgeTopPoint
,
height
,
modelData
.
dropPanelComponent
)
if
(
checked
)
{
dropPanel
.
hide
()
// hide affects checked, so this needs to be duplicated inside not outside if
}
else
{
dropPanel
.
hide
()
// hide affects checked, so this needs to be duplicated inside not outside if
uncheckAll
()
checked
=
true
var
panelEdgeTopPoint
=
mapToItem
(
_root
,
width
,
0
)
dropPanel
.
show
(
panelEdgeTopPoint
,
height
,
modelData
.
dropPanelComponent
)
}
}
}
}
...
...
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