From 8ef9a0ae8968036e92f47e9e7c0e271f9fecaceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 16 Feb 2018 18:02:45 +0100 Subject: windowflags: Make it easier to debug windows without a frame MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without any content it was hard to see the window. Put some lipstick on it. Change-Id: I0fefffb0a4deba7ac91e67a6153a9a27308fe493 Reviewed-by: Morten Johan Sørvig Reviewed-by: Tor Arne Vestbø --- tests/manual/windowflags/controllerwindow.cpp | 2 +- tests/manual/windowflags/previewwindow.cpp | 11 +++++++++++ tests/manual/windowflags/previewwindow.h | 6 ++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/manual/windowflags/controllerwindow.cpp b/tests/manual/windowflags/controllerwindow.cpp index 0b8c561d9a..6334ea588f 100644 --- a/tests/manual/windowflags/controllerwindow.cpp +++ b/tests/manual/windowflags/controllerwindow.cpp @@ -59,7 +59,7 @@ ControllerWidget::ControllerWidget(QWidget *parent) QLabel *label = new QLabel(tr("Parent window")); parentWindow->setCentralWidget(label); - previewWindow = new QWindow; + previewWindow = new PreviewWindow; previewWindow->installEventFilter(this); previewWidget = new PreviewWidget; previewWidget->installEventFilter(this); diff --git a/tests/manual/windowflags/previewwindow.cpp b/tests/manual/windowflags/previewwindow.cpp index 19473c9eee..ef3966830b 100644 --- a/tests/manual/windowflags/previewwindow.cpp +++ b/tests/manual/windowflags/previewwindow.cpp @@ -32,9 +32,20 @@ #include #include #include +#include +#include #include "previewwindow.h" +void PreviewWindow::paintEvent(QPaintEvent *event) +{ + QPainter painter(this); + QLinearGradient gradient(0, 0, width(), height()); + gradient.setColorAt(0, QColor("#64b3f4")); + gradient.setColorAt(1, QColor("#c2e59c")); + painter.fillRect(QRect(0, 0, width(), height()), gradient); +} + static void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags) { str << "Window flags: " << hex << showbase << unsigned(flags) << noshowbase << dec << ' '; diff --git a/tests/manual/windowflags/previewwindow.h b/tests/manual/windowflags/previewwindow.h index 023ddd910c..8f8fc39211 100644 --- a/tests/manual/windowflags/previewwindow.h +++ b/tests/manual/windowflags/previewwindow.h @@ -30,11 +30,17 @@ #define PREVIEWWINDOW_H #include +#include QT_BEGIN_NAMESPACE class QPlainTextEdit; QT_END_NAMESPACE +class PreviewWindow : public QRasterWindow +{ + void paintEvent(QPaintEvent *event); +}; + class PreviewWidget : public QWidget { Q_OBJECT -- cgit v1.2.3