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
fd6b895b
Commit
fd6b895b
authored
Feb 22, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1260 from DonLakeFlyer/UIWork
Qml Test dialog theme selection support
parents
92adb4c1
c2c5de27
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
454 additions
and
425 deletions
+454
-425
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
QmlTest.qml
src/QmlControls/QmlTest.qml
+429
-410
No files found.
src/QGCQmlWidgetHolder.cpp
View file @
fd6b895b
...
...
@@ -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 @
fd6b895b
...
...
@@ -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 @
fd6b895b
...
...
@@ -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 @
fd6b895b
...
...
@@ -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
src/QmlControls/QmlTest.qml
View file @
fd6b895b
...
...
@@ -11,6 +11,24 @@ Rectangle {
property
var
palette
:
QGCPalette
{
colorGroupEnabled
:
true
}
color
:
palette
.
window
Column
{
Row
{
ExclusiveGroup
{
id
:
themeGroup
}
QGCRadioButton
{
text
:
"
Light
"
exclusiveGroup
:
themeGroup
onClicked
:
{
palette
.
globalTheme
=
QGCPalette
.
Light
}
}
QGCRadioButton
{
text
:
"
Dark
"
exclusiveGroup
:
themeGroup
onClicked
:
{
palette
.
globalTheme
=
QGCPalette
.
Dark
}
}
}
Row
{
spacing
:
30
...
...
@@ -467,4 +485,5 @@ Rectangle {
}
}
}
}
}
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