From 2da85dd1f4ac5c07182d12f79e2d9243f5547d6a Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Wed, 11 Jun 2025 11:08:22 +0200 Subject: [PATCH] added shadow --- client/ayon_core/style/style.css | 5 +++ .../ayon_core/tools/loader/ui/search_bar.py | 43 +++++++++++++++++-- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/client/ayon_core/style/style.css b/client/ayon_core/style/style.css index adf27a0e03..525cf28633 100644 --- a/client/ayon_core/style/style.css +++ b/client/ayon_core/style/style.css @@ -880,6 +880,11 @@ FiltersPopup #PopupWrapper, FilterValuePopup #PopupWrapper { background: {color:bg-inputs}; } +FiltersPopup #ShadowFrame, FilterValuePopup #ShadowFrame { + border-radius: 5px; + background: rgba(0, 0, 0, 0.5); +} + FilterItemButton, FilterValueItemButton { border-radius: 5px; background: transparent; diff --git a/client/ayon_core/tools/loader/ui/search_bar.py b/client/ayon_core/tools/loader/ui/search_bar.py index 27d65bee30..ac0718f988 100644 --- a/client/ayon_core/tools/loader/ui/search_bar.py +++ b/client/ayon_core/tools/loader/ui/search_bar.py @@ -176,6 +176,9 @@ class FiltersPopup(QtWidgets.QWidget): self.setWindowFlags(QtCore.Qt.Popup | QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) + shadow_frame = QtWidgets.QFrame(self) + shadow_frame.setObjectName("ShadowFrame") + wrapper = QtWidgets.QWidget(self) wrapper.setObjectName("PopupWrapper") @@ -184,9 +187,12 @@ class FiltersPopup(QtWidgets.QWidget): wraper_layout.setSpacing(5) main_layout = QtWidgets.QHBoxLayout(self) - main_layout.setContentsMargins(0, 0, 0, 0) + main_layout.setContentsMargins(2, 2, 2, 2) main_layout.addWidget(wrapper) + shadow_frame.stackUnder(wrapper) + + self._shadow_frame = shadow_frame self._wrapper = wrapper self._wrapper_layout = wraper_layout self._preferred_width = None @@ -211,13 +217,26 @@ class FiltersPopup(QtWidgets.QWidget): for item in filter_items: widget = FilterItemButton(item, self._wrapper) widget.filter_requested.connect(self.filter_requested) - self._wrapper_layout.addWidget(widget) + self._wrapper_layout.addWidget(widget, 0) if self._wrapper_layout.count() == 0: empty_label = QtWidgets.QLabel( "No filters available...", self._wrapper ) - self._wrapper_layout.addWidget(empty_label) + self._wrapper_layout.addWidget(empty_label, 0) + + def showEvent(self, event): + super().showEvent(event) + self._update_shadow() + + def resizeEvent(self, event): + super().resizeEvent(event) + self._update_shadow() + + def _update_shadow(self): + geo = self.geometry() + geo.moveTopLeft(QtCore.QPoint(0, 0)) + self._shadow_frame.setGeometry(geo) class FilterValueItemButton(BaseClickableFrame): @@ -422,6 +441,9 @@ class FilterValuePopup(QtWidgets.QWidget): self.setWindowFlags(QtCore.Qt.Popup | QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground, True) + shadow_frame = QtWidgets.QFrame(self) + shadow_frame.setObjectName("ShadowFrame") + wrapper = QtWidgets.QWidget(self) wrapper.setObjectName("PopupWrapper") @@ -438,7 +460,7 @@ class FilterValuePopup(QtWidgets.QWidget): wraper_layout.addWidget(items_view, 0) main_layout = QtWidgets.QHBoxLayout(self) - main_layout.setContentsMargins(0, 0, 0, 0) + main_layout.setContentsMargins(2, 2, 2, 2) main_layout.addWidget(wrapper) text_input.textChanged.connect(self._text_changed) @@ -446,6 +468,9 @@ class FilterValuePopup(QtWidgets.QWidget): items_view.value_changed.connect(self._selection_changed) + shadow_frame.stackUnder(wrapper) + + self._shadow_frame = shadow_frame self._wrapper = wrapper self._wrapper_layout = wraper_layout self._text_input = text_input @@ -505,6 +530,7 @@ class FilterValuePopup(QtWidgets.QWidget): super().showEvent(event) if self._active_widget is not None: self._active_widget.setFocus() + self._update_shadow() def closeEvent(self, event): super().closeEvent(event) @@ -514,6 +540,15 @@ class FilterValuePopup(QtWidgets.QWidget): super().hideEvent(event) self.closed.emit(self._filter_name) + def resizeEvent(self, event): + super().resizeEvent(event) + self._update_shadow() + + def _update_shadow(self): + geo = self.geometry() + geo.moveTopLeft(QtCore.QPoint(0, 0)) + self._shadow_frame.setGeometry(geo) + def get_value(self): """Get the value from the active widget.""" if self._active_widget is self._text_input: