qtbase/tests/manual/windowflags/previewwindow.h
Tor Arne Vestbø 6d4a717152 Improve windowflags manual test
Group the Qt::CustomizeWindowHint specific flags separately, to make
it clear that they only apply if Qt::CustomizeWindowHint is set, and
give the QWindow preview window a title.

Add option to visualize the safe areas of the window.

Change-Id: I25ae7229b47ceaaa02f4be5a8210dbe44f54b6fa
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2024-11-21 17:49:37 +01:00

67 lines
1.1 KiB
C++

// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef PREVIEWWINDOW_H
#define PREVIEWWINDOW_H
#include <QDialog>
#include <QRasterWindow>
QT_BEGIN_NAMESPACE
class QPlainTextEdit;
QT_END_NAMESPACE
class PreviewWindow : public QRasterWindow
{
public:
PreviewWindow(QWindow *parent = nullptr);
void setVisualizeSafeAreas(bool enable)
{
m_visualizeSafeAreas = enable;
}
protected:
void paintEvent(QPaintEvent *event);
bool m_visualizeSafeAreas = false;
};
class PreviewWidget : public QWidget
{
Q_OBJECT
public:
PreviewWidget(QWidget *parent = nullptr);
void setWindowFlags(Qt::WindowFlags flags);
public slots:
void updateInfo();
protected:
bool event(QEvent *) override;
private:
QPlainTextEdit *textEdit;
};
class PreviewDialog : public QDialog
{
Q_OBJECT
public:
PreviewDialog(QWidget *parent = nullptr);
void setWindowFlags(Qt::WindowFlags flags);
public slots:
void updateInfo();
protected:
bool event(QEvent *) override;
private:
QPlainTextEdit *textEdit;
};
#endif