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
ec18ee40
Commit
ec18ee40
authored
May 01, 2013
by
Michael Carpenter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New titlebar widgets to give dock windows titles when not in advanced mode
parent
2a794534
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
7 deletions
+73
-7
MainWindow.cc
src/ui/MainWindow.cc
+47
-4
MainWindow.h
src/ui/MainWindow.h
+9
-0
QGCSettingsWidget.cc
src/ui/QGCSettingsWidget.cc
+4
-0
QGCSettingsWidget.ui
src/ui/QGCSettingsWidget.ui
+13
-3
No files found.
src/ui/MainWindow.cc
View file @
ec18ee40
...
...
@@ -104,6 +104,7 @@ MainWindow::MainWindow(QWidget *parent):
lowPowerMode
(
false
)
{
hide
();
dockWidgetTitleBarEnabled
=
true
;
isAdvancedMode
=
false
;
emit
initStatusChanged
(
"Loading UI Settings.."
);
loadSettings
();
...
...
@@ -606,12 +607,24 @@ void MainWindow::createDockWidget(QWidget *parent,QWidget *child,QString title,Q
QDockWidget
*
widget
=
new
QDockWidget
(
title
,
this
);
if
(
!
isAdvancedMode
)
{
dockToTitleBarMap
[
widget
]
=
widget
->
titleBarWidget
();
widget
->
setTitleBarWidget
(
new
QWidget
(
this
));
if
(
dockWidgetTitleBarEnabled
)
{
dockToTitleBarMap
[
widget
]
=
widget
->
titleBarWidget
();
QLabel
*
label
=
new
QLabel
(
this
);
label
->
setText
(
title
);
widget
->
setTitleBarWidget
(
label
);
}
else
{
dockToTitleBarMap
[
widget
]
=
widget
->
titleBarWidget
();
widget
->
setTitleBarWidget
(
new
QWidget
(
this
));
}
}
else
{
dockToTitleBarMap
[
widget
]
=
new
QWidget
(
this
);
QLabel
*
label
=
new
QLabel
(
this
);
label
->
setText
(
title
);
dockToTitleBarMap
[
widget
]
=
label
;
}
widget
->
setObjectName
(
objectname
);
widget
->
setWidget
(
child
);
...
...
@@ -903,7 +916,9 @@ void MainWindow::loadSettings()
autoReconnect
=
settings
.
value
(
"AUTO_RECONNECT"
,
autoReconnect
).
toBool
();
currentStyle
=
(
QGC_MAINWINDOW_STYLE
)
settings
.
value
(
"CURRENT_STYLE"
,
currentStyle
).
toInt
();
lowPowerMode
=
settings
.
value
(
"LOW_POWER_MODE"
,
lowPowerMode
).
toBool
();
dockWidgetTitleBarEnabled
=
settings
.
value
(
"DOCK_WIDGET_TITLEBARS"
,
dockWidgetTitleBarEnabled
).
toBool
();
settings
.
endGroup
();
enableDockWidgetTitleBars
(
dockWidgetTitleBarEnabled
);
}
void
MainWindow
::
storeSettings
()
...
...
@@ -990,6 +1005,35 @@ void MainWindow::saveScreen()
window
.
save
(
screenFileName
,
format
.
toAscii
());
}
}
void
MainWindow
::
enableDockWidgetTitleBars
(
bool
enabled
)
{
if
(
!
isAdvancedMode
)
{
dockWidgetTitleBarEnabled
=
enabled
;
QSettings
settings
;
settings
.
beginGroup
(
"QGC_MAINWINDOW"
);
settings
.
setValue
(
"DOCK_WIDGET_TITLEBARS"
,
dockWidgetTitleBarEnabled
);
settings
.
endGroup
();
settings
.
sync
();
if
(
enabled
)
{
for
(
QMap
<
QDockWidget
*
,
QWidget
*>::
const_iterator
i
=
dockToTitleBarMap
.
constBegin
();
i
!=
dockToTitleBarMap
.
constEnd
();
i
++
)
{
QLabel
*
label
=
new
QLabel
(
this
);
label
->
setText
(
i
.
value
()
->
windowTitle
());
i
.
key
()
->
setTitleBarWidget
(
label
);
label
->
setEnabled
(
false
);
}
}
else
{
for
(
QMap
<
QDockWidget
*
,
QWidget
*>::
const_iterator
i
=
dockToTitleBarMap
.
constBegin
();
i
!=
dockToTitleBarMap
.
constEnd
();
i
++
)
{
i
.
key
()
->
setTitleBarWidget
(
0
);
}
}
}
}
void
MainWindow
::
enableAutoReconnect
(
bool
enabled
)
{
...
...
@@ -1745,7 +1789,6 @@ void MainWindow::setAdvancedMode()
QWidget
*
widget
=
i
.
key
()
->
titleBarWidget
();
i
.
key
()
->
setTitleBarWidget
(
i
.
value
());
dockToTitleBarMap
[
i
.
key
()]
=
widget
;
}
}
}
...
...
src/ui/MainWindow.h
View file @
ec18ee40
...
...
@@ -119,6 +119,12 @@ public:
return
autoReconnect
;
}
/** @brief Get title bar mode setting */
bool
dockWidgetTitleBarsEnabled
()
{
return
dockWidgetTitleBarEnabled
;
}
/** @brief Get low power mode setting */
bool
lowPowerModeEnabled
()
{
...
...
@@ -186,6 +192,8 @@ public slots:
void
reloadStylesheet
();
/** @brief Let the user select the CSS style sheet */
void
selectStylesheet
();
/** @breif Enable title bars on dock widgets when no in advanced mode */
void
enableDockWidgetTitleBars
(
bool
enabled
);
/** @brief Automatically reconnect last link */
void
enableAutoReconnect
(
bool
enabled
);
/** @brief Save power by reducing update rates */
...
...
@@ -436,6 +444,7 @@ private:
QMap
<
QDockWidget
*
,
QWidget
*>
dockToTitleBarMap
;
QMap
<
VIEW_SECTIONS
,
QMap
<
QString
,
QWidget
*>
>
centralWidgetToDockWidgetsMap
;
bool
isAdvancedMode
;
bool
dockWidgetTitleBarEnabled
;
Ui
::
MainWindow
ui
;
QString
getWindowStateKey
();
...
...
src/ui/QGCSettingsWidget.cc
View file @
ec18ee40
...
...
@@ -42,6 +42,10 @@ QGCSettingsWidget::QGCSettingsWidget(QWidget *parent, Qt::WindowFlags flags) :
ui
->
lowPowerCheckBox
->
setChecked
(
MainWindow
::
instance
()
->
lowPowerModeEnabled
());
connect
(
ui
->
lowPowerCheckBox
,
SIGNAL
(
clicked
(
bool
)),
MainWindow
::
instance
(),
SLOT
(
enableLowPowerMode
(
bool
)));
//Dock widget title bars
ui
->
titleBarCheckBox
->
setChecked
(
MainWindow
::
instance
()
->
dockWidgetTitleBarsEnabled
());
ui
->
titleBarCheckBox
,
SIGNAL
(
clicked
(
bool
)),
MainWindow
::
instance
(),
SLOT
(
enableDockWidgetTitleBars
(
bool
));
// Style
MainWindow
::
QGC_MAINWINDOW_STYLE
style
=
(
MainWindow
::
QGC_MAINWINDOW_STYLE
)
MainWindow
::
instance
()
->
getStyle
();
switch
(
style
)
{
...
...
src/ui/QGCSettingsWidget.ui
View file @
ec18ee40
...
...
@@ -46,7 +46,7 @@
</property>
</widget>
</item>
<item
row=
"
3
"
column=
"0"
>
<item
row=
"
4
"
column=
"0"
>
<widget
class=
"QRadioButton"
name=
"nativeStyle"
>
<property
name=
"text"
>
<string>
Use native platform look and feel (Windows/Linux/Mac OS)
</string>
...
...
@@ -56,14 +56,14 @@
</property>
</widget>
</item>
<item
row=
"
4
"
column=
"0"
>
<item
row=
"
5
"
column=
"0"
>
<widget
class=
"QRadioButton"
name=
"indoorStyle"
>
<property
name=
"text"
>
<string>
Use indoor mission style (black background)
</string>
</property>
</widget>
</item>
<item
row=
"
5
"
column=
"0"
>
<item
row=
"
6
"
column=
"0"
>
<widget
class=
"QRadioButton"
name=
"outdoorStyle"
>
<property
name=
"text"
>
<string>
Use outdoor mission style (light background)
</string>
...
...
@@ -80,6 +80,16 @@
</property>
</widget>
</item>
<item
row=
"3"
column=
"0"
>
<widget
class=
"QCheckBox"
name=
"titleBarCheckBox"
>
<property
name=
"text"
>
<string>
Show Docked Widget title bars when NOT in advanced Mode.
</string>
</property>
<property
name=
"checked"
>
<bool>
true
</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
...
...
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