About drag and drop
I'm japanese high school student and not so good at English, so I'm sorry if you have some trouble in reading…(´・ω・｀)
I want to drag text from qlineedit and drop qtextbrowser and show it but I have some puestions.
I think there're two ways to do that first.
1.reimplement dragEnterEvent in MainWindow class and only if "textBrowser->geometry.contains(event->pos())" is true,accept the event.
2.create new class that inherits qtextbrowser and reimplement dragEnterEvent and accept the event.
The first way works well but in the second way,I couldn't drop the text on the textbrowser without its border.
why is this occur?
and is there any good way to let it work?
or is the first way ordinary in qt?
Hi and welcome
Both methods are valid and should both work.
,I couldn't drop the text on the textbrowser without its border.
Im not sure what the "without its border." means ?
I've read them before, but now I see one of the examples and add "mouseMoveEvent" to my program, it worked!
thanks for answering but now solved!
it means "textbrowser's frame"
it turns out that the bad point of my program is using "acceptProposedAction" instead of "accept".
Sorry , this have nothing to do with that...
I rewrite my program as below and then it worked well.
void TextBrowser::dragMoveEvent(QDragMoveEvent* event)