diff options
Diffstat (limited to 'examples/widgets/widgets/windowflags')
-rw-r--r-- | examples/widgets/widgets/windowflags/controllerwindow.cpp | 30 | ||||
-rw-r--r-- | examples/widgets/widgets/windowflags/previewwindow.cpp | 21 |
2 files changed, 28 insertions, 23 deletions
diff --git a/examples/widgets/widgets/windowflags/controllerwindow.cpp b/examples/widgets/widgets/windowflags/controllerwindow.cpp index e2abad89f4..0e9a916988 100644 --- a/examples/widgets/widgets/windowflags/controllerwindow.cpp +++ b/examples/widgets/widgets/windowflags/controllerwindow.cpp @@ -48,10 +48,15 @@ ** ****************************************************************************/ -#include <QtWidgets> - #include "controllerwindow.h" +#include <QCheckBox> +#include <QCoreApplication> +#include <QGroupBox> +#include <QHBoxLayout> +#include <QPushButton> +#include <QRadioButton> + //! [0] ControllerWindow::ControllerWindow(QWidget *parent) : QWidget(parent) @@ -63,7 +68,7 @@ ControllerWindow::ControllerWindow(QWidget *parent) quitButton = new QPushButton(tr("&Quit")); connect(quitButton, &QPushButton::clicked, - qApp, &QApplication::quit); + qApp, &QCoreApplication::quit); QHBoxLayout *bottomLayout = new QHBoxLayout; bottomLayout->addStretch(); @@ -83,26 +88,25 @@ ControllerWindow::ControllerWindow(QWidget *parent) //! [1] void ControllerWindow::updatePreview() { - Qt::WindowFlags flags = 0; + Qt::WindowFlags flags; - if (windowRadioButton->isChecked()) { + if (windowRadioButton->isChecked()) flags = Qt::Window; - } else if (dialogRadioButton->isChecked()) { + else if (dialogRadioButton->isChecked()) flags = Qt::Dialog; - } else if (sheetRadioButton->isChecked()) { + else if (sheetRadioButton->isChecked()) flags = Qt::Sheet; - } else if (drawerRadioButton->isChecked()) { + else if (drawerRadioButton->isChecked()) flags = Qt::Drawer; - } else if (popupRadioButton->isChecked()) { + else if (popupRadioButton->isChecked()) flags = Qt::Popup; - } else if (toolRadioButton->isChecked()) { + else if (toolRadioButton->isChecked()) flags = Qt::Tool; - } else if (toolTipRadioButton->isChecked()) { + else if (toolTipRadioButton->isChecked()) flags = Qt::ToolTip; - } else if (splashScreenRadioButton->isChecked()) { + else if (splashScreenRadioButton->isChecked()) flags = Qt::SplashScreen; //! [1] //! [2] - } //! [2] //! [3] if (msWindowsFixedSizeDialogCheckBox->isChecked()) diff --git a/examples/widgets/widgets/windowflags/previewwindow.cpp b/examples/widgets/widgets/windowflags/previewwindow.cpp index 8773dccb05..d7ebed7b3c 100644 --- a/examples/widgets/widgets/windowflags/previewwindow.cpp +++ b/examples/widgets/widgets/windowflags/previewwindow.cpp @@ -50,7 +50,9 @@ #include "previewwindow.h" -#include <QtWidgets> +#include <QPushButton> +#include <QTextEdit> +#include <QVBoxLayout> //! [0] PreviewWindow::PreviewWindow(QWidget *parent) @@ -81,23 +83,22 @@ void PreviewWindow::setWindowFlags(Qt::WindowFlags flags) QString text; Qt::WindowFlags type = (flags & Qt::WindowType_Mask); - if (type == Qt::Window) { + if (type == Qt::Window) text = "Qt::Window"; - } else if (type == Qt::Dialog) { + else if (type == Qt::Dialog) text = "Qt::Dialog"; - } else if (type == Qt::Sheet) { + else if (type == Qt::Sheet) text = "Qt::Sheet"; - } else if (type == Qt::Drawer) { + else if (type == Qt::Drawer) text = "Qt::Drawer"; - } else if (type == Qt::Popup) { + else if (type == Qt::Popup) text = "Qt::Popup"; - } else if (type == Qt::Tool) { + else if (type == Qt::Tool) text = "Qt::Tool"; - } else if (type == Qt::ToolTip) { + else if (type == Qt::ToolTip) text = "Qt::ToolTip"; - } else if (type == Qt::SplashScreen) { + else if (type == Qt::SplashScreen) text = "Qt::SplashScreen"; - } if (flags & Qt::MSWindowsFixedSizeDialogHint) text += "\n| Qt::MSWindowsFixedSizeDialogHint"; |