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
69cc3141
Commit
69cc3141
authored
Feb 22, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move error handling to correct location
parent
644ac77f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
15 deletions
+25
-15
QGCQmlWidgetHolder.cpp
src/QGCQmlWidgetHolder.cpp
+1
-14
QGCQmlWidgetHolder.h
src/QGCQmlWidgetHolder.h
+2
-1
QGCQuickWidget.cc
src/QGCQuickWidget.cc
+18
-0
QGCQuickWidget.h
src/QGCQuickWidget.h
+4
-0
No files found.
src/QGCQmlWidgetHolder.cpp
View file @
69cc3141
...
...
@@ -25,7 +25,6 @@
/// @author Don Gagne <don@thegagnes.com>
#include "QGCQmlWidgetHolder.h"
#include "QGCMessageBox.h"
QGCQmlWidgetHolder
::
QGCQmlWidgetHolder
(
QWidget
*
parent
)
:
QWidget
(
parent
)
...
...
@@ -46,17 +45,5 @@ void QGCQmlWidgetHolder::setAutoPilot(AutoPilotPlugin* autoPilot)
bool
QGCQmlWidgetHolder
::
setSource
(
const
QUrl
&
qmlUrl
)
{
_ui
.
qmlWidget
->
setSource
(
qmlUrl
);
if
(
_ui
.
qmlWidget
->
status
()
!=
QQuickWidget
::
Ready
)
{
QString
errorList
;
foreach
(
QQmlError
error
,
_ui
.
qmlWidget
->
errors
())
{
errorList
+=
error
.
toString
();
errorList
+=
"
\n
"
;
}
QGCMessageBox
::
warning
(
tr
(
"Qml Error"
),
tr
(
"Source not ready: %1
\n
Errors:
\n
%2"
).
arg
(
_ui
.
qmlWidget
->
status
()).
arg
(
errorList
));
return
false
;
}
return
true
;
return
_ui
.
qmlWidget
->
setSource
(
qmlUrl
);
}
src/QGCQmlWidgetHolder.h
View file @
69cc3141
...
...
@@ -49,7 +49,8 @@ public:
/// Sets the UAS into the widget which in turn will load facts into the context
void
setAutoPilot
(
AutoPilotPlugin
*
autoPilot
);
/// Sets the QML into the control
/// Sets the QML into the control. Will display errors message box if error occurs loading source.
/// @return true: source loaded, false: source not loaded, errors occured
bool
setSource
(
const
QUrl
&
qmlUrl
);
private:
...
...
src/QGCQuickWidget.cc
View file @
69cc3141
...
...
@@ -23,6 +23,7 @@
#include "QGCQuickWidget.h"
#include "AutoPilotPluginManager.h"
#include "QGCMessageBox.h"
#include <QQmlContext>
#include <QQmlEngine>
...
...
@@ -43,3 +44,20 @@ void QGCQuickWidget::setAutoPilot(AutoPilotPlugin* autoPilot)
{
rootContext
()
->
setContextProperty
(
"autopilot"
,
autoPilot
);
}
bool
QGCQuickWidget
::
setSource
(
const
QUrl
&
qmlUrl
)
{
QQuickWidget
::
setSource
(
qmlUrl
);
if
(
status
()
!=
Ready
)
{
QString
errorList
;
foreach
(
QQmlError
error
,
errors
())
{
errorList
+=
error
.
toString
();
errorList
+=
"
\n
"
;
}
QGCMessageBox
::
warning
(
tr
(
"Qml Error"
),
tr
(
"Source not ready: Status(%1)
\n
Errors:
\n
%2"
).
arg
(
status
()).
arg
(
errorList
));
return
false
;
}
return
true
;
}
src/QGCQuickWidget.h
View file @
69cc3141
...
...
@@ -42,6 +42,10 @@ public:
/// Sets the UAS into the widget which in turn will load facts into the context
void
setAutoPilot
(
AutoPilotPlugin
*
autoPilot
);
/// Sets the QML into the control. Will display errors message box if error occurs loading source.
/// @return true: source loaded, false: source not loaded, errors occured
bool
setSource
(
const
QUrl
&
qmlUrl
);
};
#endif
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