How to add custom parameters in QGC?

Dear all,
I want to observe some custom variables in QGC widget. I searched the forum but only found some questions asking the same thing. Could anyone tell me the exact steps that I can follow to achieve this?
Thanks.

QGC custom qml widgets can only be used to send commands via mavlink messages. It is not possible to “observe” telemetry data, without modifying mainline code. You will have to use the Analyze widget for that.

QGC developer Don mentioned that this a feature request but has not been worked on yet (at least not in 3.0.x version of QGC).

Thanks for the quick reply.
But I still do not quite understand. I want to observe some custom items, i.e. ground distance varied with time, just like what widget/analyze has already shown. Is this possible? I saw the source code has certain variable encapsulated within a structure and sends it via mavlink. I want to do the same way, but send my custom variables.

Hi,

Does this help?
https://dev.px4.io/advanced-debug-values.html

oh i misunderstood, i thought you wanted to write a custom qml widget to plot some variables.

CalrOlsson, has the right information for you.

Thanks guys for the feedback.
However, I am debugging the px4flow code, and there is no uorb stuff in it. By digging the code, I found the items in the widget/analyze are sent via the following mavlink command:
// send flow
mavlink_msg_optical_flow_send(MAVLINK_COMM_2, get_boot_time_us(), global_data.param[PARAM_SENSOR_ID], pixel_flow_x_sum * 10.0f, pixel_flow_y_sum * 10.0f, flow_comp_m_x, flow_comp_m_y, qual, ground_distance);

where MAVLINK_COMM_2 is USB com port. I think the items sent are fixed in this command. If I want to send my custom variables, how can I do it?
Also @CarlOlsson

I think the easiest way is to create a new topic for the variables that you want to send and then follow the instructions given above. Or am I misunderstanding you?

Yes. I mean in Px4flow source code, there is no uorb, so I cannot create a topic.
Some guys told me that I can resort to mavlink_debug_t message. I am not sure of that yet. Any ideas?

Ah now I get what you mean, sorry. No then I don’t know I haven’t been working with the Px4flow source code.
Hope someone else can guide you in the right direction