QtMvvm  1.0.0
A mvvm oriented library for Qt, to create Projects for Widgets and Quick in parallel
Namespaces | Classes | Functions
QtMvvm Namespace Reference

The primary namespace of the QtMvvm library. More...

Namespaces

 SettingsElements
 A sub namespace for the different elements in a settings setup.
 

Classes

class  AccountModel
 A list model implementation for QtDataSync::DeviceInfo via a QtDataSync::AccountManager. More...
 
class  Binding
 A handle to a multidirectional binding between properties. More...
 
class  CoreApp
 A logicaly application object to drive the mvvm application from the core part. More...
 
class  DataSyncViewModel
 A viewmodel to show a overview of the datasync status and account. More...
 
class  DataSyncWindow
 The widgets view implementation for the DataSyncViewModel. More...
 
class  ExchangeDevicesModel
 A list model implementation to show all devices available by the QtDataSync::UserExchangeManager. More...
 
class  InputViewFactory
 A factory class to generate input edit views by their type names. More...
 
class  InputWidgetFactory
 A factory class to generate input edit widgets by their type names. More...
 
class  IPresenter
 The interface for a GUI view presenter. More...
 
class  IPresentingView
 A simple interface to make it possible for any view to present subviews. More...
 
class  ISettingsSetupLoader
 An interface for a generic settings setup loader. More...
 
class  MessageConfig
 A configuration for a simple dialog to be shown from the core code. More...
 
class  MessageResult
 A result watcher to get the result once a dialog has finished. More...
 
class  NetworkExchangeViewModel
 A viewmodel to show a dialog to exchange account data via the QtDataSync::UserExchangeManager. More...
 
class  NetworkExchangeWindow
 The widgets view implementation for the NetworkExchangeViewModel. More...
 
class  PresenterException
 An exception to be thrown from the presenter if presenting fails. More...
 
class  QuickPresenter
 The IPresenter implementation for the quick module. More...
 
class  ServiceConstructionException
 Is thrown in case the construction of a service has failed. More...
 
class  ServiceDependencyException
 Is thrown if a service could not be created because of a missing dependency to be injected. More...
 
class  ServiceExistsException
 Is thrown if a service is beeing registered that is already registered. More...
 
class  ServiceRegistry
 A singleton to prepare services for dependency injection and to access them. More...
 
class  SettingsDialog
 The widgets view implementation for the SettingsViewModel. More...
 
class  SettingsLoaderException
 An exception throw in case loading a settings setup went wrong. More...
 
class  SettingsViewModel
 A ViewModel for a generic settings dialog based of an XML settings file. More...
 
class  ViewModel
 The base class for all viewmodels. More...
 
class  WidgetsPresenter
 The IPresenter implementation for the widgets module. More...
 

Functions

Q_MVVMCORE_EXPORT Binding bind (QObject *viewModel, const char *viewModelProperty, QObject *view, const char *viewProperty, Binding::BindingDirection type=Binding::TwoWay, const char *viewModelChangeSignal=nullptr, const char *viewChangeSignal=nullptr)
 Create a multidirectional binding between properties. More...
 
Q_MVVMCORE_EXPORT Binding bind (QObject *viewModel, const QMetaProperty &viewModelProperty, QObject *view, const QMetaProperty &viewProperty, Binding::BindingDirection type=Binding::TwoWay, const char *viewModelChangeSignal=nullptr, const char *viewChangeSignal=nullptr)
 Create a multidirectional binding between properties. More...
 
Q_MVVMCORE_EXPORT Binding bind (QObject *viewModel, const QMetaProperty &viewModelProperty, QObject *view, const QMetaProperty &viewProperty, Binding::BindingDirection type=Binding::TwoWay, const QMetaMethod &viewModelChangeSignal={}, const QMetaMethod &viewChangeSignal={})
 Create a multidirectional binding between properties. More...
 
template<typename TInterface >
void registerInterfaceConverter ()
 Registers QVariant converters from QObject to an interface type registered with Q_DECLARE_INTERFACE.
 
Q_MVVMDATASYNCQUICK_EXPORT void registerDataSyncQuick ()
 A method to initialize the datasync quick mvvm module. More...
 
Q_MVVMDATASYNCWIDGETS_EXPORT void registerDataSyncWidgets ()
 A method to initialize the datasync widgets mvvm module. More...
 
Methods to show simple messageboxes (MessageConfig::TypeMessageBox)
Q_MVVMCORE_EXPORT MessageResultinformation (const QString &title, const QString &text, const QString &okText={})
 A shortcut to show a simple information messagebox. More...
 
Q_MVVMCORE_EXPORT void information (const QString &title, const QString &text, QObject *scope, const std::function< void()> &onResult, const QString &okText={})
 A shortcut to show a simple information messagebox. More...
 
Q_MVVMCORE_EXPORT void information (const QString &title, const QString &text, const std::function< void()> &onResult, const QString &okText={})
 A shortcut to show a simple information messagebox. More...
 
Q_MVVMCORE_EXPORT MessageResultquestion (const QString &title, const QString &text, const QString &yesText={}, const QString &noText={})
 A shortcut to show a simple question messagebox. More...
 
Q_MVVMCORE_EXPORT void question (const QString &title, const QString &text, QObject *scope, const std::function< void(bool)> &onResult, const QString &yesText={}, const QString &noText={})
 A shortcut to show a simple question messagebox. More...
 
Q_MVVMCORE_EXPORT void question (const QString &title, const QString &text, const std::function< void(bool)> &onResult, const QString &yesText={}, const QString &noText={})
 A shortcut to show a simple question messagebox. More...
 
Q_MVVMCORE_EXPORT MessageResultwarning (const QString &title, const QString &text, const QString &okText={})
 A shortcut to show a simple warning messagebox. More...
 
Q_MVVMCORE_EXPORT void warning (const QString &title, const QString &text, QObject *scope, const std::function< void()> &onResult, const QString &okText={})
 A shortcut to show a simple warning messagebox. More...
 
Q_MVVMCORE_EXPORT void warning (const QString &title, const QString &text, const std::function< void()> &onResult, const QString &okText={})
 A shortcut to show a simple warning messagebox. More...
 
Q_MVVMCORE_EXPORT MessageResultcritical (const QString &title, const QString &text, const QString &okText={})
 A shortcut to show a simple critical error messagebox. More...
 
Q_MVVMCORE_EXPORT void critical (const QString &title, const QString &text, QObject *scope, const std::function< void()> &onResult, const QString &okText={})
 A shortcut to show a simple critical error messagebox. More...
 
Q_MVVMCORE_EXPORT void critical (const QString &title, const QString &text, const std::function< void()> &onResult, const QString &okText={})
 A shortcut to show a simple critical error messagebox. More...
 
Q_MVVMCORE_EXPORT MessageResultabout (const QString &description, const QUrl &websiteUrl=QUrl(), const QString &licenseName=QString(), const QUrl &licenseUrl=QUrl(), const QString &companyName=QString(), bool addQtVersion=true, const QStringList &extraTopInfos=QStringList(), const QString &extraBottomInfos=QString())
 A shortcut to show a rich but simple about dialog. More...
 
Methods to show simple input dialogs (MessageConfig::TypeInputDialog)
Q_MVVMCORE_EXPORT MessageResultgetInput (const QString &title, const QString &text, const char *inputType, const QVariant &defaultValue={}, const QVariantMap &viewProperties={}, const QString &okText={}, const QString &cancelText={})
 A shortcut to show an input dialog based of a type name. More...
 
Q_MVVMCORE_EXPORT void getInput (const QString &title, const QString &text, const char *inputType, QObject *scope, const std::function< void(QVariant)> &onResult, const QVariant &defaultValue={}, const QVariantMap &viewProperties={}, const QString &okText={}, const QString &cancelText={})
 A shortcut to show an input dialog based of a type name. More...
 
Q_MVVMCORE_EXPORT void getInput (const QString &title, const QString &text, const char *inputType, const std::function< void(QVariant)> &onResult, const QVariant &defaultValue={}, const QVariantMap &viewProperties={}, const QString &okText={}, const QString &cancelText={})
 A shortcut to show an input dialog based of a type name. More...
 
template<typename TEdit >
MessageResultgetInput (const QString &title, const QString &text, const TEdit &defaultValue={}, const QVariantMap &viewProperties={}, const QString &okText={}, const QString &cancelText={})
 A shortcut to show an input dialog based of a type as generic parameter. More...
 
template<typename TEdit >
void getInput (const QString &title, const QString &text, QObject *scope, const std::function< void(TEdit, bool)> &onResult, const TEdit &defaultValue={}, const QVariantMap &viewProperties={}, const QString &okText={}, const QString &cancelText={})
 A shortcut to show an input dialog based of a type as generic parameter. More...
 
template<typename TEdit >
void getInput (const QString &title, const QString &text, const std::function< void(TEdit, bool)> &onResult, const TEdit &defaultValue={}, const QVariantMap &viewProperties={}, const QString &okText={}, const QString &cancelText={})
 A shortcut to show an input dialog based of a type as generic parameter. More...
 
Methods to show simple file dialogs (MessageConfig::TypeFileDialog)
Q_MVVMCORE_EXPORT MessageResultgetExistingDirectory (const QString &title={}, const QUrl &dir={})
 A shortcut to show a file dialog to select an existing directory. More...
 
Q_MVVMCORE_EXPORT void getExistingDirectory (QObject *scope, const std::function< void(QUrl)> &onResult, const QString &title={}, const QUrl &dir={})
 A shortcut to show a file dialog to select an existing directory. More...
 
Q_MVVMCORE_EXPORT void getExistingDirectory (const std::function< void(QUrl)> &onResult, const QString &title={}, const QUrl &dir={})
 A shortcut to show a file dialog to select an existing directory. More...
 
Q_MVVMCORE_EXPORT MessageResultgetOpenFile (const QString &title={}, const QStringList &supportedMimeTypes={}, const QUrl &dir={})
 A shortcut to show a file dialog to select an existing file. More...
 
Q_MVVMCORE_EXPORT void getOpenFile (QObject *scope, const std::function< void(QUrl)> &onResult, const QString &title={}, const QStringList &supportedMimeTypes={}, const QUrl &dir={})
 A shortcut to show a file dialog to select an existing file. More...
 
Q_MVVMCORE_EXPORT void getOpenFile (const std::function< void(QUrl)> &onResult, const QString &title={}, const QStringList &supportedMimeTypes={}, const QUrl &dir={})
 A shortcut to show a file dialog to select an existing file. More...
 
Q_MVVMCORE_EXPORT MessageResultgetOpenFiles (const QString &title={}, const QStringList &supportedMimeTypes={}, const QUrl &dir={})
 A shortcut to show a file dialog to select multiple existing files. More...
 
Q_MVVMCORE_EXPORT void getOpenFiles (QObject *scope, const std::function< void(QList< QUrl >)> &onResult, const QString &title={}, const QStringList &supportedMimeTypes={}, const QUrl &dir={})
 A shortcut to show a file dialog to select multiple existing files. More...
 
Q_MVVMCORE_EXPORT void getOpenFiles (const std::function< void(QList< QUrl >)> &onResult, const QString &title={}, const QStringList &supportedMimeTypes={}, const QUrl &dir={})
 A shortcut to show a file dialog to select multiple existing files. More...
 
Q_MVVMCORE_EXPORT MessageResultgetSaveFile (const QString &title={}, const QStringList &supportedMimeTypes={}, const QUrl &dir={})
 A shortcut to show a file dialog to select a new file for saving. More...
 
Q_MVVMCORE_EXPORT void getSaveFile (QObject *scope, const std::function< void(QUrl)> &onResult, const QString &title={}, const QStringList &supportedMimeTypes={}, const QUrl &dir={})
 A shortcut to show a file dialog to select a new file for saving. More...
 
Q_MVVMCORE_EXPORT void getSaveFile (const std::function< void(QUrl)> &onResult, const QString &title={}, const QStringList &supportedMimeTypes={}, const QUrl &dir={})
 A shortcut to show a file dialog to select a new file for saving. More...
 

Detailed Description

The primary namespace of the QtMvvm library.

The following list shows which classes belong to which Qt module, in alphabetical order:

Function Documentation

◆ about()

QtMvvm::about ( const QString description,
const QUrl websiteUrl = QUrl(),
const QString licenseName = QString(),
const QUrl licenseUrl = QUrl(),
const QString companyName = QString(),
bool  addQtVersion = true,
const QStringList extraTopInfos = QStringList(),
const QString extraBottomInfos = QString() 
)

A shortcut to show a rich but simple about dialog.

Parameters
descriptionA short descriptive text what your application is all about
websiteUrlThe URL to your website
licenseNameThe name of the License you are using
licenseUrlA URL to an online (or offline) variant of the license to read for the user
companyNameThe name of your company or your name as creator of the application
addQtVersionSpecify whether the Qt Version should be visible as part of the about dialog
extraTopInfosAdditional short texts to be shown below the version
extraBottomInfosAn additional text to be shown at the bottom of the dialog

Creates an advanced about dialog out of all of this information in an organized manner. The extraTopInfos are ment as short extra information about configurations etc, for example a specific plattform plugin used, as selected style or further important links. The extraBottomInfos can be a long and rich text with anything else you want to put in the about dialog that is not applicabale for the previous part (for example a list of contributers).

Note
All the texts can be richtext (HTML). But be aware that they are already beeing wrapped in <p></p> blocks. Furthermore, QML only supports a small subset of HTML in the default text mode that is used.
See also
QtMvvm::information, MessageConfig, CoreApp::showDialog

◆ bind() [1/3]

QtMvvm::bind ( QObject viewModel,
const char *  viewModelProperty,
QObject view,
const char *  viewProperty,
Binding::BindingDirection  type = Binding::TwoWay,
const char *  viewModelChangeSignal = nullptr,
const char *  viewChangeSignal = nullptr 
)

Create a multidirectional binding between properties.

Parameters
viewModelThe object in the role of a viewmodel
viewModelPropertyThe property of the viewmodel to use in the binding
viewThe object in the role of a view
viewPropertyThe property of the view to use in the binding
typeThe type/direction of binding to create
viewModelChangeSignalAn alternative signal to be used instead of the viewModelProperty notify signal to detect property changes
viewChangeSignalAn alternative signal to be used instead of the viewProperty notify signal to detect property changes
Returns
A handle to the newly created binding, or an invalid handle on errors

The methods creates a binding similar to the QML bindings, but it is possible to create two-way bindings with this method as well. A binding means that whenever a property changes, the property it is bound to is updated to the changed value as well.

//sample usage
QtMvvm::bind(this->viewModel, "name", // A viewmodel that has a property named "name"
ui->nameLabel, "text"); // A view (for example a QLabel) that has a property named "text"
//any changes to "name" will update "text" and the other way around

To control the directions, i.e. which properties should trigger an update on changes and which only get updated, use the type parameter.

Attention
Unlike the QML variant, this binding does not handle binding loops. THis means if you use a two way binding, make shure change signals are only emitted when the value does actually change. Otherwise your application is caught up in a binding loop and will eventually crash. Using two seperate one way bindings will not prevent this.

If the properties you want to use don't have a change signal or you don't want to use that signal, you can use the viewModelChangeSignal and viewChangeSignal to overwrite the signal to be used. Please note that you must specify the full signal signature. For example, the signatur of the signal void foo(const QString &bar); has the signature foo(QString). See QMetaMethod for more details. If you leave the parameter out or set it to nullptr (or {}, an invalid meta method) the notify signals of the properties are used.

See also
Binding

◆ bind() [2/3]

Q_MVVMCORE_EXPORT Binding QtMvvm::bind ( QObject viewModel,
const QMetaProperty viewModelProperty,
QObject view,
const QMetaProperty viewProperty,
Binding::BindingDirection  type = Binding::TwoWay,
const char *  viewModelChangeSignal = nullptr,
const char *  viewChangeSignal = nullptr 
)

Create a multidirectional binding between properties.

Parameters
viewModelThe object in the role of a viewmodel
viewModelPropertyThe property of the viewmodel to use in the binding
viewThe object in the role of a view
viewPropertyThe property of the view to use in the binding
typeThe type/direction of binding to create
viewModelChangeSignalAn alternative signal to be used instead of the viewModelProperty notify signal to detect property changes
viewChangeSignalAn alternative signal to be used instead of the viewProperty notify signal to detect property changes
Returns
A handle to the newly created binding, or an invalid handle on errors

The methods creates a binding similar to the QML bindings, but it is possible to create two-way bindings with this method as well. A binding means that whenever a property changes, the property it is bound to is updated to the changed value as well.

//sample usage
QtMvvm::bind(this->viewModel, "name", // A viewmodel that has a property named "name"
ui->nameLabel, "text"); // A view (for example a QLabel) that has a property named "text"
//any changes to "name" will update "text" and the other way around

To control the directions, i.e. which properties should trigger an update on changes and which only get updated, use the type parameter.

Attention
Unlike the QML variant, this binding does not handle binding loops. THis means if you use a two way binding, make shure change signals are only emitted when the value does actually change. Otherwise your application is caught up in a binding loop and will eventually crash. Using two seperate one way bindings will not prevent this.

If the properties you want to use don't have a change signal or you don't want to use that signal, you can use the viewModelChangeSignal and viewChangeSignal to overwrite the signal to be used. Please note that you must specify the full signal signature. For example, the signatur of the signal void foo(const QString &bar); has the signature foo(QString). See QMetaMethod for more details. If you leave the parameter out or set it to nullptr (or {}, an invalid meta method) the notify signals of the properties are used.

See also
Binding

◆ bind() [3/3]

Q_MVVMCORE_EXPORT Binding QtMvvm::bind ( QObject viewModel,
const QMetaProperty viewModelProperty,
QObject view,
const QMetaProperty viewProperty,
Binding::BindingDirection  type = Binding::TwoWay,
const QMetaMethod viewModelChangeSignal = {},
const QMetaMethod viewChangeSignal = {} 
)

Create a multidirectional binding between properties.

Parameters
viewModelThe object in the role of a viewmodel
viewModelPropertyThe property of the viewmodel to use in the binding
viewThe object in the role of a view
viewPropertyThe property of the view to use in the binding
typeThe type/direction of binding to create
viewModelChangeSignalAn alternative signal to be used instead of the viewModelProperty notify signal to detect property changes
viewChangeSignalAn alternative signal to be used instead of the viewProperty notify signal to detect property changes
Returns
A handle to the newly created binding, or an invalid handle on errors

The methods creates a binding similar to the QML bindings, but it is possible to create two-way bindings with this method as well. A binding means that whenever a property changes, the property it is bound to is updated to the changed value as well.

//sample usage
QtMvvm::bind(this->viewModel, "name", // A viewmodel that has a property named "name"
ui->nameLabel, "text"); // A view (for example a QLabel) that has a property named "text"
//any changes to "name" will update "text" and the other way around

To control the directions, i.e. which properties should trigger an update on changes and which only get updated, use the type parameter.

Attention
Unlike the QML variant, this binding does not handle binding loops. THis means if you use a two way binding, make shure change signals are only emitted when the value does actually change. Otherwise your application is caught up in a binding loop and will eventually crash. Using two seperate one way bindings will not prevent this.

If the properties you want to use don't have a change signal or you don't want to use that signal, you can use the viewModelChangeSignal and viewChangeSignal to overwrite the signal to be used. Please note that you must specify the full signal signature. For example, the signatur of the signal void foo(const QString &bar); has the signature foo(QString). See QMetaMethod for more details. If you leave the parameter out or set it to nullptr (or {}, an invalid meta method) the notify signals of the properties are used.

See also
Binding

◆ critical() [1/3]

QtMvvm::critical ( const QString title,
const QString text,
const QString okText = {} 
)

A shortcut to show a simple critical error messagebox.

Parameters
titleThe messagebox title (MessageConfig::title)
textThe primary message text (MessageConfig::text)
okTextAn optional text overwrite for the OK button (MessageConfig::buttonTexts)

Shows a simple critical error dialog with a title, a text and the OK button present.

See also
QtMvvm::question, QtMvvm::warning, QtMvvm::information, MessageConfig, CoreApp::showDialog

◆ critical() [2/3]

QtMvvm::critical ( const QString title,
const QString text,
QObject scope,
const std::function< void()> &  onResult,
const QString okText = {} 
)

A shortcut to show a simple critical error messagebox.

Parameters
scopeA scope to limit to. onResult is only called as long as scope has not been deleted
onResultA handler to be called when the message box has been closed
titleThe messagebox title (MessageConfig::title)
textThe primary message text (MessageConfig::text)
okTextAn optional text overwrite for the OK button (MessageConfig::buttonTexts)

Shows a simple critical error dialog with a title, a text and the OK button present.

See also
QtMvvm::question, QtMvvm::warning, QtMvvm::information, MessageConfig, CoreApp::showDialog

◆ critical() [3/3]

QtMvvm::critical ( const QString title,
const QString text,
const std::function< void()> &  onResult,
const QString okText = {} 
)

A shortcut to show a simple critical error messagebox.

Parameters
onResultA handler to be called when the message box has been closed
titleThe messagebox title (MessageConfig::title)
textThe primary message text (MessageConfig::text)
okTextAn optional text overwrite for the OK button (MessageConfig::buttonTexts)

Shows a simple critical error dialog with a title, a text and the OK button present.

See also
QtMvvm::question, QtMvvm::warning, QtMvvm::information, MessageConfig, CoreApp::showDialog

◆ getExistingDirectory() [1/3]

QtMvvm::getExistingDirectory ( const QString title = {},
const QUrl dir = {} 
)

A shortcut to show a file dialog to select an existing directory.

Parameters
titleThe input dialog title (MessageConfig::title)
dirThe directory URL to start the file dialog from (MessageConfig::defaultValue)

Shows a folder dialog to let the user select an existing directory.

See also
MessageConfig, CoreApp::showDialog

◆ getExistingDirectory() [2/3]

QtMvvm::getExistingDirectory ( QObject scope,
const std::function< void(QUrl)> &  onResult,
const QString title = {},
const QUrl dir = {} 
)

A shortcut to show a file dialog to select an existing directory.

Parameters
scopeA scope to limit to. onResult is only called as long as scope has not been deleted
onResultA handler to be called when the folder dialog has been closed. Reports the selected directory URL or an invalid URL in case the input has been canceled.
titleThe input dialog title (MessageConfig::title)
dirThe directory URL to start the file dialog from (MessageConfig::defaultValue)

Shows a folder dialog to let the user select an existing directory.

See also
MessageConfig, CoreApp::showDialog

◆ getExistingDirectory() [3/3]

QtMvvm::getExistingDirectory ( const std::function< void(QUrl)> &  onResult,
const QString title = {},
const QUrl dir = {} 
)

A shortcut to show a file dialog to select an existing directory.

Parameters
onResultA handler to be called when the folder dialog has been closed. Reports the selected directory URL or an invalid URL in case the input has been canceled.
titleThe input dialog title (MessageConfig::title)
dirThe directory URL to start the file dialog from (MessageConfig::defaultValue)

Shows a folder dialog to let the user select an existing directory.

See also
MessageConfig, CoreApp::showDialog

◆ getInput() [1/6]

QtMvvm::getInput ( const QString title,
const QString text,
const char *  inputType,
const QVariant defaultValue = {},
const QVariantMap &  viewProperties = {},
const QString okText = {},
const QString cancelText = {} 
)

A shortcut to show an input dialog based of a type name.

Parameters
titleThe input dialog title (MessageConfig::title)
textA label to describe what to input (MessageConfig::text)
inputTypeThe data type of the edit to be used (MessageConfig::subType)
defaultValueA default value to initialize the edit with (MessageConfig::defaultValue)
viewPropertiesAdditional properties to be passed to the edit (MessageConfig::viewProperties)
okTextAn optional text overwrite for the OK button (MessageConfig::buttonTexts)
cancelTextAn optional text overwrite for the CANCEL button (MessageConfig::buttonTexts)

Shows an input dialog. The kind of edit to use is determined by using the inputType. The view properties will be applied to both, the dialog and the edit.

See also
MessageConfig, CoreApp::showDialog

◆ getInput() [2/6]

QtMvvm::getInput ( const QString title,
const QString text,
const char *  inputType,
QObject scope,
const std::function< void(QVariant)> &  onResult,
const QVariant defaultValue = {},
const QVariantMap &  viewProperties = {},
const QString okText = {},
const QString cancelText = {} 
)

A shortcut to show an input dialog based of a type name.

Parameters
scopeA scope to limit to. onResult is only called as long as scope has not been deleted
onResultA handler to be called when the input dialog has been closed. Reports the result or an invalid variant in case the input has been canceled.
titleThe input dialog title (MessageConfig::title)
textA label to describe what to input (MessageConfig::text)
inputTypeThe data type of the edit to be used (MessageConfig::subType)
defaultValueA default value to initialize the edit with (MessageConfig::defaultValue)
viewPropertiesAdditional properties to be passed to the edit (MessageConfig::viewProperties)
okTextAn optional text overwrite for the OK button (MessageConfig::buttonTexts)
cancelTextAn optional text overwrite for the CANCEL button (MessageConfig::buttonTexts)

Shows an input dialog. The kind of edit to use is determined by using the inputType. The view properties will be applied to both, the dialog and the edit.

See also
MessageConfig, CoreApp::showDialog

◆ getInput() [3/6]

QtMvvm::getInput ( const QString title,
const QString text,
const char *  inputType,
const std::function< void(QVariant)> &  onResult,
const QVariant defaultValue = {},
const QVariantMap &  viewProperties = {},
const QString okText = {},
const QString cancelText = {} 
)

A shortcut to show an input dialog based of a type name.

Parameters
onResultA handler to be called when the input dialog has been closed. Reports the result or an invalid variant in case the input has been canceled.
titleThe input dialog title (MessageConfig::title)
textA label to describe what to input (MessageConfig::text)
inputTypeThe data type of the edit to be used (MessageConfig::subType)
defaultValueA default value to initialize the edit with (MessageConfig::defaultValue)
viewPropertiesAdditional properties to be passed to the edit (MessageConfig::viewProperties)
okTextAn optional text overwrite for the OK button (MessageConfig::buttonTexts)
cancelTextAn optional text overwrite for the CANCEL button (MessageConfig::buttonTexts)

Shows an input dialog. The kind of edit to use is determined by using the inputType. The view properties will be applied to both, the dialog and the edit.

See also
MessageConfig, CoreApp::showDialog

◆ getInput() [4/6]

template<typename TEdit >
QtMvvm::getInput ( const QString title,
const QString text,
const TEdit &  defaultValue = {},
const QVariantMap &  viewProperties = {},
const QString okText = {},
const QString cancelText = {} 
)
inline

A shortcut to show an input dialog based of a type as generic parameter.

Parameters
titleThe input dialog title (MessageConfig::title)
textA label to describe what to input (MessageConfig::text)
defaultValueA default value to initialize the edit with (MessageConfig::defaultValue)
viewPropertiesAdditional properties to be passed to the edit (MessageConfig::viewProperties)
okTextAn optional text overwrite for the OK button (MessageConfig::buttonTexts)
cancelTextAn optional text overwrite for the CANCEL button (MessageConfig::buttonTexts)
Template Parameters
TEditThe input to type to create an edit for and to get a value of

Shows an input dialog. The kind of edit to use is determined by using the TEdit type name. The view properties will be applied to both, the dialog and the edit.

See also
MessageConfig, CoreApp::showDialog

Definition at line 346 of file message.h.

◆ getInput() [5/6]

template<typename TEdit >
QtMvvm::getInput ( const QString title,
const QString text,
QObject scope,
const std::function< void(TEdit, bool)> &  onResult,
const TEdit &  defaultValue = {},
const QVariantMap &  viewProperties = {},
const QString okText = {},
const QString cancelText = {} 
)
inline

A shortcut to show an input dialog based of a type as generic parameter.

Parameters
scopeA scope to limit to. onResult is only called as long as scope has not been deleted
onResultA handler to be called when the input dialog has been closed. Reports the result and true as second parameter, or a default constructed value and false in case the input has been canceled
titleThe input dialog title (MessageConfig::title)
textA label to describe what to input (MessageConfig::text)
defaultValueA default value to initialize the edit with (MessageConfig::defaultValue)
viewPropertiesAdditional properties to be passed to the edit (MessageConfig::viewProperties)
okTextAn optional text overwrite for the OK button (MessageConfig::buttonTexts)
cancelTextAn optional text overwrite for the CANCEL button (MessageConfig::buttonTexts)
Template Parameters
TEditThe input to type to create an edit for and to get a value of

Shows an input dialog. The kind of edit to use is determined by using the TEdit type name. The view properties will be applied to both, the dialog and the edit.

See also
MessageConfig, CoreApp::showDialog

Definition at line 356 of file message.h.

◆ getInput() [6/6]

template<typename TEdit >
QtMvvm::getInput ( const QString title,
const QString text,
const std::function< void(TEdit, bool)> &  onResult,
const TEdit &  defaultValue = {},
const QVariantMap &  viewProperties = {},
const QString okText = {},
const QString cancelText = {} 
)
inline

A shortcut to show an input dialog based of a type as generic parameter.

Parameters
onResultA handler to be called when the input dialog has been closed. Reports the result and true as second parameter, or a default constructed value and false in case the input has been canceled
titleThe input dialog title (MessageConfig::title)
textA label to describe what to input (MessageConfig::text)
defaultValueA default value to initialize the edit with (MessageConfig::defaultValue)
viewPropertiesAdditional properties to be passed to the edit (MessageConfig::viewProperties)
okTextAn optional text overwrite for the OK button (MessageConfig::buttonTexts)
cancelTextAn optional text overwrite for the CANCEL button (MessageConfig::buttonTexts)
Template Parameters
TEditThe input to type to create an edit for and to get a value of

Shows an input dialog. The kind of edit to use is determined by using the TEdit type name. The view properties will be applied to both, the dialog and the edit.

See also
MessageConfig, CoreApp::showDialog

Definition at line 370 of file message.h.

◆ getOpenFile() [1/3]

QtMvvm::getOpenFile ( const QString title = {},
const QStringList supportedMimeTypes = {},
const QUrl dir = {} 
)

A shortcut to show a file dialog to select an existing file.

Parameters
titleThe input dialog title (MessageConfig::title)
supportedMimeTypesA list of all allowed mimetypes (MessageConfig::viewProperties, extra property named mimeTypes)
dirThe directory URL to start the file dialog from (MessageConfig::defaultValue)

Shows a file dialog to let the user select an existing file. The selectable files are limited to the mime types allowed.

See also
MessageConfig, CoreApp::showDialog

◆ getOpenFile() [2/3]

QtMvvm::getOpenFile ( QObject scope,
const std::function< void(QUrl)> &  onResult,
const QString title = {},
const QStringList supportedMimeTypes = {},
const QUrl dir = {} 
)

A shortcut to show a file dialog to select an existing file.

Parameters
scopeA scope to limit to. onResult is only called as long as scope has not been deleted
onResultA handler to be called when the file dialog has been closed. Reports the selected file URL or an invalid URL in case the input has been canceled.
titleThe input dialog title (MessageConfig::title)
supportedMimeTypesA list of all allowed mimetypes (MessageConfig::viewProperties, extra property named mimeTypes)
dirThe directory URL to start the file dialog from (MessageConfig::defaultValue)

Shows a file dialog to let the user select an existing file. The selectable files are limited to the mime types allowed.

See also
MessageConfig, CoreApp::showDialog

◆ getOpenFile() [3/3]

QtMvvm::getOpenFile ( const std::function< void(QUrl)> &  onResult,
const QString title = {},
const QStringList supportedMimeTypes = {},
const QUrl dir = {} 
)

A shortcut to show a file dialog to select an existing file.

Parameters
onResultA handler to be called when the file dialog has been closed. Reports the selected file URL or an invalid URL in case the input has been canceled.
titleThe input dialog title (MessageConfig::title)
supportedMimeTypesA list of all allowed mimetypes (MessageConfig::viewProperties, extra property named mimeTypes)
dirThe directory URL to start the file dialog from (MessageConfig::defaultValue)

Shows a file dialog to let the user select an existing file. The selectable files are limited to the mime types allowed.

See also
MessageConfig, CoreApp::showDialog

◆ getOpenFiles() [1/3]

QtMvvm::getOpenFiles ( const QString title = {},
const QStringList supportedMimeTypes = {},
const QUrl dir = {} 
)

A shortcut to show a file dialog to select multiple existing files.

Parameters
titleThe input dialog title (MessageConfig::title)
supportedMimeTypesA list of all allowed mimetypes (MessageConfig::viewProperties, extra property named mimeTypes)
dirThe directory URL to start the file dialog from (MessageConfig::defaultValue)

Shows a file dialog to let the user select multiple existing files. The selectable files are limited to the mime types allowed.

See also
MessageConfig, CoreApp::showDialog

◆ getOpenFiles() [2/3]

QtMvvm::getOpenFiles ( QObject scope,
const std::function< void(QList< QUrl >)> &  onResult,
const QString title = {},
const QStringList supportedMimeTypes = {},
const QUrl dir = {} 
)

A shortcut to show a file dialog to select multiple existing files.

Parameters
scopeA scope to limit to. onResult is only called as long as scope has not been deleted
onResultA handler to be called when the file dialog has been closed. Reports the selected file URLs in a list or an empty list in case the input has been canceled.
titleThe input dialog title (MessageConfig::title)
supportedMimeTypesA list of all allowed mimetypes (MessageConfig::viewProperties, extra property named mimeTypes)
dirThe directory URL to start the file dialog from (MessageConfig::defaultValue)

Shows a file dialog to let the user select multiple existing files. The selectable files are limited to the mime types allowed.

See also
MessageConfig, CoreApp::showDialog

◆ getOpenFiles() [3/3]

QtMvvm::getOpenFiles ( const std::function< void(QList< QUrl >)> &  onResult,
const QString title = {},
const QStringList supportedMimeTypes = {},
const QUrl dir = {} 
)

A shortcut to show a file dialog to select multiple existing files.

Parameters
onResultA handler to be called when the file dialog has been closed. Reports the selected file URLs in a list or an empty list in case the input has been canceled.
titleThe input dialog title (MessageConfig::title)
supportedMimeTypesA list of all allowed mimetypes (MessageConfig::viewProperties, extra property named mimeTypes)
dirThe directory URL to start the file dialog from (MessageConfig::defaultValue)

Shows a file dialog to let the user select multiple existing files. The selectable files are limited to the mime types allowed.

See also
MessageConfig, CoreApp::showDialog

◆ getSaveFile() [1/3]

QtMvvm::getSaveFile ( const QString title = {},
const QStringList supportedMimeTypes = {},
const QUrl dir = {} 
)

A shortcut to show a file dialog to select a new file for saving.

Parameters
titleThe input dialog title (MessageConfig::title)
supportedMimeTypesA list of all allowed mimetypes (MessageConfig::viewProperties, extra property named mimeTypes)
dirThe directory URL to start the file dialog from (MessageConfig::defaultValue)

Shows a file dialog to let the user select an (non existing) file name for saving. The selectable files are limited to the mime types allowed.

See also
MessageConfig, CoreApp::showDialog

◆ getSaveFile() [2/3]

QtMvvm::getSaveFile ( QObject scope,
const std::function< void(QUrl)> &  onResult,
const QString title = {},
const QStringList supportedMimeTypes = {},
const QUrl dir = {} 
)

A shortcut to show a file dialog to select a new file for saving.

Parameters
scopeA scope to limit to. onResult is only called as long as scope has not been deleted
onResultA handler to be called when the file dialog has been closed. Reports the selected file URL or an invalid URL in case the input has been canceled.
titleThe input dialog title (MessageConfig::title)
supportedMimeTypesA list of all allowed mimetypes (MessageConfig::viewProperties, extra property named mimeTypes)
dirThe directory URL to start the file dialog from (MessageConfig::defaultValue)

Shows a file dialog to let the user select an (non existing) file name for saving. The selectable files are limited to the mime types allowed.

See also
MessageConfig, CoreApp::showDialog

◆ getSaveFile() [3/3]

QtMvvm::getSaveFile ( const std::function< void(QUrl)> &  onResult,
const QString title = {},
const QStringList supportedMimeTypes = {},
const QUrl dir = {} 
)

A shortcut to show a file dialog to select a new file for saving.

Parameters
onResultA handler to be called when the file dialog has been closed. Reports the selected file URL or an invalid URL in case the input has been canceled.
titleThe input dialog title (MessageConfig::title)
supportedMimeTypesA list of all allowed mimetypes (MessageConfig::viewProperties, extra property named mimeTypes)
dirThe directory URL to start the file dialog from (MessageConfig::defaultValue)

Shows a file dialog to let the user select an (non existing) file name for saving. The selectable files are limited to the mime types allowed.

See also
MessageConfig, CoreApp::showDialog

◆ information() [1/3]

QtMvvm::information ( const QString title,
const QString text,
const QString okText = {} 
)

A shortcut to show a simple information messagebox.

Parameters
titleThe messagebox title (MessageConfig::title)
textThe primary message text (MessageConfig::text)
okTextAn optional text overwrite for the OK button (MessageConfig::buttonTexts)

Shows a simple informative dialog with a title, a text and the OK button present.

See also
QtMvvm::question, QtMvvm::warning, QtMvvm::critical, QtMvvm::about, MessageConfig, CoreApp::showDialog

◆ information() [2/3]

QtMvvm::information ( const QString title,
const QString text,
QObject scope,
const std::function< void()> &  onResult,
const QString okText = {} 
)

A shortcut to show a simple information messagebox.

Parameters
scopeA scope to limit to. onResult is only called as long as scope has not been deleted
onResultA handler to be called when the message box has been closed
titleThe messagebox title (MessageConfig::title)
textThe primary message text (MessageConfig::text)
okTextAn optional text overwrite for the OK button (MessageConfig::buttonTexts)

Shows a simple informative dialog with a title, a text and the OK button present.

See also
QtMvvm::question, QtMvvm::warning, QtMvvm::critical, QtMvvm::about, MessageConfig, CoreApp::showDialog

◆ information() [3/3]

QtMvvm::information ( const QString title,
const QString text,
const std::function< void()> &  onResult,
const QString okText = {} 
)

A shortcut to show a simple information messagebox.

Parameters
onResultA handler to be called when the message box has been closed
titleThe messagebox title (MessageConfig::title)
textThe primary message text (MessageConfig::text)
okTextAn optional text overwrite for the OK button (MessageConfig::buttonTexts)

Shows a simple informative dialog with a title, a text and the OK button present.

See also
QtMvvm::question, QtMvvm::warning, QtMvvm::critical, QtMvvm::about, MessageConfig, CoreApp::showDialog

◆ question() [1/3]

QtMvvm::question ( const QString title,
const QString text,
const QString yesText = {},
const QString noText = {} 
)

A shortcut to show a simple question messagebox.

Parameters
titleThe messagebox title (MessageConfig::title)
textThe primary message text (MessageConfig::text)
yesTextAn optional text overwrite for the YES button (MessageConfig::buttonTexts)
noTextAn optional text overwrite for the NO button (MessageConfig::buttonTexts)

Shows a simple question dialog with a title, a text and two buttons (typically YES and NO) to ask the user a simple boolean question.

See also
QtMvvm::information, QtMvvm::warning, QtMvvm::critical, MessageConfig, CoreApp::showDialog

◆ question() [2/3]

QtMvvm::question ( const QString title,
const QString text,
QObject scope,
const std::function< void(bool)> &  onResult,
const QString yesText = {},
const QString noText = {} 
)

A shortcut to show a simple question messagebox.

Parameters
scopeA scope to limit to. onResult is only called as long as scope has not been deleted
onResultA handler to be called when the message box has been closed. The parameter is true if the user pressed YES, false if he pressed NO or cancled the dialog
titleThe messagebox title (MessageConfig::title)
textThe primary message text (MessageConfig::text)
yesTextAn optional text overwrite for the YES button (MessageConfig::buttonTexts)
noTextAn optional text overwrite for the NO button (MessageConfig::buttonTexts)

Shows a simple question dialog with a title, a text and two buttons (typically YES and NO) to ask the user a simple boolean question.

See also
QtMvvm::information, QtMvvm::warning, QtMvvm::critical, MessageConfig, CoreApp::showDialog

◆ question() [3/3]

QtMvvm::question ( const QString title,
const QString text,
const std::function< void(bool)> &  onResult,
const QString yesText = {},
const QString noText = {} 
)

A shortcut to show a simple question messagebox.

Parameters
onResultA handler to be called when the message box has been closed. The parameter is true if the user pressed YES, false if he pressed NO or cancled the dialog
titleThe messagebox title (MessageConfig::title)
textThe primary message text (MessageConfig::text)
yesTextAn optional text overwrite for the YES button (MessageConfig::buttonTexts)
noTextAn optional text overwrite for the NO button (MessageConfig::buttonTexts)

Shows a simple question dialog with a title, a text and two buttons (typically YES and NO) to ask the user a simple boolean question.

See also
QtMvvm::information, QtMvvm::warning, QtMvvm::critical, MessageConfig, CoreApp::showDialog

◆ registerDataSyncQuick()

QtMvvm::registerDataSyncQuick ( )

A method to initialize the datasync quick mvvm module.

You must add this method to your main.cpp in order to register all the datasync views with the QuickPresenter when using the quick ui:

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// register other stuff etc...
return a.exec();
}
See also
QuickPresenter

◆ registerDataSyncWidgets()

QtMvvm::registerDataSyncWidgets ( )

A method to initialize the datasync widgets mvvm module.

You must add this method to your main.cpp in order to register all the datasync views with the WidgetsPresenter when using the widgets ui:

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// register other stuff etc...
return a.exec();
}
See also
WidgetsPresenter::registerView

◆ warning() [1/3]

QtMvvm::warning ( const QString title,
const QString text,
const QString okText = {} 
)

A shortcut to show a simple warning messagebox.

Parameters
titleThe messagebox title (MessageConfig::title)
textThe primary message text (MessageConfig::text)
okTextAn optional text overwrite for the OK button (MessageConfig::buttonTexts)

Shows a simple warning dialog with a title, a text and the OK button present.

See also
QtMvvm::question, QtMvvm::information, QtMvvm::critical, MessageConfig, CoreApp::showDialog

◆ warning() [2/3]

QtMvvm::warning ( const QString title,
const QString text,
QObject scope,
const std::function< void()> &  onResult,
const QString okText = {} 
)

A shortcut to show a simple warning messagebox.

Parameters
scopeA scope to limit to. onResult is only called as long as scope has not been deleted
onResultA handler to be called when the message box has been closed
titleThe messagebox title (MessageConfig::title)
textThe primary message text (MessageConfig::text)
okTextAn optional text overwrite for the OK button (MessageConfig::buttonTexts)

Shows a simple warning dialog with a title, a text and the OK button present.

See also
QtMvvm::question, QtMvvm::information, QtMvvm::critical, MessageConfig, CoreApp::showDialog

◆ warning() [3/3]

QtMvvm::warning ( const QString title,
const QString text,
const std::function< void()> &  onResult,
const QString okText = {} 
)

A shortcut to show a simple warning messagebox.

Parameters
onResultA handler to be called when the message box has been closed
titleThe messagebox title (MessageConfig::title)
textThe primary message text (MessageConfig::text)
okTextAn optional text overwrite for the OK button (MessageConfig::buttonTexts)

Shows a simple warning dialog with a title, a text and the OK button present.

See also
QtMvvm::question, QtMvvm::information, QtMvvm::critical, MessageConfig, CoreApp::showDialog