Are you sure you use qtranslate-x? That function would have name qtranxf_generateLanguageSelectCode: https://qtranslatexteam.wordpress.com/faq/#LanguageSwitchingMethods
You can only use the widget of qTranslate-X in your menu or sidebars or footers.
now if you want to have to your header flags
use this php code
in this examples is for greek and english language..you have to change the English and Ελληνικά with images of flags or other words and the ?lang=en or ?lang=el with the languages that you prefer
also you can use css code for decorate your options
<php?
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; $changelanguage=str_replace("?lang=en","?lang=el",$actual_link);
<span><a href='http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]?lang=en'>English</a></span>
<span><a href='$changelanguage'>Ελληνικά</a></span>
?>
it works for me like a shortcode and i can place it every wher in my page
Thank you, @apoulakis, it is a good way for Query URL Modification Mode, however it will not work in other URL Modification modes.
With PHP code, there is a simpler way, for example:
$href = apply_filters('translate_url','','en');
or
$href = qtranxf_convertURL('','en',false,true);
Here is an faq: https://qtranslatexteam.wordpress.com/faq/#DevelperNotes