qt5base-lts/tests/manual/qtbug-8933/widget.cpp
Lucie Gérard 05fc3aef53 Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.

Task-number: QTBUG-67283
Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-05-16 16:37:38 +02:00

62 lines
1.2 KiB
C++

// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "widget.h"
#include "ui_widget.h"
#include <QTimer>
#include <QDebug>
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
QTimer::singleShot(5000, this, SLOT(switchToFullScreen()));
QTimer::singleShot(10000, this, SLOT(addMenuBar()));
QTimer::singleShot(15000, this, SLOT(removeMenuBar()));
QTimer::singleShot(20000, this, SLOT(switchToNormalScreen()));
}
Widget::~Widget()
{
delete ui;
}
void Widget::changeEvent(QEvent *e)
{
QWidget::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
void Widget::switchToFullScreen()
{
ui->label->setText("entering full screen");
showFullScreen();
}
void Widget::switchToNormalScreen()
{
ui->label->setText("leaving full screen");
showNormal();
}
void Widget::addMenuBar()
{
ui->label->setText("adding menu bar");
menuBar = new QMenuBar(this);
menuBar->setVisible(true);
}
void Widget::removeMenuBar()
{
ui->label->setText("removing menu bar");
delete menuBar;
}