Browse Source

added shortcut methods to get the view factories

pull/2/head
Skycoder42 7 years ago
parent
commit
862e43f63e
No known key found for this signature in database GPG Key ID: 8E01AD9EF0578D2B
  1. 5
      src/mvvmquick/quickpresenter.cpp
  2. 2
      src/mvvmquick/quickpresenter.h
  3. 5
      src/mvvmwidgets/widgetspresenter.cpp
  4. 2
      src/mvvmwidgets/widgetspresenter.h

5
src/mvvmquick/quickpresenter.cpp

@ -54,6 +54,11 @@ void QuickPresenter::registerViewExplicitly(const QMetaObject *viewModelType, co
QuickPresenterPrivate::currentPresenter()->d->explicitMappings.insert(viewModelType, viewUrl);
}
InputViewFactory *QuickPresenter::getInputViewFactory()
{
return QuickPresenterPrivate::currentPresenter()->inputViewFactory();
}
void QuickPresenter::present(QtMvvm::ViewModel *viewModel, const QVariantHash &params, QPointer<QtMvvm::ViewModel> parent)
{
if(d->qmlPresenter) {

2
src/mvvmquick/quickpresenter.h

@ -42,6 +42,8 @@ public:
//! @copybrief registerViewExplicitly()
static void registerViewExplicitly(const QMetaObject *viewModelType, const QUrl &viewUrl);
static InputViewFactory* getInputViewFactory();
void present(ViewModel *viewModel, const QVariantHash &params, QPointer<ViewModel> parent) override;
void showDialog(const MessageConfig &config, MessageResult *result) override;

5
src/mvvmwidgets/widgetspresenter.cpp

@ -68,6 +68,11 @@ void WidgetsPresenter::registerViewExplicitly(const QMetaObject *viewModelType,
WidgetsPresenterPrivate::currentPresenter()->d->explicitMappings.insert(viewModelType, viewType);
}
InputWidgetFactory *WidgetsPresenter::getInputWidgetFactory()
{
return WidgetsPresenterPrivate::currentPresenter()->inputWidgetFactory();
}
void WidgetsPresenter::present(ViewModel *viewModel, const QVariantHash &params, QPointer<ViewModel> parent)
{
// find and create view

2
src/mvvmwidgets/widgetspresenter.h

@ -46,6 +46,8 @@ public:
//! @copybrief registerViewExplicitly()
static void registerViewExplicitly(const QMetaObject *viewModelType, const QMetaObject *viewType);
static InputWidgetFactory* getInputWidgetFactory();
void present(ViewModel *viewModel, const QVariantHash &params, QPointer<ViewModel> parent) override;
void showDialog(const MessageConfig &config, MessageResult *result) override;

Loading…
Cancel
Save