Hi,
in my app I am reading a file name by opening a QFileDialog and save the filename to a string variable. And then I check for the variable in question of filename returned. I am doing this with an If statement and showing message box if the variable is empty. But when I get to the If statement my program showing a message that "example.exe has stopped working unexpectedly". here is my code
void MainWindow::getFilename()
{
msgbox.setText("Please select the file");
filepath
= QFileDialog::getOpenFileName(this, tr
("Open File"),
"/home",tr
("Text files(*.txt)"));
if(filepath.isEmpty())
msgbox.exec();
}
void MainWindow::getFilename()
{
QMessageBox msgbox;
msgbox.setText("Please select the file");
filepath = QFileDialog::getOpenFileName(this, tr("Open File"),"/home",tr("Text files(*.txt)"));
if(filepath.isEmpty())
msgbox.exec();
}
To copy to clipboard, switch view to plain text mode
I would be grateful for any solution.
Thank You,
Baluk
Bookmarks