From fb3a789dc307ccfbba5799d55ae362142fe3decc Mon Sep 17 00:00:00 2001 From: Alex Huszagh Date: Sun, 1 May 2022 12:43:57 -0500 Subject: [PATCH] Bug fix for QCalendarWidget in QDateTimeEdit. Fixes the year drop-down menu to properly be styled, via the `qt_datetimedit_calendar` object name. --- dist/pyqt6/dark/stylesheet.qss | 23 +++++++++++++++++++---- dist/pyqt6/light/stylesheet.qss | 23 +++++++++++++++++++---- dist/qrc/dark/stylesheet.qss | 23 +++++++++++++++++++---- dist/qrc/light/stylesheet.qss | 23 +++++++++++++++++++---- template/stylesheet.qss.in | 19 +++++++++++++++++-- 5 files changed, 93 insertions(+), 18 deletions(-) diff --git a/dist/pyqt6/dark/stylesheet.qss b/dist/pyqt6/dark/stylesheet.qss index e29a63e..0dd3de8 100644 --- a/dist/pyqt6/dark/stylesheet.qss +++ b/dist/pyqt6/dark/stylesheet.qss @@ -1032,7 +1032,13 @@ QCalendarWidget QToolButton:pressed outline: none; } -QCalendarWidget QToolButton::menu-indicator +/** + * The QCalendarWidget for QDateTimeEdit seems to improperly + * style the year QToolButton, which has an object name + * `qt_datetimedit_calendar`, so ensure we style it as well. + */ +QCalendarWidget QToolButton::menu-indicator, +#qt_datetimedit_calendar QCalendarWidget QToolButton::menu-indicator { border-image: none; image: url(dark:down_arrow.svg); @@ -1045,7 +1051,8 @@ QCalendarWidget QToolButton::menu-indicator subcontrol-position: bottom right; } -QCalendarWidget QToolButton::menu-arrow +QCalendarWidget QToolButton::menu-arrow, +#qt_datetimedit_calendar QCalendarWidget QToolButton::menu-arrow { border-image: none; image: url(dark:down_arrow.svg); @@ -1453,8 +1460,8 @@ QTabBar[shape="7"]::tab:!selected /** * Increase padding on the opposite side of the icon to avoid text clipping. * - * BUG: The padding works for North in Qt5, South does not work. - * Both work in Qt6. + * BUG: The padding works for North, West, and East in Qt5, South does not + * work. All tab positions work for triangular tabs in Qt6. */ QTabBar[shape="4"][tabsClosable="true"]::tab, QTabBar[shape="5"][tabsClosable="true"]::tab @@ -1785,21 +1792,29 @@ QToolButton[autoRaise="false"]::down-arrow QToolButton::right-arrow { image: url(dark:right_arrow.svg); + width: 0.8em; + height: 0.5em; } QToolButton::left-arrow { image: url(dark:left_arrow.svg); + width: 0.8em; + height: 0.5em; } QToolButton::up-arrow { image: url(dark:up_arrow.svg); + height: 0.8em; + width: 0.5em; } QToolButton::down-arrow { image: url(dark:down_arrow.svg); + height: 0.8em; + width: 0.5em; } QToolButton[autoRaise="false"]:hover diff --git a/dist/pyqt6/light/stylesheet.qss b/dist/pyqt6/light/stylesheet.qss index be130e0..b5490af 100644 --- a/dist/pyqt6/light/stylesheet.qss +++ b/dist/pyqt6/light/stylesheet.qss @@ -1032,7 +1032,13 @@ QCalendarWidget QToolButton:pressed outline: none; } -QCalendarWidget QToolButton::menu-indicator +/** + * The QCalendarWidget for QDateTimeEdit seems to improperly + * style the year QToolButton, which has an object name + * `qt_datetimedit_calendar`, so ensure we style it as well. + */ +QCalendarWidget QToolButton::menu-indicator, +#qt_datetimedit_calendar QCalendarWidget QToolButton::menu-indicator { border-image: none; image: url(light:down_arrow.svg); @@ -1045,7 +1051,8 @@ QCalendarWidget QToolButton::menu-indicator subcontrol-position: bottom right; } -QCalendarWidget QToolButton::menu-arrow +QCalendarWidget QToolButton::menu-arrow, +#qt_datetimedit_calendar QCalendarWidget QToolButton::menu-arrow { border-image: none; image: url(light:down_arrow.svg); @@ -1453,8 +1460,8 @@ QTabBar[shape="7"]::tab:!selected /** * Increase padding on the opposite side of the icon to avoid text clipping. * - * BUG: The padding works for North in Qt5, South does not work. - * Both work in Qt6. + * BUG: The padding works for North, West, and East in Qt5, South does not + * work. All tab positions work for triangular tabs in Qt6. */ QTabBar[shape="4"][tabsClosable="true"]::tab, QTabBar[shape="5"][tabsClosable="true"]::tab @@ -1785,21 +1792,29 @@ QToolButton[autoRaise="false"]::down-arrow QToolButton::right-arrow { image: url(light:right_arrow.svg); + width: 0.8em; + height: 0.5em; } QToolButton::left-arrow { image: url(light:left_arrow.svg); + width: 0.8em; + height: 0.5em; } QToolButton::up-arrow { image: url(light:up_arrow.svg); + height: 0.8em; + width: 0.5em; } QToolButton::down-arrow { image: url(light:down_arrow.svg); + height: 0.8em; + width: 0.5em; } QToolButton[autoRaise="false"]:hover diff --git a/dist/qrc/dark/stylesheet.qss b/dist/qrc/dark/stylesheet.qss index fb5ab31..c2a23ae 100644 --- a/dist/qrc/dark/stylesheet.qss +++ b/dist/qrc/dark/stylesheet.qss @@ -1032,7 +1032,13 @@ QCalendarWidget QToolButton:pressed outline: none; } -QCalendarWidget QToolButton::menu-indicator +/** + * The QCalendarWidget for QDateTimeEdit seems to improperly + * style the year QToolButton, which has an object name + * `qt_datetimedit_calendar`, so ensure we style it as well. + */ +QCalendarWidget QToolButton::menu-indicator, +#qt_datetimedit_calendar QCalendarWidget QToolButton::menu-indicator { border-image: none; image: url(:/dark/down_arrow.svg); @@ -1045,7 +1051,8 @@ QCalendarWidget QToolButton::menu-indicator subcontrol-position: bottom right; } -QCalendarWidget QToolButton::menu-arrow +QCalendarWidget QToolButton::menu-arrow, +#qt_datetimedit_calendar QCalendarWidget QToolButton::menu-arrow { border-image: none; image: url(:/dark/down_arrow.svg); @@ -1453,8 +1460,8 @@ QTabBar[shape="7"]::tab:!selected /** * Increase padding on the opposite side of the icon to avoid text clipping. * - * BUG: The padding works for North in Qt5, South does not work. - * Both work in Qt6. + * BUG: The padding works for North, West, and East in Qt5, South does not + * work. All tab positions work for triangular tabs in Qt6. */ QTabBar[shape="4"][tabsClosable="true"]::tab, QTabBar[shape="5"][tabsClosable="true"]::tab @@ -1785,21 +1792,29 @@ QToolButton[autoRaise="false"]::down-arrow QToolButton::right-arrow { image: url(:/dark/right_arrow.svg); + width: 0.8em; + height: 0.5em; } QToolButton::left-arrow { image: url(:/dark/left_arrow.svg); + width: 0.8em; + height: 0.5em; } QToolButton::up-arrow { image: url(:/dark/up_arrow.svg); + height: 0.8em; + width: 0.5em; } QToolButton::down-arrow { image: url(:/dark/down_arrow.svg); + height: 0.8em; + width: 0.5em; } QToolButton[autoRaise="false"]:hover diff --git a/dist/qrc/light/stylesheet.qss b/dist/qrc/light/stylesheet.qss index 8bb968f..4e49d91 100644 --- a/dist/qrc/light/stylesheet.qss +++ b/dist/qrc/light/stylesheet.qss @@ -1032,7 +1032,13 @@ QCalendarWidget QToolButton:pressed outline: none; } -QCalendarWidget QToolButton::menu-indicator +/** + * The QCalendarWidget for QDateTimeEdit seems to improperly + * style the year QToolButton, which has an object name + * `qt_datetimedit_calendar`, so ensure we style it as well. + */ +QCalendarWidget QToolButton::menu-indicator, +#qt_datetimedit_calendar QCalendarWidget QToolButton::menu-indicator { border-image: none; image: url(:/light/down_arrow.svg); @@ -1045,7 +1051,8 @@ QCalendarWidget QToolButton::menu-indicator subcontrol-position: bottom right; } -QCalendarWidget QToolButton::menu-arrow +QCalendarWidget QToolButton::menu-arrow, +#qt_datetimedit_calendar QCalendarWidget QToolButton::menu-arrow { border-image: none; image: url(:/light/down_arrow.svg); @@ -1453,8 +1460,8 @@ QTabBar[shape="7"]::tab:!selected /** * Increase padding on the opposite side of the icon to avoid text clipping. * - * BUG: The padding works for North in Qt5, South does not work. - * Both work in Qt6. + * BUG: The padding works for North, West, and East in Qt5, South does not + * work. All tab positions work for triangular tabs in Qt6. */ QTabBar[shape="4"][tabsClosable="true"]::tab, QTabBar[shape="5"][tabsClosable="true"]::tab @@ -1785,21 +1792,29 @@ QToolButton[autoRaise="false"]::down-arrow QToolButton::right-arrow { image: url(:/light/right_arrow.svg); + width: 0.8em; + height: 0.5em; } QToolButton::left-arrow { image: url(:/light/left_arrow.svg); + width: 0.8em; + height: 0.5em; } QToolButton::up-arrow { image: url(:/light/up_arrow.svg); + height: 0.8em; + width: 0.5em; } QToolButton::down-arrow { image: url(:/light/down_arrow.svg); + height: 0.8em; + width: 0.5em; } QToolButton[autoRaise="false"]:hover diff --git a/template/stylesheet.qss.in b/template/stylesheet.qss.in index a0a8319..62ff37f 100644 --- a/template/stylesheet.qss.in +++ b/template/stylesheet.qss.in @@ -1032,7 +1032,13 @@ QCalendarWidget QToolButton:pressed outline: none; } -QCalendarWidget QToolButton::menu-indicator +/** + * The QCalendarWidget for QDateTimeEdit seems to improperly + * style the year QToolButton, which has an object name + * `qt_datetimedit_calendar`, so ensure we style it as well. + */ +QCalendarWidget QToolButton::menu-indicator, +#qt_datetimedit_calendar QCalendarWidget QToolButton::menu-indicator { border-image: none; image: url(^style^down_arrow.svg); @@ -1045,7 +1051,8 @@ QCalendarWidget QToolButton::menu-indicator subcontrol-position: bottom right; } -QCalendarWidget QToolButton::menu-arrow +QCalendarWidget QToolButton::menu-arrow, +#qt_datetimedit_calendar QCalendarWidget QToolButton::menu-arrow { border-image: none; image: url(^style^down_arrow.svg); @@ -1785,21 +1792,29 @@ QToolButton[autoRaise="false"]::down-arrow QToolButton::right-arrow { image: url(^style^right_arrow.svg); + width: 0.8em; + height: 0.5em; } QToolButton::left-arrow { image: url(^style^left_arrow.svg); + width: 0.8em; + height: 0.5em; } QToolButton::up-arrow { image: url(^style^up_arrow.svg); + height: 0.8em; + width: 0.5em; } QToolButton::down-arrow { image: url(^style^down_arrow.svg); + height: 0.8em; + width: 0.5em; } QToolButton[autoRaise="false"]:hover