Results 1 to 3 of 3

Thread: QML DropArea: drop an external file does not work

  1. #1
    Join Date
    Apr 2013
    Posts
    61
    Qt products
    Qt4
    Platforms
    Windows

    Default QML DropArea: drop an external file does not work

    Hi,

    I have a QML application and I would like to enable an area to drop there an external file (dragged from Windows explorer, for instance) and show the file path in my application.

    I have a really simple test qml to try, but I can not drop anything ("not accepted" cursor is displayed when I enter my DropArea dragging the file).

    My code:

    Qt Code:
    1. import QtQuick 2.1
    2. import QtQuick.Controls 1.0
    3.  
    4. ApplicationWindow {
    5. title: qsTr("Drop Area test")
    6.  
    7. width: 800
    8. height: 600
    9.  
    10. visible: true
    11.  
    12. DropArea {
    13. id: drop
    14. anchors.fill: parent
    15.  
    16. enabled: true
    17.  
    18. onEntered:
    19. console.log("entered");
    20.  
    21. onExited:
    22. console.log("exited")
    23.  
    24. onDropped:
    25. console.log("dropped")
    26. }
    27.  
    28. Text {
    29. id: textDrop
    30. anchors.centerIn: parent
    31. text: "Drop an element"
    32. }
    33. }
    To copy to clipboard, switch view to plain text mode 

    I supponse I am doing anything wrong, but I can not fix it...

    Thanks in advance,
    Diego

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QML DropArea: drop an external file does not work

    You might have to accept the event in your signal handlers.

    Cheers,
    _

  3. #3
    Join Date
    Apr 2013
    Posts
    61
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QML DropArea: drop an external file does not work

    Thanks for your time. It seemed to be something related to my QT installation, I reinstalled QT package and now it works... I don't know why!!!

Similar Threads

  1. Replies: 5
    Last Post: 4th March 2015, 22:02
  2. External openGL paining on a Qt widget does not work
    By MasterBLB in forum Qt Programming
    Replies: 0
    Last Post: 10th November 2012, 13:20
  3. Replies: 2
    Last Post: 25th June 2012, 19:14
  4. QML file not loading external JS file?
    By anothertest in forum Qt Programming
    Replies: 2
    Last Post: 14th April 2010, 09:11
  5. Can't get Drag and Drop capability work.
    By HeX0R in forum Newbie
    Replies: 1
    Last Post: 28th March 2010, 00:30

Tags for this Thread

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.