Qt Catching signal of checkbox to do an action
<p>In my Qt program, I want to catch the signal of one of my checkbox to know if it's checked or not. I did it :</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;QVBoxLayout&gt;
#include &lt;QtGui&gt;
#include "Window.h"

Window::Window() : QWidget()
{
  setFixedSize(400, 800);

  m_bouton = new QPushButton("Module 1");
  m_bouton-&gt;setCursor(Qt::PointingHandCursor);

  m_bouton2 = new QPushButton("Module 2");
  m_bouton2-&gt;setCursor(Qt::PointingHandCursor);

  m_bouton3 = new QPushButton("Module 3");
  m_bouton3-&gt;setCursor(Qt::PointingHandCursor);

  m_bouton4 = new QPushButton("Module 4");
  m_bouton4-&gt;setCursor(Qt::PointingHandCursor);

  m_check4 = new QCheckBox(this);
  m_check4-&gt;move(300, 50);
  m_check4-&gt;setChecked(true);

  m_check3 = new QCheckBox(this);
  m_check3-&gt;move(200, 50);
  m_check3-&gt;setChecked(true);

  m_check2 = new QCheckBox(this);
  m_check2-&gt;move(100, 50);
  m_check2-&gt;setChecked(true);

  m_check1 = new QCheckBox(this);
  m_check1-&gt;move(0, 50);
  m_check1-&gt;setChecked(true);

  QVBoxLayout *layout = new QVBoxLayout;
  layout-&gt;addWidget(m_bouton);
  layout-&gt;addWidget(m_bouton2);
  layout-&gt;addWidget(m_bouton3);
  layout-&gt;addWidget(m_bouton4);
  this-&gt;setLayout(layout);
  this-&gt;setStyleSheet("border: 1px solid black; border-radius: 10px;");

  this-&gt;setWindowOpacity(0.5);
  QWidget::setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
  QWidget::setWindowTitle("Monitor Core");
  QObject::connect(m_bouton4, SIGNAL(clicked()), this, SLOT(SizeCHange()));
  QObject::connect(m_check4, SIGNAL(clicked()), this, SLOT(SizeCHange()));
}

void    Window::SizeCHange()
{
  setFixedSize(400, 800 - 200);
  m_bouton4-&gt;setVisible(false);
}
</code></pre>

<p>and this is my .h :</p>

<pre><code>#ifndef _WINDOW_H_
#define _WINDOW_H_

#include &lt;QApplication&gt;
#include &lt;QWidget&gt;
#include &lt;QPushButton&gt;
#include &lt;QCheckBox&gt;

class Window : public QWidget
{
  Q_OBJECT

 public:
  Window();

  public slots:
    void SizeCHange();

 private:
    QPushButton *m_bouton;
    QPushButton *m_bouton2;
    QPushButton *m_bouton3;
    QPushButton *m_bouton4;
    QCheckBox *m_check1;
    QCheckBox *m_check2;
    QCheckBox *m_check3;
    QCheckBox *m_check4;
};

#endif
</code></pre>

<p>This is working but just one time. I want to know if it's check or not, then I will be able to resize my window and make something invisible as I want.</p>