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.9 6.8 Change-Id: I97427c73fe46f129ca11afa6b2c222bf0f0fb0af Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
678564291d
commit
3d42f31243
@ -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