qtbase/tests/manual/windowflags/controllerwindow.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

94 lines
1.9 KiB
C++

// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef CONTROLLERWINDOW_H
#define CONTROLLERWINDOW_H
#include <QPlainTextEdit>
#include "previewwindow.h"
QT_BEGIN_NAMESPACE
class QCheckBox;
class QGroupBox;
class QLabel;
class QPushButton;
class QRadioButton;
class QMainWindow;
QT_END_NAMESPACE
class HintControl;
class WindowStatesControl;
class TypeControl;
class ControllerWidget : public QWidget
{
Q_OBJECT
public:
explicit ControllerWidget(QWidget *parent = nullptr);
virtual bool eventFilter(QObject *o, QEvent *e);
private slots:
void updatePreview();
void updateStateControl();
private:
void updatePreview(PreviewWindow *);
void updatePreview(QWidget *);
void createTypeGroupBox();
QCheckBox *createCheckBox(const QString &text);
QRadioButton *createRadioButton(const QString &text);
QMainWindow *parentWindow;
PreviewWindow *previewWindow;
PreviewWidget *previewWidget;
PreviewDialog *previewDialog;
QWindow *activePreview;
QGroupBox *widgetTypeGroupBox;
QGroupBox *additionalOptionsGroupBox;
TypeControl *typeControl;
HintControl *hintsControl;
WindowStatesControl *statesControl;
QRadioButton *previewWindowButton;
QRadioButton *previewWidgetButton;
QRadioButton *previewDialogButton;
QCheckBox *modalWindowCheckBox;
QCheckBox *fixedSizeWindowCheckBox;
QCheckBox *safeAreaCheckBox;
};
class LogWidget : public QPlainTextEdit
{
Q_OBJECT
public:
explicit LogWidget(QWidget *parent = nullptr);
~LogWidget();
static LogWidget *instance() { return m_instance; }
static void install();
public slots:
void appendText(const QString &);
private:
static QString startupMessage();
static LogWidget *m_instance;
};
class ControllerWindow : public QWidget {
Q_OBJECT
public:
ControllerWindow();
void registerEventFilter();
};
#endif // CONTROLLERWINDOW_H