[Solved] Enable / disable drag and drop in some part of a qtextedit
-
Hi, i used the qconsole app (coded by someone else here in "sourceforge":https://sourceforge.net/projects/qconsole/). I want to enable the drop only in the editable zone i.e the zone after the command prompt on the last line, and i want to disable it everywhere else. Is it possible?
Thanks for your help.
-
mohson, are you sure about that?
I just took a look at the "sourcecode":http://qconsole.svn.sourceforge.net/viewvc/qconsole/trunk/include/qconsole.h?revision=28&view=markup of QConsole, and noticed that the console view is just a QTextEdit (see line 101). That means that you can use all the normal Qt D&D handling you need. I think the documentation on QDragMoveEvent contains the information you need.
-
oh! you're right! i was in mistake that qconsole is just controls the default OS console application.
But still there should be problems because it's only 1 textbox, not every command line has its own textbox[quote author="Andre" date="1294996143"]mohson, are you sure about that?
I just took a look at the "sourcecode":http://qconsole.svn.sourceforge.net/viewvc/qconsole/trunk/include/qconsole.h?revision=28&view=markup of QConsole, and noticed that the console view is just a QTextEdit (see line 101). That means that you can use all the normal Qt D&D handling you need. I think the documentation on QDragMoveEvent contains the information you need.
[/quote]
-
[quote author="mohsen" date="1294997985"]but commands are not always in a fixed position unless to be always at last line[/quote]
No. So? You figure out where the text cursor is, and create a target rect based on that information. QTextEdit::cursorRect() is your friend, I'd say.