summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-01-25 14:41:32 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-02-02 11:29:13 +0100
commit1724fccb014a673a97eb3133b182e68f5337d7ae (patch)
tree826f3c4b1d0bd2a9242806f82792ea61e3fee6d7 /src/plugins
parent7f8a80ebf87cccb57da316202e5350eb5eca9d5d (diff)
macOS: Reduce duplicated updates of file dialog properties
Change-Id: I2017bfdfa6d5598405d700680ecaaf04fd6023fd Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index cd92245832..561d702e1f 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -116,6 +116,7 @@ static const int kReturnCodeNotSet = -1;
m_returnCode = kReturnCodeNotSet;
m_helper = helper;
+
m_nameFilterDropDownList = new QStringList(m_options->nameFilters());
QString selectedVisualNameFilter = m_options->initiallySelectedNameFilter();
m_selectedNameFilter = new QStringList([self findStrippedFilterWithVisualFilterName:selectedVisualNameFilter]);
@@ -129,8 +130,6 @@ static const int kReturnCodeNotSet = -1;
m_currentSelection = new QString(sel.absoluteFilePath());
}
- m_panel.title = options->windowTitle().toNSString();
-
[self createPopUpButton:selectedVisualNameFilter hideDetails:options->testOption(QFileDialogOptions::HideNameFilterDetails)];
[self createTextField];
[self createAccessory];
@@ -144,11 +143,6 @@ static const int kReturnCodeNotSet = -1;
if (auto *openPanel = openpanel_cast(m_panel))
openPanel.accessoryViewDisclosed = YES;
- if (m_options->isLabelExplicitlySet(QFileDialogOptions::Accept))
- m_panel.prompt = strippedText(options->labelText(QFileDialogOptions::Accept));
- if (m_options->isLabelExplicitlySet(QFileDialogOptions::FileName))
- m_panel.nameFieldLabel = strippedText(options->labelText(QFileDialogOptions::FileName));
-
[self updateProperties];
}
return self;
@@ -381,6 +375,11 @@ static const int kReturnCodeNotSet = -1;
m_panel.title = m_options->windowTitle().toNSString();
m_panel.canCreateDirectories = !(m_options->testOption(QFileDialogOptions::ReadOnly));
+ if (m_options->isLabelExplicitlySet(QFileDialogOptions::Accept))
+ m_panel.prompt = strippedText(m_options->labelText(QFileDialogOptions::Accept));
+ if (m_options->isLabelExplicitlySet(QFileDialogOptions::FileName))
+ m_panel.nameFieldLabel = strippedText(m_options->labelText(QFileDialogOptions::FileName));
+
if (auto *openPanel = openpanel_cast(m_panel)) {
openPanel.canChooseFiles = !chooseDirsOnly;
openPanel.canChooseDirectories = !chooseFilesOnly;
@@ -597,12 +596,6 @@ void QCocoaFileDialogHelper::setFilter()
{
if (!m_delegate)
return;
- const SharedPointerFileDialogOptions &opts = options();
- m_delegate->m_panel.title = opts->windowTitle().toNSString();
- if (opts->isLabelExplicitlySet(QFileDialogOptions::Accept))
- m_delegate->m_panel.prompt = strippedText(opts->labelText(QFileDialogOptions::Accept));
- if (opts->isLabelExplicitlySet(QFileDialogOptions::FileName))
- m_delegate->m_panel.nameFieldLabel = strippedText(opts->labelText(QFileDialogOptions::FileName));
[m_delegate updateProperties];
}