mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-06 09:15:23 +08:00
qt 6.5.1 original
This commit is contained in:
20
tests/auto/widgets/kernel/qapplication/modal/CMakeLists.txt
Normal file
20
tests/auto/widgets/kernel/qapplication/modal/CMakeLists.txt
Normal file
@ -0,0 +1,20 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#####################################################################
|
||||
## modal Binary:
|
||||
#####################################################################
|
||||
|
||||
qt_internal_add_executable(modal_helper
|
||||
SOURCES
|
||||
base.cpp base.h
|
||||
main.cpp
|
||||
OUTPUT_DIRECTORY
|
||||
${CMAKE_CURRENT_BINARY_DIR}/..
|
||||
LIBRARIES
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
)
|
||||
|
||||
## Scopes:
|
||||
#####################################################################
|
24
tests/auto/widgets/kernel/qapplication/modal/base.cpp
Normal file
24
tests/auto/widgets/kernel/qapplication/modal/base.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
// 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 "base.h"
|
||||
|
||||
base::base(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
m_timer = new QTimer(this);
|
||||
m_timer->setSingleShot(false);
|
||||
connect(m_timer, &QTimer::timeout, this, &base::periodicTimer);
|
||||
m_timer->start(5000);
|
||||
}
|
||||
|
||||
void base::periodicTimer()
|
||||
{
|
||||
if(m_modalStarted)
|
||||
exit(0);
|
||||
m_modalDialog = new QDialog(this);
|
||||
m_modalDialog->setWindowTitle(QLatin1String("modal"));
|
||||
m_modalDialog->setModal(true);
|
||||
m_modalDialog->show();
|
||||
m_modalStarted = true;
|
||||
}
|
24
tests/auto/widgets/kernel/qapplication/modal/base.h
Normal file
24
tests/auto/widgets/kernel/qapplication/modal/base.h
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#ifndef BASE_H
|
||||
#define BASE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTimer>
|
||||
#include <QDialog>
|
||||
|
||||
class base : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
QTimer *m_timer;
|
||||
bool m_modalStarted = false;
|
||||
QDialog *m_modalDialog = nullptr;
|
||||
public:
|
||||
explicit base(QWidget *parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void periodicTimer();
|
||||
};
|
||||
|
||||
#endif // BASE_H
|
13
tests/auto/widgets/kernel/qapplication/modal/main.cpp
Normal file
13
tests/auto/widgets/kernel/qapplication/modal/main.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
// 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 <QApplication>
|
||||
#include "base.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
QApplication::setAttribute(Qt::AA_NativeWindows); //QTBUG-15774
|
||||
base b;
|
||||
return app.exec();
|
||||
}
|
Reference in New Issue
Block a user