qtbase/tests/manual/windowflags/controllerwindow.h
Tor Arne Vestbø d56dbdd48c windowflags manual test: Add option to force window recreation
Not all flags have an affect on an already created window, depending
on the platform and existing flags. Add option to force recreating
the window.

To aid debugging we also now log platform destruction/recreation events.

Pick-to: 6.9
Change-Id: I7822cb58eaed51d72ed4ea3244f1f4113964cff7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2025-03-17 20:14:01 +00:00

95 lines
2.0 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;
QCheckBox *recreateCheckbox;
};
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