title: How to change dynamic QLabel with a Pixmap (QList)
body: <p>I have the following scenario: With an add Button I create a dynamic QLabel, and it gets a QPixmap, the first one is different then the other. So if I add a second one, everything is fine. The problem starts by adding a third. Then my second shown label should be replaced. I give you some picture that will explain my problem and my source code.
  At first a picture of the current situation after 2 times add clicked:<a href="https://i.stack.imgur.com/sIqpa.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sIqpa.jpg" alt="2times add"></a></p>
  
  <p>and here after i clicked it the third time, as you can see the pixmap in the middle should be replaced by one without a crossbar:
  <a href="https://i.stack.imgur.com/4v2nh.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4v2nh.jpg" alt="enter image description here"></a></p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include "mainwindow.h"
  #include "ui_mainwindow.h"
  
  MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
      counter=0;
  
      ui-&gt;setupUi(this);
  
      //Verteiler links
  
  }
  MainWindow::~MainWindow()
  {
      delete ui;
  }
  
  void MainWindow::changeEvent(QEvent *e)
  {
      QMainWindow::changeEvent(e);
      switch (e-&gt;type()) {
      case QEvent::LanguageChange:
          ui-&gt;retranslateUi(this);
          break;
      default:
          break;
      }
  }
  
  void MainWindow::on_pushButton_add_clicked()
  {
  
  
      int xposition;
      QPixmap vert_links("C:/Users/Boushar/Desktop/Bachelor_Fred/Coden/Verteiler_links");
      QPixmap vert_mitte("C:/Users/Boushar/Desktop/Bachelor_Fred/Coden/Verteiler_mitte");
      QPixmap vert_rechts("C:/Users/Boushar/Desktop/Bachelor_Fred/Coden/Verteiler_rechts");
  
      QLabel *label = new QLabel ();
      //add Label to the List
      qlist.append(label);
  
      xposition=counter*60;
  
      if  (counter==0)
      {
          label-&gt;setPixmap(vert_links);
      }
      else
      {
          xposition=xposition+35;
          label-&gt;setPixmap(vert_rechts);
      }
      if (counter&gt;1)
      {
          QLabel *label2 = new QLabel ();
          label2-&gt;setPixmap(vert_mitte);
          label2-&gt;show();
          label2-&gt;setParent(this);
          label2-&gt;setGeometry((xposition-60),500,125,172);
          qlist.replace(2,label2);
  
      }
      label-&gt;setParent(this);
      label-&gt;setGeometry((xposition),500,125,172);
      label-&gt;show();
  
      counter++;
  
  }
  </code></pre>
  
  <p>I get following error from QT "setGeometry: Unable to set geometry 89x172+915+454 on 'QLabelClassWindow'. Resulting geometry:  116x172+915+454 (frame: 8, 30, 8, 8)."
  I guess it is, because i just change the value in my list and not the diplayed one, but i have no clue how to code it correctly.
  Thanks for the help.</p>