title: C++ - Adding item to QListWidget from QPushButton
body: <p>Hello I am trying to add items to a QListWidget from a QPushButton. Both the QListWidget and QPushButton are added as individual widgets inside of a QGraphicsScene. I want the effect of a box that fills with text lines</p>
  
  <p>main.c </p>
  
  <pre><code>int main(int argc, char *argv[])
  {
      QApplication a(argc, argv);
      MainWindow w;
  
      QGraphicsView view;
  
      QGraphicsScene *scene = new QGraphicsScene(0, 0, 1200, 1200, &amp;view);
  
      scene-&gt;setBackgroundBrush(Qt::gray);
  
      view.setScene(scene);
  
      QPushButton *PushButton1;
      PushButton1 = new QPushButton();
      PushButton1-&gt;setGeometry(QRect(19, 20, 154, 4));
  
      QListWidget *ListWidget;
      ListWidget = new QListWidget;
  
      scene-&gt;addWidget(ListWidget);
      scene-&gt;addWidget(PushButton1);
  
      QObject::connect(PushButton1, SIGNAL(clicked()),&amp;w, SLOT(handleClick(*QListWidget)));
  
      view.show();
  
      return a.exec();
  </code></pre>
  
  <p>}</p>
  
  <p>mainwindow.cpp</p>
  
  <pre><code>#include "mainwindow.h"
  #include "ui_mainwindow.h"
  
  MainWindow::MainWindow(QWidget *parent) :
  QMainWindow(parent),
  ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
  }
  
  MainWindow::~MainWindow()
  {
      delete ui;
  }
  
  
  void MainWindow::handleClick(QListWidget *List)
  {
      int test;
  
      List-&gt;addItem("TESTING");
  
      //QApplication::quit();
  
  }
  </code></pre>
  
  <p>mainwindow.h</p>
  
  <pre><code>#ifndef MAINWINDOW_H
  #define MAINWINDOW_H
  
  #include &lt;QMainWindow&gt;
  #include &lt;QListWidget&gt;
  
  
  namespace Ui {
  class MainWindow;
  }
  
  class MainWindow : public QMainWindow
  {
  Q_OBJECT
  
  public:
      explicit MainWindow(QWidget *parent = 0);
      ~MainWindow();
  
  private:
      Ui::MainWindow *ui;
  
  
      private slots:
  
  
      public slots:
  
          void handleClick(QListWidget *List);
  };
  
  #endif // MAINWINDOW_H
  </code></pre>
  
  <p>This code compiles fine. How I get the following error in the console when the application is running</p>
  
  <pre><code>QObject::connect: No such slot MainWindow::handleClick(*ListWidget) in ..\MenuTest\main.cpp:48
  </code></pre>
  
  <p>Can someone help me do this? I've seen several tutorials but it's using the designer to make the GUI and I'd like to know how to do it in code without using designer. Thanks.</p>