title: Refresh QLabel in a QWidget
body: <p>I have created an app which is used to display folders and files in c++ and Qt.</p>
  
  <p>I have added an info section which is supposed to display the number of files and folders.</p>
  
  <p>To do saw, I have created a layout and widgets as below:</p>
  
  <pre><code>void MainWindow::createInfoSection()
  {
      uint64_t space;
      CreateInfoSection = new QWidget();
      CreateInfoSection-&gt;setFixedHeight(40);
  
      //QGridLayout *CreateInfoLayout = new QGridLayout(CreateInfoSection);
      CreateInfoLayout = new QGridLayout(CreateInfoSection);
      NbOfFolderLabel = new QLabel(tr("%1 Folders").arg(m_device.getNbOfFolder()));
      NbOfFilesLabel = new QLabel(tr("%1 Files").arg(m_device.getNbOfFiles()));
  
      space = m_device.getAvailableFreeSpaceInBytes();
  
      if(space &lt; MEGABYTE)
          SpaceAvailLabel = new QLabel(tr("%1 KB Remaining").arg(space/KILOBYTE));
      else if (space &lt; GIGABYTE)
          SpaceAvailLabel = new QLabel(tr("%1 MB Remaining").arg(space/MEGABYTE));
      else
          SpaceAvailLabel = new QLabel(tr("%1 GB Remaining").arg(space/GIGABYTE));
  
      NbOfFolderLabel-&gt;updatesEnabled();
      NbOfFilesLabel-&gt;updatesEnabled();
      SpaceAvailLabel-&gt;updatesEnabled();
  
      CreateInfoLayout-&gt;addWidget(NbOfFolderLabel, 0,0);
      CreateInfoLayout-&gt;addWidget(NbOfFilesLabel, 0,1);
      CreateInfoLayout-&gt;addWidget(SpaceAvailLabel, 0,2);
      CreateInfoLayout-&gt;setAlignment(Qt::AlignCenter);
  }
  </code></pre>
  
  <p>And when an action is done such as adding a Folder, I'm calling a Refresh method as below:</p>
  
  <pre><code>void MainWindow::RefreshInfoSection()
  {
      uint64_t space;
  
      NbOfFolderLabel = new QLabel(tr("%1 Files").arg(m_device.getNbOfFolder()));
      NbOfFilesLabel = new QLabel(tr("%1 Files").arg(m_device.getNbOfFiles()));
  
      space = m_device.getAvailableFreeSpaceInBytes();
  
      if(space &lt; MEGABYTE)
          SpaceAvailLabel = new QLabel(tr("%1 KB Available").arg(space/KILOBYTE));
      else if (space &lt; GIGABYTE)
          SpaceAvailLabel = new QLabel(tr("%1 MB Available").arg(space/MEGABYTE));
      else
          SpaceAvailLabel = new QLabel(tr("%1 GB Available").arg(space/GIGABYTE));
  
      NbOfFolderLabel-&gt;update();
      NbOfFilesLabel-&gt;update();
      SpaceAvailLabel-&gt;update();
      CreateInfoLayout-&gt;update();
  }
  </code></pre>
  
  <p>But it never works even if the 3 labels are updated.</p>
  
  <p>Any idea ?</p>