Opened 14 years ago
Closed 13 years ago
#2793 closed bug (fixed)
Drag and Drop regression on Mac OSX
Reported by: | springmeyer | Owned by: | telwertowski |
---|---|---|---|
Priority: | major: does not work as expected | Milestone: | Version 1.7.0 |
Component: | GUI | Version: | Trunk |
Keywords: | startup document open | Cc: | |
Must Fix for Release: | Yes | Platform: | OS X |
Platform Version: | Awaiting user input: | no |
Description
In QGIS 1.4 on osx it is possible to both:
1) Double click on one shapefile (with the .shp ext), have it open QGIS (if not previously open), and zooms to the layer's extent. 2) Double click or drag and drop a second shapefile and have it automatically added to the layers list
In QGIS trunk (r13595), only the #1 above works. Double-clicking or dragging and dropping a second shapefile prompts no response.
While this may seems like a minor breakage in functionality, it is such a nice feature I've really come to depend on it, so +1 to keeping it working if possible.
Change History (9)
comment:1 by , 14 years ago
comment:3 by , 14 years ago
Must Fix for Release: | Yes → No |
---|
comment:4 by , 13 years ago
Milestone: | Version 1.6.0 → Version 1.7.0 |
---|
comment:5 by , 13 years ago
It's now even worse - double-clicking or drag-n-drop onto QGIS do not work at all to open a GIS data file or a project file, not even if QGIS is not running. Though they still activate/start QGIS.
Dragging a data file (or a QGIS project file, odd) into the layers palette still works.
This is current SVN (r14999), with Qt 4.7.
comment:6 by , 13 years ago
Keywords: | startup document open added |
---|---|
Must Fix for Release: | No → Yes |
Hah! I found a reference in QApplication::macEventFilter, though not used in QGIS, that Mac events are handled differently in Qt Cocoa:
Cocoa uses a different event system which means this function is NOT CALLED when building Qt against Cocoa. If you want similar functionality subclass NSApplication and reimplement the sendEvent: message to handle all the NSEvents. You also will need to to instantiate your custom NSApplication before creating a QApplication. See Apple's NSApplication Reference for more information.
So, the openDocumentsAEHandler() setup in main.cpp may not be called using Qt Cocoa. This is way beyond me to try to fix.
comment:7 by , 13 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Yes, a Cocoa vs. Carbon app is the cause of the problem.
I have been building both Qt/Carbon and Qt/Cocoa but using QGIS/Qt/Carbon because it works more reliably. I was still waiting for Qt/Cocoa to improve or for Qt to issue some instructions on what developers need to change.
While pursuing the details of NSApplication/QApplication interaction, I discovered QFileOpenEvent which reports "double clicking on a file icon in the Finder" among other things. It looks like it abstracts Carbon/Cocoa Open Document Apple Events so that separate code isn't needed for each.
Rather than writing Cocoa code to match the existing Carbon code, migrating to QFileOpenEvent may be a better solution.
comment:8 by , 13 years ago
Is that something you think you can do for the 1.7 release? Or would it affect other systems and require more work?
Further clarification from my use: double-click a shapefile or drag-n-drop a shapefile onto the Qgis icon works only if Qgis is not already running. If Qgis is running, even with an empty layout, one must drag the shapefile into the layers pane of the window. If running, a drag-n-drop or double-click will activate the Qgis application, so the system seems to be sending the open file event to Qgis.
I'm using Qt 4.6. I don't remember if I saw this with Qt 4.5.