Open Dauto98 opened 2 years ago
I am debugging the issue and the problem seems to be no event is fired when I close the dialog through Cancel button (logExceptions
not called in class EventWidget extends Component_1.Component
in node_modules/@nodegui/nodegui/dist/lib/core/EventWidget.js
).
Not sure is it related to the #373 issue (another issue of mine)
I'm not sure is it actual right now, but I managed same issue like this
const [files, setFiles] = useState([]);
const chooseFileButtonHandler = useEventHandler<QPushButtonSignals>(
{
clicked: () => {
const fileDialog = new QFileDialog();
fileDialog.exec();
const selectedFiles = fileDialog.selectedFiles();
if (fileDialog.result() !== 0) { // 0 = user closed the dialog, 1 = user selected file
setFiles(selectedFiles)
}
}
},
[]
);
return (
<View>
<Button on={chooseFileButtonHandler} text='Chose file' />
</View>
);
Describe the bug When using FileDialog I would like to handle the event when the user close the dialog through Cancel button or Alt-F4. Basically any way that is not selecting a file. The problem is I cannot find any event that is fired when I close the dialog this way. It is needed so I can set the open state back to false.
How can I handle this use case?
To Reproduce Sample code
Desktop (please complete the following information):