Skip to content

PythonQt.Qt.QSessionManager

QSessionManager

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

A session manager in a desktop environment (in which Qt GUI applications live) keeps track of a session, which is a group of running applications, each of which has a particular state. The state of an application contains (most notably) the documents the application has open and the position and size of its windows.

The session manager is used to save the session, e.g., when the machine is shut down, and to restore a session, e.g., when the machine is started up. We recommend that you use QSettings to save an application's settings, for example, window positions, recently used files, etc. When the application is restarted by the session manager, you can restore the settings.

QSessionManager provides an interface between the application and the platform's session manager. In Qt, session management requests for action are handled by the two signals QGuiApplication::commitDataRequest() and QGuiApplication::saveStateRequest(). Both provide a reference to a QSessionManager object as argument. The session manager can only be accessed in slots invoked by these signals.

Warning: If you use QSessionManager, you should disable fallback session management: QGuiApplication::setFallbackSessionManagementEnabled().

No user interaction is possible unless the application gets explicit permission from the session manager. You ask for permission by calling allowsInteraction() or, if it is really urgent, allowsErrorInteraction(). Qt does not enforce this, but the session manager may.

You can try to abort the shutdown process by calling cancel().

For sophisticated session managers provided on Unix/X11, QSessionManager offers further possibilities to fine-tune an application's session management behavior: setRestartCommand(), setDiscardCommand(), setRestartHint(), setProperty(), requestPhase2(). See the respective function descriptions for further details.

Source: https://doc.qt.io/archives/qt-5.15/qsessionmanager.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
RestartAnyway attribute Any (shared captured text)
RestartHint attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
RestartIfRunning attribute Any (shared captured text)
RestartImmediately attribute Any (shared captured text)
RestartNever attribute Any (shared captured text)
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
allowsErrorInteraction function (self) -> bool X.allowsErrorInteraction() -> bool (shared captured text)
allowsInteraction function (self) -> bool X.allowsInteraction() -> bool (shared captured text)
blockSignals function (self, b: Any) -> bool X.blockSignals(b) -> bool (shared captured text)
cancel function (self) -> None Tells the session manager to cancel the shutdown process. (shared captured text)
childEvent function (self, event: Any) -> Any (shared captured text)
children function (self) -> tuple X.children() -> tuple (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
connect function (self, signal: Any, receiver: Any, slot: Any, type: Any) -> bool X.connect(signal, receiver, slot, type) -> bool (shared captured text)
customEvent function (self, event: Any) -> Any (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
deleteLater function (self) -> Any (shared captured text)
destroyed function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QSessionManager.destroyed; argument details are not documented.
discardCommand function (self) -> tuple X.discardCommand() -> tuple (shared captured text)
disconnect function (self, signal: Any, receiver: Any, slot: Any) -> bool X.disconnect(signal, receiver, slot) -> bool (shared captured text)
dumpObjectInfo function (self) -> Any (shared captured text)
dumpObjectTree function (self) -> Any (shared captured text)
dynamicPropertyNames function (self) -> Any (shared captured text)
event function (self, event: Any) -> bool X.event(event) -> bool (shared captured text)
eventFilter function (self, watched: Any, event: Any) -> bool X.eventFilter(watched, event) -> bool (shared captured text)
findChild function (self, type: Any, name: Any) -> Any X.findChild(type, name) -> PythonQt.private.QObject (shared captured text)
findChildren function (self, type: Any, name: Any) -> tuple X.findChildren(type, name) -> tuple (shared captured text)
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
installEventFilter function (self, filterObj: Any) -> Any (shared captured text)
isPhase2 function (self) -> bool X.isPhase2() -> bool (shared captured text)
isSignalConnected function (self, signal: Any) -> bool X.isSignalConnected(signal) -> bool (shared captured text)
isWidgetType function (self) -> bool X.isWidgetType() -> bool (shared captured text)
isWindowType function (self) -> bool X.isWindowType() -> bool (shared captured text)
killTimer function (self, id: Any) -> Any (shared captured text)
metaObject function (self) -> Any X.metaObject() -> PythonQt.QtCore.QMetaObject (shared captured text)
moveToThread function (self, thread: Any) -> Any (shared captured text)
objectName attribute Any (shared captured text)
objectNameChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QSessionManager.objectNameChanged; argument details are not documented.
parent function (self) -> Any X.parent() -> PythonQt.private.QObject (shared captured text)
property function (self, name: Any) -> Any X.property(name) -> object (shared captured text)
release function (self) -> None Releases the session manager's interaction semaphore after an interaction phase. (shared captured text)
removeEventFilter function (self, obj: Any) -> Any (shared captured text)
requestPhase2 function (self) -> None Requests a second session management phase for the application. (shared captured text)
restartCommand function (self) -> tuple X.restartCommand() -> tuple (shared captured text)
restartHint function (self) -> Any Returns the application's current restart hint. (shared captured text)
sender function (self) -> Any X.sender() -> PythonQt.private.QObject (shared captured text)
senderSignalIndex function (self) -> int X.senderSignalIndex() -> int (shared captured text)
sessionId function (self) -> str X.sessionId() -> str (shared captured text)
sessionKey function (self) -> str X.sessionKey() -> str (shared captured text)
setDiscardCommand function (self, arg__1: Any) -> None Sets the discard command to the given command. (shared captured text)
setManagerProperty function (self, name: str, value: Any) -> None X.setManagerProperty(name, value) (shared captured text)
setObjectName function (self, name: Any) -> Any (shared captured text)
setParent function (self, parent: Any) -> Any (shared captured text)
setProperty function (self, name: Any, value: Any) -> bool X.setProperty(name, value) -> bool (shared captured text)
setRestartCommand function (self, arg__1: Any) -> None If the session manager is capable of restoring sessions it will execute command in order to restore the application. (shared captured text)
setRestartHint function (self, arg__1: Any) -> None Sets the application's restart hint to hint. (shared captured text)
signalsBlocked function (self) -> bool X.signalsBlocked() -> bool (shared captured text)
startTimer function (self, interval: Any, timerType: Any) -> int X.startTimer(interval, timerType) -> int (shared captured text)
thread function (self) -> Any (shared captured text)
timerEvent function (self, event: Any) -> Any (shared captured text)
tr function (self, text: Any, ambig: Any, n: Any) -> str X.tr(text, ambig, n) -> str (shared captured text)