If QProgressDialog and the 'Cancel' button shares the parent-child relationship you can use findChild to get the QObject and do QObject casting to get the pushbutton*. Then you can use QWidget::geometry() to get the co-ordinates. Save it and use the same for your logic.