diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h index 1d8461d5f22..514d3ac5503 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.h +++ b/src/plugins/platforms/cocoa/qcocoahelpers.h @@ -55,6 +55,7 @@ #include #include #include +#include #include #include @@ -199,7 +200,7 @@ QT_END_NAMESPACE - (instancetype)initWithPanelDelegate:(id)panelDelegate; - (void)dealloc; -- (NSButton *)createButtonWithTitle:(const char *)title; +- (NSButton *)createButtonWithTitle:(QPlatformDialogHelper::StandardButton)type; - (void)layout; @end diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 53741993602..2b1e512cf31 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -394,11 +394,10 @@ QT_END_NAMESPACE { if ((self = [super initWithFrame:NSZeroRect])) { // create OK and Cancel buttons and add these as subviews - _okButton = [self createButtonWithTitle:"&OK"]; + _okButton = [self createButtonWithTitle:QPlatformDialogHelper::Ok]; _okButton.action = @selector(onOkClicked); _okButton.target = panelDelegate; - - _cancelButton = [self createButtonWithTitle:"Cancel"]; + _cancelButton = [self createButtonWithTitle:QPlatformDialogHelper::Cancel]; _cancelButton.action = @selector(onCancelClicked); _cancelButton.target = panelDelegate; @@ -422,12 +421,13 @@ QT_END_NAMESPACE [super dealloc]; } -- (NSButton *)createButtonWithTitle:(const char *)title +- (NSButton *)createButtonWithTitle:(QPlatformDialogHelper::StandardButton)type { NSButton *button = [[NSButton alloc] initWithFrame:NSZeroRect]; button.buttonType = NSMomentaryLightButton; button.bezelStyle = NSRoundedBezelStyle; - const QString &cleanTitle = QPlatformTheme::removeMnemonics(QCoreApplication::translate("QDialogButtonBox", title)); + const QString &cleanTitle = + QPlatformTheme::removeMnemonics(QGuiApplicationPrivate::platformTheme()->standardButtonText(type)); // FIXME: Not obvious, from Cocoa's documentation, that QString::toNSString() makes a deep copy button.title = (NSString *)cleanTitle.toCFString(); ((NSButtonCell *)button.cell).font =