我通过 addDockWidget
将各种停靠小部件添加到我的窗口,并通过 setCentralWidget
添加一个主要小部件。使用 addDockWidget
添加的小部件会自动添加(上下文菜单由 Qt 生成)到右键单击时出现的上下文菜单列表,允许用户切换可见性各种停靠小部件的:
但是,通过 setCentralWidget
添加的小部件在此菜单中不存在,并且如果它“关闭”,则无法通过上下文菜单再次使其可见。如何将中央小部件添加到此菜单?
I add various dock widgets to my window through addDockWidget
, and one main widget through setCentralWidget
. The widgets added with addDockWidget
are automatically added (the context menu is generated by Qt) to a context menu list that appear when right-clicking, allowing the user to toggle the visibility of the various dock widgets:
However, the widget added through setCentralWidget
is absent from this menu, and if it's "closed" it can't be made visible again through the context menu. How can I add the central widget to this menu?
发布评论