macOS: Emit font dialog change when dialog is not active window
The NSFontPanel emits changeFont even when not the active window, and applications are expected to update their views accordingly. As the changeFont action message is sent through the responder chain we were only picking up the changes when the font panel was active, thanks to the NSWindow delegate we were installing on the panel. But when the active window is one of our other windows, we were failing to process the changeFont message in our QNSView. We now handle the message by forwarding it to the font dialog delegate, so that we enter the same code path as before, and emit the right signals for QFontDialog and friends. Pick-to: 6.8 Change-Id: I97427c73fe46f129ca11afa6b2c222bf0f0fb0af Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 3d42f31243ce52e517e09843b93f40b79925652f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
97880102dc
commit
c04a7aa2c6
@ -14,6 +14,7 @@
|
||||
#include "qcocoafontdialoghelper.h"
|
||||
#include "qcocoahelpers.h"
|
||||
#include "qcocoaeventdispatcher.h"
|
||||
#include "qnsview.h"
|
||||
|
||||
#if !CGFLOAT_DEFINED
|
||||
typedef float CGFloat; // Should only not be defined on 32-bit platforms
|
||||
@ -255,6 +256,18 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate);
|
||||
|
||||
@end
|
||||
|
||||
@interface QNSView (FontPanel)
|
||||
- (void)changeFont:(id)sender;
|
||||
@end
|
||||
|
||||
@implementation QNSView (FontPanel)
|
||||
- (void)changeFont:(id)sender
|
||||
{
|
||||
if (auto *delegate = qt_objc_cast<QNSFontPanelDelegate*>(NSFontPanel.sharedFontPanel.delegate))
|
||||
[delegate changeFont:sender];
|
||||
}
|
||||
@end
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QCocoaFontPanel
|
||||
|
Loading…
x
Reference in New Issue
Block a user