Change flight mode via QGC widgets

Good night! How to change flight mode via QGC widget? I try
import QtQuick 2.2

import QGroundControl.Controls      1.0
import QGroundControl.FactSystem    1.0
import QGroundControl.FactControls  1.0
import QGroundControl.Palette       1.0
import QGroundControl.ScreenTools   1.0
import QGroundControl.Controllers   1.0

Rectangle {
    anchors.fill:   parent
    color:          qgcPal.window

    CustomCommandWidgetController {
        id:         controller
        factPanel:  panel
    }

    QGCPalette { id: qgcPal; colorGroupEnabled: enabled }

    Column {
        spacing: ScreenTools.defaultFontPixelHeight

		
		QGCButton {
            text: "1"
            // Arguments to CustomCommandWidgetController::sendCommand (MAVLink COMMAND_LONG)
            //   command id
            //   component id
            //   confirmation
            //   param 1-7
            onClicked: controller.sendCommand(176, 50, 0, 1 , 0, 0, 0, 0, 0, 0)
        }
		
		QGCButton {
            text: "1"
            // Arguments to CustomCommandWidgetController::sendCommand (MAVLink COMMAND_LONG)
            //   command id
            //   component id
            //   confirmation
            //   param 1-7
            onClicked: controller.sendCommand(176, 50, 0, 12 , 0, 0, 0, 0, 0, 0)
        }
		
        QGCButton {
            text: "65 | 65536 new"
            // Arguments to CustomCommandWidgetController::sendCommand (MAVLink COMMAND_LONG)
            //   command id
            //   component id
            //   confirmation
            //   param 1-7
            onClicked: controller.sendCommand(176, 50, 0, 65 , 0, 0, 0, 0, 0, 0)
        }
	
		QGCButton {
            text: "65 | 458752t"
            // Arguments to CustomCommandWidgetController::sendCommand (MAVLink COMMAND_LONG)
            //   command id
            //   component id
            //   confirmation
            //   param 1-7
            onClicked: controller.sendCommand(176, 50, 0, 65 , 0, 0, 0, 0, 0, 0)
        }
		
		QGCButton {
            text: "81 | 65536"
            // Arguments to CustomCommandWidgetController::sendCommand (MAVLink COMMAND_LONG)
            //   command id
            //   component id
            //   confirmation
            //   param 1-7
            onClicked: controller.sendCommand(176, 50, 0, 81 , 0, 0, 0, 0, 0, 0)
        }

		
    }
}

but it’s don’t work. I get

Not easy to do with mavlink commands. Use this:

import QGroundControl 1.0

property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
_activeVehicle.flightMode = “…”

Thanks! But I want to test it on QGC and create on c++. How can I do it with mavlink?

Look at PX4FirmwarePlugin.cc/h

It’s a simple mavlink command

Do you know how to change flight mode from QGC status bar?
I know I have to re-compile QGC but I don’t know which files I have to edit. For now I can only change flight mode by terminal typing 'commander mode <my_flight_mode>.
I would appreciate any suggestions

YOu can already change flight mode from the toolbar. Why would you want to change it from the status bar?