Commit 0fe8ae9d authored by Stefan Dunca's avatar Stefan Dunca

custom-example: add showAttitudeWidget as a persistent option

parent 73a4286d
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
static const char* kGroupName = "CustomSettings"; static const char* kGroupName = "CustomSettings";
static const char* kShowGimbalCtl = "ShowGimbalCtl"; static const char* kShowGimbalCtl = "ShowGimbalCtl";
static const char* kShowAttitudeWidget = "ShowAttitudeWidget";
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
CustomQuickInterface::CustomQuickInterface(QObject* parent) CustomQuickInterface::CustomQuickInterface(QObject* parent)
...@@ -45,7 +46,8 @@ CustomQuickInterface::init() ...@@ -45,7 +46,8 @@ CustomQuickInterface::init()
{ {
QSettings settings; QSettings settings;
settings.beginGroup(kGroupName); 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) ...@@ -60,3 +62,16 @@ CustomQuickInterface::setShowGimbalControl(bool set)
emit showGimbalControlChanged(); emit showGimbalControlChanged();
} }
} }
//-----------------------------------------------------------------------------
void
CustomQuickInterface::setShowAttitudeWidget(bool set)
{
if(_showAttitudeWidget != set) {
_showAttitudeWidget = set;
QSettings settings;
settings.beginGroup(kGroupName);
settings.setValue(kShowAttitudeWidget,set);
emit showAttitudeWidgetChanged();
}
}
...@@ -29,12 +29,20 @@ public: ...@@ -29,12 +29,20 @@ public:
CustomQuickInterface(QObject* parent = nullptr); CustomQuickInterface(QObject* parent = nullptr);
~CustomQuickInterface(); ~CustomQuickInterface();
Q_PROPERTY(bool showGimbalControl READ showGimbalControl WRITE setShowGimbalControl NOTIFY showGimbalControlChanged) Q_PROPERTY(bool showGimbalControl READ showGimbalControl WRITE setShowGimbalControl NOTIFY showGimbalControlChanged)
Q_PROPERTY(bool showAttitudeWidget READ showAttitudeWidget WRITE setShowAttitudeWidget NOTIFY showAttitudeWidgetChanged)
bool showGimbalControl () { return _showGimbalControl; } bool showGimbalControl () { return _showGimbalControl; }
void setShowGimbalControl (bool set); void setShowGimbalControl (bool set);
void init (); void init ();
bool showAttitudeWidget () { return _showAttitudeWidget; }
void setShowAttitudeWidget (bool set);
signals: signals:
void showGimbalControlChanged (); void showGimbalControlChanged ();
void showAttitudeWidgetChanged();
private: private:
bool _showGimbalControl = true; bool _showGimbalControl = true;
bool _showAttitudeWidget = false;
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment