OSX: FileDialogHelper uses options to remember the selected filter
Task-number: QTBUG-35958 Change-Id: I998cf93232e79f70837cfa8f63592b69ea0dc563 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
parent
61e1bcb4dd
commit
64d95e3df2
@ -665,8 +665,10 @@ void QCocoaFileDialogHelper::selectNameFilter(const QString &filter)
|
|||||||
const int index = options()->nameFilters().indexOf(filter);
|
const int index = options()->nameFilters().indexOf(filter);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
|
QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
|
||||||
if (!delegate)
|
if (!delegate) {
|
||||||
|
options()->setInitiallySelectedNameFilter(filter);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
[delegate->mPopUpButton selectItemAtIndex:index];
|
[delegate->mPopUpButton selectItemAtIndex:index];
|
||||||
[delegate filterChanged:nil];
|
[delegate filterChanged:nil];
|
||||||
}
|
}
|
||||||
@ -676,7 +678,7 @@ QString QCocoaFileDialogHelper::selectedNameFilter() const
|
|||||||
{
|
{
|
||||||
QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
|
QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
|
||||||
if (!delegate)
|
if (!delegate)
|
||||||
return QString();
|
return options()->initiallySelectedNameFilter();
|
||||||
int index = [delegate->mPopUpButton indexOfSelectedItem];
|
int index = [delegate->mPopUpButton indexOfSelectedItem];
|
||||||
if (index >= options()->nameFilters().count())
|
if (index >= options()->nameFilters().count())
|
||||||
return QString();
|
return QString();
|
||||||
|
Loading…
Reference in New Issue
Block a user