Hello everyone,
I'm doing a program to acquire data from an NI USB-6008, where the acquired data is saved in a .bin file. This file can be exported to a file that can be opened in excel. The problem I have is to open the window to locate the file to export, the window created by QFileDialog does not send me the signal issued by means of "fileSelected ()" to send the address of the file to be exported to a function for this purpose. The only way I can get the address of the file to be exported is to create the object type QFileDialog and use the function show (). I dont know becuase I can not emit the signal when the window generated it by means of getOpenFileName (). Thanks for your help.

http://doc.qt.io/qt-4.8/
#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>

namespace Ui {
class Widget;
}
class QFileDialog;
class Widget : public QWidget
{
Q_OBJECT

public:
explicit Widget(QWidget *parent = 0);
~Widget();
public slots:
void fileDialog();
void sentSignal(QString fileName);
private:
Ui::Widget *ui;
QFileDialog *fileDialogWin;
};
#endif // WIDGET_H


http://doc.qt.io/qt-4.8/
#include "widget.h"
#include "ui_widget.h"
#include <QFileDialog>
#include <QDebug>
#include <QPushButton>


Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
QPushButton *button=new QPushButton("Open File",this);
connect(button, SIGNAL(clicked(bool)), this, SLOT(fileDialog()));
}

Widget::~Widget()
{
delete ui;
}

void Widget::fileDialog()//public slots.
{
fileDialogWin=new QFileDialog();
//fileDialogWin->getOpenFileName();//????????
fileDialogWin->show();
connect(fileDialogWin, SIGNAL(fileSelected(QString)), this, SLOT(sentSignal(QString)));
/*connect(fileDialogWin,&QFileDialog::fileSelected, [&](QString filename){
sentSignal(filename);
});*/
}

void Widget::sentSignal(QString fileName)//public slots.
{
qDebug() << "SIGNAL:" << fileName;
}