简体   繁体   English

窗口内的QT窗口?

[英]QT window within window?

I'm setting up a small code editor using QT and following this example . 我正在使用QT设置一个小型代码编辑器,并遵循此示例 However, i'm curious on how to create windows within windows or widgets within widgets. 但是,我很好奇如何在窗口中创建窗口或在窗口小部件中创建窗口。 I'm trying to achieve something similar to these: 我正在尝试实现与以下类似的功能:

http://i.stack.imgur.com/Vn8Ut.png http://i.stack.imgur.com/Vn8Ut.png

http://www.hanselman.com/blog/content/binary/Windows-Live-Writer/Download-Visual-Studio-2013-while-your-f_1431E/image_4eb5427c-1ae7-4464-9c26-2282fe8d06c3.png http://www.hanselman.com/blog/content/binary/Windows-Live-Writer/Download-Visual-Studio-2013-while-your-f_1431E/image_4eb5427c-1ae7-4464-9c26-2282fe8d06c3.png

Is there an example of overlaying widgets like this? 有没有这样的叠加小部件的示例?

Any alternative soloution for QMessagebox for IOS development (QWidget application only)? QMessagebox是否可以用于IOS开发(仅QWidget应用程序)?

I gave an example of getting another QWidget to be embedded and painted on top of another one. 我举了一个示例,说明如何将另一个QWidget嵌入并绘制在另一个QWidget上。 Let me know if you have any questions about how it was done. 如果您有任何疑问,请告诉我。

The PopUp flag and Qt::Tool options are also relevant. PopUp标志和Qt::Tool选项也相关。

Be sure to check out: the ToolTip property of a QWidget and the WhatsThis property of QWidget . 一定要检查出:该ToolTip一个财产QWidgetWhatsThis财产QWidget

http://qt-project.org/doc/qt-5/qwidget.html#toolTip-prop http://qt-project.org/doc/qt-5/qwidget.html#toolTip-prop

http://qt-project.org/doc/qt-5/qwidget.html#whatsThis-prop http://qt-project.org/doc/qt-5/qwidget.html#whatsThis-prop

There are also other ways to make borderless, focusless windows that hover and disappear quickly on command. 还有其他方法可以使无边界,无焦点的窗口根据命令快速悬停并消失。 The Window Flags and Widget Attributes in Qt are very powerful when you are looking to modify Qt Widgets. 当您想要修改Qt小部件时,Qt中的Window FlagsWidget Attributes非常强大。

When you parent a Widget to another widget, it will draw itself on top of the other. 当您将一个小部件作为另一个小部件的父项时,它将在另一个之上绘制自身。 Then you just need to resize and position it properly. 然后,您只需要调整大小和正确放置它即可。

Also subclassing existing widgets can give you more options. 子类化现有小部件也可以为您提供更多选择。

Draw text on scrollbar 在滚动条上绘制文本

Also common Qt::Tool s that you will find are QDockWidget s. 您还会发现的常见Qt::ToolQDockWidget They are awesome! 他们真棒!

Hope that helps. 希望能有所帮助。

Take a look at Qt Namespace especially Qt::WA_LayoutOnEntireRect and Qt::WA_StyleSheet. 看一下Qt命名空间,尤其是Qt :: WA_LayoutOnEntireRect和Qt :: WA_StyleSheet。 Pass it as a widget attrybutes. 作为小部件尝试传递。 The second option looks promising but you have to create style sheet for QWidget. 第二个选项看起来很有希望,但是您必须为QWidget创建样式表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM