diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-09-05 17:21:44 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-09-05 17:21:44 +0200 |
commit | 2ca5ae5fc7a0bf752dc22026b627c0a3a742270b (patch) | |
tree | d90a7826563bbea3df0aefa23f75df3f457aad4a /gui/mapping-window.cpp | |
parent | 4f7bafa0124c3baa7b8da18806f50e6ff84fcf98 (diff) |
gui/mappings: set smaller snap for XYZ splines
Reported-by: @olegiy
Issue: #436
Diffstat (limited to 'gui/mapping-window.cpp')
-rw-r--r-- | gui/mapping-window.cpp | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/gui/mapping-window.cpp b/gui/mapping-window.cpp index e47fe8e5..38ea48d8 100644 --- a/gui/mapping-window.cpp +++ b/gui/mapping-window.cpp @@ -29,56 +29,56 @@ MapWidget::MapWidget(Mappings& m) : void MapWidget::reload() { + + struct { + spline_widget* qfc; + Axis axis; + QCheckBox* checkbox; + bool altp; + } qfcs[] = { - struct { - spline_widget* qfc; - Axis axis; - QCheckBox* checkbox; - bool altp; - } qfcs[] = - { - { ui.rxconfig, Yaw, nullptr, false }, - { ui.ryconfig, Pitch, nullptr, false }, - { ui.rzconfig, Roll, nullptr, false }, - { ui.txconfig, TX, nullptr, false }, - { ui.tyconfig, TY, nullptr, false }, - { ui.tzconfig, TZ, nullptr, false }, - - { ui.rxconfig_alt, Yaw, ui.rx_altp, true }, - { ui.ryconfig_alt, Pitch, ui.ry_altp, true }, - { ui.rzconfig_alt, Roll, ui.rz_altp, true }, - { ui.txconfig_alt, TX, ui.tx_altp, true }, - { ui.tyconfig_alt, TY, ui.ty_altp, true }, - { ui.tzconfig_alt, TZ, ui.tz_altp, true }, - { nullptr, Yaw, nullptr, false } - }; - - for (int i = 0; qfcs[i].qfc; i++) + { ui.rxconfig, Yaw, nullptr, false }, + { ui.ryconfig, Pitch, nullptr, false }, + { ui.rzconfig, Roll, nullptr, false }, + { ui.txconfig, TX, nullptr, false }, + { ui.tyconfig, TY, nullptr, false }, + { ui.tzconfig, TZ, nullptr, false }, + + { ui.rxconfig_alt, Yaw, ui.rx_altp, true }, + { ui.ryconfig_alt, Pitch, ui.ry_altp, true }, + { ui.rzconfig_alt, Roll, ui.rz_altp, true }, + { ui.txconfig_alt, TX, ui.tx_altp, true }, + { ui.tyconfig_alt, TY, ui.ty_altp, true }, + { ui.tzconfig_alt, TZ, ui.tz_altp, true }, + { nullptr, Yaw, nullptr, false } +}; + + for (int i = 0; qfcs[i].qfc; i++) + { + const bool altp = qfcs[i].altp; + + Map& axis = m(qfcs[i].axis); + spline& conf = altp ? axis.spline_alt : axis.spline_main; + //const QString& name = altp ? axis.name2 : axis.name1; + //conf.set_bundle(make_bundle(name)); + qfcs[i].qfc->setConfig(&conf); + + if (altp) { - const bool altp = qfcs[i].altp; - - Map& axis = m(qfcs[i].axis); - spline& conf = altp ? axis.spline_alt : axis.spline_main; - //const QString& name = altp ? axis.name2 : axis.name1; - //conf.set_bundle(make_bundle(name)); - qfcs[i].qfc->setConfig(&conf); - - if (altp) - { - spline_widget& qfc = *qfcs[i].qfc; - connect(qfcs[i].checkbox, &QCheckBox::toggled, - this, - [&](bool f) -> void {qfc.setEnabled(f); qfc.force_redraw();}); - qfc.setEnabled(qfcs[i].checkbox->isChecked()); - qfc.force_redraw(); - } - - if (qfcs[i].axis >= 3) - qfcs[i].qfc->set_snap(1, 5); - else - qfcs[i].qfc->set_snap(1, 1); + spline_widget& qfc = *qfcs[i].qfc; + connect(qfcs[i].checkbox, &QCheckBox::toggled, + this, + [&](bool f) -> void {qfc.setEnabled(f); qfc.force_redraw();}); + qfc.setEnabled(qfcs[i].checkbox->isChecked()); + qfc.force_redraw(); } + + if (qfcs[i].axis >= 3) + qfcs[i].qfc->set_snap(1, 5); + else + qfcs[i].qfc->set_snap(.5, 2.5); } + } void MapWidget::closeEvent(QCloseEvent*) |