QT 具有滚动效果的屏幕切换(例如:- 从第一个屏幕滚动到第二个屏幕)
我正在开发 QT UI 应用程序。其中,主屏幕显示在 QT 应用程序启动时。稍后,在按钮按下事件中,必须显示第二个屏幕,依此类推。
但要将屏幕从屏幕 1 切换到屏幕 2,必须向用户显示滚动效果,滚动效果可以是从左到右(或从右到左)从第一个移动到第二个。
到目前为止我已经使用QT动画框架实现了。
如果还有其他方法可以实现这一目标,有人可以建议我吗?
对此的任何帮助都将受到高度赞赏。
提前致谢 瓦伦
I’m developijng a QT UI application. where in, The main Screen is shown on the launch of QT application. And later on button press event the Second Screen has to be shown and so on.
But to switch the screens from Screen 1 to Screen 2 the scrolling effects has to be show to the user, the scrolling effect can be from moving first to second from left to right(or from right to left).
As of now i have implemented using QT animation framework.
can any one please suggest me If there is any other way to achive this ?
Any help on this is highly appreciated.
Thanks in Advance
Varun
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基本上,我有一个具有更高优先级的多线程应用程序 UI 线程和具有 NormalPriority 的工作线程。 Worker 线程在整个生命周期中持续侦听来自其他应用程序的事件。
当我通过设置 setDuration(1500) 的动画持续时间来启动切换屏幕的动画时;动画在 UI 线程中顺利发生。仅当工作线程未接收到任何事件时。如果工作线程在动画期间从其他应用程序接收到任何事件,我可以在动画中看到堵塞效果。
原因是,当 UI 线程设置动画时,如果工作线程接收到导致 UI 中出现堵塞效果的事件,它会切换到工作线程。
如果我使用小部件的滚动而不是动画。在这种情况下,UI 线程不会切换到工作线程,直到它处理完事件队列中的所有事件。从而实现平滑滚动。为了实现这一点,我在事件循环中每次滚动 10 个像素。这样我就可以看到平滑的滚动。
如果您有任何其他场景(或其他方式)我可以尝试,请建议我?这样我就可以看到流畅的动画,而没有令人窒息的效果。
Basically, I have a multiThreaded application UI Thread with higher priority and Worker thread with NormalPriority. The Worker thread continuously listens to the events from other applications throught out the life time.
When i start an animation of switching the screen by setting the animation duration of setDuration(1500); the animation happens smoothly in the UI thread. only if the worker thread does not receive any events. And I can see the chocking effect in the animation if the worker thread receives any event form other applications during the animation.
The reason is, While the UI thread is animating it switches to the worker thread if the worker thread receives an event resulting in chocking effect in the UI.
If i use the scrolling of widgets instead of animation. than in this case the UI thread does not switch to the worker thread untill it process all the events in its event queue. resulting in smooth scrolling. To achive this I’m scrolling 10 pixel ever time in a event loop. so that i can see the smooth scrolling.
Please do suggest me if you have any other scenarios(or other way) which i can try ? So that i can see smooth animation with out chocking effects.