QFileDialog: add missing break statements in switch in labelText()

It is of course wrong to potentially return the text of the Cancel
button if the text of the Accept role button was asked for.

Found independently by GCC 7 and Coverity.

Coverity-Id: 11150
Change-Id: Ie30f7875daee16a78eeff4b314ce17cbd7cd3aa8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
bb10
Marc Mutz 2016-10-10 20:34:54 +02:00
parent 9ad4157530
commit dafa7cc7b5
1 changed files with 2 additions and 0 deletions

View File

@ -2042,10 +2042,12 @@ QString QFileDialog::labelText(DialogLabel label) const
button = d->qFileDialogUi->buttonBox->button(QDialogButtonBox::Save);
if (button)
return button->text();
break;
case Reject:
button = d->qFileDialogUi->buttonBox->button(QDialogButtonBox::Cancel);
if (button)
return button->text();
break;
}
return QString();
}