GH-2050 fix cancel button in file browse dialogs filling text fields

This commit is contained in:
Petr Mrázek
2017-12-03 19:21:04 +01:00
parent 95e6f37d39
commit 4bae6fe491
7 changed files with 19 additions and 22 deletions

View File

@ -388,7 +388,7 @@ bool ExportInstanceDialog::doExport()
const QString output = QFileDialog::getSaveFileName(
this, tr("Export %1").arg(m_instance->name()),
FS::PathCombine(QDir::homePath(), name + ".zip"), "Zip (*.zip)", nullptr, QFileDialog::DontConfirmOverwrite);
if (output.isNull())
if (output.isEmpty())
{
return false;
}

View File

@ -54,11 +54,11 @@ void SkinUploadDialog::on_buttonBox_accepted()
void SkinUploadDialog::on_skinBrowseBtn_clicked()
{
QString raw_path = QFileDialog::getOpenFileName(this, tr("Select Skin Texture"), QString(), "*.png");
QString cooked_path = FS::NormalizePath(raw_path);
if (cooked_path.isEmpty() || !QFileInfo::exists(cooked_path))
if (raw_path.isEmpty() || !QFileInfo::exists(raw_path))
{
return;
}
QString cooked_path = FS::NormalizePath(raw_path);
ui->skinPathTextBox->setText(cooked_path);
}