|Dec 21, 2011, 09:43 PM||#1|
Arguments in Mac OS X
I am using Qt (Nokia) with X-Code. Once coded, it works with Windows, Linux, and in Mac OS X. However, double-clicking in the Finder or drag-and-dropping from the Finder works in a different way.
I supposed that the name of the file that was double-clicked or dropped is sent by the arguments in main( ) function such as:
int main( int argc, char *argv )
The name is usually stored in argv. Alternatively, it is possible to get argument strings by QCoreApplication::arguments( ) as a QStringList. In Mac OS X, Finder seems to send some message in a fashon completely different form the ordinary methods.
Could someone tell me how to get the name of the data files that are sent from Finder by double-clicking or by dropping in Mac OS X. I am not using Objective C because it just works only with Mac OS X.
|Dec 22, 2011, 11:31 AM||#3|
You should probably ask your question on a forum that specializes in Qt.
I googled the following search terms:
qt drag and drop
qt drag and drop files
The results show the basic Qt DnD reference doc, a mention of XDND protocol, and a nearly identical question from 2005:
which contains a link to this:
I didn't spend more than about 2 minutes doing these searches. The important thing is to confine the search to Qt, since a correct answer must use only portable Qt features or capabilities. Asking how to do it on a Mac is misguided if the result needs to be portable.
|Dec 22, 2011, 06:57 PM||#4|
Mac specific issue
When a file is dropped on the application icon, the application starts at the enter point main( argc, argv ). In Windows and Linux, argv contains the name of dropped file. This is not the case with Mac OS X. When an application in Mac is executed by a shell, it is possible to send the data file name to be opened but then it is not possible to send the file name from Finder to the shell.
Otherwise, Qt provides QCoreApplication::arguments( ) function and it also works with Windows and Linux. However, in Mac OS X, it just returns an empty string.
Therefore, what I want to know is simple. The method to know the file name dropped from Finder in Mac OS X. Probably this is not the problem of Mac OS X and I should find out the method in Qt functions. I tried to find out, but I could not get useful information. I rather considered that I have to solve this problem by Mac-specific method as is shown in
Thank you again.
Last edited by maflynn; Dec 22, 2011 at 07:20 PM.
|Dec 22, 2011, 10:40 PM||#6|
Arguments when a file is dropped
I appreciate your kindness.
Last edited by balamw; Dec 23, 2011 at 05:02 AM. Reason: fixed quote
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Resolved: Any good kids games to run on an iMac G3 running Mac OS 10.1-10.4?||alexreich||PowerPC Macs||10||Feb 10, 2012 02:09 AM|
|Mac OS X 10.8 Nyan Cat||Vasileios||Wasteland||6||Jul 22, 2011 08:45 AM|
|Can Mac OS 10.5 disc repair a 10.4 installation (PowerPC))||Chadder||OS X||3||Jun 4, 2011 09:46 PM|
|how to disable default screen capturing in mac os x||Monaj||OS X||1||Mar 16, 2011 12:53 AM|
|Running Mac Os 9 (Classics) Apps in Snow Leopard||mrt209||OS X||8||Dec 31, 2010 03:31 AM|
All times are GMT -5. The time now is 02:47 PM.