Kirigami::Platform::TabletModeWatcher Class

class Kirigami::Platform::TabletModeWatcher
Header: #include <Kirigami/Platform/TabletModeWatcher>
CMake: find_package(KF6 REQUIRED COMPONENTS KirigamiPlatform)
target_link_libraries(mytarget PRIVATE KF6::KirigamiPlatform)
Inherits: QObject

Properties

Public Functions

void addWatcher(QObject *watcher)
bool isTabletMode() const
bool isTabletModeAvailable() const
void removeWatcher(QObject *watcher)

Signals

void tabletModeAvailableChanged(bool tabletModeAvailable)
void tabletModeChanged(bool tabletMode)

Detailed Description

This class reports on the status of certain transformable devices which can be both tablets and laptops at the same time, with a detachable keyboard. It reports whether the device supports a tablet mode and if the device is currently in such mode or not, emitting a signal when the user switches.

Property Documentation

[read-only] tabletMode : const bool

true if the machine is now in tablet mode, such as the laptop keyboard flipped away or detached.

Note that this doesn't mean exactly a tablet form factor, but that the preferred input mode for the device is the touch screen and that pointer and keyboard are either secondary or not available.

For debug purposes, if either the environment variable QT_QUICK_CONTROLS_MOBILE or KDE_KIRIGAMI_TABLET_MODE are set to true, tabletMode will be true

Access functions:

bool isTabletMode() const

Notifier signal:

void tabletModeChanged(bool tabletMode)

[read-only] tabletModeAvailable : const bool

true if the device supports a tablet mode and has a switch to report when the device has been transformed.

For debug purposes, if either the environment variable QT_QUICK_CONTROLS_MOBILE or KDE_KIRIGAMI_TABLET_MODE are set to true, tabletModeAvailable will be true

Access functions:

bool isTabletModeAvailable() const

Notifier signal:

void tabletModeAvailableChanged(bool tabletModeAvailable)

Member Function Documentation

void TabletModeWatcher::addWatcher(QObject *watcher)

Register an arbitrary QObject to send events from this. At the moment only one event will be sent: TabletModeChangedEvent

void TabletModeWatcher::removeWatcher(QObject *watcher)

Unsubscribe watcher from receiving events from TabletModeWatcher.