本文介绍了如何检测何时将QDockWidget从QMainWindow中移出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有一个信号,允许用户知道QDockWidget已被移到QMainWindow内部内部的地方:
There is a signal which allows the user to know where a QDockWidget has been moved inside a QMainWindow :
void dockLocationChanged(Qt::DockWidgetArea area)
问题在于,将QDockWidget从QMainWindow中移出 时,不会触发该信号(通过拖动或双击Dockwidget的标题栏).
The problem is that this signal is not fired when a QDockWidget is moved out of the QMainWindow (either by dragging or by double-clicking the dockwidget's title bar).
是否有一种方法可以检测到该事件,无需重新实现 moveEvent()
?
Is there a way to detect that event, without reimplementing moveEvent()
?
推荐答案
有一个专门用于此目的的floating
属性和一个topLevelChanged
信号.
There is a floating
property exactly for that purpose, and a topLevelChanged
signal.
这篇关于如何检测何时将QDockWidget从QMainWindow中移出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!