创建时,屏幕中间可以看到QDockWidget(Glimpse of QDockWidget in the middle of the screen when gets created)

编程入门 行业动态 更新时间:2024-10-24 02:37:55
创建时,屏幕中间可以看到QDockWidget(Glimpse of QDockWidget in the middle of the screen when gets created)

当我创建一个新的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.

更多推荐

本文发布于:2023-04-28 01:58:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1330268.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可以看到   屏幕   QDockWidget   Glimpse   screen

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!