Browse Source

added widgets doc and quick main module doc

(no qml doc yet)
pull/2/head
Skycoder42 7 years ago
parent
commit
a3f19ba689
No known key found for this signature in database GPG Key ID: 8E01AD9EF0578D2B
  1. 159
      doc/inputviewfactory.dox
  2. 14
      doc/inputwidgetfactory.dox
  3. 35
      doc/message.dox
  4. 8
      doc/qtmvvm.dox
  5. 132
      doc/quickpresenter.dox
  6. 71
      doc/widgetspresenter.dox
  7. 4
      src/mvvmquick/inputviewfactory.cpp
  8. 22
      src/mvvmquick/inputviewfactory.h
  9. 14
      src/mvvmquick/quickpresenter.cpp
  10. 19
      src/mvvmquick/quickpresenter.h
  11. 2
      src/mvvmquick/quickpresenter_p.h
  12. 1
      src/mvvmwidgets/inputwidgetfactory.h

159
doc/inputviewfactory.dox

@ -0,0 +1,159 @@
/*!
@class QtMvvm::InputViewFactory
The factory is used by the QuickPresenter to create input views and delegates for various
types. This is used to for example create the edits of input dialogs or for the list delegates
of a SettingsView.
@sa QuickPresenter, QuickPresenter::inputViewFactory, MessageConfig::TypeInputDialog,
QtMvvm::getInput, SettingsViewModel
*/
/*!
@fn QtMvvm::InputViewFactory::getInputUrl
@param type The input type to create a view for
@param viewProperties A map with extra properties to be set on the edit
@returns A url to a QML component suitable for editing input of the given type
The factory first checks if the given type is registered as alias. If yes, it continues with
the aliased type. Then it checks for a url registered as simple view exists for the given
type and uses that one if present. If no simple view is set the default mapping for type to
urls is used (See MessageConfig::TypeInputDialog for a full table of supported types). If no
url can be found for a type, an invalid url is returned.
The viewProperties are used to setup the created view by settings them as properties on the
view. For every key-value-pair in the map, QObject::setProperty is called on the view to
set the property.
@sa MessageConfig::TypeInputDialog, InputViewFactory::addSimpleInput,
InputViewFactory::addInputAlias, InputViewFactory::getDelegate
*/
/*!
@fn QtMvvm::InputViewFactory::getDelegate
@param type The input type to create a delegate for
@param viewProperties A map with extra properties to be set on the delegate
@returns A url to a QML component suitable for editing input of the given type, as a delegate
Delegates can be used to provide "editabel" list items for ListViews. (For example, the
SettingsView makes use of them). Available roles are:
- group
- key
- type
- title
- tooltip
- delegateUrl
- inputValue
- properties
The factory first checks if the given type is registered as alias. If yes, it continues with
the aliased type. Then it checks for a url registered as simple delegate exists for the given
type and uses that one if present. If no simple delegate is set the default mapping for type
to urls is used (See MessageConfig::TypeInputDialog for a full table of supported types). If
no url can be found for a type, the MsgDelegate is returned, which will simply show an input
of the given type. Thus, for all not explicitly supported delegate types, the getInputUrl() is
used to find an edit for the dialog.
The viewProperties are used to setup the created delegate by settings them as properties on
the delegate. For every key-value-pair in the map, QObject::setProperty is called on the
delegate to set the property.
@sa MessageConfig::TypeInputDialog, InputViewFactory::addSimpleDelegate,
InputViewFactory::addDelegateAlias, InputViewFactory::getInputUrl
*/
/*!
@fn QtMvvm::InputViewFactory::addSimpleInput(const QUrl &)
@tparam TType The type to add an input view for
@param qmlFileUrl The URL of the QML file that contains the component
The qmlFileUrl must be a valid URL to a QML file with a displayable quick item. The item must
have a property named `inputValue` that is used to read and write the edit data.
@sa InputViewFactory::getInputUrl, InputViewFactory::addInputAlias
*/
/*!
@fn QtMvvm::InputViewFactory::addSimpleInput(const QByteArray &, const QUrl &)
@param type The type to add an input view for
@param qmlFileUrl The URL of the QML file that contains the component
The qmlFileUrl must be a valid URL to a QML file with a displayable quick item. The item must
have a property named `inputValue` that is used to read and write the edit data.
@sa InputViewFactory::getInputUrl, InputViewFactory::addInputAlias
*/
/*!
@fn QtMvvm::InputViewFactory::addSimpleDelegate(const QUrl &)
@tparam TType The type to add a delegate view for
@param qmlFileUrl The URL of the QML file that contains the component
The qmlFileUrl must be a valid URL to a QML file with a displayable quick item that can be
used as a delegate for a ListView.
@sa InputViewFactory::getDelegate, InputViewFactory::addDelegateAlias
*/
/*!
@fn QtMvvm::InputViewFactory::addSimpleDelegate(const QByteArray &, const QUrl &)
@param type The type to add a delegate view for
@param qmlFileUrl The URL of the QML file that contains the component
The qmlFileUrl must be a valid URL to a QML file with a displayable quick item that can be
used as a delegate for a ListView.
@sa InputViewFactory::getDelegate, InputViewFactory::addDelegateAlias
*/
/*!
@fn QtMvvm::InputViewFactory::addInputAlias()
@tparam TAliasType The type to add as a new alias
@tparam TTargetType The type the alias should be translated to
If an input view for the alias type is requested, one of the target type is created instead.
@sa InputViewFactory::getInputUrl, InputViewFactory::addSimpleInput
*/
/*!
@fn QtMvvm::InputViewFactory::addInputAlias(const QByteArray &, const QByteArray &)
@param alias The type to add as a new alias
@param targetType The type the alias should be translated to
If an input view for the alias type is requested, one of the target type is created instead.
@sa InputViewFactory::getInputUrl, InputViewFactory::addSimpleInput
*/
/*!
@fn QtMvvm::InputViewFactory::addDelegateAlias()
@tparam TAliasType The type to add as a new alias
@tparam TTargetType The type the alias should be translated to
If an delegate view for the alias type is requested, one of the target type is created
instead.
@sa InputViewFactory::getDelegate, InputViewFactory::addSimpleDelegate
*/
/*!
@fn QtMvvm::InputViewFactory::addDelegateAlias(const QByteArray &, const QByteArray &)
@param alias The type to add as a new alias
@param targetType The type the alias should be translated to
If an delegate view for the alias type is requested, one of the target type is created
instead.
@sa InputViewFactory::getDelegate, InputViewFactory::addSimpleDelegate
*/

14
doc/inputwidgetfactory.dox

@ -39,9 +39,10 @@ InputWidgetFactory::addAlias
@tparam TWidget The type of the widget to provide for that type
The TWidget type must extend QWidget and have a constructor that takes a single `QWidget*` as
argument.
argument. It furthermore needs to have a USER property, which is used to read and write the
input value.
@sa MessageConfig::createInput, InputWidgetFactory::addAlias
@sa InputWidgetFactory::createInput, InputWidgetFactory::addAlias
*/
/*!
@ -51,9 +52,10 @@ argument.
@param creator A function that creates a new instance of a widget for the given type
The `QWidget*` argument of the creator function must be used as the parent of the created
widget that is returned by the function.
widget that is returned by the function. It furthermore needs to have a USER property, which is
used to read and write the input value.
@sa MessageConfig::createInput, InputWidgetFactory::addAlias
@sa InputWidgetFactory::createInput, InputWidgetFactory::addAlias
*/
/*!
@ -64,7 +66,7 @@ widget that is returned by the function.
If an input widget for the alias type is requested, one of the target type is created instead.
@sa MessageConfig::createInput, InputWidgetFactory::addSimpleWidget
@sa InputWidgetFactory::createInput, InputWidgetFactory::addSimpleWidget
*/
/*!
@ -75,5 +77,5 @@ If an input widget for the alias type is requested, one of the target type is cr
If an input widget for the alias type is requested, one of the target type is created instead.
@sa MessageConfig::createInput, InputWidgetFactory::addSimpleWidget
@sa InputWidgetFactory::createInput, InputWidgetFactory::addSimpleWidget
*/

35
doc/message.dox

@ -228,22 +228,25 @@ via QVariant can be used as input value. However, only for the most common types
edit views exist. In case you want to use types not present in the list below, you need to
create edit views yourself
Type | Widgets edit | Quick edit
------------------------|-------------------------------|------------
bool | QCheckBox | CheckBox
switch | -/- | Switch
QString, string | QLineEdit | TextField
int | QSpinBox | SpinBox
double, number | QDoubleSpinBox | DoubleSpinBox
QDate | QDateEdit | -/-
QTime | QTimeEdit | -/-
QDateTime, date | QDateTimeEdit | -/-
QFont | QFontComboBox | FontEdit
QKeySequence | QKeySequenceEdit | -/-
QUrl, url | QLineEdit with QUrlValidator | UrlField
selection, list | QComboBox | ListEdit
radiolist | -/- | RadioListEdit
action (settings only) | QPushButton | ItemDelegate
Type | Widgets edit | Quick edit | Quick delegate
------------------------|-------------------------------|---------------|----------------
bool | QCheckBox | CheckBox | BoolDelegate
switch | -/- | Switch | SwitchDelegate
QString, string | QLineEdit | TextField | MsgDelegate (*)
int | QSpinBox | SpinBox | MsgDelegate
double, number | QDoubleSpinBox | DoubleSpinBox | MsgDelegate
QDate | QDateEdit | -/- | -/-
QTime | QTimeEdit | -/- | -/-
QDateTime, date | QDateTimeEdit | -/- | -/-
QFont | QFontComboBox | FontEdit | MsgDelegate
QKeySequence | QKeySequenceEdit | -/- | -/-
QUrl, url | QLineEdit with QUrlValidator | UrlField | MsgDelegate
selection, list | QComboBox | ListEdit | ListDelegate
radiolist | -/- | RadioListEdit | -/-
action (settings only) | QPushButton | -/- | ItemDelegate
(*) The MsgDelegate is used for any type but the ones that have explicit delegates. It will
show a dialog with an input of the "Quick edit" column
The following types have special properties as well:

8
doc/qtmvvm.dox

@ -50,6 +50,14 @@ The following list shows which classes belong to which Qt module, in alphabetica
<b>Current Version</b><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.0
<b>Available Types</b>
- @ref QtMvvm::MessageConfig "MessageConfig" (uncreatable)
- @ref QtMvvm::MessageResult "MessageResult" (uncreatable)
- MvvmBinding
- Message (singleton)
- @ref QtMvvm::SettingsViewModel "SettingsViewModel" (uncreatable)
- @ref QtMvvm::ViewModel "ViewModel" (uncreatable)
*/
/*!

132
doc/quickpresenter.dox

@ -0,0 +1,132 @@
/*!
@class QtMvvm::QuickPresenter
This presenter is automatically registered as the default presenter for the IPresenter
interface with the ServiceRegistry, but as weak service, in order to make it possible to
overwrite it.
The class handles all the logic required for presenting Quick Controsl 2 based views. You can
extend this class and reimplement it's virtual methods if you need to adjust how certain views
or dialogs are presented, or if you want to support custom stuff.
By default, the presenter will use the `":/qtmvvm/views"` directory for finding views. When
presenting a viewmodel, the presenter tries to find a view url with a matching name. If the
viewmodel is for example named `MyViewModel`, then the view must start with `My` too. For
example it can be named `MyView.qml` or `MyDialog.qml`
@note Implicit detection of views for viewmodels can sometimes lead to ambiguities and thus a
wrong view beeing found. In such cases, use registerViewExplicitly() instead.
*/
/*!
@property QtMvvm::QuickPresenter::inputViewFactory
@default{<i>Injected</i>}
Do not set this property yourself. It is automatically injected when showing the viewmodel.
You can use the ServiceRegistry::registerInterface if you need to use a factory different from
the default one.
@accessors{
@readAc{inputViewFactory()}
@writeAc{setInputViewFactory()}
@notifyAc{inputViewFactoryChanged()}
}
@sa #QTMVVM_INJECT
*/
/*!
@fn QtMvvm::QuickPresenter::addViewSearchDir
@param dirPath A path to directory to be searched for input views
Simply adds the directory to the ones beeing searched for views. The new directoy will be
prepended to the search list and thus be searched before any other directory.
@sa QuickPresenter::registerViewExplicitly
*/
/*!
@fn QtMvvm::QuickPresenter::registerViewExplicitly(const QUrl &)
@tparam TViewModel The viewmodel to to register the view for
@param viewUrl The QML url register within the presenter. Must be a valid qml component
The url is registered with the current presenter. It is registered explicitly, which means
that whenever the given viewmodel is beeing presented, this exact url will be used. Explicit
registration have precedence over implicit ones.
@sa QuickPresenter::addViewSearchDir
*/
/*!
@fn QtMvvm::QuickPresenter::registerViewExplicitly(const QMetaObject *, const QUrl &)
@param viewModelType The viewmodel to to register the view for
@param viewUrl The QML url register within the presenter. Must be a valid qml component
The url is registered with the current presenter. It is registered explicitly, which means
that whenever the given viewmodel is beeing presented, this exact url will be used. Explicit
registration have precedence over implicit ones.
@sa QuickPresenter::addViewSearchDir
*/
/*!
@fn QtMvvm::QuickPresenter::presentToQml
@param qmlPresenter The presenter to present the view to
@param viewObject The view QML object to be presented
@returns `true` if successfully presented, `false` if not
Is called from the qml presentation part to actually present a view to another view that takes
the role of a presenter, or the actual main presenter.
The default implementation uses presentMethodIndex() to find a method to call, then calls it
and returns the result of that method call. If no method was found, false is returned.
@sa QuickPresenter::presentMethodIndex
*/
/*!
@fn QtMvvm::QuickPresenter::findViewUrl
@param viewModelType The metobject of the viewmodel to find a view for
@returns The URL of the found file
@throws PresenterException If no view url could be found
The default implementation simply check all explicitly registered views and then tries to
match the name with all qml files available in the search dirs. If no match if found, the
same is tried for the parent viewmodel type recursively, until the ViewModel base is reached.
@sa QuickPresenter::addViewSearchDir
*/
/*!
@fn QtMvvm::QuickPresenter::presentMethodIndex
@param presenterMetaObject The metobject of the presenter to search a method on
@param viewObject The QML item to be presented on that presenter
@returns The index of the method from the meta object to be called, or `-1` if no method could
be found.
This method is called to find the method. The method must take a single argument, the view to
be presented, and return a bool to report whether presenting actually worked or not. The
default implementation first checks if the view extends QQuickPopup, and if yes looks for the
`presentPopup` method. If the view is a normal QQuickItem, the name is analyzed. If the name
contains `Drawer`, the `presentDrawerContent` method is checkd. If the name contains `Tab`,
the `presentTab` method is checkd. If none applies or none was found, the method looks for the
`presentItem` method. If that one is not found as well, `-1 is returned.
@sa QuickPresenter::presentToQml
*/
/*!
@fn QtMvvm::QuickPresenter::nameOrClassContains
@param obj The object to search for the string
@param contained The string to be searched
@param caseSensitive Specifies if the check should be case sensitive
@returns `true` if the object or class name contain the string, `false` if not
*/

71
doc/widgetspresenter.dox

@ -22,6 +22,7 @@ the default one.
@accessors{
@readAc{inputWidgetFactory()}
@writeAc{setInputWidgetFactory()}
@notifyAc{inputWidgetFactoryChanged()}
}
@sa #QTMVVM_INJECT
@ -92,6 +93,7 @@ registration have precedence over implicit ones.
@param viewModelMetaObject The metobject of the viewmodel to find a view for
@returns The metaobject of the view to used, or `nullptr` if none was found
@throws PresenterException If no view could be found
The default implementation simply check all explicitly registered views and then tries to
match the name with the implicitly registered ones. If no match if found, the same is tried
@ -115,3 +117,72 @@ it is presented as QMdiSubWindow. For all other cases, showForeground() is calle
@sa WidgetsPresenter::showForeground, QDialog, QMainWindow, QDockWidget, QMdiArea
*/
/*!
@fn QtMvvm::WidgetsPresenter::showForeground
@param view The view to be presented
This method is called by tryPresent() to simply show a standard window. The method however
does not only show the window, but also makes shure it becomes the currently active
foreground window.
@sa WidgetsPresenter::tryPresent
*/
/*!
@fn QtMvvm::WidgetsPresenter::presentMessageBox
@param config The configuration of the message box
@param result The message result to report the result to
@throws PresenterException If presenting the dialog failed
This method is called by showDialog() to present a dialog from a message config with the
MessageConfig::type set to MessageConfig::TypeMessageBox. You can override it to customize
how to show them.
@sa WidgetsPresenter::showDialog
*/
/*!
@fn QtMvvm::WidgetsPresenter::presentInputDialog
@param config The configuration of the input dialog
@param result The message result to report the result to
@throws PresenterException If presenting the dialog failed
This method is called by showDialog() to present a dialog from a message config with the
MessageConfig::type set to MessageConfig::TypeInputDialog. You can override it to customize
how to show them.
@sa WidgetsPresenter::showDialog
*/
/*!
@fn QtMvvm::WidgetsPresenter::presentFileDialog
@param config The configuration of the file dialog
@param result The message result to report the result to
@throws PresenterException If presenting the dialog failed
This method is called by showDialog() to present a dialog from a message config with the
MessageConfig::type set to MessageConfig::TypeFileDialog. You can override it to customize
how to show them.
@sa WidgetsPresenter::showDialog
*/
/*!
@fn QtMvvm::WidgetsPresenter::presentOtherDialog
@param config The configuration of the dialog
@param result The message result to report the result to
@throws PresenterException If presenting the dialog failed
This method is called by showDialog() to present a dialog from a message config with the
MessageConfig::type set to to custom type (i.e. none of the 3 default types). The default
implementation simply throws the PresenterException. If you want to support additional types
to the 3 default types, reimplement this method to do so.
@sa WidgetsPresenter::showDialog
*/

4
src/mvvmquick/inputviewfactory.cpp

@ -10,8 +10,8 @@
using namespace QtMvvm;
InputViewFactory::InputViewFactory() :
QObject(nullptr),
InputViewFactory::InputViewFactory(QObject *parent) :
QObject(parent),
d(new InputViewFactoryPrivate())
{}

22
src/mvvmquick/inputviewfactory.h

@ -11,32 +11,44 @@
namespace QtMvvm {
class InputViewFactoryPrivate;
//! A factory class to generate input edit views by their type names
class Q_MVVMQUICK_EXPORT InputViewFactory : public QObject
{
Q_OBJECT
public:
InputViewFactory();
//! Default constructor
Q_INVOKABLE InputViewFactory(QObject *parent = nullptr);
virtual ~InputViewFactory();
//! Find the input view URL of the given input type
Q_INVOKABLE virtual QUrl getInputUrl(const QByteArray &type, const QVariantMap &viewProperties);
//! Find the input list delegate URL of the given input type
Q_INVOKABLE virtual QUrl getDelegate(const QByteArray &type, const QVariantMap &viewProperties);
Q_INVOKABLE virtual void addSimpleInput(const QByteArray &type, const QUrl &qmlFileUrl);
//! Adds a new QML file to create views for the given type
template <typename TType>
inline void addSimpleInput(const QUrl &qmlFileUrl);
//! @copybrief addSimpleInput(const QUrl &)
Q_INVOKABLE virtual void addSimpleInput(const QByteArray &type, const QUrl &qmlFileUrl);
Q_INVOKABLE virtual void addSimpleDelegate(const QByteArray &type, const QUrl &qmlFileUrl);
//! Adds a new QML file to create delegates for the given type
template <typename TType>
inline void addSimpleDelegate(const QUrl &qmlFileUrl);
//! @copybrief addSimpleDelegate(const QUrl &)
Q_INVOKABLE virtual void addSimpleDelegate(const QByteArray &type, const QUrl &qmlFileUrl);
Q_INVOKABLE virtual void addInputAlias(const QByteArray &alias, const QByteArray &targetType);
//! Adds a type name alias for views
template <typename TAliasType, typename TTargetType>
inline void addInputAlias();
//! @copybrief addInputAlias()
Q_INVOKABLE virtual void addInputAlias(const QByteArray &alias, const QByteArray &targetType);
Q_INVOKABLE virtual void addDelegateAlias(const QByteArray &alias, const QByteArray &targetType);
//! Adds a type name alias for delegates
template <typename TAliasType, typename TTargetType>
inline void addDelegateAlias();
//! @copybrief addDelegateAlias()
Q_INVOKABLE virtual void addDelegateAlias(const QByteArray &alias, const QByteArray &targetType);
private:
QScopedPointer<InputViewFactoryPrivate> d;

14
src/mvvmquick/quickpresenter.cpp

@ -17,6 +17,7 @@ namespace {
void qtMvvmQuickInit()
{
qmlRegisterType<QUrlValidator>("de.skycoder42.QtMvvm.Quick.Private", 1, 0, "UrlValidator");
QtMvvm::ServiceRegistry::instance()->registerObject<QtMvvm::InputViewFactory>(true);
QtMvvm::ServiceRegistry::instance()->registerInterface<QtMvvm::IPresenter, QtMvvm::QuickPresenter>(true);
}
@ -43,9 +44,9 @@ QuickPresenter::QuickPresenter(QObject *parent) :
QuickPresenter::~QuickPresenter() {}
void QuickPresenter::addViewSearchDir(const QString &dirUrl)
void QuickPresenter::addViewSearchDir(const QString &dirPath)
{
QuickPresenterPrivate::currentPresenter()->d->searchDirs.prepend(dirUrl);
QuickPresenterPrivate::currentPresenter()->d->searchDirs.prepend(dirPath);
}
void QuickPresenter::registerViewExplicitly(const QMetaObject *viewModelType, const QUrl &viewUrl)
@ -93,12 +94,12 @@ bool QuickPresenter::presentToQml(QObject *qmlPresenter, QObject *viewObject)
InputViewFactory *QuickPresenter::inputViewFactory() const
{
return d->inputViewFactory.data();
return d->inputViewFactory;
}
void QuickPresenter::setInputViewFactory(InputViewFactory *inputViewFactory)
{
d->inputViewFactory.reset(inputViewFactory);
d->inputViewFactory = inputViewFactory;
emit inputViewFactoryChanged(inputViewFactory);
}
@ -166,7 +167,8 @@ int QuickPresenter::presentMethodIndex(const QMetaObject *presenterMetaObject, Q
if(nameOrClassContains(viewObject, QStringLiteral("Drawer"))) {
logDebug() << "Presenting" << viewObject->metaObject()->className() << "as drawer";
index = presenterMetaObject->indexOfMethod("presentDrawerContent(QVariant)");
} if(index == -1 && nameOrClassContains(viewObject, QStringLiteral("Tab"))) {
}
if(index == -1 && nameOrClassContains(viewObject, QStringLiteral("Tab"))) {
logDebug() << "Presenting" << viewObject->metaObject()->className() << "as tab";
index = presenterMetaObject->indexOfMethod("presentTab(QVariant)");
}
@ -198,7 +200,7 @@ QuickPresenterPrivate::QuickPresenterPrivate() :
explicitMappings(),
searchDirs({QStringLiteral(":/qtmvvm/views")}),
qmlPresenter(nullptr),
inputViewFactory(new InputViewFactory())
inputViewFactory(nullptr)
{}
QuickPresenter *QuickPresenterPrivate::currentPresenter()

19
src/mvvmquick/quickpresenter.h

@ -15,42 +15,57 @@
namespace QtMvvm {
class QuickPresenterPrivate;
//! The IPresenter implementation for the quick module
class Q_MVVMQUICK_EXPORT QuickPresenter : public QObject, public IPresenter
{
Q_OBJECT
Q_INTERFACES(QtMvvm::IPresenter)
//! The factory to create input views with, as injected property
Q_PROPERTY(InputViewFactory* inputViewFactory READ inputViewFactory WRITE setInputViewFactory NOTIFY inputViewFactoryChanged)
QTMVVM_INJECT(InputViewFactory*, inputViewFactory)
public:
//! Invokable constructor
Q_INVOKABLE explicit QuickPresenter(QObject *parent = nullptr);
~QuickPresenter();
template <typename TPresenter = QuickPresenter>
//! Register a subclass of the QuickPresenter as the active presenter for the CoreApp
template <typename TPresenter>
static void registerAsPresenter();
static void addViewSearchDir(const QString &dirUrl);
//! Adds a directory to search for input views
static void addViewSearchDir(const QString &dirPath);
//! Register a view for a viewmodel to be found by the presenter
template <typename TViewModel>
static void registerViewExplicitly(const QUrl &viewUrl);
//! @copybrief registerViewExplicitly()
static void registerViewExplicitly(const QMetaObject *viewModelType, const QUrl &viewUrl);
void present(ViewModel *viewModel, const QVariantHash &params, QPointer<ViewModel> parent) override;
void showDialog(const MessageConfig &config, MessageResult *result) override;
//! Is called to present a view to presenter living in QML
virtual bool presentToQml(QObject *qmlPresenter, QObject *viewObject);
//! @readAcFn{QuickPresenter::inputViewFactory}
InputViewFactory* inputViewFactory() const;
public Q_SLOTS:
//! @writeAcFn{QuickPresenter::inputViewFactory}
void setInputViewFactory(InputViewFactory* inputViewFactory);
Q_SIGNALS:
//! @notifyAcFn{QuickPresenter::inputViewFactory}
void inputViewFactoryChanged(InputViewFactory* inputViewFactory);
protected:
//! Is called to find the URL of the view to be used for the given viewmodel
virtual QUrl findViewUrl(const QMetaObject *viewModelType);
//! Tries to find the index of a method to present the view object on the presenter
virtual int presentMethodIndex(const QMetaObject *presenterMetaObject, QObject *viewObject);
//! Checks if the object name or class name contains the given string
bool nameOrClassContains(const QObject *obj, const QString &contained, Qt::CaseSensitivity caseSensitive = Qt::CaseInsensitive) const;
private:

2
src/mvvmquick/quickpresenter_p.h

@ -24,7 +24,7 @@ private:
QStringList searchDirs;
QPointer<QObject> qmlPresenter;
QScopedPointer<InputViewFactory> inputViewFactory;
InputViewFactory *inputViewFactory;
};
}

1
src/mvvmwidgets/inputwidgetfactory.h

@ -19,6 +19,7 @@ class InputWidgetFactory : public QObject
Q_OBJECT
public:
//! Default constructor
Q_INVOKABLE explicit InputWidgetFactory(QObject *parent = nullptr);
virtual ~InputWidgetFactory();

Loading…
Cancel
Save