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
2d4766c7
Commit
2d4766c7
authored
Jul 28, 2020
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
71e4c784
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
50 deletions
+37
-50
qgroundcontrol.qrc
qgroundcontrol.qrc
+1
-0
QGCViewDialog.qml
src/QmlControls/QGCViewDialog.qml
+2
-0
QGCViewDialogContainer.qml
src/QmlControls/QGCViewDialogContainer.qml
+26
-8
MainRootWindow.qml
src/ui/MainRootWindow.qml
+8
-42
No files found.
qgroundcontrol.qrc
View file @
2d4766c7
...
...
@@ -162,6 +162,7 @@
<file alias="QGroundControl/Controls/QGCToolBarButton.qml">src/QmlControls/QGCToolBarButton.qml</file>
<file alias="QGroundControl/Controls/QGCToolInsets.qml">src/QmlControls/QGCToolInsets.qml</file>
<file alias="QGroundControl/Controls/QGCViewDialog.qml">src/QmlControls/QGCViewDialog.qml</file>
<file alias="QGroundControl/Controls/QGCViewDialogContainer.qml">src/QmlControls/QGCViewDialogContainer.qml</file>
<file alias="QGroundControl/Controls/QGCViewMessage.qml">src/QmlControls/QGCViewMessage.qml</file>
<file alias="QGroundControl/Controls/qmldir">src/QmlControls/QGroundControl/Controls/qmldir</file>
<file alias="QGroundControl/Controls/RallyPointEditorHeader.qml">src/PlanView/RallyPointEditorHeader.qml</file>
...
...
src/QmlControls/QGCViewDialog.qml
View file @
2d4766c7
...
...
@@ -9,6 +9,7 @@
import
QtQuick
2.3
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Dialogs
1.3
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Palette
1.0
...
...
@@ -17,6 +18,7 @@ import QGroundControl.FactControls 1.0
import
QGroundControl
.
ScreenTools
1.0
Item
{
property
var
buttons
:
StandardButton
.
NoButton
signal
hideDialog
...
...
src/QmlControls/QGCViewDialogContainer.qml
View file @
2d4766c7
...
...
@@ -15,16 +15,20 @@ import QGroundControl.Controls 1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
ScreenTools
1.0
Item
{
anchors.fill
:
parent
Drawer
{
edge
:
Qt
.
RightEdge
interactive
:
false
property
var
dialogComponent
property
string
dialogTitle
property
var
dialogButtons
:
StandardButton
.
NoButton
property
real
_defaultTextHeight
:
_textMeasure
.
contentHeight
property
real
_defaultTextWidth
:
_textMeasure
.
contentWidth
function
setupDialogButtons
()
{
function
setupDialogButtons
(
buttons
)
{
_acceptButton
.
visible
=
false
_rejectButton
.
visible
=
false
var
buttons
=
mainWindowDialog
.
dialogButtons
// Accept role buttons
if
(
buttons
&
StandardButton
.
Ok
)
{
_acceptButton
.
text
=
qsTr
(
"
Ok
"
)
...
...
@@ -81,18 +85,33 @@ Item {
_rejectButton
.
text
=
qsTr
(
"
Abort
"
)
_rejectButton
.
visible
=
true
}
if
(
buttons
&
StandardButton
.
Cancel
||
buttons
&
StandardButton
.
Close
||
buttons
&
StandardButton
.
Discard
||
buttons
&
StandardButton
.
Abort
||
buttons
&
StandardButton
.
Ignore
)
{
closePolicy
=
Popup
.
NoAutoClose
;
interactive
=
false
;
}
else
{
closePolicy
=
Popup
.
CloseOnEscape
|
Popup
.
CloseOnPressOutside
;
interactive
=
true
;
}
}
Connections
{
target
:
_dialogComponentLoader
.
item
onHideDialog
:
{
Qt
.
inputMethod
.
hide
()
mainWindowDialog
.
close
()
close
()
}
}
Component.onCompleted
:
setupDialogButtons
(
dialogButtons
)
QGCLabel
{
id
:
_textMeasure
;
text
:
"
X
"
;
visible
:
false
}
background
:
Rectangle
{
color
:
qgcPal
.
windowShadeDark
}
// This is the main dialog panel
Item
{
id
:
_dialogPanel
...
...
@@ -103,9 +122,8 @@ Item {
height
:
_acceptButton
.
visible
?
_acceptButton
.
height
:
_rejectButton
.
height
color
:
qgcPal
.
windowShade
QGCLabel
{
id
:
titleLabel
x
:
_defaultTextWidth
text
:
mainWindowDialog
.
dialogTitle
text
:
dialogTitle
height
:
parent
.
height
verticalAlignment
:
Text
.
AlignVCenter
}
...
...
@@ -136,7 +154,7 @@ Item {
anchors.right
:
parent
.
right
anchors.top
:
_spacer
.
bottom
anchors.bottom
:
parent
.
bottom
sourceComponent
:
mainWindowDialog
.
dialogComponent
sourceComponent
:
dialogComponent
focus
:
true
property
bool
acceptAllowed
:
_acceptButton
.
visible
property
bool
rejectAllowed
:
_rejectButton
.
visible
...
...
src/ui/MainRootWindow.qml
View file @
2d4766c7
...
...
@@ -196,52 +196,18 @@ ApplicationWindow {
readonly
property
int
showDialogDefaultWidth
:
40
///< Use for default dialog width
function
showComponentDialog
(
component
,
title
,
charWidth
,
buttons
)
{
if
(
mainWindowDialog
.
visible
)
{
console
.
warn
((
"
showComponentDialog called while dialog is already visible
"
))
return
}
var
dialogWidth
=
charWidth
===
showDialogFullWidth
?
mainWindow
.
width
:
ScreenTools
.
defaultFontPixelWidth
*
charWidth
mainWindowDialog
.
width
=
dialogWidth
mainWindowDialog
.
dialogComponent
=
component
mainWindowDialog
.
dialogTitle
=
title
mainWindowDialog
.
dialogButtons
=
buttons
var
dialog
=
dialogDrawerComponent
.
createObject
(
mainWindow
,
{
width
:
dialogWidth
,
dialogComponent
:
component
,
dialogTitle
:
title
,
dialogButtons
:
buttons
})
mainWindow
.
pushPreventViewSwitch
()
mainWindowDialog
.
open
()
if
(
buttons
&
StandardButton
.
Cancel
||
buttons
&
StandardButton
.
Close
||
buttons
&
StandardButton
.
Discard
||
buttons
&
StandardButton
.
Abort
||
buttons
&
StandardButton
.
Ignore
)
{
mainWindowDialog
.
closePolicy
=
Popup
.
NoAutoClose
;
mainWindowDialog
.
interactive
=
false
;
}
else
{
mainWindowDialog
.
closePolicy
=
Popup
.
CloseOnEscape
|
Popup
.
CloseOnPressOutside
;
mainWindowDialog
.
interactive
=
true
;
}
dialog
.
open
()
}
Drawer
{
id
:
mainWindowDialog
y
:
mainWindow
.
header
.
height
height
:
mainWindow
.
height
-
mainWindow
.
header
.
height
edge
:
Qt
.
RightEdge
interactive
:
false
background
:
Rectangle
{
color
:
qgcPal
.
windowShadeDark
}
property
var
dialogComponent
:
null
property
var
dialogButtons
:
null
property
string
dialogTitle
:
""
Loader
{
id
:
dlgLoader
anchors.fill
:
parent
onLoaded
:
{
item
.
setupDialogButtons
()
}
}
onOpened
:
{
dlgLoader
.
source
=
"
QGCViewDialogContainer.qml
"
}
onClosed
:
{
//console.log("View switch ok")
mainWindow
.
popPreventViewSwitch
()
dlgLoader
.
source
=
""
Component
{
id
:
dialogDrawerComponent
QGCViewDialogContainer
{
y
:
mainWindow
.
header
.
height
height
:
mainWindow
.
height
-
mainWindow
.
header
.
height
onClosed
:
mainWindow
.
popPreventViewSwitch
()
}
}
...
...
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