Fixed issue #623. Issue: Bug with dialog Open file.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-06-19 16:11:44 +03:00
parent e982df63c0
commit 9686d0e179
7 changed files with 31 additions and 15 deletions

View File

@ -137,7 +137,9 @@ void PreferencesPathPage::EditPath()
} }
const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), path, const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), path,
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); QFileDialog::ShowDirsOnly
| QFileDialog::DontResolveSymlinks
| QFileDialog::DontUseNativeDialog);
if (dir.isEmpty()) if (dir.isEmpty())
{ {
if (usedNotExistedDir) if (usedNotExistedDir)

View File

@ -787,7 +787,8 @@ void DialogPatternProperties::InitImage()
void DialogPatternProperties::ChangeImage() void DialogPatternProperties::ChangeImage()
{ {
const QString filter = tr("Images") + QLatin1String(" (*.png *.jpg *.jpeg *.bmp)"); const QString filter = tr("Images") + QLatin1String(" (*.png *.jpg *.jpeg *.bmp)");
const QString fileName = QFileDialog::getOpenFileName(this, tr("Image for pattern"), QString(), filter); const QString fileName = QFileDialog::getOpenFileName(this, tr("Image for pattern"), QString(), filter, nullptr,
QFileDialog::DontUseNativeDialog);
QImage image; QImage image;
if (fileName.isEmpty()) if (fileName.isEmpty())
{ {
@ -832,7 +833,8 @@ void DialogPatternProperties::SaveImage()
QByteArray ba = QByteArray::fromBase64(byteArray); QByteArray ba = QByteArray::fromBase64(byteArray);
const QString extension = QLatin1String(".") + doc->GetImageExtension(); const QString extension = QLatin1String(".") + doc->GetImageExtension();
QString filter = tr("Images") + QLatin1String(" (*") + extension + QLatin1String(")"); QString filter = tr("Images") + QLatin1String(" (*") + extension + QLatin1String(")");
QString filename = QFileDialog::getSaveFileName(this, tr("Save File"), tr("untitled"), filter, &filter); QString filename = QFileDialog::getSaveFileName(this, tr("Save File"), tr("untitled"), filter, &filter,
QFileDialog::DontUseNativeDialog);
if (not filename.isEmpty()) if (not filename.isEmpty())
{ {
if (not filename.endsWith(extension.toUpper())) if (not filename.endsWith(extension.toUpper()))

View File

@ -105,7 +105,9 @@ DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *
} }
const QString dir = QFileDialog::getExistingDirectory(this, tr("Select folder"), dirPath, const QString dir = QFileDialog::getExistingDirectory(this, tr("Select folder"), dirPath,
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); QFileDialog::ShowDirsOnly
| QFileDialog::DontResolveSymlinks
| QFileDialog::DontUseNativeDialog);
if (not dir.isEmpty()) if (not dir.isEmpty())
{// If paths equal the signal will not be called, we will do this manually {// If paths equal the signal will not be called, we will do this manually
dir == ui->lineEditPath->text() ? PathChanged(dir) : ui->lineEditPath->setText(dir); dir == ui->lineEditPath->text() ? PathChanged(dir) : ui->lineEditPath->setText(dir);

View File

@ -1507,7 +1507,8 @@ void MainWindow::LoadIndividual()
usedNotExistedDir = directory.mkpath("."); usedNotExistedDir = directory.mkpath(".");
} }
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter); const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr,
QFileDialog::DontUseNativeDialog);
if (not mPath.isEmpty()) if (not mPath.isEmpty())
{ {
@ -1544,7 +1545,8 @@ void MainWindow::LoadStandard()
//Use standard path to standard measurements //Use standard path to standard measurements
QString path = qApp->ValentinaSettings()->GetPathStandardMeasurements(); QString path = qApp->ValentinaSettings()->GetPathStandardMeasurements();
path = VCommonSettings::PrepareStandardTables(path); path = VCommonSettings::PrepareStandardTables(path);
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter); const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr,
QFileDialog::DontUseNativeDialog);
if (not mPath.isEmpty()) if (not mPath.isEmpty())
{ {
@ -2536,7 +2538,7 @@ bool MainWindow::SaveAs()
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"),
dir + QLatin1String("/") + tr("pattern") + QLatin1String(".val"), dir + QLatin1String("/") + tr("pattern") + QLatin1String(".val"),
filters); filters, nullptr, QFileDialog::DontUseNativeDialog);
auto RemoveTempDir = [usedNotExistedDir, dir]() auto RemoveTempDir = [usedNotExistedDir, dir]()
{ {
@ -2727,7 +2729,8 @@ void MainWindow::Open()
dir = QFileInfo(files.first()).absolutePath(); dir = QFileInfo(files.first()).absolutePath();
} }
qCDebug(vMainWindow, "Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir)); qCDebug(vMainWindow, "Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir));
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter); const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr,
QFileDialog::DontUseNativeDialog);
if (filePath.isEmpty()) if (filePath.isEmpty())
{ {
return; return;
@ -4503,7 +4506,8 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS
//Use standard path to standard measurements //Use standard path to standard measurements
QString path = qApp->ValentinaSettings()->GetPathStandardMeasurements(); QString path = qApp->ValentinaSettings()->GetPathStandardMeasurements();
path = VCommonSettings::PrepareStandardTables(path); path = VCommonSettings::PrepareStandardTables(path);
mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter); mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr,
QFileDialog::DontUseNativeDialog);
} }
else if (patternType == MeasurementsType::Individual) else if (patternType == MeasurementsType::Individual)
{ {
@ -4518,7 +4522,8 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS
usedNotExistedDir = directory.mkpath("."); usedNotExistedDir = directory.mkpath(".");
} }
mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter); mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr,
QFileDialog::DontUseNativeDialog);
if (usedNotExistedDir) if (usedNotExistedDir)
{ {
@ -4541,7 +4546,8 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS
usedNotExistedDir = directory.mkpath("."); usedNotExistedDir = directory.mkpath(".");
} }
mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter); mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr,
QFileDialog::DontUseNativeDialog);
if (usedNotExistedDir) if (usedNotExistedDir)
{ {

View File

@ -859,7 +859,7 @@ void MainWindowsNoGUI::SaveLayoutAs()
QString fileName = QFileDialog::getSaveFileName(this, tr("Print to pdf"), QString fileName = QFileDialog::getSaveFileName(this, tr("Print to pdf"),
dir + QLatin1String("/") + FileName() + QLatin1String(".pdf"), dir + QLatin1String("/") + FileName() + QLatin1String(".pdf"),
tr("PDF file (*.pdf)")); tr("PDF file (*.pdf)"), nullptr, QFileDialog::DontUseNativeDialog);
if (not fileName.isEmpty()) if (not fileName.isEmpty())
{ {
QFileInfo f( fileName ); QFileInfo f( fileName );

View File

@ -111,9 +111,12 @@ QString VPE::VFileEditWidget::getFile() const
void VPE::VFileEditWidget::onToolButtonClicked() void VPE::VFileEditWidget::onToolButtonClicked()
{ {
QString filepath = (Directory ? QFileDialog::getExistingDirectory(0, tr("Directory"), CurrentFilePath) QString filepath = (Directory ? QFileDialog::getExistingDirectory(0, tr("Directory"), CurrentFilePath,
QFileDialog::ShowDirsOnly
| QFileDialog::DontUseNativeDialog)
: QFileDialog::getOpenFileName(0, tr("Open File"), CurrentFilePath, : QFileDialog::getOpenFileName(0, tr("Open File"), CurrentFilePath,
FileDialogFilter)); FileDialogFilter, nullptr,
QFileDialog::DontUseNativeDialog));
if (filepath.isNull() == false) if (filepath.isNull() == false)
{ {
setFile(filepath, true); setFile(filepath, true);

View File

@ -99,7 +99,8 @@ void VAbstractMainWindow::ExportToCSV()
const QString suffix("csv"); const QString suffix("csv");
const QString path = QDir::homePath() + QLatin1String("/") + tr("values") + QLatin1String(".") + suffix; const QString path = QDir::homePath() + QLatin1String("/") + tr("values") + QLatin1String(".") + suffix;
QString fileName = QFileDialog::getSaveFileName(this, tr("Export to CSV"), path, filters); QString fileName = QFileDialog::getSaveFileName(this, tr("Export to CSV"), path, filters, nullptr,
QFileDialog::DontUseNativeDialog);
if (fileName.isEmpty()) if (fileName.isEmpty())
{ {