Qt: the Child Window is embedded in the parent window. The Child Window follows the qdialog and qwidget of the parent window.

Source: Internet
Author: User

[Please indicate the source of the post: blog.csdn.net/lanmanck]

 

It is interesting to embed a child window into the parent window. For example, we use this method to easily implement each interface in the common software installation dialog box. If there is only one form, the control will crash.

VC-MFC can also be implemented, please refer to thisArticle: Http://blog.csdn.net/lanmanck/archive/2009/02/02/3857896.aspx

It can also be implemented in QT, but it is actually very simple. Take qt4.5.2 and qt4.7.0 as examples.

1. Create a new window in the current project and inherit from qdialog or qwidget.

2. Create this window: F2 = New Form2(This);

3. Add this sentence to the new window constructor: setwindowflags(Qt::Customizewindowhint|Qt::Framelesswindowhint); Hide ();

You can also use move to a proper position. This position is relative to the parent window, rather than the desktop or other windows.

4. In the parent window, call show () of the Child Window.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.