diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index 70b0e066b12..a6e8f7a0135 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -778,6 +778,7 @@ const QBrush &QPalette::brush(ColorGroup gr, ColorRole cr) const
 void QPalette::setBrush(ColorGroup cg, ColorRole cr, const QBrush &b)
 {
     Q_ASSERT(cr < NColorRoles);
+//    Q_ASSERT(cr !=  Window || b.color().isValid());
 
     if (cg == All) {
         for (uint i = 0; i < NColorGroups; i++)
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 2835884ea7e..86a39838cde 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -4565,6 +4565,7 @@ void QWidget::setPalette(const QPalette &palette)
 {
     Q_D(QWidget);
     setAttribute(Qt::WA_SetPalette, palette.resolveMask() != 0);
+    qDebug() << __FUNCTION__ << this;
 
     // Determine which palette is inherited from this widget's ancestors and
     // QApplication::palette, resolve this against \a palette (attributes from
@@ -4646,6 +4647,11 @@ void QWidgetPrivate::setPalette_helper(const QPalette &palette)
     updateIsOpaque();
     q->update();
     updateIsOpaque();
+    auto tc= data.pal.text().color();
+    auto wc= data.pal.window().color();
+    qDebug() << __FUNCTION__ << q
+       << "textcol=" << tc << tc.name(QColor::NameFormat::HexArgb)
+       << "win_col=" << wc << wc.name(QColor::NameFormat::HexArgb);
 }
 
 void QWidgetPrivate::updateSystemBackground()
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 33777933495..98a2259b9c0 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -554,6 +554,21 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
 
         // Draw Outline
         painter->setPen(hasFocus ? highlightedOutline : outline);
+        static const QWidget *lastW{};
+        if (lastW != widget  && widget) {
+            lastW = widget;
+
+            auto tc= option->palette.text().color();
+            auto wc= option->palette.window().color();
+
+            auto c= painter->pen().color();
+            qDebug() << "Fusion" << __FUNCTION__ << widget
+                 << "col=" << c << c.name(QColor::NameFormat::HexArgb)
+                 << "textcol=" << tc << tc.name(QColor::NameFormat::HexArgb)
+                 << "win_col=" << wc << wc.name(QColor::NameFormat::HexArgb)
+                 << "hasFocus" << hasFocus
+                 << "palette.window().style" << option->palette.window().style();
+        }
         painter->drawRoundedRect(r.adjusted(0, 0, -1, -1), 2, 2);
 
         if (hasFocus) {
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 54facf60bdd..62ffa4bf25e 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -1432,6 +1432,8 @@ void setDefault(QPalette *palette, QPalette::ColorGroup group, QPalette::ColorRo
 
 void QRenderRule::configurePalette(QPalette *p, QPalette::ColorGroup cg, const QWidget *w, bool embedded)
 {
+    qDebug() << __FUNCTION__ <<  w << cg << embedded
+             << bg->brush.color() << bg->brush.style();
     if (bg && bg->brush.style() != Qt::NoBrush) {
         p->setBrush(cg, QPalette::Base, bg->brush); // for windows, windowxp
         p->setBrush(cg, QPalette::Button, bg->brush); // for plastique
@@ -4632,7 +4634,16 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
 
             if (rule.hasNativeBorder()) {
                 QStyleOptionFrame frmOpt(*frm);
+                auto orig_tc= frm->palette.text().color();
+                auto orig_wc= frm->palette.window().color();
                 rule.configurePalette(&frmOpt.palette, QPalette::Text, QPalette::Base);
+                auto tc= frmOpt.palette.text().color();
+                auto wc= frmOpt.palette.window().color();
+                qDebug() << "StyleSheet" << __FUNCTION__
+                      << "textcol=" << tc << tc.name(QColor::NameFormat::HexArgb)
+                      << "win_col=" << wc << wc.name(QColor::NameFormat::HexArgb)
+                      << "orig_textcol=" << orig_tc << orig_tc.name(QColor::NameFormat::HexArgb)
+                      << "orig_win_col=" << orig_wc << orig_wc.name(QColor::NameFormat::HexArgb);
                 frmOpt.rect = rule.borderRect(frmOpt.rect);
                 if (rule.baseStyleCanDraw()) {
                     rule.drawBackgroundImage(p, opt->rect);
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index 2f68ad5d4d5..39ae737aa87 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -1980,7 +1980,11 @@ void QLineEdit::paintEvent(QPaintEvent *)
     Q_D(QLineEdit);
     QPainter p(this);
     QPalette pal = palette();
-
+    auto tc= pal.text().color();
+    auto wc= pal.window().color();
+    qDebug() << "QLineEdit::paintEvent" << this
+        << "textcol=" << tc << tc.name(QColor::NameFormat::HexArgb)
+        << "win_col=" << wc << wc.name(QColor::NameFormat::HexArgb);
     QStyleOptionFrame panel;
     initStyleOption(&panel);
     style()->drawPrimitive(QStyle::PE_PanelLineEdit, &panel, &p, this);
