Q_invokable Public Slot

Posted onby
  1. As you can see after exposing the object with setContextProperty we can access the property backgroundColor by name. We can also access the method usefulMethod because we declared it with the macro QINVOKABLE. We can also call the public slot reactToColorChange from QML. The example above doesn't have enums, but the usage is simple.
  2. As an alternative to the QSLOT macro, you might see slot functions declared in a public slots: section in a header file. In Cascades, these approaches are identical. Another useful macro that you might see is QINVOKABLE.

Read Only Properties. Properties can be read-only. Slots or QINVOKABLE functions. Can change state and emit signals. Sometimes it’s cleaner to have. Read only properties. QINVOKABLE setter functions 30.

Q invocable public slot machines

Greetings,

I have been reviewing this game engine for most of the day now and I am starting a project that has a sound engine that I would like to connect to that was developed as a DLL. I had looked over the QML documentation and got the sound engine loading using a Qt Quick app and now have sounds firing off with mouse events. I am not seeing a clear way to be able to call any slots or Q_INVOKABLE calls from my C++ wrapper class using Felgo’s framework.

Could anyone be kind enough to point me in the right direction? Thanks!

A singleton class that manages the oAuth 2.0 user agent/refresh flow. More...

#include <core/SFAuthenticationManager.h>

Inheritance diagram for sf::SFAuthenticationManager:

Public Slots

void onAppStart ()

Signals

void SFOAuthFlowSuccess (SFOAuthInfo *info)
void SFOAuthFlowFailure (SFOAuthInfo *info)
void SFOAuthFlowCanceled (SFOAuthInfo *info)
void SFUserLoggedOut ()
void SFLoginHostChanged ()

Public Member Functions

Q_INVOKABLE void login ()
Q_INVOKABLE void logout ()
Q_INVOKABLE bool isAuthenticating ()
Q_INVOKABLE void cancelAuthentication ()
QString loginHost () const
const SFIdentityData * getIdData () const
const SFOAuthCredentials * getCredentials () const

Static Public Member Functions

static SFAuthenticationManager * instance ()
static void setScopes (QList< QString > newScopes)

Static Protected Attributes

static SFAuthenticationManager * sharedInstance

Detailed Description

A singleton class that manages the oAuth 2.0 user agent/refresh flow.

This is a singleton class and its instance can be accessed by by SFAuthenticationManager::instance()

Initialization

Before using this class to start the authentication process, the application code needs to specify the required information to connect to salesforce.com:

  • consumer key: set this value in your applicationui class by defining the SFRemoteAccessConsumerKey variable
  • redirect url: set this value in your applicationui class by defining the SFRemoteAccessConsumerKey variable
  • scopes: optionally set the scopes you want the access token to be associated with. Set its value by calling SFAuthenticationManager::setScopes(QList<QString> newScopes);

Note

The consumer key, redirect url and scopes information is persisted on the device. If you decide to reconfigured these information, the change will take effect only after the app performed a logout or the app is deleted and re-installed. See SFAccountManager for more details

Usage

To use this class, connect to the desired signals and invoke the desired functions

SFAuthenticationManager* authManager = SFAuthenticationManager::instance();
connect(authManager, SIGNAL(SFOAuthFlowSuccess(SFOAuthInfo*)), this, SLOT(onSFOAuthFlowSuccess(SFOAuthInfo*)), Qt::UniqueConnection);

In order for the SDK to handle the authentication process. It uses a few QML assets to construct the UI needed during authentication They can be found in the assets/salesforce folder

  • SFSettings.qml: a screen for user to specify which environment to connect the application to. The application developer is responsible for presenting this screen if a setting screen is required in the application. The SDK will do the necessary clean up tasks and emit a LoginHostChanged signal. The application is responsible for handling this signal (e.g. trigger login again)
  • SFOAuthSheet.qml: a sheet that holds the web view for authentication. It is presented and dismissed by SFAuthenticationManager as part of the login process
  • SFPasscodeCreation.qml: a sheet that lets user set up device password after authentication. It is presented and dismissed by SFAuthenticationManager
  • SFLockScreen.qml: a sheet that locks the screen when the app is inactive for a period of time. It is presented and dismissed by SFAuthenticationManager
See Also
SFAuthenticationManager, SFAbstractApplicationUI See Authenticating Remote Access Application OAuth for more details. This SDK supports the oAuth 2.0 user agent flow and refresh token flow.

Definition at line 91 of file SFAuthenticationManager.h.

Member Function Documentation

Q_INVOKABLE void sf::SFAuthenticationManager::cancelAuthentication ()

Cancels in progress authentication (stops web view from loading, or aborts refresh token connection) Does not clear existing account data.

const SFOAuthCredentials* sf::SFAuthenticationManager::getCredentials () const
const SFIdentityData* sf::SFAuthenticationManager::getIdData () const
Returns
the current logged in user's identity data
static SFAuthenticationManager* sf::SFAuthenticationManager::instance ()
static
Q_INVOKABLE bool sf::SFAuthenticationManager::isAuthenticating ()
Returns
boolean value indicating whether there is any authentication in progress
Q_INVOKABLE void sf::SFAuthenticationManager::login ()

Starts the authentication process and emits either the success or failure signal This function will trigger the user-agent flow if the refresh token is not available otherwise the refresh token flow will be triggered.

QString sf::SFAuthenticationManager::loginHost () const
Q_INVOKABLE void sf::SFAuthenticationManager::logout ()

Cancels any authentication in progress and clears stored account data

void sf::SFAuthenticationManager::onAppStart ()
slot

This slot is connected to the application's fullscreen signal to automatically display either the login screen or lock screen.

static void sf::SFAuthenticationManager::setScopes (QList< QString > newScopes)
static

Q Invocable Public Slot Machine

void sf::SFAuthenticationManager::SFLoginHostChanged ()
signal

Emitted if user went into settings and changed the login host

void sf::SFAuthenticationManager::SFOAuthFlowCanceled (SFOAuthInfo * info)
signal
Parameters
infoa pointer to SFOAuthInfo indicating the type of the oAuth flow (user agent or refresh token) Emitted by cancelAuthentication()
void sf::SFAuthenticationManager::SFOAuthFlowFailure (SFOAuthInfo * info)
signal
Parameters
infoa pointer to SFOAuthInfo indicating the type of the oAuth flow (user agent or refresh token) Emitted by login() if failed
void sf::SFAuthenticationManager::SFOAuthFlowSuccess (SFOAuthInfo * info)
signal
Parameters
infoa pointer to SFOAuthInfo indicating the type of the oAuth flow (user agent or refresh token) Emitted by login() if succeeded. Not recommended to use with queued connection. If you do you are responsible to make sure the pointer is still valid when the signal is processed.
void sf::SFAuthenticationManager::SFUserLoggedOut ()
signal

Member Data Documentation

SFAuthenticationManager* sf::SFAuthenticationManager::sharedInstance
staticprotected

Q Invocable Public Slot Machines

Definition at line 169 of file SFAuthenticationManager.h.