Two questions about QDialog
-
- I have currently got code like this:
void DropFilesDlg::showEvent(QShowEvent* event) { if (!event->spontaneous()) { if (!initialised) { initialised = true; onInitDialog(); } } // Invoke base class showEvent() return Inherited::showEvent(event); }which invokes an mf to setup the dialog
Should I instead be using onActivateWindow?
- If in that code (either onInitDialog or onActivateWindow) I decide that I don't actually want to display the dialog how can I do that?
Why - maybe we only accept files with extension .xyzzy and the user only dropped other filetypes...
Thanks
David -
- I have currently got code like this:
void DropFilesDlg::showEvent(QShowEvent* event) { if (!event->spontaneous()) { if (!initialised) { initialised = true; onInitDialog(); } } // Invoke base class showEvent() return Inherited::showEvent(event); }which invokes an mf to setup the dialog
Should I instead be using onActivateWindow?
- If in that code (either onInitDialog or onActivateWindow) I decide that I don't actually want to display the dialog how can I do that?
Why - maybe we only accept files with extension .xyzzy and the user only dropped other filetypes...
Thanks
DavidHi,
You should reject the drag and drop event if the proposed file type is not what is allowed on the widget. That way you don't have to do things like that.
-
Hi,
You should reject the drag and drop event if the proposed file type is not what is allowed on the widget. That way you don't have to do things like that.
@SGaist That sort of works for a file drag/drop ... not so much if a directory containing a mix of files is dropped.
If you know the answer to my first Q that would be great...
PS I've moved the drop processing to the code the invokes the dlg so the 2nd. issue is resolved.
Thanks
David -
@SGaist That sort of works for a file drag/drop ... not so much if a directory containing a mix of files is dropped.
If you know the answer to my first Q that would be great...
PS I've moved the drop processing to the code the invokes the dlg so the 2nd. issue is resolved.
Thanks
David@Perdrix do you mean your question about onActivateWindow ? The thing is that I don't know what that function does and when it is called.
As for folders, are folders allowed ? Should only a subset of files be processed ? That's again something you should manage on drop.