gpt4 book ai didi

qt - 使用 QBoxLayout 减少闪烁

转载 作者:行者123 更新时间:2023-12-01 23:25:41 24 4
gpt4 key购买 nike

每当显示的 QBoxLayout 被填充时,屏幕上就会出现一些闪烁,因为小部件被添加到布局中。如何停止这种闪烁?

setUpdatesEnabled 没有成功。

最佳答案

show() 仅在您完成填充/布局后才显示小部件。

或者在您完成添加之前不要将您的布局附加到它的小部件。 (即仅在您完成向 your_layout 添加内容后调用 setLayout(your_layout))。

或者,查看 updatesEnabled QWidget 属性。您可以使用它来暂时禁用小部件的更新以防止闪烁。 (当您对基础数据进行“大量”更改时,这对更复杂的小部件(如 QTableWidget 和类似小部件)最有用。)

引用上面的文档:

setUpdatesEnabled() is normally used to disable updates for a short period of time, for instance to avoid screen flicker during large changes. In Qt, widgets normally do not generate screen flicker, but on X11 the server might erase regions on the screen when widgets get hidden before they can be replaced by other widgets. Disabling updates solves this.

关于qt - 使用 QBoxLayout 减少闪烁,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6016085/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com