Opening files from a pinned Qt Application
I have pinned my Qt application to the taskbar
However, I would like to open the application using external files, example lets say there is a jpeg file. I would like to be able to drag it onto the taskbar where the Qt app Icon is present and open the contents of the file in my App.
How can that be accomplished?
Any Qt classes specific to this purpose or should I use command line arguments?
Re: Opening files from a pinned Qt Application
You'll need to read the documentation of whatever system you have there that provides that.
Maybe the system starts the application in a certain way or it jsut starts it and then devivers the drag to the first window or you need to register your program somehow for that kind of operation, etc.
Cheers,
Re: Opening files from a pinned Qt Application
Thanks for the response. But how am I supposed to make the Qt application understand that the file passed to it needs to be opened. Can it be done using an argument list?
There needs to be some mechanism for the Qt application to understand that the file passed to it needs to be validated and opened right?
Re: Opening files from a pinned Qt Application
As I said: find out how the system handles these drags.
There is nothing Qt specific here at all, the system does likely not distinguish which language an application is written in or which framework it uses, etc.
Cheers,
_
P.S.: moving this to General Programming
Re: Opening files from a pinned Qt Application
I really am unable to obtain the filename as an argument. If I may explain
Code:
qDebug()<<QApplication::arguments().size();
qDebug()<<toPass;
The above only gives 1 and an Empty String in the qDebug statements
What I am trying to achieve is to be able to open the pinned files from the task bar of the pinned Qt Application over there and display their contents
I do not wish to use QDesktopServices and open the files separately, rather use the file within the Qt application.
Also, when using the pinned application, I do not see any debug lines getting printed in the Qt console, where can I look for the same?
Sorry for the trouble and Thanks
Re: Opening files from a pinned Qt Application
Quote:
Originally Posted by
newtoQ_s
I really am unable to obtain the filename as an argument. If I may explain
Code:
qDebug()<<QApplication::arguments().size();
qDebug()<<toPass;
The above only gives 1 and an Empty String in the qDebug statements
How did you call the application?
Did you pass an argument?
Quote:
Originally Posted by
newtoQ_s
What I am trying to achieve is to be able to open the pinned files from the task bar of the pinned Qt Application over there and display their contents
We've already covered that.
Quote:
Originally Posted by
newtoQ_s
I do not wish to use QDesktopServices and open the files separately, rather use the file within the Qt application.
QDesktopServices is for delegating file opening to other applications, so not relevant here.
Quote:
Originally Posted by
newtoQ_s
Also, when using the pinned application, I do not see any debug lines getting printed in the Qt console, where can I look for the same?
Your operating system might have a logging facility and Qt might have been built with support for that and log to this factility.
If you are unsure, maybe log to a file.
Cheers,
_
1 Attachment(s)
Re: Opening files from a pinned Qt Application
I am unable to understand as to how one can pass the pinned File on a Qt application as an argument, if that is relevant at all.
Attachment 11536
I want to be able to open pinned files in a similar way from the Qt application that is pinned to the taskbar.
I am unable to understand the mechanism of how one can pass these files to the Qt application in order to be used within the application.
The main issue is how one can make a pinned file be passed as an argument to the Qt application?
All I am able to see is that there is a pinned file menu and on clicking the file the QApplication opens (Windows) but what I am trying to achieve is obtain the file's name in the process of opening the pinned file for use in the QApplication.
Re: Opening files from a pinned Qt Application
Quote:
Originally Posted by
anda_skoa
You'll need to read the documentation of whatever system you have there that provides that.
Quote:
Originally Posted by
anda_skoa
As I said: find out how the system handles these drags.
And a third time:
find the system's developer documentation and research how this mechanism works.
Cheers,
_