You can use the QDesktopServices::openUrl
function to open local files with a suitable application.
Try this:
void Widget::open()
{
QString filename = QFileDialog::getOpenFileName();
if (!filename.isEmpty())
{
QUrl url = QUrl::fromLocalFile(filename);
QDesktopServices::openUrl(url);
}
}