Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert from 'QChar' to 'wchar_t'

Tags:

c++

qt

qchar

I need to pass a QChar to a function that expects a wchar_t:

void myFunc(wchar_t wch);

Trying to just pass the QChar fails with an error:

error: C2664: 'myFunc' : cannot convert parameter 1 from 'QChar' to 'wchar_t'
like image 484
sashoalm Avatar asked Dec 12 '13 16:12

sashoalm


1 Answers

Found the answer even while I was asking the question, I needed to use QChar::unicode().

wchar_t wch = qch.unicode();
like image 80
sashoalm Avatar answered Sep 20 '22 02:09

sashoalm