title: How to show the row where QPushButton is clicked in QTableWidget
body: <p>I would like to delete row where <code>QPushButton</code> is clicked how it is possible to I think it is reasonable to use slots but how to do it don't know , if you have any ideas how to get a row of selected button please share, thanks.</p>
  
  <p>It is my table</p>
  
  <p><img src="https://i.stack.imgur.com/uPhUW.png" alt=""></p>
  
  <p>It is a code where i add rows to my QTableWidget</p>
  
  <pre><code>MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
      for(int i = 0; i&lt;20;i++)
          ui-&gt;tableWidget-&gt;insertRow(ui-&gt;tableWidget-&gt;rowCount());
      QVector&lt;QString&gt;vec;
      vec&lt;&lt;"first"&lt;&lt;"sec"&lt;&lt;"third"&lt;&lt;"for"&lt;&lt;"fif"&lt;&lt;"first"&lt;&lt;"sec"
        &lt;&lt;"third"&lt;&lt;"for"&lt;&lt;"fif";
      vec&lt;&lt;"first"&lt;&lt;"sec"&lt;&lt;"third"&lt;&lt;"for"&lt;&lt;"fif"&lt;&lt;"first"&lt;&lt;"sec"
        &lt;&lt;"third"&lt;&lt;"for"&lt;&lt;"fif";
      for(int i = 0; i&lt;ui-&gt;tableWidget-&gt;rowCount();i++)
      {
          for(int j = 0; j&lt;ui-&gt;tableWidget-&gt;columnCount();j++)
          {
              if(j == 0)
              {
                  QWidget* pWidget = new QWidget();
                  QPushButton* btn_edit = new QPushButton();
                  btn_edit-&gt;setText("Remove");
                  QHBoxLayout* pLayout = new QHBoxLayout(pWidget);
                  pLayout-&gt;addWidget(btn_edit);
                  pLayout-&gt;setAlignment(Qt::AlignCenter);
                  pLayout-&gt;setContentsMargins(0, 0, 0, 0);
                  pWidget-&gt;setLayout(pLayout);
                  ui-&gt;tableWidget-&gt;setCellWidget(i, j, pWidget);
                  continue;
  
              }
              QTableWidgetItem*item = new QTableWidgetItem(vec[i]);
              item-&gt;setFlags(item-&gt;flags() ^ Qt::ItemIsEditable);
              ui-&gt;tableWidget-&gt;setItem(i, j, item);
          }
      }
  }
  </code></pre>