Handy

Search for usage in LXR

#include <handy.h>

Inheritance diagram for Handy:

Public Types

enum  FFactor { Desktop = 0 , Tablet , Phone }
 
- Public Types inherited from QObject
typedef  QObjectList
 

Properties

FFactor formFactor
 
bool hasKeyboard
 
bool hasMouse
 
bool hasTransientTouchInput
 
bool isAndroid
 
bool isIOS
 
bool isLinux
 
bool isMac
 
QML_SINGLETONbool isMobile
 
bool isTouch
 
bool isWindows
 
bool singleClick
 
- Properties inherited from QObject
 objectName
 

Signals

void formFactorChanged ()
 
void hasKeyboardChanged ()
 
void hasMouseChanged ()
 
void hasTransientTouchInputChanged ()
 
void isMobileChanged ()
 
void isTouchChanged ()
 
void singleClickChanged ()
 

Public Slots

static bool copyTextToClipboard (const QString &text)
 
static bool copyToClipboard (const QVariantMap &value, const bool &cut=false)
 
static QString formatDate (const QString &dateStr, const QString &format=QString("dd/MM/yyyy"), const QString &initFormat=QString())
 
static QString formatSize (quint64 size)
 
static QString formatTime (const qint64 &value)
 
FFactor formFactor ()
 
static QVariantMap getClipboard ()
 
static QString getClipboardText ()
 
bool hasKeyboard ()
 
bool hasMouse ()
 
static bool isAndroid ()
 
static bool isIOS ()
 
static bool isLinux ()
 
static bool isMac ()
 
bool isMobile () const
 
bool isTouch ()
 
static bool isWindows ()
 
static QVariantMap userInfo ()
 
static int version ()
 

Public Member Functions

 Handy (QObject *parent=nullptr)
 
bool hasTransientTouchInput () const
 
void setTransientTouchInput (bool touch)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
QBindable< QStringbindableObjectName ()
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo () const const
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType)
 
QThreadthread () const const
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

The Handy class.

Contains useful static methods to be used in the MauiKit application.

Note
This class is exposed as the singleton type Handy to the QML engine.

Definition at line 40 of file handy.h.

Member Enumeration Documentation

◆ FFactor

The different form factor options.

Enumerator
Desktop 

Desktop form factor assumes there is a physical mouse and keyboard, and the screen area is wide and spacious.

Tablet 

Tablet form factor assumes a hand held device with touch screen, maybe there is a physical keyboard attached.

The screen area is spacious enough still, not as wide as a desktop or as narrow as a mobile phone.

Phone 

Mobile form factor mode assumes a phone is the target device.

A small touch screen and not mouse or keyboard attached.

Definition at line 117 of file handy.h.

Property Documentation

◆ formFactor

Handy::FFactor Handy::formFactor
read

The current preferred from factor the user has selected.

Note
This preference can be set using MauiMan, and it is exposed to the end user via the Maui Settings.

This property allows the user to manually pick between a mobile, tablet or desktop mode. This can be consumed by the applications to position elements in a fitting manner.

Definition at line 109 of file handy.h.

◆ hasKeyboard

bool Handy::hasKeyboard
read

Whether the target device has a physical keyboard attached.

Definition at line 65 of file handy.h.

◆ hasMouse

bool Handy::hasMouse
read

Whether the target device has a physical mouse attached.

Definition at line 60 of file handy.h.

◆ hasTransientTouchInput

bool Handy::hasTransientTouchInput
read

Whether the current press input has been received from a touch screen.

Definition at line 70 of file handy.h.

◆ isAndroid

bool Handy::isAndroid
read

Whether the host platform is an Android device.

Definition at line 75 of file handy.h.

◆ isIOS

bool Handy::isIOS
read

Whether the host platform is running IOS.

Definition at line 95 of file handy.h.

◆ isLinux

bool Handy::isLinux
read

Whether the host platform is a GNU/Linux distribution.

Definition at line 80 of file handy.h.

◆ isMac

bool Handy::isMac
read

Whether the host platform is running MacOS.

Definition at line 90 of file handy.h.

◆ isMobile

QML_SINGLETONbool Handy::isMobile
read

Whether the host platform is set as mobile.

Either by the QT_QUICK_CONTROLS_MOBILE environment variable on, or from the MauiMan form factor mode to mobile.

Definition at line 50 of file handy.h.

◆ isTouch

bool Handy::isTouch
read

Whether the target device has a touch screen.

Definition at line 55 of file handy.h.

◆ isWindows

bool Handy::isWindows
read

Whether the host platform is running Windows OS.

Definition at line 85 of file handy.h.

◆ singleClick

bool Handy::singleClick

Whether the system preference is to open/trigger items with a single click.

Note
This preference is taken from MauiMan global preference.

Definition at line 101 of file handy.h.

Constructor & Destructor Documentation

◆ Handy()

Handy::Handy ( QObject * parent = nullptr)

Definition at line 47 of file handy.cpp.

Member Function Documentation

◆ copyTextToClipboard

bool Handy::copyTextToClipboard ( const QString & text)
staticslot

Copies a text string to the clipboard.

Parameters
texttext to be copied to the clipboard
Returns
whether the operation was successful

Definition at line 289 of file handy.cpp.

◆ copyToClipboard

bool Handy::copyToClipboard ( const QVariantMap & value,
const bool & cut = false )
staticslot

Adds a key-value map to the clipboard.

Possible keys can be:

  • text
  • urls
  • image

There can be more than one.

Parameters
valuethe data
cutwhether to add the metadata information necessary for it to be read as a cut operation by third party.
Returns
whether the operation was successful

Definition at line 258 of file handy.cpp.

◆ formatDate

QString Handy::formatDate ( const QString & dateStr,
const QString & format = QString("dd/MM/yyyy"),
const QString & initFormat = QString() )
staticslot

Given a date string, its original format and an intended format, return a readable string.

Parameters
dateStrdate string
formatIntended format, by default "dd/MM/yyyy"
initFormatthe original date format. This is optional and by default it will try to be auto determined.
Returns

Definition at line 346 of file handy.cpp.

◆ formatSize

QString Handy::formatSize ( quint64 size)
staticslot

Format a size value to the a readable locale size format.

Parameters
sizethe size value in bits
Returns
Formatted into a readable string using the preferred locale settings.

Definition at line 340 of file handy.cpp.

◆ formatTime

QString Handy::formatTime ( const qint64 & value)
staticslot

Format a milliseconds value to a readable format.

Parameters
valuemilliseconds
Returns
readable formatted value

Definition at line 354 of file handy.cpp.

◆ getClipboard

QVariantMap Handy::getClipboard ( )
staticslot

Retrieves the data in the clipboard into a key-value map.

The possible keys available are [only if there is any metadata]:

  • text
  • urls
  • image
  • cut
Note
This can invoked from QML and the data extracted as Handy.getClipboard().text for example.

Definition at line 223 of file handy.cpp.

◆ getClipboardText

QString Handy::getClipboardText ( )
staticslot

Returns the text contained in the clipboard.

Returns
text string

Definition at line 208 of file handy.cpp.

◆ hasTransientTouchInput()

bool Handy::hasTransientTouchInput ( ) const

Definition at line 140 of file handy.cpp.

◆ isMobile

bool Handy::isMobile ( ) const
slot

Definition at line 370 of file handy.cpp.

◆ setTransientTouchInput()

void Handy::setTransientTouchInput ( bool touch)

Definition at line 145 of file handy.cpp.

◆ userInfo

QVariantMap Handy::userInfo ( )
staticslot

Returns a key-value map containing basic information about the current user.

The pairs keys for the information returned are:

  • name
Returns
with user info map

Definition at line 199 of file handy.cpp.

◆ version

int Handy::version ( )
staticslot

Returns the major version of the current OS.

This function is static.

Returns
Major OS version number

Definition at line 299 of file handy.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:29:24 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.