QtBase  v6.3.1
widget.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the test suite of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21 ** included in the packaging of this file. Please review the following
22 ** information to ensure the GNU General Public License requirements will
23 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24 **
25 ** $QT_END_LICENSE$
26 **
27 ****************************************************************************/
28 
29 #include "widget.h"
30 #include "ui_widget.h"
31 
32 #include <QTimer>
33 #include <QDebug>
34 
36  QWidget(parent),
37  ui(new Ui::Widget)
38 {
39  ui->setupUi(this);
40  QTimer::singleShot(5000, this, SLOT(switchToFullScreen()));
41  QTimer::singleShot(10000, this, SLOT(addMenuBar()));
42  QTimer::singleShot(15000, this, SLOT(removeMenuBar()));
43  QTimer::singleShot(20000, this, SLOT(switchToNormalScreen()));
44 }
45 
47 {
48  delete ui;
49 }
50 
52 {
54  switch (e->type()) {
56  ui->retranslateUi(this);
57  break;
58  default:
59  break;
60  }
61 }
62 
64 {
65  ui->label->setText("entering full screen");
67 }
68 
70 {
71  ui->label->setText("leaving full screen");
72  showNormal();
73 }
74 
76 {
77  ui->label->setText("adding menu bar");
78  menuBar = new QMenuBar(this);
79  menuBar->setVisible(true);
80 }
81 
83 {
84  ui->label->setText("removing menu bar");
85  delete menuBar;
86 }
The QEvent class is the base class of all event classes. Event objects contain event parameters.
Definition: qcoreevent.h:58
@ LanguageChange
Definition: qcoreevent.h:136
The QMenuBar class provides a horizontal menu bar.
Definition: qmenubar.h:56
void setVisible(bool visible) override
Definition: qmenubar.cpp:967
bool singleShot
whether the timer is a single-shot timer
Definition: qtimer.h:60
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:133
setupUi(QWidget *widget)
void showFullScreen()
Definition: qwidget.cpp:3033
virtual void changeEvent(QEvent *)
Definition: qwidget.cpp:9283
void showNormal()
Definition: qwidget.cpp:3072
void retranslateUi(QWidget *Widget)
Definition: widget.h:60
void changeEvent(QEvent *) override
void switchToNormalScreen()
Definition: widget.cpp:69
void addMenuBar()
Definition: widget.cpp:75
~Widget()
Definition: widget.cpp:78
void removeMenuBar()
Definition: widget.cpp:82
void switchToFullScreen()
Definition: widget.cpp:63
double e
void removeMenuBar(QAndroidPlatformMenuBar *menuBar)
void addMenuBar(QAndroidPlatformMenuBar *menuBar)
#define SLOT(a)
Definition: qobjectdefs.h:87
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent