You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using QtInteractor from pyvistaqt within a frameless window created with PyQt5, if the window is maximized and then hidden and shown again, the widget begins to misalign or shift from its original position.
Environment
OS: Windows 10
DPI scaling: 120%
Python: 3.8.0 64bit
PyQt5: 5.15.2
To Reproduce
Maximaze the window
Hide and show the window from taskbar a few times
CM4dRYvYfu.mp4
Code
requirements.txt:
PyQt5
pyvista
pyvistaqt
PyQt5-Frameless-Window
script:
# Minimum code to reproduce the errorimportsysfromPyQt5.QtWidgetsimportQApplication, QVBoxLayout, QWidgetimportpyvistaaspvfrompyvistaqtimportQtInteractorfromqframelesswindowimportFramelessWindow, StandardTitleBarfromqframelesswindow.windows.window_effectimportWindowsWindowEffectfromqframelesswindow.utils.win32_utilsimportisCompositionEnabledfromctypesimportbyreffromqframelesswindow.windows.c_structuresimportMARGINSclassWindowsWindowEffectEdit(WindowsWindowEffect):
def__init__(self, window):
# Call the parent class initializersuper().__init__(window)
defaddShadowEffect(self, hWnd):
ifnotisCompositionEnabled():
returnhWnd=int(hWnd)
# set margins from -1 to 1 in order to solve backround color rendering in pyvista plotmargins=MARGINS(1, 1, 1, 1)
self.DwmExtendFrameIntoClientArea(hWnd, byref(margins))
classMainWidget(QWidget):
def__init__(self, parent=None):
super().__init__(parent)
self.layout=QVBoxLayout(self)
self.interactor=QtInteractor(self)
self.layout.addWidget(self.interactor)
self.setLayout(self.layout)
self.initialize_plot()
definitialize_plot(self):
sphere=pv.Sphere()
self.interactor.add_mesh(sphere, color='orange')
self.interactor.background_color='grey'# Set the background color to greyself.interactor.show_bounds()
classWindow(FramelessWindow):
def__init__(self, parent=None):
super().__init__(parent=parent)
self.setTitleBar(StandardTitleBar(self))
self.setWindowTitle('PyVistaQt Minimal Example')
# Instantiate the subclass to override the effectself.windowEffect=WindowsWindowEffectEdit(self) # Use the subclass hereself.windowEffect.addShadowEffect(self.winId()) # This should call the overridden methodself.setupLayout()
defsetupLayout(self):
titleBarHeight=self.titleBar.sizeHint().height()
self.layout=QVBoxLayout(self)
self.layout.setContentsMargins(0, titleBarHeight, 0, 0)
self.mainWidget=MainWidget(self)
self.layout.addWidget(self.mainWidget)
self.setLayout(self.layout)
if__name__=="__main__":
app=QApplication(sys.argv)
demo=Window()
demo.show()
sys.exit(app.exec_())
The text was updated successfully, but these errors were encountered:
Describe the bug
When using QtInteractor from pyvistaqt within a frameless window created with PyQt5, if the window is maximized and then hidden and shown again, the widget begins to misalign or shift from its original position.
Environment
To Reproduce
CM4dRYvYfu.mp4
Code
requirements.txt:
script:
The text was updated successfully, but these errors were encountered: