4

In my Qt application, I have couple of QtWidgets which are floating. I want to know when QtWidget is dragged to another screen So that I can resize content within according to new screen DPI.

living on edge
  • 401
  • 1
  • 6
  • 13

1 Answers1

0

Connect the primaryScreenChanged signal from your QGuiApplication to slots in your widgets.

Edited to add: On reflection, this probably doesn't do what you want -- it signals when the application changes screen, not the widget.

TonyK
  • 16,761
  • 4
  • 37
  • 72
  • One Query, My application has lot of QDialogs, so this signal is emitted. only one Qdialog is moved other screen not main application window. – living on edge Nov 23 '20 at 03:12
  • I have DISPLAY1 and DISPLAY2, DISPLAY1 is primary, when DISPLAY1 HDMI is plug out, after primaryScreenChanged signal, MainWindow is shown on secondary screen DISPLAY2, but MainWindow->screen() is still DISPLAY1. – Acewind Apr 06 '23 at 07:27