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
c2e06168
Commit
c2e06168
authored
Apr 29, 2018
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Work on getting keyboard focus to right place
parent
8e1a3fd9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
36 deletions
+31
-36
FactTextField.qml
src/FactSystem/FactControls/FactTextField.qml
+0
-5
ParameterEditorDialog.qml
src/QmlControls/ParameterEditorDialog.qml
+12
-9
QGCTextField.qml
src/QmlControls/QGCTextField.qml
+13
-17
QGCView.qml
src/QmlControls/QGCView.qml
+1
-0
QGCViewDialog.qml
src/QmlControls/QGCViewDialog.qml
+0
-2
QGCViewDialogContainer.qml
src/QmlControls/QGCViewDialogContainer.qml
+5
-3
No files found.
src/FactSystem/FactControls/FactTextField.qml
View file @
c2e06168
...
...
@@ -20,16 +20,11 @@ QGCTextField {
property
string
_validateString
// At this point all Facts are numeric
inputMethodHints
:
((
fact
&&
fact
.
typeIsString
)
||
ScreenTools
.
isiOS
)
?
Qt
.
ImhNone
:
// iOS numeric keyboard has no done button, we can't use it
Qt
.
ImhFormattedNumbersOnly
// Forces use of virtual numeric keyboard
onEditingFinished
:
{
if
(
ScreenTools
.
isMobile
)
{
// Toss focus on mobile after Done on virtual keyboard. Prevent strange interactions.
focus
=
false
}
if
(
typeof
qgcView
!==
'
undefined
'
&&
qgcView
)
{
var
errorString
=
fact
.
validate
(
text
,
false
/* convertOnly */
)
if
(
errorString
===
""
)
{
...
...
src/QmlControls/ParameterEditorDialog.qml
View file @
c2e06168
...
...
@@ -20,13 +20,16 @@ import QGroundControl.FactControls 1.0
import
QGroundControl
.
ScreenTools
1.0
QGCViewDialog
{
id
:
root
id
:
root
focus
:
true
property
Fact
fact
property
bool
showRCToParam
:
false
property
bool
validate
:
false
property
string
validateValue
signal
valueChanged
property
real
_editFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
20
property
bool
_longDescriptionAvailable
:
fact
.
longDescription
!=
""
property
bool
_editingParameter
:
fact
.
componentId
!=
0
...
...
@@ -41,15 +44,18 @@ QGCViewDialog {
if
(
bitmaskColumn
.
visible
&&
!
manualEntry
.
checked
)
{
fact
.
value
=
bitmaskValue
();
fact
.
valueChanged
(
fact
.
value
)
valueChanged
()
hideDialog
();
}
else
if
(
factCombo
.
visible
&&
!
manualEntry
.
checked
)
{
fact
.
enumIndex
=
factCombo
.
currentIndex
valueChanged
()
hideDialog
()
}
else
{
var
errorString
=
fact
.
validate
(
valueField
.
text
,
forceSave
.
checked
)
if
(
errorString
===
""
)
{
fact
.
value
=
valueField
.
text
fact
.
valueChanged
(
fact
.
value
)
valueChanged
()
hideDialog
()
}
else
{
validationError
.
text
=
errorString
...
...
@@ -85,12 +91,8 @@ QGCViewDialog {
}
}
// set focus to the text field when becoming visible (in case of an Enum,
// the valueField is not visible, but it's not an issue because the combo
// box cannot have a focus)
onVisibleChanged
:
if
(
visible
&&
!
ScreenTools
.
isMobile
)
valueField
.
forceActiveFocus
()
QGCFlickable
{
id
:
flickable
anchors.fill
:
parent
contentHeight
:
_column
.
y
+
_column
.
height
flickableDirection
:
Flickable
.
VerticalFlick
...
...
@@ -120,9 +122,10 @@ QGCViewDialog {
unitsLabel
:
fact
.
units
showUnits
:
fact
.
units
!=
""
Layout.fillWidth
:
true
inputMethodHints
:
ScreenTools
.
isiOS
?
Qt
.
ImhNone
:
// iOS numeric keyboard has not done button, we can't use it
Qt
.
ImhFormattedNumbersOnly
// Forces use of virtual numeric keyboard
focus
:
true
inputMethodHints
:
(
fact
.
typeIsString
||
ScreenTools
.
isiOS
)
?
Qt
.
ImhNone
:
// iOS numeric keyboard has no done button, we can't use it
Qt
.
ImhFormattedNumbersOnly
// Forces use of virtual numeric keyboard
}
QGCButton
{
...
...
src/QmlControls/QGCTextField.qml
View file @
c2e06168
...
...
@@ -7,7 +7,10 @@ import QGroundControl.Palette 1.0
import
QGroundControl
.
ScreenTools
1.0
TextField
{
id
:
root
id
:
root
textColor
:
qgcPal
.
textFieldText
implicitHeight
:
ScreenTools
.
implicitTextFieldHeight
activeFocusOnPress
:
true
property
bool
showUnits
:
false
property
bool
showHelp
:
false
...
...
@@ -17,18 +20,11 @@ TextField {
property
real
_helpLayoutWidth
:
0
Component.onCompleted
:
{
if
(
typeof
qgcTextFieldforwardKeysTo
!==
'
undefined
'
)
{
root
.
Keys
.
forwardTo
=
[
qgcTextFieldforwardKeysTo
]
}
}
Component.onCompleted
:
selectAllIfActiveFocus
()
onActiveFocusChanged
:
selectAllIfActiveFocus
()
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
enabled
}
textColor
:
qgcPal
.
textFieldText
implicitHeight
:
ScreenTools
.
implicitTextFieldHeight
onEditingFinished
:
{
if
(
ScreenTools
.
isMobile
)
{
// Toss focus on mobile after Done on virtual keyboard. Prevent strange interactions.
...
...
@@ -36,6 +32,12 @@ TextField {
}
}
function
selectAllIfActiveFocus
()
{
if
(
activeFocus
)
{
selectAll
()
}
}
QGCLabel
{
id
:
unitsLabelWidthGenerator
text
:
unitsLabel
...
...
@@ -59,7 +61,7 @@ TextField {
Rectangle
{
anchors.fill
:
parent
border.color
:
control
.
activeFocus
?
"
#47b
"
:
"
#999
"
border.color
:
root
.
activeFocus
?
"
#47b
"
:
"
#999
"
color
:
qgcPal
.
textField
}
...
...
@@ -114,10 +116,4 @@ TextField {
padding.right
:
control
.
_helpLayoutWidth
//control.showUnits ? unitsLabelWidthGenerator.width : control.__contentHeight * 0.333
}
onActiveFocusChanged
:
{
if
(
activeFocus
)
{
selectAll
()
}
}
}
src/QmlControls/QGCView.qml
View file @
c2e06168
...
...
@@ -68,6 +68,7 @@ FactPanel {
"
viewPanel
"
:
viewPanel
})
dialog
.
setupDialogButtons
(
buttons
)
dialog
.
focus
=
true
viewPanel
.
enabled
=
false
}
...
...
src/QmlControls/QGCViewDialog.qml
View file @
c2e06168
...
...
@@ -17,8 +17,6 @@ import QGroundControl.FactControls 1.0
import
QGroundControl
.
ScreenTools
1.0
FactPanel
{
property
var
qgcTextFieldforwardKeysTo
:
this
///< Causes all QGCTextFields to forward keys here if they have focus
property
real
defaultTextWidth
:
ScreenTools
.
defaultFontPixelWidth
property
real
defaultTextHeight
:
ScreenTools
.
defaultFontPixelHeight
...
...
src/QmlControls/QGCViewDialogContainer.qml
View file @
c2e06168
...
...
@@ -15,9 +15,10 @@ import QGroundControl.Controls 1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
ScreenTools
1.0
Item
{
id
:
_root
z
:
5000
FocusScope
{
id
:
_root
z
:
5000
focus
:
true
property
alias
dialogWidth
:
_dialogPanel
.
width
property
alias
dialogTitle
:
titleLabel
.
text
...
...
@@ -182,6 +183,7 @@ Item {
anchors.top
:
_spacer
.
bottom
anchors.bottom
:
parent
.
bottom
sourceComponent
:
_dialogComponent
focus
:
true
property
bool
acceptAllowed
:
_acceptButton
.
visible
property
bool
rejectAllowed
:
_rejectButton
.
visible
...
...
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