Here's the way I'd do it:

Qt Code:
  1. QChar fill = '0';
  2. int num = 0x07;
  3. QString binary_str = QString("%1").arg(num,8,2,fill);
To copy to clipboard, switch view to plain text mode