diff --git a/Furious/Qt/AppStyleSheet.py b/Furious/Qt/AppStyleSheet.py index 1af14ce..7c7baec 100644 --- a/Furious/Qt/AppStyleSheet.py +++ b/Furious/Qt/AppStyleSheet.py @@ -316,6 +316,11 @@ class AppStyleSheet: background-color: {palette['panel_alt']}; }} + QFrame#NavigationRailPlaceholder {{ + border: none; + background-color: {palette['panel_alt']}; + }} + QStackedWidget#ApplicationPageStack {{ border: none; background-color: {palette['window']}; diff --git a/Furious/Widget/NavigationView.py b/Furious/Widget/NavigationView.py index 1834f45..251b30f 100644 --- a/Furious/Widget/NavigationView.py +++ b/Furious/Widget/NavigationView.py @@ -162,12 +162,21 @@ class NavigationView(Mixins.QTranslatable, Mixins.ThemeAware, QWidget): self.pageStack = QStackedWidget(parent=self) self.pageStack.setObjectName('ApplicationPageStack') + # Keep the layout's navigation reservation at the compact rail width. + # The real panel is a sibling overlay, mirroring Fluent NavigationView: + # expanding it changes only the panel geometry, never the page geometry. + self.navigationRail = QFrame(parent=self) + self.navigationRail.setObjectName('NavigationRailPlaceholder') + self.navigationRail.setFixedWidth(self.CollapsedWidth) + self._layout = QHBoxLayout(self) self._layout.setContentsMargins(0, 0, 0, 0) self._layout.setSpacing(0) - self._layout.addWidget(self.navigationPanel) + self._layout.addWidget(self.navigationRail) self._layout.addWidget(self.pageStack, 1) + self.navigationPanel.raise_() + self._widthAnimation = QtCore.QPropertyAnimation( self, b'navigationWidth', @@ -324,9 +333,16 @@ class NavigationView(Mixins.QTranslatable, Mixins.ThemeAware, QWidget): return self._navigationWidth def _setNavigationWidth(self, width: int): - """Apply an animated width to the navigation panel.""" + """Apply an animated overlay width without resizing the page stack.""" self._navigationWidth = int(width) - self.navigationPanel.setFixedWidth(self._navigationWidth) + + self.navigationPanel.setGeometry( + 0, + 0, + self._navigationWidth, + self.height(), + ) + self.navigationPanel.raise_() navigationWidth = QtCore.Property( int, @@ -345,6 +361,12 @@ class NavigationView(Mixins.QTranslatable, Mixins.ThemeAware, QWidget): if not self._expanded: self._setPageButtonsExpanded(False) + def resizeEvent(self, event): + """Keep the navigation overlay as tall as the page container.""" + super().resizeEvent(event) + + self._setNavigationWidth(self._navigationWidth) + @staticmethod def _refreshWidgetStyle(widget: QWidget): """Re-polish a widget after a dynamic property changes."""