title: Qt : How to alternate alignment of a QTextEdit in a QVBoxLayout?
body: <p>I would like to add QTextEdit widgets in a layout and alternate the alignment</p>
  <pre><code>QVBoxLayout *lt = new QVBoxLayout;
  
  for(int i=0;i&lt;5;i++)
  {
      text1 = new QTextEdit;
      text1-&gt;setText(&quot;Hello world !&quot; + QString::number(i));
      text1-&gt;setMaximumSize(100,30);
      lt-&gt;addWidget(text1);
      lt-&gt;setAlignment(Qt::AlignLeft);
  
      if(i%2)
      {
          lt-&gt;setAlignment(Qt::AlignRight);
      }
      else
      {
          lt-&gt;setAlignment(Qt::AlignLeft);
      }
  }
  
  setLayout(lt);
  </code></pre>
  <p>However, the QTextEdits, are all align on the left.</p>
  <p>Is there a solution to my problem ?</p>