Browse Source

todo cleanup

pull/2/head
Skycoder42 7 years ago
parent
commit
726321a73d
  1. 2
      src/imports/mvvmquick/PresentingDrawer.qml
  2. 1
      src/imports/mvvmquick/PresentingStackView.qml
  3. 12
      src/imports/mvvmquick/qqmlquickpresenter.cpp
  4. 12
      src/mvvmwidgets/widgetspresenter.cpp
  5. 1
      src/mvvmwidgets/widgetspresenter.h

2
src/imports/mvvmquick/PresentingDrawer.qml

@ -19,7 +19,7 @@ Drawer {
function presentDrawerContent(item) {
if(_mainChild)
_mainChild.destroy();
item.parent = _presentingDrawer.contentItem; //TODO test
item.parent = _presentingDrawer.contentItem;
item.drawer = _presentingDrawer;
_mainChild = item;
return true;

1
src/imports/mvvmquick/PresentingStackView.qml

@ -72,7 +72,6 @@ StackView {
_clearItems = [];
}
//TODO only for android? maybe move to second class?
pushEnter: Transition {
PropertyAnimation {
property: "y"

12
src/imports/mvvmquick/qqmlquickpresenter.cpp

@ -92,8 +92,8 @@ void QQmlQuickPresenter::present(ViewModel *viewModel, const QVariantHash &param
void QQmlQuickPresenter::showDialog(const MessageConfig &config, MessageResult *result)
{
if(!_qmlPresenter) {
qmlWarning(this).space() << "No QML-Presenter registered! Unable to present dialog of type" //TODO use via define EVERYWHERE!!!
<< config.type();
qmlWarning(this).space() << "No QML-Presenter registered! Unable to present dialog of type"
<< config.type();
return;
}
@ -104,7 +104,7 @@ void QQmlQuickPresenter::showDialog(const MessageConfig &config, MessageResult *
Q_ARG(QVariant, QVariant::fromValue(result)));
if(!res.toBool()) {
qmlWarning(this).space() << "Failed to present dialog of type"
<< config.type();
<< config.type();
}
}
@ -143,7 +143,7 @@ void QQmlQuickPresenter::addObject(QQmlComponent *component, ViewModel *viewMode
{
if(!_qmlPresenter) {
qmlWarning(this).space() << "No QML-Presenter registered! Unable to present viewModel of type"
<< viewModel->metaObject()->className();
<< viewModel->metaObject()->className();
return;
}
@ -151,7 +151,7 @@ void QQmlQuickPresenter::addObject(QQmlComponent *component, ViewModel *viewMode
auto item = component->beginCreate(_engine->rootContext());
if(!item) {
qmlWarning(this).space() << "Unable to create quick view from the loaded component"
<< component->url();
<< component->url();
return;
}
item->setProperty("viewModel", QVariant::fromValue(viewModel));
@ -171,7 +171,7 @@ void QQmlQuickPresenter::addObject(QQmlComponent *component, ViewModel *viewMode
QQmlEngine::setObjectOwnership(item, QQmlEngine::JavaScriptOwnership);
} else {
qmlWarning(this).space() << "Failed to present item for viewModel of type"
<< viewModel->metaObject()->className();
<< viewModel->metaObject()->className();
item->deleteLater();
}
}

12
src/mvvmwidgets/widgetspresenter.cpp

@ -66,9 +66,7 @@ void WidgetsPresenter::present(ViewModel *viewModel, const QVariantHash &params,
// initialize viewmodel and view relationship
viewModel->setParent(view);
auto hasCycle = setupLifeCycle(viewModel, view);
if(!hasCycle)
view->setAttribute(Qt::WA_DeleteOnClose);
view->setAttribute(Qt::WA_DeleteOnClose);
viewModel->onInit(params);
// present the view
@ -187,14 +185,6 @@ bool WidgetsPresenter::tryPresent(QWidget *view, QWidget *parentView)
return true;
}
bool WidgetsPresenter::setupLifeCycle(ViewModel *viewModel, QWidget *view)
{
//TODO implement as soon as quick part is ready as well
Q_UNUSED(viewModel)
Q_UNUSED(view)
return false;
}
void WidgetsPresenter::showForeground(QWidget *view) const
{
if(view->windowState().testFlag(Qt::WindowMinimized))

1
src/mvvmwidgets/widgetspresenter.h

@ -51,7 +51,6 @@ Q_SIGNALS:
protected:
virtual const QMetaObject *findWidgetMetaObject(const QMetaObject *viewModelMetaObject);
virtual bool tryPresent(QWidget *view, QWidget *parentView);
virtual bool setupLifeCycle(ViewModel *viewModel, QWidget *view);
virtual void showForeground(QWidget *view) const;

Loading…
Cancel
Save