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
b37fa76b
Commit
b37fa76b
authored
Oct 13, 2013
by
John Tapsell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow custom widget to be deleted
parent
37d8faf2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
6 deletions
+21
-6
MainWindow.cc
src/ui/MainWindow.cc
+12
-2
MainWindow.h
src/ui/MainWindow.h
+4
-0
QGCToolWidget.cc
src/ui/designer/QGCToolWidget.cc
+5
-4
No files found.
src/ui/MainWindow.cc
View file @
b37fa76b
...
...
@@ -753,6 +753,7 @@ void MainWindow::addTool(SubMainWindow *parent,VIEW_SECTIONS view,QDockWidget* w
centralWidgetToDockWidgetsMap
[
view
][
widget
->
objectName
()]
=
widget
;
connect
(
tempAction
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
showTool
(
bool
)));
connect
(
widget
,
SIGNAL
(
visibilityChanged
(
bool
)),
tempAction
,
SLOT
(
setChecked
(
bool
)));
connect
(
widget
,
SIGNAL
(
destroyed
()),
tempAction
,
SLOT
(
deleteLater
()));
tempAction
->
setChecked
(
widget
->
isVisible
());
}
else
...
...
@@ -786,9 +787,20 @@ QDockWidget* MainWindow::createDockWidget(QWidget *parent,QWidget *child,QString
widget
->
setMinimumWidth
(
minwidth
);
}
addTool
(
qobject_cast
<
SubMainWindow
*>
(
parent
),
view
,
widget
,
title
,
area
);
connect
(
child
,
SIGNAL
(
destroyed
()),
widget
,
SLOT
(
deleteLater
()));
connect
(
widget
,
SIGNAL
(
destroyed
()),
this
,
SLOT
(
dockWidgetDestroyed
()));
return
widget
;
}
void
MainWindow
::
dockWidgetDestroyed
()
{
QDockWidget
*
dock
=
dynamic_cast
<
QDockWidget
*>
(
QObject
::
sender
());
Q_ASSERT
(
dock
);
if
(
!
dock
)
return
;
dockWidgets
.
removeAll
(
dock
);
}
void
MainWindow
::
loadDockWidget
(
QString
name
)
{
if
(
centralWidgetToDockWidgetsMap
[
currentView
].
contains
(
name
))
...
...
@@ -1039,8 +1051,6 @@ void MainWindow::createCustomWidget()
settings
.
setValue
(
QString
(
"TOOL_PARENT_"
)
+
tool
->
objectName
(),
currentView
);
settings
.
endGroup
();
//connect(tool, SIGNAL(destroyed()), dock, SLOT(deleteLater()));
//dock->setWidget(tool);
...
...
src/ui/MainWindow.h
View file @
b37fa76b
...
...
@@ -307,6 +307,10 @@ public slots:
void
commsWidgetDestroyed
(
QObject
*
obj
);
protected
slots
:
/** @brief Called by a dock widget when it is has been deleted */
void
dockWidgetDestroyed
();
signals:
void
styleChanged
(
MainWindow
::
QGC_MAINWINDOW_STYLE
newTheme
);
void
styleChanged
();
...
...
src/ui/designer/QGCToolWidget.cc
View file @
b37fa76b
...
...
@@ -668,11 +668,12 @@ void QGCToolWidget::deleteWidget()
// Hide
this
->
hide
();
instances
()
->
remove
(
getTitle
());
/*QSettings settings;
settings.beginGroup(getTitle());
settings.remove("");
QSettings
settings
;
settings
.
beginGroup
(
"QGC_MAINWINDOW"
);
settings
.
remove
(
QString
(
"TOOL_PARENT_"
)
+
objectName
());
settings
.
endGroup
();
storeWidgetsToSettings();*/
storeWidgetsToSettings
();
// Delete
...
...
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