KSystemInhibitor Class

Inhibit system actions such as logout, suspend, etc. More...

Header: #include <KSystemInhibitor>
CMake: find_package(KF6 REQUIRED COMPONENTS GuiAddons)
target_link_libraries(mytarget PRIVATE KF6::GuiAddons)
Since: 6.23
Inherits: QObject

Public Types

enum class Type { Logout, UserSwitch, Suspend, Idle }
flags Types

Public Functions

KSystemInhibitor(const QString &reason, KSystemInhibitor::Types types, QWindow *window, QObject *parent = nullptr)
virtual ~KSystemInhibitor() override

Detailed Description

Member Type Documentation

enum class KSystemInhibitor::Type
flags KSystemInhibitor::Types

Inhibition types.

ConstantValueDescription
KSystemInhibitor::Type::Logout1Inhibit logout/shutdown
KSystemInhibitor::Type::UserSwitch2Inhibit user switching
KSystemInhibitor::Type::Suspend4Inhibit suspend/hibernate
KSystemInhibitor::Type::Idle8Inhibit idle actions (e.g. screen locking)

The Types type is a typedef for QFlags<Type>. It stores an OR combination of Type values.

Member Function Documentation

KSystemInhibitor::KSystemInhibitor(const QString &reason, KSystemInhibitor::Types types, QWindow *window, QObject *parent = nullptr)

Claim inhibition.

reason is the user-visible reason for the inhibition.

types is a combination of inhibition types.

window is the window for which to apply the inhibition. May be null in which case possible user queries will not be associated with any window.

parent is the parent QObject.

[override virtual noexcept] KSystemInhibitor::~KSystemInhibitor()

Release inhibition