mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-03 07:45:30 +08:00
qt 6.5.1 original
This commit is contained in:
16
tests/manual/transientwindow/CMakeLists.txt
Normal file
16
tests/manual/transientwindow/CMakeLists.txt
Normal file
@ -0,0 +1,16 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#####################################################################
|
||||
## transientwindow Binary:
|
||||
#####################################################################
|
||||
|
||||
qt_internal_add_manual_test(transientwindow
|
||||
GUI
|
||||
SOURCES
|
||||
main.cpp
|
||||
mainwindow.cpp mainwindow.h
|
||||
LIBRARIES
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
)
|
13
tests/manual/transientwindow/main.cpp
Normal file
13
tests/manual/transientwindow/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 "mainwindow.h"
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
29
tests/manual/transientwindow/mainwindow.cpp
Normal file
29
tests/manual/transientwindow/mainwindow.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
// 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 "mainwindow.h"
|
||||
#include <QDebug>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent), m_showButton("Toggle visible", this), m_window(0)
|
||||
{
|
||||
connect(&m_showButton, SIGNAL(clicked()), this, SLOT(toggleVisible()));
|
||||
setWindowTitle(QString::fromLatin1("Main Window"));
|
||||
m_showButton.setVisible(true);
|
||||
setMinimumSize(300, 200);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
}
|
||||
|
||||
void MainWindow::toggleVisible()
|
||||
{
|
||||
if (!m_window) {
|
||||
m_window = new QWindow();
|
||||
m_window->setTransientParent(windowHandle());
|
||||
m_window->setMinimumSize(QSize(200, 100));
|
||||
m_window->setTitle("Transient Window");
|
||||
m_window->setFlags(Qt::Dialog);
|
||||
}
|
||||
m_window->setVisible(!m_window->isVisible());
|
||||
}
|
26
tests/manual/transientwindow/mainwindow.h
Normal file
26
tests/manual/transientwindow/mainwindow.h
Normal file
@ -0,0 +1,26 @@
|
||||
// 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 MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QPushButton>
|
||||
#include <QWindow>
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
public slots:
|
||||
void toggleVisible();
|
||||
|
||||
private:
|
||||
QPushButton m_showButton;
|
||||
QWindow* m_window;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
6
tests/manual/transientwindow/transientwindow.pro
Normal file
6
tests/manual/transientwindow/transientwindow.pro
Normal file
@ -0,0 +1,6 @@
|
||||
QT += core gui widgets
|
||||
TARGET = transientwindow
|
||||
TEMPLATE = app
|
||||
SOURCES += main.cpp\
|
||||
mainwindow.cpp
|
||||
HEADERS += mainwindow.h
|
Reference in New Issue
Block a user