当我创建一个新的QDockWidget
myWidget = new MyDockWidget(this); MyMainWindow::instance()->addDockWidget(Qt::RightDockWidgetArea, mSettings);我可以在屏幕中间看到它。 在那之后,我可以注意到它被放置在右侧。 我在调试器下运行,所以可以理解的是事情很慢。 然而最终用户可能会在超量预订的机器上运行等。我可以创建已停靠的窗口或隐藏它直到实际停靠吗?
在构造函数中我有setupUi(this); 我的MyDockWidget具有以下设置:
MyDockWidget->setFloating(true); MyDockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures); MyDockWidget->setAllowedAreas(Qt::RightDockWidgetArea);那么为什么它出现在中心? 如何解决这个问题?
PS如果我将dock widget parent设置为主窗口,它会显示为unocked - 为什么? 什么是正确的父母? 我当前的父母是mdi窗口。
When I create a new QDockWidget
myWidget = new MyDockWidget(this); MyMainWindow::instance()->addDockWidget(Qt::RightDockWidgetArea, mSettings);I can see it in the middle of the screen. After that I can notice it is placed docked to the right. I'm running under debugger so understandably things are slow. Nevertheless end users might run on overbooked machines etc. Could I create the window docked already or hide it until it actually gets docked?
In constructor I have setupUi(this); for my MyDockWidget with following settings:
MyDockWidget->setFloating(true); MyDockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures); MyDockWidget->setAllowedAreas(Qt::RightDockWidgetArea);So why it appears on center on start? How to fix this?
P.S. If I set dock widget parent to main window it appears undocked - why? What is correct parent? My current parent is mdi window.
最满意答案
删除了所有功能,在Dock Widgets示例中保留默认设置,并将父设置为主窗口 - 现在工作正常。
PS Set功能DockWidgetFloatable | DockWidgetMovable手动,然后在Designer中也一样 - 也可以 - 一些奇怪的bug。 解决了。
Removed all features, left default like in Dock Widgets Example, and set parent to main window - works fine now.
P.S. Set features DockWidgetFloatable | DockWidgetMovable manually, then same in Designer - works also - some weird bug. Solved.
更多推荐
发布评论