Below is the code sample of getting list of fields from all objects that were used in the currently active sub-query. This list is identical to the content of drop-down in inline editor for Expression column in the Query Columns Grid.
procedure TForm1.ButtonClick(Sender: TObject);
var 
    availableFields: TStringList;
    usq: TacUnionSubQuery;
    datasourceList: TObjectList;
    i,j: integer;
    datasource: TacDatasource;
    datasourceNameInQuery: WideString;
    fieldName: WideString;
    field: TacMetadataField;
begin
    usq := queryBuilder.ActiveSubQuery.ActiveUnionSubquery;

    availableFields := TStringList.Create;
    datasourceList := TObjectList.Create(false);
    try
        // get list of all datasources
        usq.FromClause.GetDatasources(datasourceList);

        for i:=0 to datasourceList.Count-1 do
        begin
            datasource := TacDatasource(datasourceList[i]);
            datasourceNameInQuery := datasource.NameInQuery;

            for j:=0 to datasource.Fields.Count-1 do
            begin
                field := datasource.Fields[j];

                fieldName := '';

                if queryBuilder.UseAltNames and (field.AltName <> '')
                then fieldName := field.AltNameId.SimpleSQL(queryBuilder.SQLContext.SQLBuilderExpression);

                if fieldName='' then fieldName := field.Name.QualifiedName;

                availableFields.Add(datasourceNameInQuery+'.'+fieldName);
            end;
        end;

        ShowMessage(availableFields.Text);
    finally
        datasourceList.Free;
        availableFields.Free;
    end;
end;

Is this article helpful for you?