Results 1 to 7 of 7

Thread: Drag incomming localurl !=linux not work kde

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Drag incomming localurl !=linux not work kde

    Quote Originally Posted by patrik08 View Post
    it display inside qtextedit "file:///path/blabla.xx"... as text not read inside
    You're dropping on a wrong widget. The text edit has its own drop handler which is displaying text carried by the drag and it happens that URLs are stored as text, so it's a perfectly good drag for the text edit, so it handles the event and doesn't pass it to a parent widget where your drop handler resides. Try dropping outside the text edit.

    i suppose toLocalFile(); is os different....
    Of course it's os specific, but toLocalFile() doesn't have anything to do here - it's not even called when you drop on the text edit.

  2. #2
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    76
    Thanked 37 Times in 32 Posts

    Default Re: Drag incomming localurl !=linux not work kde

    You're dropping on a wrong widget. The text edit has its own drop handler which is displaying text carried by the drag and it happens that URLs are stored as text, so it's a perfectly good drag for the text edit, so it handles the event and doesn't pass it to a parent widget where your drop handler resides. Try dropping outside the text edit.
    Or from the C++ Gui programming Book

    Suppose the QTextEdit is inside a main Window then
    Qt Code:
    1. MainWindow::MainWindow( ... ){
    2. [...]
    3. textEdit->setAcceptDrops( false );
    4. setAcceptDrops( true );
    5. }
    6.  
    7. void MainWindow::dragEnterEvent( QDragEnterEvent *e ) {
    8. // accept if you can decode the mime data
    9. }
    10.  
    11. void MainWindow::dropEvent( QDropEvent *e ) {
    12. // get the file from the mime Data
    13. readFile( file );
    14. }
    To copy to clipboard, switch view to plain text mode 
    We can't solve problems by using the same kind of thinking we used when we created them

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
  •  
Qt is a trademark of The Qt Company.