Skip to content

Commit

Permalink
Merge pull request #241 from pilotnbr1/master
Browse files Browse the repository at this point in the history
VR overlay wont draw anything without uav position
  • Loading branch information
pilotnbr1 authored Sep 2, 2021
2 parents a2a3198 + fd70d26 commit 85e05bf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions qml/ui/widgets/VROverlayWidgetForm.ui.qml
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ BaseWidget {
//needs width and height but needs to be dynamic
//:applicationWindow.width
//height:applicationWindow.height
width: 1200
height: 800
width: applicationWindow.width
height: applicationWindow.height

clip: false
color: settings.color_shape
Expand Down
12 changes: 12 additions & 0 deletions src/vroverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ VROverlay::VROverlay(QQuickItem *parent): QQuickPaintedItem(parent) {
}

void VROverlay::paint(QPainter* painter) {

//if no position

double home_lat = OpenHD::instance()->get_lat();
double home_lon = OpenHD::instance()->get_lon();

if ( home_lat == 0.0 || home_lon == 0.0 ){
//dont draw any VR if we dont have a real position for the uav
qDebug() << "VROverlay:: early return due to bad position";
return;
}

painter->save();

//QFont font("sans-serif", 10, QFont::Bold, false);
Expand Down

0 comments on commit 85e05bf

Please sign in to comment.