문제

Here is the code:

// Latitude line edit
QLineEdit *lineEdit = new QLineEdit;
lineEdit->setInputMask( ">\N999999.99;_" );

But, I am getting compiler warning: Unknown escape sequence '\N' and QLineEdit text does not contain 'N' character, only '_'. What am I doing wrong? Than you all in advance.

도움이 되었습니까?

해결책

In C++, there is a set of defined escape sequences to store special characters into a string.

You are actually lucky that \N is not within this set, because then you wouldn't even get a compiler warning; the text of the warning could have made you learn about escape sequences (unfortunately, it didn't).

Because the \ is used to prefix an escape sequence, you cannot use it directly; it has to be escaped itself:

">\\N999999.99;_"

This compiles to a single >\N999999.99;_ in the output.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top