|
@ -284,8 +284,7 @@ void WidgetsPresenter::presentMessageBox(const MessageConfig &config, QPointer<M |
|
|
//special properties
|
|
|
//special properties
|
|
|
QSharedPointer<bool> checked; |
|
|
QSharedPointer<bool> checked; |
|
|
auto props = config.viewProperties(); |
|
|
auto props = config.viewProperties(); |
|
|
if(!props.value(QStringLiteral("modal"), false).toBool()) |
|
|
info.parent = WidgetsPresenterPrivate::parent(props); |
|
|
info.parent = QApplication::activeWindow(); |
|
|
|
|
|
if(props.contains(QStringLiteral("windowTitle"))) |
|
|
if(props.contains(QStringLiteral("windowTitle"))) |
|
|
info.windowTitle = props.value(QStringLiteral("windowTitle")).toString(); |
|
|
info.windowTitle = props.value(QStringLiteral("windowTitle")).toString(); |
|
|
if(props.contains(QStringLiteral("details"))) |
|
|
if(props.contains(QStringLiteral("details"))) |
|
@ -320,10 +319,7 @@ void WidgetsPresenter::presentMessageBox(const MessageConfig &config, QPointer<M |
|
|
void WidgetsPresenter::presentInputDialog(const MessageConfig &config, QPointer<MessageResult> result) |
|
|
void WidgetsPresenter::presentInputDialog(const MessageConfig &config, QPointer<MessageResult> result) |
|
|
{ |
|
|
{ |
|
|
auto input = d->inputViewFactory->createInput(config.subType(), nullptr, config.viewProperties()); |
|
|
auto input = d->inputViewFactory->createInput(config.subType(), nullptr, config.viewProperties()); |
|
|
QWidget *parent = nullptr; |
|
|
auto dialog = new QDialog{WidgetsPresenterPrivate::parent(config.viewProperties())}; |
|
|
if(!config.viewProperties().value(QStringLiteral("modal"), false).toBool()) |
|
|
|
|
|
parent = QApplication::activeWindow(); |
|
|
|
|
|
auto dialog = new QDialog(parent); |
|
|
|
|
|
dialog->setAttribute(Qt::WA_DeleteOnClose); |
|
|
dialog->setAttribute(Qt::WA_DeleteOnClose); |
|
|
result->setCloseTarget(dialog, QStringLiteral("reject()")); |
|
|
result->setCloseTarget(dialog, QStringLiteral("reject()")); |
|
|
auto layout = new QVBoxLayout(dialog); |
|
|
auto layout = new QVBoxLayout(dialog); |
|
@ -379,11 +375,7 @@ void WidgetsPresenter::presentInputDialog(const MessageConfig &config, QPointer< |
|
|
void WidgetsPresenter::presentFileDialog(const MessageConfig &config, QPointer<MessageResult> result) |
|
|
void WidgetsPresenter::presentFileDialog(const MessageConfig &config, QPointer<MessageResult> result) |
|
|
{ |
|
|
{ |
|
|
auto props = config.viewProperties(); |
|
|
auto props = config.viewProperties(); |
|
|
|
|
|
auto dialog = new QFileDialog{WidgetsPresenterPrivate::parent(props)}; |
|
|
QWidget *parent = nullptr; |
|
|
|
|
|
if(!props.value(QStringLiteral("modal"), false).toBool()) |
|
|
|
|
|
parent = QApplication::activeWindow(); |
|
|
|
|
|
auto dialog = new QFileDialog(parent); |
|
|
|
|
|
dialog->setAttribute(Qt::WA_DeleteOnClose); |
|
|
dialog->setAttribute(Qt::WA_DeleteOnClose); |
|
|
result->setCloseTarget(dialog, QStringLiteral("reject()")); |
|
|
result->setCloseTarget(dialog, QStringLiteral("reject()")); |
|
|
|
|
|
|
|
@ -440,11 +432,7 @@ void WidgetsPresenter::presentFileDialog(const MessageConfig &config, QPointer<M |
|
|
void WidgetsPresenter::presentColorDialog(const MessageConfig &config, const QPointer<MessageResult> &result) |
|
|
void WidgetsPresenter::presentColorDialog(const MessageConfig &config, const QPointer<MessageResult> &result) |
|
|
{ |
|
|
{ |
|
|
auto props = config.viewProperties(); |
|
|
auto props = config.viewProperties(); |
|
|
|
|
|
auto dialog = new QColorDialog{WidgetsPresenterPrivate::parent(props)}; |
|
|
QWidget *parent = nullptr; |
|
|
|
|
|
if(!props.value(QStringLiteral("modal"), false).toBool()) |
|
|
|
|
|
parent = QApplication::activeWindow(); |
|
|
|
|
|
auto dialog = new QColorDialog{parent}; |
|
|
|
|
|
dialog->setAttribute(Qt::WA_DeleteOnClose); |
|
|
dialog->setAttribute(Qt::WA_DeleteOnClose); |
|
|
result->setCloseTarget(dialog, QStringLiteral("reject()")); |
|
|
result->setCloseTarget(dialog, QStringLiteral("reject()")); |
|
|
|
|
|
|
|
@ -492,11 +480,7 @@ void WidgetsPresenter::presentProgressDialog(const MessageConfig &config, const |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
auto props = config.viewProperties(); |
|
|
auto props = config.viewProperties(); |
|
|
|
|
|
auto dialog = new ProgressDialog{config, result, control, WidgetsPresenterPrivate::parent(props)}; |
|
|
QWidget *parent = nullptr; //TODO move to seperate method
|
|
|
|
|
|
if(!props.value(QStringLiteral("modal"), false).toBool()) |
|
|
|
|
|
parent = QApplication::activeWindow(); |
|
|
|
|
|
auto dialog = new ProgressDialog{config, result, control, parent}; |
|
|
|
|
|
dialog->setAttribute(Qt::WA_DeleteOnClose); |
|
|
dialog->setAttribute(Qt::WA_DeleteOnClose); |
|
|
result->setCloseTarget(dialog, QStringLiteral("reject()")); |
|
|
result->setCloseTarget(dialog, QStringLiteral("reject()")); |
|
|
dialog->open(); |
|
|
dialog->open(); |
|
@ -529,6 +513,14 @@ WidgetsPresenter *WidgetsPresenterPrivate::currentPresenter() |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QWidget *WidgetsPresenterPrivate::parent(const QVariantMap &properties) |
|
|
|
|
|
{ |
|
|
|
|
|
if(!properties.value(QStringLiteral("modal"), false).toBool()) |
|
|
|
|
|
return QApplication::activeWindow(); |
|
|
|
|
|
else |
|
|
|
|
|
return nullptr; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
QValidator *QtMvvm::createUrlValidator(QStringList schemes, QObject *parent) |
|
|
QValidator *QtMvvm::createUrlValidator(QStringList schemes, QObject *parent) |
|
|
{ |
|
|
{ |
|
|
return new QUrlValidator(std::move(schemes), parent); |
|
|
return new QUrlValidator(std::move(schemes), parent); |
|
|