Frameless Window Design with Secondary Monitor Flickering and Performance Degradation

Hi all!

I am currently working on implementing a frameless window design for my application and rebuilding the functionalities provided by the native frame. The primary reasons for this approach are:

  • To ensure consistent window design across operating systems.
  • To maximize the available size of the MainWindow.

Below is the code snippet I am using for this purpose:

mainWindow = slicer.util.mainWindow()
flags = mainWindow.windowFlags()
newFlags = (flags | qt.Qt.FramelessWindowHint | qt.Qt.WindowStaysOnTopHint)
mainWindow.setWindowFlags(newFlags)
mainWindow.hide()
mainWindow.show()

This implementation works as expected on the primary monitor. However, when the application is moved to a secondary monitor, I encounter two issues:

  • Noticeable flickering of the window.
  • Significant performance degradation.

I would appreciate any insights into the potential cause of these issues or suggestions for resolving them.

Thank you in advance for your help!