I’m building a Qt app. In the event handler I want to access the widget that fired the event.
You can do this in the event filter method by casting the QObject parameter:
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
MyWidget* widget= static_cast<MyWidget*>(obj);
...
}
But how can I do that inside a signal method? For example, a listview onclick signal:
void MainWindow::listView_Click(QModelIndex index)
{
QListView* view = // ????
}
Thank you
Try QObject::sender().