From 0fe8ae9d1e044239954f2ed12857556869a24104 Mon Sep 17 00:00:00 2001 From: Stefan Dunca Date: Tue, 13 Aug 2019 12:30:39 +0200 Subject: [PATCH] custom-example: add showAttitudeWidget as a persistent option --- custom-example/src/CustomQuickInterface.cc | 17 ++++++++++++++++- custom-example/src/CustomQuickInterface.h | 8 ++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/custom-example/src/CustomQuickInterface.cc b/custom-example/src/CustomQuickInterface.cc index 790402d09..320827040 100644 --- a/custom-example/src/CustomQuickInterface.cc +++ b/custom-example/src/CustomQuickInterface.cc @@ -25,6 +25,7 @@ static const char* kGroupName = "CustomSettings"; static const char* kShowGimbalCtl = "ShowGimbalCtl"; +static const char* kShowAttitudeWidget = "ShowAttitudeWidget"; //----------------------------------------------------------------------------- CustomQuickInterface::CustomQuickInterface(QObject* parent) @@ -45,7 +46,8 @@ CustomQuickInterface::init() { QSettings settings; settings.beginGroup(kGroupName); - _showGimbalControl = settings.value(kShowGimbalCtl, true).toBool(); + _showGimbalControl = settings.value(kShowGimbalCtl, false).toBool(); + _showAttitudeWidget = settings.value(kShowAttitudeWidget, false).toBool(); } //----------------------------------------------------------------------------- @@ -60,3 +62,16 @@ CustomQuickInterface::setShowGimbalControl(bool set) emit showGimbalControlChanged(); } } + +//----------------------------------------------------------------------------- +void +CustomQuickInterface::setShowAttitudeWidget(bool set) +{ + if(_showAttitudeWidget != set) { + _showAttitudeWidget = set; + QSettings settings; + settings.beginGroup(kGroupName); + settings.setValue(kShowAttitudeWidget,set); + emit showAttitudeWidgetChanged(); + } +} diff --git a/custom-example/src/CustomQuickInterface.h b/custom-example/src/CustomQuickInterface.h index 9253fb8c2..c0bc2e110 100644 --- a/custom-example/src/CustomQuickInterface.h +++ b/custom-example/src/CustomQuickInterface.h @@ -29,12 +29,20 @@ public: CustomQuickInterface(QObject* parent = nullptr); ~CustomQuickInterface(); Q_PROPERTY(bool showGimbalControl READ showGimbalControl WRITE setShowGimbalControl NOTIFY showGimbalControlChanged) + Q_PROPERTY(bool showAttitudeWidget READ showAttitudeWidget WRITE setShowAttitudeWidget NOTIFY showAttitudeWidgetChanged) bool showGimbalControl () { return _showGimbalControl; } void setShowGimbalControl (bool set); void init (); + + bool showAttitudeWidget () { return _showAttitudeWidget; } + void setShowAttitudeWidget (bool set); + signals: void showGimbalControlChanged (); + void showAttitudeWidgetChanged(); + private: bool _showGimbalControl = true; + bool _showAttitudeWidget = false; }; -- 2.22.0