Q:

customContextMenuRequested(const QPoint&) want to have customContextMenuRequested(const QPoint&, QTableView)

I'm stuck on a issue I have and I dont know how to solve it.
The issue is that I want to have the QTableView object that I'm working with to be sent to the next function. In this way I don't need to copy the function for all the tables that I have. I can make a generic function and reuse it. But to do that I need to send the QTableView so that   I can add the row I want to add... Please see how my code looks. The code is how I would like to have it.
void InputWindow::on_pushButton_ViewMilestone_clicked()
{

    QTableView *viewMilestone = new QTableView;
    viewMilestone->setModel(sourceMilestonesModel);
    viewMilestone->setContextMenuPolicy(Qt::CustomContextMenu);
    viewMilestone->resizeColumnsToContents();
    viewMilestone->setMinimumWidth(getVerticalSizeOfQTableView(viewMilestone));
    viewMilestone->show();

    connect(viewMilestone, SIGNAL(customContextMenuRequested(const QPoint&)),
            this, SLOT(showMenu(const QPoint&)));

}

void InputWindow::showMenu(const QPoint &pos, QTableView *tableView)
{
    QAction *insertRowAction = new QAction(this);
    insertRowAction->setText("Insert new row");

    connect(insertRowAction, SIGNAL(triggered()),
            this, SLOT(addNewRow()));

    QMenu *rightClickMenu = new QMenu(this);
    rightClickMenu->addAction(insertRowAction);
    rightClickMenu->popup(tableView->viewport()->mapToGlobal(pos));

}

void InputWindow::addNewRow(QTableView *qTblView)
{
    QAbstractItemModel *tableModel = qTblView->model();
    int rows = tableModel->rowCount();
    tableModel->insertRow(rows);
}

A:

It sounds like a QSignalMapper could be helpful here. It's designed to link multiple QObjects to a single slot and to provide context as to what was the originating source. It's generally more reliable than MarioBlueSkies sender() mechanism as you're more explicitly controlling what gets registered against the Mapper.
Something like this...
QSignalMapper *mapper = new QSignalMapper(this);
connect(mapper, SIGNAL(mapped(const QObject&)),
        this, SLOT(clicked(const QObject&)));

void InputWindow::on_pushButton_ViewMilestone_clicked()
{

    QTableView *viewMilestone = new QTableView;
    viewMilestone->setModel(sourceMilestonesModel);
    viewMilestone->setContextMenuPolicy(Qt::CustomContextMenu);
    viewMilestone->resizeColumnsToContents();
    viewMilestone->setMinimumWidth(getVerticalSizeOfQTableView(viewMilestone));
    viewMilestone->show();
    connect(viewMilestone, SIGNAL(customContextMenuRequested(const QPoint&)),                 signalMapper, SLOT(map()));
    signalMapper->setMapping(viewMilestone, viewMilestone);
}

