QT Learning Notes Window widget finishing

Source: Internet
Author: User

learn about the widgets in Qt

  Today began to learn the Qt widget, the magic of QT, remember the 2012 winter, I still learn Java, and now basically say goodbye to Java, but for the development of the embedded QT is very important, I want to take advantage of the holiday time, good study. After the examination of a problem, no matter how much you learned to understand, always forget, the best way is to record them down, even write down your mood at that time, if one day you need to look back, is a good fortune.

1. Qdialog Class dialog box1.1 Modal and non modal dialog boxes

  For dialog boxes, there are modes (modal) and non-modal (modeless) points. Modal dialog box when the dialog box is out, you cannot click on the panel behind the dialog box. Non-modal is when the dialog box is out, you can click on the back panel. Here's how the code is set.

1#include"widget.h"2#include"ui_widget.h"3#include <QDialog>4#include <QDebug>5 6Widget::widget (Qwidget *parent):7 Qwidget (parent),8UiNewui::widget)9 {TenUI-&GT;SETUPUI ( This); One     //* Set up a Qdialog object to set this object in the widget A     //* This object is set to one of the following: Modal dialogs (cannot click other Apps section) -Qdialog *dialog1 =NewQdialog ( This); -Dialog1->setwindowtitle ("DIALOG-1"); the     //* * Transfer Dialog method, Setmodal (), given parameter is Boolean type value -     //* * If it is true to establish a modal dialog box, if False to establish a non-modal dialog box -Dialog1->setmodal (false); -     //* * Equivalent to the following method of transfer setwindowmodality () +     //* * Given parameters: -     //* * 1. Qt::applicationmodal ====> blocking the entire application (with Setmodal (true) effect) +     //* * 2. Qt::windowmodal ====> blocks his parent and ancestor windows and its child windows A     //* * 3. Qt::nonmodal ====> does not block any Windows at     //dialog1->setwindowmodality (qt::applicationmodal); -  -     //* Another way to create a Qdialog object -  -Qdialog DIALOG2 ( This); -Dialog2.setwindowtitle ("DIALOG-2"); inDialog2.exec ();//and show the difference is that this needs to be closed to return -                                                     //the difference between the variable definition method and the pointer definition method is that the variable definition method is released.  to     //If you take advantage of dialog2.show (), it will be a flash!  +  -Dialog1->setwindowmodality (qt::applicationmodal); theDialog1->Show (); *  $ }Panax Notoginseng  -widget::~widgets () the { +     DeleteUI; A}

QT Learning Notes Window widget finishing

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.