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

custom-example: add showAttitudeWidget as a persistent option

parent 73a4286d
......@@ -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();
}
}
......@@ -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;
};
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