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
ef536df8
Unverified
Commit
ef536df8
authored
Feb 13, 2020
by
Gus Grubba
Committed by
GitHub
Feb 13, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8331 from mavlink/pr-custom-window-save
Control main window size/position save/restore.
parents
0cfc69ce
7c24fa63
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
22 deletions
+30
-22
MainWindowSavedState.qml
src/QmlControls/MainWindowSavedState.qml
+27
-22
QGCOptions.h
src/api/QGCOptions.h
+3
-0
No files found.
src/QmlControls/MainWindowSavedState.qml
View file @
ef536df8
...
...
@@ -12,11 +12,14 @@ import QtQuick.Window 2.11
import
QtQuick
.
Controls
2.4
import
Qt
.
labs
.
settings
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
1.0
import
QGroundControl
.
ScreenTools
1.0
Item
{
property
Window
window
property
bool
_enabled
:
!
ScreenTools
.
isMobile
&&
QGroundControl
.
corePlugin
.
options
.
enableSaveMainWindowPosition
Settings
{
id
:
s
category
:
"
MainWindowState
"
...
...
@@ -29,7 +32,7 @@ Item {
}
Component.onCompleted
:
{
if
(
!
ScreenTools
.
isMobile
&&
s
.
width
&&
s
.
height
)
{
if
(
_enabled
&&
s
.
width
&&
s
.
height
)
{
window
.
x
=
s
.
x
;
window
.
y
=
s
.
y
;
window
.
width
=
s
.
width
;
...
...
@@ -39,12 +42,12 @@ Item {
}
Connections
{
target
:
ScreenTools
.
isMobile
?
null
:
window
onXChanged
:
saveSettingsTimer
.
restart
()
onYChanged
:
saveSettingsTimer
.
restart
()
onWidthChanged
:
saveSettingsTimer
.
restart
()
onHeightChanged
:
saveSettingsTimer
.
restart
()
onVisibilityChanged
:
saveSettingsTimer
.
restart
()
target
:
window
onXChanged
:
if
(
_enabled
)
saveSettingsTimer
.
restart
()
onYChanged
:
if
(
_enabled
)
saveSettingsTimer
.
restart
()
onWidthChanged
:
if
(
_enabled
)
saveSettingsTimer
.
restart
()
onHeightChanged
:
if
(
_enabled
)
saveSettingsTimer
.
restart
()
onVisibilityChanged
:
if
(
_enabled
)
saveSettingsTimer
.
restart
()
}
Timer
{
...
...
@@ -55,20 +58,22 @@ Item {
}
function
saveSettings
()
{
switch
(
window
.
visibility
)
{
case
ApplicationWindow
.
Windowed
:
s
.
x
=
window
.
x
;
s
.
y
=
window
.
y
;
s
.
width
=
window
.
width
;
s
.
height
=
window
.
height
;
s
.
visibility
=
window
.
visibility
;
break
;
case
ApplicationWindow
.
FullScreen
:
s
.
visibility
=
window
.
visibility
;
break
;
case
ApplicationWindow
.
Maximized
:
s
.
visibility
=
window
.
visibility
;
break
;
if
(
_enabled
)
{
switch
(
window
.
visibility
)
{
case
ApplicationWindow
.
Windowed
:
s
.
x
=
window
.
x
;
s
.
y
=
window
.
y
;
s
.
width
=
window
.
width
;
s
.
height
=
window
.
height
;
s
.
visibility
=
window
.
visibility
;
break
;
case
ApplicationWindow
.
FullScreen
:
s
.
visibility
=
window
.
visibility
;
break
;
case
ApplicationWindow
.
Maximized
:
s
.
visibility
=
window
.
visibility
;
break
;
}
}
}
}
src/api/QGCOptions.h
View file @
ef536df8
...
...
@@ -66,6 +66,7 @@ public:
Q_PROPERTY
(
bool
showMavlinkLogOptions
READ
showMavlinkLogOptions
CONSTANT
)
Q_PROPERTY
(
bool
enableMultiVehicleList
READ
enableMultiVehicleList
CONSTANT
)
Q_PROPERTY
(
bool
enableMapScale
READ
enableMapScale
CONSTANT
)
Q_PROPERTY
(
bool
enableSaveMainWindowPosition
READ
enableSaveMainWindowPosition
CONSTANT
)
/// Should QGC hide its settings menu and colapse it into one single menu (Settings and Vehicle Setup)?
/// @return true if QGC should consolidate both menus into one.
...
...
@@ -127,6 +128,8 @@ public:
virtual
bool
showMavlinkLogOptions
()
const
{
return
true
;
}
virtual
bool
enableMultiVehicleList
()
const
{
return
true
;
}
virtual
bool
enableMapScale
()
const
{
return
true
;
}
/// Desktop builds save the main application size and position on close (and restore it on open)
virtual
bool
enableSaveMainWindowPosition
()
const
{
return
true
;
}
#if defined(__mobile__)
virtual
bool
useMobileFileDialog
()
const
{
return
true
;}
...
...
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