I have some Dialog class via which I select files and/or directories. Within this dialog there is a fnc called okBtn_clicked and in this fnc I’m getting QModelIndexes and via them I’m able to create QStringList of picked files. But how to return them after this dialog is closed?
EDIT:
QModelIndexList Dir_File_Select::okBtn_clicked_()
{
accept();
return view->selectionModel()->selectedIndexes();
}


You can still access the dialog after it is closed except it’s destructor has been called. So the easiest approach would be to add a public function that will return the
QStringListyou want.In your main application you should just connect the
acceptedsignal of the dialog with a slot that handles it and retrieves the string list.Another option is to create a signal in your dialog with a
QStringListas argument and emit it before theacceptAgain you have to connect this signal with a slot that handles the
QStringListYour ok button slot should not return anything since this is handled internally by
Qt.