Merge pull request #75 from aws-lumberyard-dev/Atom/guthadam/material_dialog_button_and_modality_fixes
[ATOM-15173 ATOM-15174] Standardizing dialogs across material editor and component
This commit is contained in:
+2
@@ -37,6 +37,8 @@ namespace MaterialEditor
|
|||||||
//Connect ok and cancel buttons
|
//Connect ok and cancel buttons
|
||||||
QObject::connect(m_ui->m_buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
QObject::connect(m_ui->m_buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||||
QObject::connect(m_ui->m_buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
QObject::connect(m_ui->m_buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||||
|
|
||||||
|
setModal(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateMaterialDialog::InitMaterialTypeSelection()
|
void CreateMaterialDialog::InitMaterialTypeSelection()
|
||||||
|
|||||||
+1
@@ -35,6 +35,7 @@ namespace MaterialEditor
|
|||||||
SetupPresetList();
|
SetupPresetList();
|
||||||
SetupSearchWidget();
|
SetupSearchWidget();
|
||||||
SetupDialogButtons();
|
SetupDialogButtons();
|
||||||
|
setModal(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PresetBrowserDialog::SetupPresetList()
|
void PresetBrowserDialog::SetupPresetList()
|
||||||
|
|||||||
+7
-14
@@ -25,6 +25,7 @@ AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnin
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
@@ -215,19 +216,10 @@ namespace AZ
|
|||||||
tableWidget->sortItems(MaterialSlotColumn);
|
tableWidget->sortItems(MaterialSlotColumn);
|
||||||
|
|
||||||
// Create the bottom row of the dialog with action buttons for exporting or canceling the operation
|
// Create the bottom row of the dialog with action buttons for exporting or canceling the operation
|
||||||
QWidget* buttonRow = new QWidget(&dialog);
|
QDialogButtonBox* buttonBox = new QDialogButtonBox(&dialog);
|
||||||
buttonRow->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
|
buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
|
||||||
|
QObject::connect(buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
|
||||||
QPushButton* confirmButton = new QPushButton("Confirm", buttonRow);
|
QObject::connect(buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
|
||||||
QObject::connect(confirmButton, &QPushButton::clicked, confirmButton, [&dialog] { dialog.accept(); });
|
|
||||||
|
|
||||||
QPushButton* cancelButton = new QPushButton("Cancel", buttonRow);
|
|
||||||
QObject::connect(cancelButton, &QPushButton::clicked, cancelButton, [&dialog] { dialog.reject(); });
|
|
||||||
|
|
||||||
QHBoxLayout* buttonLayout = new QHBoxLayout(buttonRow);
|
|
||||||
buttonLayout->addStretch();
|
|
||||||
buttonLayout->addWidget(confirmButton);
|
|
||||||
buttonLayout->addWidget(cancelButton);
|
|
||||||
|
|
||||||
// Create a heading label for the top of the dialog
|
// Create a heading label for the top of the dialog
|
||||||
QLabel* labelWidget = new QLabel("\nSelect the material slots that you want to generate new source materials for. Edit the material file name and location using the file picker.\n", &dialog);
|
QLabel* labelWidget = new QLabel("\nSelect the material slots that you want to generate new source materials for. Edit the material file name and location using the file picker.\n", &dialog);
|
||||||
@@ -236,8 +228,9 @@ namespace AZ
|
|||||||
QVBoxLayout* dialogLayout = new QVBoxLayout(&dialog);
|
QVBoxLayout* dialogLayout = new QVBoxLayout(&dialog);
|
||||||
dialogLayout->addWidget(labelWidget);
|
dialogLayout->addWidget(labelWidget);
|
||||||
dialogLayout->addWidget(tableWidget);
|
dialogLayout->addWidget(tableWidget);
|
||||||
dialogLayout->addWidget(buttonRow);
|
dialogLayout->addWidget(buttonBox);
|
||||||
dialog.setLayout(dialogLayout);
|
dialog.setLayout(dialogLayout);
|
||||||
|
dialog.setModal(true);
|
||||||
|
|
||||||
// Forcing the initial dialog size to accomodate typical content.
|
// Forcing the initial dialog size to accomodate typical content.
|
||||||
// Temporarily settng fixed size because dialog.show/exec invokes WindowDecorationWrapper::showEvent.
|
// Temporarily settng fixed size because dialog.show/exec invokes WindowDecorationWrapper::showEvent.
|
||||||
|
|||||||
+9
-5
@@ -37,6 +37,7 @@
|
|||||||
AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnings spawned by QT
|
AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnings spawned by QT
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
@@ -534,7 +535,7 @@ namespace AZ
|
|||||||
inspector->Populate();
|
inspector->Populate();
|
||||||
inspector->SetOverrides(propertyOverrideMap);
|
inspector->SetOverrides(propertyOverrideMap);
|
||||||
|
|
||||||
// Create the menu bottom row with actions for exporting or canceling the operation
|
// Create the menu button
|
||||||
QToolButton* menuButton = new QToolButton(&dialog);
|
QToolButton* menuButton = new QToolButton(&dialog);
|
||||||
menuButton->setAutoRaise(true);
|
menuButton->setAutoRaise(true);
|
||||||
menuButton->setIcon(QIcon(":/Cards/img/UI20/Cards/menu_ico.svg"));
|
menuButton->setIcon(QIcon(":/Cards/img/UI20/Cards/menu_ico.svg"));
|
||||||
@@ -546,10 +547,6 @@ namespace AZ
|
|||||||
action = menu.addAction("Clear Overrides", [&] { inspector->SetOverrides(MaterialPropertyOverrideMap()); });
|
action = menu.addAction("Clear Overrides", [&] { inspector->SetOverrides(MaterialPropertyOverrideMap()); });
|
||||||
action = menu.addAction("Revert Changes", [&] { inspector->SetOverrides(propertyOverrideMap); });
|
action = menu.addAction("Revert Changes", [&] { inspector->SetOverrides(propertyOverrideMap); });
|
||||||
|
|
||||||
menu.addSeparator();
|
|
||||||
action = menu.addAction("Confirm Changes", [&] { dialog.accept(); });
|
|
||||||
action = menu.addAction("Cancel Changes", [&] { dialog.reject(); });
|
|
||||||
|
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
action = menu.addAction("Save Material", [&] { inspector->SaveMaterial(); });
|
action = menu.addAction("Save Material", [&] { inspector->SaveMaterial(); });
|
||||||
action = menu.addAction("Save Material To Source", [&] { inspector->SaveMaterialToSource(); });
|
action = menu.addAction("Save Material To Source", [&] { inspector->SaveMaterialToSource(); });
|
||||||
@@ -563,12 +560,19 @@ namespace AZ
|
|||||||
menu.exec(QCursor::pos());
|
menu.exec(QCursor::pos());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QDialogButtonBox* buttonBox = new QDialogButtonBox(&dialog);
|
||||||
|
buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
|
||||||
|
QObject::connect(buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
|
||||||
|
QObject::connect(buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
|
||||||
|
|
||||||
QObject::connect(&dialog, &QDialog::rejected, &dialog, [&] { inspector->SetOverrides(propertyOverrideMap); });
|
QObject::connect(&dialog, &QDialog::rejected, &dialog, [&] { inspector->SetOverrides(propertyOverrideMap); });
|
||||||
|
|
||||||
QVBoxLayout* dialogLayout = new QVBoxLayout(&dialog);
|
QVBoxLayout* dialogLayout = new QVBoxLayout(&dialog);
|
||||||
dialogLayout->addWidget(menuButton);
|
dialogLayout->addWidget(menuButton);
|
||||||
dialogLayout->addWidget(inspector);
|
dialogLayout->addWidget(inspector);
|
||||||
|
dialogLayout->addWidget(buttonBox);
|
||||||
dialog.setLayout(dialogLayout);
|
dialog.setLayout(dialogLayout);
|
||||||
|
dialog.setModal(true);
|
||||||
|
|
||||||
// Forcing the initial dialog size to accomodate typical content.
|
// Forcing the initial dialog size to accomodate typical content.
|
||||||
// Temporarily settng fixed size because dialog.show/exec invokes WindowDecorationWrapper::showEvent.
|
// Temporarily settng fixed size because dialog.show/exec invokes WindowDecorationWrapper::showEvent.
|
||||||
|
|||||||
+23
-31
@@ -32,8 +32,11 @@
|
|||||||
AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnings spawned by QT
|
AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnings spawned by QT
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QPushButton>
|
#include <QDialogButtonBox>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QToolButton>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
AZ_POP_DISABLE_WARNING
|
AZ_POP_DISABLE_WARNING
|
||||||
|
|
||||||
@@ -286,42 +289,31 @@ namespace AZ
|
|||||||
MaterialModelUvNameMapInspector* inspector = new MaterialModelUvNameMapInspector(assetId, matModUvOverrides, modelUvNames, matModUvOverrideMapChangedCallBack, &dialog);
|
MaterialModelUvNameMapInspector* inspector = new MaterialModelUvNameMapInspector(assetId, matModUvOverrides, modelUvNames, matModUvOverrideMapChangedCallBack, &dialog);
|
||||||
inspector->Populate();
|
inspector->Populate();
|
||||||
|
|
||||||
// Create the bottom row of the dialog with action buttons for exporting or canceling the operation
|
// Create the menu button
|
||||||
QWidget* buttonRow = new QWidget(&dialog);
|
QToolButton* menuButton = new QToolButton(&dialog);
|
||||||
buttonRow->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
|
menuButton->setAutoRaise(true);
|
||||||
|
menuButton->setIcon(QIcon(":/Cards/img/UI20/Cards/menu_ico.svg"));
|
||||||
|
menuButton->setVisible(true);
|
||||||
|
QObject::connect(menuButton, &QToolButton::clicked, &dialog, [&]() {
|
||||||
|
QAction* action = nullptr;
|
||||||
|
|
||||||
QPushButton* revertButton = new QPushButton("Revert", buttonRow);
|
QMenu menu(&dialog);
|
||||||
QObject::connect(revertButton, &QPushButton::clicked, revertButton, [inspector, matModUvOverrides] {
|
action = menu.addAction("Clear", [&] { inspector->SetUvNameMap(RPI::MaterialModelUvOverrideMap()); });
|
||||||
inspector->SetUvNameMap(matModUvOverrides);
|
action = menu.addAction("Revert", [&] { inspector->SetUvNameMap(matModUvOverrides);; });
|
||||||
});
|
menu.exec(QCursor::pos());
|
||||||
|
});
|
||||||
|
|
||||||
QPushButton* clearButton = new QPushButton("Clear", buttonRow);
|
QDialogButtonBox* buttonBox = new QDialogButtonBox(&dialog);
|
||||||
QObject::connect(clearButton, &QPushButton::clicked, clearButton, [inspector] {
|
buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
|
||||||
inspector->SetUvNameMap(RPI::MaterialModelUvOverrideMap());
|
QObject::connect(buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
|
||||||
});
|
QObject::connect(buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
|
||||||
|
|
||||||
QPushButton* confirmButton = new QPushButton("Confirm", buttonRow);
|
|
||||||
QObject::connect(confirmButton, &QPushButton::clicked, confirmButton, [&dialog] {
|
|
||||||
dialog.accept();
|
|
||||||
});
|
|
||||||
|
|
||||||
QPushButton* cancelButton = new QPushButton("Cancel", buttonRow);
|
|
||||||
QObject::connect(cancelButton, &QPushButton::clicked, cancelButton, [inspector, matModUvOverrides, &dialog] {
|
|
||||||
inspector->SetUvNameMap(matModUvOverrides);
|
|
||||||
dialog.reject();
|
|
||||||
});
|
|
||||||
|
|
||||||
QHBoxLayout* buttonLayout = new QHBoxLayout(buttonRow);
|
|
||||||
buttonLayout->addStretch();
|
|
||||||
buttonLayout->addWidget(revertButton);
|
|
||||||
buttonLayout->addWidget(clearButton);
|
|
||||||
buttonLayout->addWidget(confirmButton);
|
|
||||||
buttonLayout->addWidget(cancelButton);
|
|
||||||
|
|
||||||
QVBoxLayout* dialogLayout = new QVBoxLayout(&dialog);
|
QVBoxLayout* dialogLayout = new QVBoxLayout(&dialog);
|
||||||
|
dialogLayout->addWidget(menuButton);
|
||||||
dialogLayout->addWidget(inspector);
|
dialogLayout->addWidget(inspector);
|
||||||
dialogLayout->addWidget(buttonRow);
|
dialogLayout->addWidget(buttonBox);
|
||||||
dialog.setLayout(dialogLayout);
|
dialog.setLayout(dialogLayout);
|
||||||
|
dialog.setModal(true);
|
||||||
|
|
||||||
// Forcing the initial dialog size to accomodate typical content.
|
// Forcing the initial dialog size to accomodate typical content.
|
||||||
// Temporarily settng fixed size because dialog.show/exec invokes WindowDecorationWrapper::showEvent.
|
// Temporarily settng fixed size because dialog.show/exec invokes WindowDecorationWrapper::showEvent.
|
||||||
|
|||||||
Reference in New Issue
Block a user