View Single Post
Old 06-02-2018, 12:47 AM   #12
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
It's ages since I did this sort of thing, so I'm a bit rusty on it. And I was using the low-level Windows and OS/2 APIs with C and C++. Or with libraries that were just wrappers for these.

I'm a bit surprised that Qt doesn't have a way to set the cursor, but, I don't think this is needed. Setting the drop action to copy on the drag enter and drag move options seems to be all that is needed. As an experiment, in gui2/book_details.py, I changed the following:
Code:
    def dragEnterEvent(self, event):
        md = event.mimeData()
        if dnd_has_extension(md, image_extensions() + BOOK_EXTENSIONS, allow_all_extensions=True) or \
                dnd_has_image(md):
#             event.acceptProposedAction()
            event.setDropAction(Qt.CopyAction)
            event.accept()
Code:
    def dragMoveEvent(self, event):
#         event.acceptProposedAction()
        event.setDropAction(Qt.CopyAction)
        event.accept()
With that, when I drag a book from explorer over the details pane for a book, the copy icon and message is shown all the time. A very quick look at the other places that have these two methods, the same change should work.

And I disagree with you about disallowing the drops. The application should be telling the user what it can do. Changing the cursor to indicate the action tells me what the application can do and maybe that I don't want to drop something on it. And this discussion was started because someone was confused because calibre had the move cursor when it actually did a copy.
davidfor is offline   Reply With Quote