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
ac51a6d2
Unverified
Commit
ac51a6d2
authored
Jul 29, 2020
by
Don Gagne
Committed by
GitHub
Jul 29, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8945 from DonLakeFlyer/StackedDialog
Support stacked component dialogs
parents
4157b334
deba8a2e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
51 deletions
+37
-51
qgroundcontrol.qrc
qgroundcontrol.qrc
+1
-1
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 @
ac51a6d2
...
@@ -77,7 +77,6 @@
...
@@ -77,7 +77,6 @@
<file alias="PX4FlowSensor.qml">src/VehicleSetup/PX4FlowSensor.qml</file>
<file alias="PX4FlowSensor.qml">src/VehicleSetup/PX4FlowSensor.qml</file>
<file alias="QGCInstrumentWidget.qml">src/FlightMap/Widgets/QGCInstrumentWidget.qml</file>
<file alias="QGCInstrumentWidget.qml">src/FlightMap/Widgets/QGCInstrumentWidget.qml</file>
<file alias="QGCInstrumentWidgetAlternate.qml">src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml</file>
<file alias="QGCInstrumentWidgetAlternate.qml">src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml</file>
<file alias="QGCViewDialogContainer.qml">src/QmlControls/QGCViewDialogContainer.qml</file>
<file alias="QGroundControl/Controls/AnalyzePage.qml">src/AnalyzeView/AnalyzePage.qml</file>
<file alias="QGroundControl/Controls/AnalyzePage.qml">src/AnalyzeView/AnalyzePage.qml</file>
<file alias="QGroundControl/Controls/AppMessages.qml">src/QmlControls/AppMessages.qml</file>
<file alias="QGroundControl/Controls/AppMessages.qml">src/QmlControls/AppMessages.qml</file>
<file alias="QGroundControl/Controls/AxisMonitor.qml">src/QmlControls/AxisMonitor.qml</file>
<file alias="QGroundControl/Controls/AxisMonitor.qml">src/QmlControls/AxisMonitor.qml</file>
...
@@ -162,6 +161,7 @@
...
@@ -162,6 +161,7 @@
<file alias="QGroundControl/Controls/QGCToolBarButton.qml">src/QmlControls/QGCToolBarButton.qml</file>
<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/QGCToolInsets.qml">src/QmlControls/QGCToolInsets.qml</file>
<file alias="QGroundControl/Controls/QGCViewDialog.qml">src/QmlControls/QGCViewDialog.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/QGCViewMessage.qml">src/QmlControls/QGCViewMessage.qml</file>
<file alias="QGroundControl/Controls/qmldir">src/QmlControls/QGroundControl/Controls/qmldir</file>
<file alias="QGroundControl/Controls/qmldir">src/QmlControls/QGroundControl/Controls/qmldir</file>
<file alias="QGroundControl/Controls/RallyPointEditorHeader.qml">src/PlanView/RallyPointEditorHeader.qml</file>
<file alias="QGroundControl/Controls/RallyPointEditorHeader.qml">src/PlanView/RallyPointEditorHeader.qml</file>
...
...
src/QmlControls/QGCViewDialog.qml
View file @
ac51a6d2
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
import
QtQuick
2.3
import
QtQuick
2.3
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Dialogs
1.3
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Palette
1.0
...
@@ -17,6 +18,7 @@ import QGroundControl.FactControls 1.0
...
@@ -17,6 +18,7 @@ import QGroundControl.FactControls 1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
ScreenTools
1.0
Item
{
Item
{
property
var
buttons
:
StandardButton
.
NoButton
signal
hideDialog
signal
hideDialog
...
...
src/QmlControls/QGCViewDialogContainer.qml
View file @
ac51a6d2
...
@@ -15,16 +15,20 @@ import QGroundControl.Controls 1.0
...
@@ -15,16 +15,20 @@ import QGroundControl.Controls 1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
ScreenTools
1.0
Item
{
Drawer
{
anchors.fill
:
parent
edge
:
Qt
.
RightEdge
interactive
:
false
property
var
dialogComponent
property
string
dialogTitle
property
var
dialogButtons
:
StandardButton
.
NoButton
property
real
_defaultTextHeight
:
_textMeasure
.
contentHeight
property
real
_defaultTextHeight
:
_textMeasure
.
contentHeight
property
real
_defaultTextWidth
:
_textMeasure
.
contentWidth
property
real
_defaultTextWidth
:
_textMeasure
.
contentWidth
function
setupDialogButtons
()
{
function
setupDialogButtons
(
buttons
)
{
_acceptButton
.
visible
=
false
_acceptButton
.
visible
=
false
_rejectButton
.
visible
=
false
_rejectButton
.
visible
=
false
var
buttons
=
mainWindowDialog
.
dialogButtons
// Accept role buttons
// Accept role buttons
if
(
buttons
&
StandardButton
.
Ok
)
{
if
(
buttons
&
StandardButton
.
Ok
)
{
_acceptButton
.
text
=
qsTr
(
"
Ok
"
)
_acceptButton
.
text
=
qsTr
(
"
Ok
"
)
...
@@ -81,18 +85,33 @@ Item {
...
@@ -81,18 +85,33 @@ Item {
_rejectButton
.
text
=
qsTr
(
"
Abort
"
)
_rejectButton
.
text
=
qsTr
(
"
Abort
"
)
_rejectButton
.
visible
=
true
_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
{
Connections
{
target
:
_dialogComponentLoader
.
item
target
:
_dialogComponentLoader
.
item
onHideDialog
:
{
onHideDialog
:
{
Qt
.
inputMethod
.
hide
()
Qt
.
inputMethod
.
hide
()
mainWindowDialog
.
close
()
close
()
}
}
}
}
Component.onCompleted
:
setupDialogButtons
(
dialogButtons
)
QGCLabel
{
id
:
_textMeasure
;
text
:
"
X
"
;
visible
:
false
}
QGCLabel
{
id
:
_textMeasure
;
text
:
"
X
"
;
visible
:
false
}
background
:
Rectangle
{
color
:
qgcPal
.
windowShadeDark
}
// This is the main dialog panel
// This is the main dialog panel
Item
{
Item
{
id
:
_dialogPanel
id
:
_dialogPanel
...
@@ -103,9 +122,8 @@ Item {
...
@@ -103,9 +122,8 @@ Item {
height
:
_acceptButton
.
visible
?
_acceptButton
.
height
:
_rejectButton
.
height
height
:
_acceptButton
.
visible
?
_acceptButton
.
height
:
_rejectButton
.
height
color
:
qgcPal
.
windowShade
color
:
qgcPal
.
windowShade
QGCLabel
{
QGCLabel
{
id
:
titleLabel
x
:
_defaultTextWidth
x
:
_defaultTextWidth
text
:
mainWindowDialog
.
dialogTitle
text
:
dialogTitle
height
:
parent
.
height
height
:
parent
.
height
verticalAlignment
:
Text
.
AlignVCenter
verticalAlignment
:
Text
.
AlignVCenter
}
}
...
@@ -136,7 +154,7 @@ Item {
...
@@ -136,7 +154,7 @@ Item {
anchors.right
:
parent
.
right
anchors.right
:
parent
.
right
anchors.top
:
_spacer
.
bottom
anchors.top
:
_spacer
.
bottom
anchors.bottom
:
parent
.
bottom
anchors.bottom
:
parent
.
bottom
sourceComponent
:
mainWindowDialog
.
dialogComponent
sourceComponent
:
dialogComponent
focus
:
true
focus
:
true
property
bool
acceptAllowed
:
_acceptButton
.
visible
property
bool
acceptAllowed
:
_acceptButton
.
visible
property
bool
rejectAllowed
:
_rejectButton
.
visible
property
bool
rejectAllowed
:
_rejectButton
.
visible
...
...
src/ui/MainRootWindow.qml
View file @
ac51a6d2
...
@@ -196,52 +196,18 @@ ApplicationWindow {
...
@@ -196,52 +196,18 @@ ApplicationWindow {
readonly
property
int
showDialogDefaultWidth
:
40
///< Use for default dialog width
readonly
property
int
showDialogDefaultWidth
:
40
///< Use for default dialog width
function
showComponentDialog
(
component
,
title
,
charWidth
,
buttons
)
{
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
var
dialogWidth
=
charWidth
===
showDialogFullWidth
?
mainWindow
.
width
:
ScreenTools
.
defaultFontPixelWidth
*
charWidth
mainWindowDialog
.
width
=
dialogWidth
var
dialog
=
dialogDrawerComponent
.
createObject
(
mainWindow
,
{
width
:
dialogWidth
,
dialogComponent
:
component
,
dialogTitle
:
title
,
dialogButtons
:
buttons
})
mainWindowDialog
.
dialogComponent
=
component
mainWindowDialog
.
dialogTitle
=
title
mainWindowDialog
.
dialogButtons
=
buttons
mainWindow
.
pushPreventViewSwitch
()
mainWindow
.
pushPreventViewSwitch
()
mainWindowDialog
.
open
()
dialog
.
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
;
}
}
}
Drawer
{
Component
{
id
:
mainWindowDialog
id
:
dialogDrawerComponent
QGCViewDialogContainer
{
y
:
mainWindow
.
header
.
height
y
:
mainWindow
.
header
.
height
height
:
mainWindow
.
height
-
mainWindow
.
header
.
height
height
:
mainWindow
.
height
-
mainWindow
.
header
.
height
edge
:
Qt
.
RightEdge
onClosed
:
mainWindow
.
popPreventViewSwitch
()
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
=
""
}
}
}
}
...
...
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