|
Krita Source Code Documentation
|
#include <KisScreenMigrationTracker.h>
Inheritance diagram for KisScreenMigrationTracker:Signals | |
| void | sigScreenChanged (QScreen *screen) |
| void | sigScreenOrResolutionChanged (QScreen *screen) |
Public Member Functions | |
| QScreen * | currentScreen () const |
| QScreen * | currentScreenSafe () const |
| KisScreenMigrationTracker (QWidget *trackedWidget, QObject *parent=nullptr) | |
Protected Member Functions | |
| bool | eventFilter (QObject *watched, QEvent *event) override |
Private Slots | |
| void | slotResolutionCompressorTriggered () |
| void | slotScreenChanged (QScreen *screen) |
| void | slotScreenLogicalResolutionChanged (qreal value) |
| void | slotScreenResolutionChanged (qreal value) |
Private Member Functions | |
| void | connectScreenSignals (QScreen *screen) |
| void | connectTopLevelWindow (QWindow *window) |
Private Attributes | |
| KisSignalCompressor * | m_resolutionChangeCompressor |
| KisSignalAutoConnectionsStore | m_screenConnections |
| QPointer< QWindow > | m_trackedTopLevelWindow |
| QWidget * | m_trackedWidget {nullptr} |
A simple class that tracks the current screen assigned to the widget. When the widget migrates to a different screen, a signal is emitted.
If KisScreenMigrationTracker is created before the actual window for the widget is created, then it subscribes to widget's QEvent::Show event and waits until the widget is displayed.
Definition at line 29 of file KisScreenMigrationTracker.h.
| KisScreenMigrationTracker::KisScreenMigrationTracker | ( | QWidget * | trackedWidget, |
| QObject * | parent = nullptr ) |
The window of the tracked widget may be not initialized at the construction of the widget. Hence we should postpone initialization of the window handle till the widget gets shown on screen.
Definition at line 32 of file KisScreenMigrationTracker.cpp.
References connect(), connectTopLevelWindow(), KIS_SAFE_ASSERT_RECOVER_RETURN, m_resolutionChangeCompressor, m_trackedTopLevelWindow, slotResolutionCompressorTriggered(), and KisSignalCompressor::timeout().
|
private |
Definition at line 66 of file KisScreenMigrationTracker.cpp.
References KisSignalAutoConnectionsStore::addConnection(), KisSignalAutoConnectionsStore::clear(), m_screenConnections, slotScreenLogicalResolutionChanged(), and slotScreenResolutionChanged().
|
private |
Definition at line 75 of file KisScreenMigrationTracker.cpp.
References connect(), connectScreenSignals(), KIS_SAFE_ASSERT_RECOVER_RETURN, sigScreenChanged(), sigScreenOrResolutionChanged(), and slotScreenChanged().
| QScreen * KisScreenMigrationTracker::currentScreen | ( | ) | const |
Return the screen currently assigned to the tracked widget. If the widget has no native window associated, then the function asserts.
Definition at line 55 of file KisScreenMigrationTracker.cpp.
References KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, and m_trackedTopLevelWindow.
| QScreen * KisScreenMigrationTracker::currentScreenSafe | ( | ) | const |
Return the screen currently assigned to the tracked widget or the default screen if the widget has no native window association (usually it means that the widget hasn't yet been added into the window hierarchy).
Definition at line 61 of file KisScreenMigrationTracker.cpp.
References m_trackedTopLevelWindow.
|
overrideprotected |
Definition at line 85 of file KisScreenMigrationTracker.cpp.
References connectTopLevelWindow(), m_trackedTopLevelWindow, and m_trackedWidget.
|
signal |
Emitted when the widget migrates to a different screen
|
signal |
Emitted when the widget migrates to a different screen or screen resolution changes. This signal is useful for adjusting the display scale factor.
|
privateslot |
Definition at line 118 of file KisScreenMigrationTracker.cpp.
References KIS_SAFE_ASSERT_RECOVER_RETURN, m_trackedTopLevelWindow, and sigScreenOrResolutionChanged().
|
privateslot |
Definition at line 98 of file KisScreenMigrationTracker.cpp.
References connectScreenSignals(), sigScreenChanged(), and sigScreenOrResolutionChanged().
|
privateslot |
Definition at line 112 of file KisScreenMigrationTracker.cpp.
References m_resolutionChangeCompressor, KisSignalCompressor::start(), and value().
|
privateslot |
Definition at line 106 of file KisScreenMigrationTracker.cpp.
References m_resolutionChangeCompressor, KisSignalCompressor::start(), and value().
|
private |
Definition at line 79 of file KisScreenMigrationTracker.h.
|
private |
Definition at line 78 of file KisScreenMigrationTracker.h.
|
private |
Definition at line 77 of file KisScreenMigrationTracker.h.
|
private |
Definition at line 76 of file KisScreenMigrationTracker.h.