void xx::on_pushButton_clicked()
{
    QFileDialog dialog(this);
    dialog.setNameFilter(tr("Images (*.png *.gif *.jpg)"));
    dialog.setViewMode(QFileDialog::Detail);
    QString fn = QFileDialog::getOpenFileName(this,
                                              tr("Select Image"),
                                              "e:/",
                                              tr("Images (*.png)"));
    // Do something
}
void xx::on_pushButton_2_clicked()
{
    QString ex= fn; // to be accessed from the above button selection
}
I would like use the filename selected using a button for an action to be established by another button. How can I do it?
 
     
    