The NotificationService class. This class used for working with notify.
More...
#include <notificationservice.h>
|
| void | notifyChanged () |
| | notifyChanged This signal emited whet the notificator (Ths object) received a new notification message.
|
| void | questionChanged () |
| | questionChanged This signal emited whet the notificator (Ths object) received a new question message.
|
| void | questionCompleted (bool accepted, int questionCode) |
| | questionCompleted This signal emited when youser clcik any buttons on question popup.
|
| void | historyListChanged () |
| | historyListChanged This signal is emitted when the notification history list was changed.
|
| void | sigShowHistory () |
| | sigShowHistory This signal is emitted when the notification history view should be shown (see showHistory).
|
| void | countNotificationsChanged () |
| | countNotificationsChanged This signal is emitted when the count of history notifications was changed.
|
|
| NotificationData | notify () const |
| | Notify This method return data of the last notify message.
|
| NotificationData | question () const |
| | question This method return data of the last question.
|
| void | setNotify (const NotificationData ¬ify) |
| | setNotify This method add new notification message of application.
|
| int | setQuestion (const Listner &listner, const NotificationData &question) |
| | setQuestion This method sets information of the users question.
|
| Q_INVOKABLE void | questionComplete (bool accepted, int code=0) |
| | questionComplete This method is main responce method of the users questions.
|
| Q_INVOKABLE void | setNotify (const QString &title="", const QString &text="", const QString &img="", int type=NotificationData::Normal) |
| | setNotify This method set new notify message for user. When notify changed on main application windows shows notify message.
|
| Q_INVOKABLE int | setQuestion (QObject *listnerObject, const QString &listnerMethod, const QString &title="", const QString &text="", const QString &img="", int code=0) |
| | setQuestion This method set new question for user. When question changed on main application windows shows question.
|
| int | setQuestion (const Listner &listner, const QString &title="", const QString &text="", const QString &img="", int code=0) |
| | setQuestion This method set new question for user. When question changed on main application windows shows question.
|
| QObject * | history () const |
| | history - This method used for return notify history model.
|
| Q_INVOKABLE void | showHistory () |
| | showHistory - This method used for emit signal by which show notification menu.
|
| Q_INVOKABLE int | notificationsCount () const |
| | notificationsCount - This method used for return count of history notifications.
|
| | ~NotificationService () |
| QString | modelId () const override |
| | modelId returns text model id. override this method to provide access to model in qml or other models.
|
| | iModel ()=default |
| virtual | ~iModel ()=default |
| const QWeakPointer< ModelStorage > & | storage () const |
| | storage returns storage object. this method return context of the model's storage.
|
| QQmlEngine * | engine () const |
| | engine returns qml engine.
|
|
| static NotificationService * | getService () |
| | getService This method return instance to notify service.
|
|
| virtual void | initStorage (const QWeakPointer< ModelStorage > &newStorage) |
| | initStorage This method is called by storage object after adding model to storage.
|
The NotificationService class. This class used for working with notify.
This service displays notifications and questions on the main application window and stores all sent notifications in a history model (see HistoryNotificationsModel).
The service is a singleton - use the getService method to access it.
Example:
[](bool accept) {
if (accept)
qDebug() << "User accepted";
},
"Are you sure?");
void setNotify(const NotificationData ¬ify)
setNotify This method add new notification message of application.
int setQuestion(const Listner &listner, const NotificationData &question)
setQuestion This method sets information of the users question.
static NotificationService * getService()
getService This method return instance to notify service.
In QML the service is used by the NotificationServiceView component, it must be exposed as the notificationService context property:
engine.rootContext()->setContextProperty(
"notificationService",
QQmlEngine * engine() const
engine returns qml engine.
import ViewSolutions
Item {
ViewSolutions.NotificationServiceView {}
}
Definition at line 63 of file notificationservice.h.
◆ ~NotificationService()
| ViewSolutions::NotificationService::~NotificationService |
( |
| ) |
|
◆ countNotificationsChanged
| void ViewSolutions::NotificationService::countNotificationsChanged |
( |
| ) |
|
|
signal |
countNotificationsChanged This signal is emitted when the count of history notifications was changed.
◆ getService()
| NotificationService * ViewSolutions::NotificationService::getService |
( |
| ) |
|
|
static |
getService This method return instance to notify service.
- Returns
- pointer to the notification service.
Definition at line 107 of file notificationservice.cpp.
◆ history()
| QObject * ViewSolutions::NotificationService::history |
( |
| ) |
const |
history - This method used for return notify history model.
- Returns
- history model of all notify.
Definition at line 112 of file notificationservice.cpp.
◆ historyListChanged
| void ViewSolutions::NotificationService::historyListChanged |
( |
| ) |
|
|
signal |
historyListChanged This signal is emitted when the notification history list was changed.
◆ modelId()
| QString ViewSolutions::NotificationService::modelId |
( |
| ) |
const |
|
overridevirtual |
◆ notificationsCount()
| int ViewSolutions::NotificationService::notificationsCount |
( |
| ) |
const |
notificationsCount - This method used for return count of history notifications.
- Returns
- count of history notifications.
Definition at line 120 of file notificationservice.cpp.
◆ notify()
Notify This method return data of the last notify message.
- Returns
- return data of the last notify message.
Definition at line 27 of file notificationservice.cpp.
◆ notifyChanged
| void ViewSolutions::NotificationService::notifyChanged |
( |
| ) |
|
|
signal |
notifyChanged This signal emited whet the notificator (Ths object) received a new notification message.
◆ question()
question This method return data of the last question.
- Returns
- question data.
Definition at line 31 of file notificationservice.cpp.
◆ questionChanged
| void ViewSolutions::NotificationService::questionChanged |
( |
| ) |
|
|
signal |
questionChanged This signal emited whet the notificator (Ths object) received a new question message.
◆ questionComplete()
| void ViewSolutions::NotificationService::questionComplete |
( |
bool | accepted, |
|
|
int | code = 0 ) |
questionComplete This method is main responce method of the users questions.
- Parameters
-
| accepted | are boolean option. Set this option to true if user click on accept button. |
| code | are automaticly generated code fo the question. |
Definition at line 56 of file notificationservice.cpp.
◆ questionCompleted
| void ViewSolutions::NotificationService::questionCompleted |
( |
bool | accepted, |
|
|
int | questionCode ) |
|
signal |
questionCompleted This signal emited when youser clcik any buttons on question popup.
- Parameters
-
| accepted | are bool option with "true" value if the yesr click to accept button. |
| questionCode | are automaticly generated code of the question. For more information about code option see the setQuestion method. |
◆ setNotify() [1/2]
| void ViewSolutions::NotificationService::setNotify |
( |
const NotificationData & | notify | ) |
|
setNotify This method add new notification message of application.
- Parameters
-
Definition at line 35 of file notificationservice.cpp.
◆ setNotify() [2/2]
| void ViewSolutions::NotificationService::setNotify |
( |
const QString & | title = "", |
|
|
const QString & | text = "", |
|
|
const QString & | img = "", |
|
|
int | type = NotificationData::Normal ) |
setNotify This method set new notify message for user. When notify changed on main application windows shows notify message.
- Parameters
-
| title | are title of a notify window. |
| text | are text value of a notify window. |
| img | are url to image of a notify window. |
| type | are code of a notification type. For more information about notification type see the NotificationData enum. |
Definition at line 67 of file notificationservice.cpp.
◆ setQuestion() [1/3]
setQuestion This method sets information of the users question.
- Parameters
-
| listner | This is listner lyambda function. |
| question | are data of the question. |
- Returns
- return question code. You must be save this code for check ansver of your qestion.
Definition at line 44 of file notificationservice.cpp.
◆ setQuestion() [2/3]
| int ViewSolutions::NotificationService::setQuestion |
( |
const Listner & | listner, |
|
|
const QString & | title = "", |
|
|
const QString & | text = "", |
|
|
const QString & | img = "", |
|
|
int | code = 0 ) |
setQuestion This method set new question for user. When question changed on main application windows shows question.
- Parameters
-
| listner | This is listner lyambda function. |
| title | are title of a question window. |
| text | are text value of a question window. |
| img | are url to image of a queston window. |
| code | are code of question. This code must be sendet to the questionComplete method after buttons clik. |
Definition at line 97 of file notificationservice.cpp.
◆ setQuestion() [3/3]
| int ViewSolutions::NotificationService::setQuestion |
( |
QObject * | listnerObject, |
|
|
const QString & | listnerMethod, |
|
|
const QString & | title = "", |
|
|
const QString & | text = "", |
|
|
const QString & | img = "", |
|
|
int | code = 0 ) |
setQuestion This method set new question for user. When question changed on main application windows shows question.
- Parameters
-
| listnerObject | This is qml object with listner function. |
| listnerMethod | This is listner method name. Method signature : void(bool) |
| title | are title of a question window. |
| text | are text value of a question window. |
| img | are url to image of a queston window. |
| code | are code of question. This code must be sendet to the questionComplete method after buttons clik. |
Definition at line 76 of file notificationservice.cpp.
◆ showHistory()
| void ViewSolutions::NotificationService::showHistory |
( |
| ) |
|
showHistory - This method used for emit signal by which show notification menu.
Definition at line 116 of file notificationservice.cpp.
◆ sigShowHistory
| void ViewSolutions::NotificationService::sigShowHistory |
( |
| ) |
|
|
signal |
sigShowHistory This signal is emitted when the notification history view should be shown (see showHistory).
◆ history
| QObject* ViewSolutions::NotificationService::history |
|
read |
◆ notificationsCount
| int ViewSolutions::NotificationService::notificationsCount |
|
read |
◆ notify
◆ question
The documentation for this class was generated from the following files: