Convert from 'QChar' to 'wchar_t'

1.3k views Asked by At

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'
1

There are 1 answers

1
sashoalm On BEST ANSWER

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

wchar_t wch = qch.unicode();