简体   繁体   English

Qt + Necessitas + Android-拖放防止显示重新绘制

[英]Qt + Necessitas + Android - drag and drop preventing display re-paint

The current ALPHA 4 version of Necessitas (Qt port for Android) has a bug with drag and drop. 当前的ALPHA 4版本的Necessitas(Android的Qt端口)存在拖放错误。 The drag in drop works fine except it blocks the event loop preventing the GUI getting re-paint events. 拖放操作效果很好,只是它阻止了事件循环,从而防止GUI获取重画事件。 I reported the problem in the project bug tracker. 我在项目错误跟踪器中报告了该问题。 https://bugs.kde.org/show_bug.cgi?id=304180 https://bugs.kde.org/show_bug.cgi?id=304180

This will probably be solved in the next release and does not seem to be a showstopper to the developers of the port which makes sens as Necessitas is still Beta. 这可能会在下一个版本中得到解决,并且对于端口开发人员来说似乎并不是一个突破,因为Necessitas仍然是Beta版,因此引起了轰动。 I wanted to give it a trial because what I am porting requires this to work. 我想试用一下,因为我要移植的内容需要此功能。

I need some help from Qt guru who is familiar with event loop and Qt internal. 我需要熟悉事件循环和Qt内部的Qt专家的帮助。 I know from the Qt doc that the drag and drop implementation is platform dependent, you can read the following note, 我从Qt文档中了解到,拖放实现取决于平台,您可以阅读以下说明,

Note: On Linux and Mac OS X, the drag and drop operation can take some time, but this function does not block the event loop. 注意:在Linux和Mac OS X上,拖放操作可能会花费一些时间,但是此功能不会阻止事件循环。 Other events are still delivered to the application while the operation is performed. 在执行操作时,其他事件仍会传递到应用程序。 On Windows, the Qt event loop is blocked while during the operation. 在Windows上,操作期间Qt事件循环被阻止。

Looking inside the Qt source, I ended at QDropManager which is implemented in 在Qt源代码内部,我结束于QDropManager ,该实现在

src/gui/kernel/qdnd_XXX.cpp src / gui / kernel / qdnd_XXX.cpp

This file has different implementation for X11, Win, MacOS and Symbian. 该文件对X11,Win,MacOS和Symbian具有不同的实现。 In the Necessitas Qt its X11 version is used for the build. 在Necessitas Qt中,其X11版本用于构建。

Any directions on how to fix this issue will be very helpful. 有关如何解决此问题的任何说明将非常有帮助。

You can just repaint all necessary widgets by yourself. 您可以自己重新粉刷所有必要的小部件。 For example call repaint() function at dragMoveEvent. 例如,在dragMoveEvent上调用repaint()函数。 dragMoveEvents are generating successfully. dragMoveEvents生成成功。 It works for me on android. 它适用于我在android上。

Also, you can try to create special thread for QDrag object. 另外,您可以尝试为QDrag对象创建特殊的线程。 As far as I know, QThreads have their own event loops. 据我所知,QThreads有自己的事件循环。 But I haven't tried this yet. 但是我还没有尝试过。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM