QColor QColorDialogPrivate::currentQColor() const
{
- if (nativeDialogInUse)
+ if (!options->testOption(QColorDialogOptions::DontUseNativeDialog) && nativeDialogInUse)
return platformColorDialogHelper()->currentColor_sys();
return cs->currentQColor();
}
d->selectColor(color);
d->setCurrentAlpha(color.alpha());
- // ### fixme: Call helper
- if (d->nativeDialogInUse)
+ if (!testOption(QColorDialog::DontUseNativeDialog) && d->nativeDialogInUse)
d->platformColorDialogHelper()->setCurrentColor_sys(color);
}
{
Q_Q(QFontDialog);
-#ifdef Q_WS_MAC
- nativeDialogInUse = false;
- delegate = 0;
-#endif
-
q->setSizeGripEnabled(true);
q->setWindowTitle(QFontDialog::tr("Select Font"));
d->strikeout->setChecked(font.strikeOut());
d->underline->setChecked(font.underline());
d->updateFamilies();
- if (QPlatformFontDialogHelper *helper = d->platformFontDialogHelper())
- helper->setCurrentFont_sys(font);
+ if (d->canBeNativeDialog()) {
+ if (QPlatformFontDialogHelper *helper = d->platformFontDialogHelper())
+ helper->setCurrentFont_sys(font);
+ }
#ifdef Q_WS_MAC
if (d->delegate)
QFont QFontDialog::currentFont() const
{
Q_D(const QFontDialog);
- if (const QPlatformFontDialogHelper *helper = d->platformFontDialogHelper())
- return helper->currentFont_sys();
+ if (d->canBeNativeDialog()) {
+ if (const QPlatformFontDialogHelper *helper = d->platformFontDialogHelper())
+ return helper->currentFont_sys();
+ }
return d->sampleEdit->font();
}
d->memberToDisconnectOnClose.clear();
}
-bool QFontDialogPrivate::canBeNativeDialog()
+bool QFontDialogPrivate::canBeNativeDialog() const
{
- Q_Q(QFontDialog);
+ Q_Q(const QFontDialog);
if (nativeDialogInUse)
return true;
if (q->testAttribute(Qt::WA_DontShowOnScreen))
QPointer<QObject> receiverToDisconnectOnClose;
QByteArray memberToDisconnectOnClose;
- bool canBeNativeDialog();
+ bool canBeNativeDialog() const;
void _q_runNativeAppModalPanel();
#ifdef Q_WS_MAC
static void setFont(void *delegate, const QFont &font);
void tst_QFontDialog::task256466_wrongStyle()
{
-#ifdef Q_OS_MAC
- QSKIP("Test crashes on Mac OS X, see QTBUG-24321");
-#endif
-
QFontDatabase fdb;
FriendlyFontDialog dialog;
+ dialog.setOption(QFontDialog::DontUseNativeDialog);
QListView *familyList = reinterpret_cast<QListView*>(dialog.d_func()->familyList);
QListView *styleList = reinterpret_cast<QListView*>(dialog.d_func()->styleList);
QListView *sizeList = reinterpret_cast<QListView*>(dialog.d_func()->sizeList);