From be8c17034b99c5f52b5d885055493c405fd5eadb Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 10 Sep 2009 18:25:46 +0200 Subject: Fixes regression in QStyleSheet regarding QFrame:no-frame In Qt know the frame is drawn in PE_Widget with stylesheet. But the QStyleOption passed by QWidgetPrivate::drawBackground is really simple and doesn't contains frame information. We need to rely on the widget itself to know if we should look for the :no-frame pseudo element. Reviewed-by: jbache Task-number: 261110 --- src/gui/styles/qstylesheetstyle.cpp | 6 +++- tests/auto/uiloader/baseline/css_frames.ui | 45 +++++++++++++++++++----------- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index 49337b5..9f2d245 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -84,6 +84,7 @@ #include "qdrawutil.h" #include +#include QT_BEGIN_NAMESPACE @@ -2013,7 +2014,10 @@ QRenderRule QStyleSheetStyle::renderRule(const QWidget *w, const QStyleOption *o } } else #endif - { } // required for the above ifdef'ery + if (const QFrame *frm = qobject_cast(w)) { + if (frm->lineWidth() == 0) + extraClass |= PseudoClass_Frameless; + } } return renderRule(w, pseudoElement, pseudoClass(state) | extraClass); diff --git a/tests/auto/uiloader/baseline/css_frames.ui b/tests/auto/uiloader/baseline/css_frames.ui index 92ecee1..d1397bb 100644 --- a/tests/auto/uiloader/baseline/css_frames.ui +++ b/tests/auto/uiloader/baseline/css_frames.ui @@ -33,22 +33,16 @@ border: 5px solid white; #line1, #line2 { border: 1px solid rgb(170, 85, 255); } + + +QFrame::no-frame { + background: orange; + border-color: #000; + } + - - - - - 0 - 0 - - - - This test that all the frame style can handle margins and paddings correctly - - - @@ -99,7 +93,7 @@ border: 5px solid white; - QFrame::Box + QFrame::StyledPanel QFrame::Raised @@ -171,7 +165,7 @@ border: 5px solid white; - QFrame::Box + QFrame::StyledPanel @@ -204,7 +198,7 @@ border: 5px solid white; - QFrame::Panel + QFrame::StyledPanel QFrame::Raised @@ -240,7 +234,7 @@ border: 5px solid white; - QFrame::WinPanel + QFrame::StyledPanel QFrame::Sunken @@ -301,6 +295,23 @@ border: 5px solid white; + + + + + 0 + 0 + + + + 0 + + + This test that all the frame style can handle margins and paddings correctly + (and the background of this label should be orange) + + + -- cgit v0.12