PDA

View Full Version : drag and drop



nupul
3rd April 2006, 12:19
if i drag an icon from the desktop onto a toolbar that i created using Qt in a different window (eg panel in KDE) i wish the corresponding Icon to be displayed to be displayed in the toolbar...Is it possible on X11??

What are the things I need to know w.r.t to the methods to be used for the purpose...i.e. do i need to use QPixmap or any other qt class to accompany the drag and drop functions??

Thanks

Nupul

wysota
3rd April 2006, 13:38
You have to provide a little broader explanation. Better yet an example or even a screenshot. You want to be able to add an image to the toolbar when it is dropped over it? What should that image do anyway? Toolbars contain actions -- at least (image|text)+somefunctiontocall. If you drop an image only, what good would it be for? Of course I don't say it's not possible :)

nupul
4th April 2006, 11:08
.
You want to be able to add an image to the toolbar when it is dropped over it? What should that image do anyway? Toolbars contain actions -- at least Image|text)+somefunctiontocall. If you drop an image only, what good would it be for? Of course I don't say it's not possible :)


Well it seems I assumed some notions...

I wish to drag the icon from the desktop to a toolbar...assuming that the functionality of that Icon could still be retained i.e (Image|text)+some_function_to_call

...the user should still be able to launch that particular program from that toolbar...

:)

Nupul

wysota
4th April 2006, 11:22
Which window manager and platform? For KDE you'd have to handle its .desktop files which are .ini sections containing information such as name of the icon (name, not path), label of the icon and actions associated with it.

nupul
4th April 2006, 12:22
Which window manager and platform? For KDE you'd have to handle its .desktop files which are .ini sections containing information such as name of the icon (name, not path), label of the icon and actions associated with it.

Is such DnD dependent on the underlying window manager???

Platform: SuSE 9/10

How does, what you mention help me get the actions associated with the icons...

eg: KDE

You drag an item from the desktop onto the panel...the app can now be launched from the panel too. I would like to know the sequence of operation that happened in this scenario...and how should i go about doing this.

Thanks.

Nupul

wysota
4th April 2006, 13:31
Is such DnD dependent on the underlying window manager???

Of course it is. KDE has .desktop files, GNOME probably has its own infrastructure, Windows... well... Windows is Windows, it probably has a crappy interface of its own, etc.



How does, what you mention help me get the actions associated with the icons...

eg: KDE

You drag an item from the desktop onto the panel...the app can now be launched from the panel too. I would like to know the sequence of operation that happened in this scenario...and how should i go about doing this.

Are you trying to code your own "KDE" in a month or so? Take my advice -- don't :) KDE guys have been doing that for years and they are not one person :) You are cloning much of KDE design and functionality... what for? If you want, make your own infrastructure for drag & drop, icons, toolbars, etc. Then code it with Qt and voila. Alternatively implement your own "kwin" and use the rest of KDE architecture.

nupul
5th April 2006, 09:00
Of course it is. KDE has .desktop files, GNOME probably has its own infrastructure, Windows... well... Windows is Windows, it probably has a crappy interface of its own, etc.

understood this part.



Are you trying to code your own "KDE" in a month or so?

No.



You are cloning much of KDE design and functionality... what for?


KDE follows the standards set be freedesktop.org and so does my Desktop manager...And I am also using Qt, thus you feel as though I am cloning KDE.
I suggest you read my reply to you on the following thread too:

http://www.qtcentre.org/forum/showthread.php?t=1591



If you want, make your own infrastructure for drag & drop, icons, toolbars, etc. Then code it with Qt and voila.


That's what I intend to do, I just wanted to know how does the KDE Panel implement DnD so that I could understand how to do it....This is where i need your help!!! I too am implementing a panel which needs to provide the DnD functionality...and I am not able to figure out the implementation so that the actions associated with the Icons and the corresponding Icon image are retained on the panel....This is the crux of this thread....the main guidance that i want...I would appreciate if anyone could throw more light on "DnD + (KDE's) .desktop files + Qt's involvement (i.e how does Qt handle this)"



Alternatively implement your own "kwin" and use the rest of KDE architecture.

You must be kidding!!!! kwin is a window manager - one of the MOST complicated pieces of softwares!!! I am implementing a Desktop Manager - conceptually simpler and comparatively easier to build....the difference is highlighted in the above give thread link.

Nupul

wysota
5th April 2006, 11:55
KDE follows the standards set be freedesktop.org and so does my Desktop manager...And I am also using Qt, thus you feel as though I am cloning KDE.
I'm talking about functionality not standards. I don't think things like "hiding a panel" are described by freedesktop.


That's what I intend to do, I just wanted to know how does the KDE Panel implement DnD so that I could understand how to do it...
KDE is open source -- take a look at its sources.


.This is where i need your help!!! I too am implementing a panel which needs to provide the DnD functionality...and I am not able to figure out the implementation so that the actions associated with the Icons and the corresponding Icon image are retained on the panel
This all depends on components provided by other software. If you want to have your own desktop handler, you have to provide your own infrastructure for that and try to handle operations initiated by window managers (which probably conform to freedesktop's specs, so you should be looking there).


....This is the crux of this thread....the main guidance that i want...I would appreciate if anyone could throw more light on "DnD + (KDE's) .desktop files + Qt's involvement (i.e how does Qt handle this)"
If you start a drag of .desktop files, a special mime is set on the drag which can then be handled by other .desktop-aware components. I suggest you run the "dropsite" example from Qt4 distribution and drop some .desktop file on it.[/quote]


You must be kidding!!!! kwin is a window manager - one of the MOST complicated pieces of softwares!!!
It's not that complicated :)


I am implementing a Desktop Manager - conceptually simpler and comparatively easier to build....

s/kwin/kdesktop/ ;)

If it's simpler, why do you have so much trouble with it? :)

nupul
8th April 2006, 04:38
If you start a drag of .desktop files, a special mime is set on the drag which can then be handled by other .desktop-aware components. I suggest you run the "dropsite" example from Qt4 distribution and drop some .desktop file on it.


Well thanks for the pointer...but I still have a doubt:

say you have a QListView and you'd like to drag some 'icons' from the KDE desktop onto it. The Icons such as "trash", "my computer" etc all have a .desktop file associated with them, giving the path of the icon, the icon label and the app to be executed when the icon is single/double clicked.

How do I drag such an 'Icon' onto my QListWidget and still retain it's functionality? What happens to the associated .desktop file? All in all, how to manage such an "icon" drag which has a file associated with it?

Thanks

Nupul.


P.S.: wysota had mentioned in one of his previous replies that KDE uses .desktop files and GNOME it's own infrastructure.....I forgot to clarify that the .desktop files are a specification standard put forth by freedesktop.org and expects that all desktop managers (DM) follow it. Thus Gnome or any other DM all use .desktop files for the same purpose!

wysota
8th April 2006, 22:51
How do I drag such an 'Icon' onto my QListWidget and still retain it's functionality? What happens to the associated .desktop file? All in all, how to manage such an "icon" drag which has a file associated with it?

I really suggest you try the "dropsite" demo and look at data which you get when you drop a desktop file on it. Then you'll be able to answer that question yourself (especially when you also take a look at dropsite source files).


P.S.: wysota had mentioned in one of his previous replies that KDE uses .desktop files and GNOME it's own infrastructure.....I forgot to clarify that the .desktop files are a specification standard put forth by freedesktop.org and expects that all desktop managers (DM) follow it. Thus Gnome or any other DM all use .desktop files for the same purpose!

Don't say that any other :) Any other that implements it :)

Just checked something... I don't think WindowMaker uses .desktop files. At least it doesn't allow any interaction with them (meaning you can't drop them on any wmaker object -- at least I didn't manage to).