mDelegate keeps the pointer to a QNSFontPanelDelegate, which reacts
on the NSFontPanel used by this dialog helper. It has to be created
before it can be used. On a read-only access, this has been fixed to
return a default-constructed value (like QFont()). For writing access
(like setting the font) the delegate was already created.
The same applies to mDelegate to QNSColorPanelDelegate respective.
Change-Id: I36b89c16d98db9275aa31d399fe094b1d56d800d
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
QCocoaColorDialogHelper::DialogCode QCocoaColorDialogHelper::dialogResultCode_sys()
{
+ if (!mDelegate)
+ return QPlatformDialogHelper::Rejected;
QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *>(mDelegate);
return [delegate dialogResultCode];
}
QColor QCocoaColorDialogHelper::currentColor_sys() const
{
+ if (!mDelegate)
+ return QColor();
return reinterpret_cast<QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *>(mDelegate)->mQtColor;
}
QCocoaFontDialogHelper::DialogCode QCocoaFontDialogHelper::dialogResultCode_sys()
{
+ if (!mDelegate)
+ return QPlatformDialogHelper::Rejected;
QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) *>(mDelegate);
return [delegate dialogResultCode];
}
QFont QCocoaFontDialogHelper::currentFont_sys() const
{
+ if (!mDelegate)
+ return QFont();
return reinterpret_cast<QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) *>(mDelegate)->mQtFont;
}