I have tested on kubuntu 10.4 and there is no "flicker", and can test on ubuntu, but a little bit later
LE:tested on ubuntu 10.4 and didn't flicker.
I have tested on kubuntu 10.4 and there is no "flicker", and can test on ubuntu, but a little bit later
LE:tested on ubuntu 10.4 and didn't flicker.
Last edited by Zlatomir; 12th September 2010 at 11:43.
Well, I'm pleased with the correctness of the code, but astonished with the configuration of my system.
Can't think about anything correlated...
Try playing with performance settings.
- Update your graphics driver
- Try disabling some desktop effects
Tried playing with some Compiz effects, following tbscope's hint.
However I think it's not a performance matter.
The problem seems to be correlated to MyTextEdit widget itself. To prove that, I added a second QTextEdit to MainWindow: flicker shows up only when dragging over MyTextEdit.
P.S. Short video included
Last edited by guiQt; 12th September 2010 at 16:34.
Ok, on my console I get? Not sure what goes wrong here.Qt: Internal error: WH0A, unexpected condition reached
Ehm, I found it: you have forgot to forward the drag to the base class:Also use the Q_OBJECT macro in your own text edit class.Qt Code:
{ if (e->source()) { if (e->source() == viewport()) { e->accept(); } } }To copy to clipboard, switch view to plain text mode
The solution proposed by Lykurg removes the flicker, but the drag is not forwarded to the MainWindow when text editor accepts external file drop.
So the code that meets initial requests is:
Qt Code:
{ if (e->source()) { if (e->source() == viewport()) { e->accept(); return; } } e->ignore(); }To copy to clipboard, switch view to plain text mode
Hmm.... You mean you don't want the text editor to accept any drags apart the ones that originated in itself? Some strange text editor![]()
It's a pure theoretical (and trivial, obviously) case (described above in detail).
The final goal is to develop a lot more complex custom widget (MyTextEdit class with extended QTextEdit functionalities) that besides accepting normal drag and drop originated in itself, it sends external drops to its parent.
This way it's reusable: each application using MyTextEdit class is allowed to manage external drops in its own way.
I would still want to be able to drop some text snippet into the text editor without having to implement that in the parent/subclass of the editor... Especially if that was part of the original behaviour of the text editor.
Perhaps I would simply block only those events I explicitly don't want instead of blocking everything which is not what I am interested in at the moment.
Bookmarks