|Dec 21, 2011, 10: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, 12:31 PM||#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, 07: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 08:20 PM.
|Dec 22, 2011, 11:40 PM||#6|
Arguments when a file is dropped
I appreciate your kindness.
Last edited by balamw; Dec 23, 2011 at 06:02 AM. Reason: fixed quote
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|NSRegularExpression to capture C function arguments?||ArtOfWarfare||Mac Programming||13||Jun 18, 2013 12:17 AM|
|Accepting arguments of multiple types?||moonman239||iPhone/iPad Programming||8||Jun 5, 2013 02:35 AM|
|Resolved: variable arguments help (Cocoa format string)||ArtOfWarfare||Mac Programming||1||May 1, 2013 03:22 AM|
|Calling applescript from objective c code with arguments||Jitin Jindal||Mac Programming||2||Mar 4, 2013 12:03 PM|
All times are GMT -5. The time now is 09:47 AM.