title: Qt: QVector<bool> to QByteArray
body: <p>Hello please help me with convertion. QVector of bool to array of bytes.</p>
  
  <pre><code>QByteArray currentArray
  //get(currentArray); currentArray is just text.
  QMap &lt;QChar, QVector&lt;bool&gt; &gt; table;
  //creating table;
  //table: is set of QChar and bit code
  //0: 100110111001
  //1: 00011
  //2: 011110
  //3: 010001
  //...
  QByteArray compressedArray;
  //converting QVector&lt;bool&gt; from QMap to QByteArray
  //it do not work fine.
  int count=0;
  Сhar buf=0;
  i=0;
  
  while(i&lt;currentArray.size())
  {
      QVector &lt;bool&gt; x = table[currentArray.at(i++)];
      for(int n=0; n &lt; x.size(); n++)
      {
          buf = buf | x[n] &lt;&lt; (7 - count);
          count ++;
          if (count == 8)
          {
              count=0;
              compressedArray += buf;
              buf = 0;
          }
      }
  
  }
  </code></pre>
  
  <p>This is an implementation of the algorithm Huffman.
  Decryption works correctly, so problem is here.</p>