1 Attachment(s)
Very disappointed with drag-and-drop :(
I am searching around 3 days now on how to do a drag-and-drop action in a listwidget, which should just take the name (full path), and, depending on the extension, do some action (e.g. if it is .png add to listwidget, if it is .txt, read the content etc)
I found some full examples but very misleading... I don't know... If anybody could send me back the attachment but working, please, i am so tired of this...?
Re: Very disappointed with drag-and-drop :(
How did you subclass QListWidget?
Re: Very disappointed with drag-and-drop :(
Re: Very disappointed with drag-and-drop :(
I see no functionality for drag and drop in your code, so basically what you are asking for is a full implementation, which is not going to happen.
Re: Very disappointed with drag-and-drop :(
Thanks for the replies.... If you knew what searching i've done till now you won't tell this... Anyway, I expected it.:(
Re: Very disappointed with drag-and-drop :(
Quote:
Originally Posted by
hakermania
How do I do this?
So... you don't know what subclassing is? So what exactly have you tried so far?
1 Attachment(s)
Re: Very disappointed with drag-and-drop :(
That's is as far as I managed to go,... The lineedit does work, but (in my OS) with file:/// in frond of the name, but listwudget doesn't work at all....
Re: Very disappointed with drag-and-drop :(
Where did you copy this from?
Re: Very disappointed with drag-and-drop :(
I didn't copy anything actually. I had a very strange (at least, in my opinion) example, an tried to make a program that works similar to he example but with code understandable to me..... And that's the result...
Re: Very disappointed with drag-and-drop :(
file:/// is a (almost-valid) uri, which is what you state you accept, so I would expect that. If you wrote the code and understood how it worked, you would expect that also.
Re: Very disappointed with drag-and-drop :(
So what was the example? You didn't even enable drops for your listwidget...
Re: Very disappointed with drag-and-drop :(
Quote:
tried to make a program that works similar to he example but with code understandable to me....
You need to do few things:
1) know how to subclass a widget
2) read the "Drag and Drop" documentation section
3) reimplement some protected methods of QWidget and enable drops in order to handle expected drop events
Don't copy-paste the code. Maybe the program will work, but you'll dont know why. And that's even worse than having the code that does not work.