Results 1 to 10 of 10

Thread: drag and drop

  1. #1
    Join Date
    Mar 2006
    Posts
    172
    Thanks
    30
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Red face drag and drop

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: drag and drop

    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

  3. #3
    Join Date
    Mar 2006
    Posts
    172
    Thanks
    30
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Red face Re: drag and drop

    Quote Originally Posted by wysota
    .
    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

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: drag and drop

    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.

  5. #5
    Join Date
    Mar 2006
    Posts
    172
    Thanks
    30
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation Re: drag and drop

    Quote Originally Posted by wysota
    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

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: drag and drop

    Quote Originally Posted by nupul
    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.

  7. #7
    Join Date
    Mar 2006
    Posts
    172
    Thanks
    30
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation Re: drag and drop

    Quote Originally Posted by wysota
    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

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: drag and drop

    Quote Originally Posted by nupul
    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....
    perl Code:
    1. s/kwin/kdesktop/
    To copy to clipboard, switch view to plain text mode 


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

  9. #9
    Join Date
    Mar 2006
    Posts
    172
    Thanks
    30
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation Re: drag and drop

    Quote Originally Posted by wysota


    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!
    Last edited by nupul; 8th April 2006 at 04:40. Reason: missed a statement

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: drag and drop

    Quote Originally Posted by nupul
    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).

  11. The following user says thank you to wysota for this useful post:

    nupul (10th April 2006)

Similar Threads

  1. Drag and Drop QTableWidget in UI file.
    By tpf80 in forum Qt Programming
    Replies: 3
    Last Post: 20th January 2009, 23:02
  2. drag and drop QToolButton in QToolBar
    By NBilal in forum Qt Programming
    Replies: 1
    Last Post: 28th December 2008, 20:11
  3. Change cursor & status during Drag & Drop
    By ronlongo in forum Qt Programming
    Replies: 0
    Last Post: 1st December 2008, 16:56
  4. Drag & Drop when parent and childs accept drops?
    By gri in forum Qt Programming
    Replies: 0
    Last Post: 17th October 2008, 09:00
  5. Drag and drop revisited
    By Big Duck in forum Newbie
    Replies: 2
    Last Post: 30th June 2006, 16:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.