Could you write me proper code for my code

Qt Code:
  1. QByteArray test ;
  2. test[0] = 0xFF;
  3. unsigned char ch = 0;
  4.  
  5. ch = 0xff;
  6. if (test.at(0)==ch) qDebug () << "OK";
  7.  
  8. qDebug () << ch;
  9.  
  10. qDebug () << test.at(0);
To copy to clipboard, switch view to plain text mode 

because test[0] is signed and ch is unsigned the condition is false. I will try to use your method but without success.