@@ -190,9 +190,20 @@ MiniStrip::MiniStrip(QString ac_id, QWidget *parent) : QWidget(parent),
190190 gl->addLayout (th_lay, 2 , 0 );
191191
192192 // ////// mode //////////
193- ap_mode_label = new ColorLabel (10 , this );
194- gl->addWidget (ap_mode_label, 1 , 2 );
195- ap_mode_label->setToolTip (" AP mode" );
193+ ap_mode_button = new QPushButton (" MODE" );
194+ ap_mode_button->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
195+ gl->addWidget (ap_mode_button, 1 , 2 );
196+ ap_mode_button->setToolTip (" AP mode" );
197+ auto settings = ac->getSettingMenu ()->getAllSettings ();
198+ for (auto setting: settings) {
199+ if (setting->getName () == " autopilot.mode" ) {
200+ connect (ap_mode_button, &QPushButton::clicked, this , [=](){
201+ AircraftManager::get ()->getAircraft (ac_id)->setSetting (setting, " AUTO2" );
202+ });
203+ break ;
204+ }
205+ }
206+
196207
197208
198209 // /// Link, GPS, RC //////
@@ -261,12 +272,19 @@ void MiniStrip::updateFlightTime(uint32_t flight_time, uint32_t block_time, uint
261272}
262273
263274void MiniStrip::updateAp (QString ap_mode) {
275+ QColor color = QColor (Qt::white);
264276 if (mode_colors.contains (ap_mode)) {
265- ap_mode_label->setBrush (QColor (mode_colors[ap_mode]));
266- } else {
267- ap_mode_label->setBrush (Qt::white);
277+ color = QColor (mode_colors[ap_mode]);
278+
268279 }
269- ap_mode_label->setText (ap_mode);
280+ QString style_back = " background: rgb(%1, %2, %3);" ;
281+ QString style = " QPushButton {" ;
282+ style += style_back.arg (color.red ()).arg (color.green ()).arg (color.blue ());
283+ style += " color:black; font-size:12px;" ;
284+ style += " font-weight:bold;" ;
285+ style += " }" ;
286+ ap_mode_button->setStyleSheet (style);
287+ ap_mode_button->setText (ap_mode);
270288}
271289
272290void MiniStrip::updateGps (QString gps_mode) {
0 commit comments