Widgets: Use QPlatformDialogHelper in QColorDialog/QFontDialog.
Change-Id: Ib9a2f19679c2d4c8583742a918d61c1a98403843 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>bb10
parent
5e26608ae2
commit
f54411069c
|
|
@ -1663,6 +1663,12 @@ void QColorDialogPrivate::_q_addCustom()
|
|||
nextCust = (nextCust+1) % 16;
|
||||
}
|
||||
|
||||
void QColorDialogPrivate::_q_platformRunNativeAppModalPanel()
|
||||
{
|
||||
if (nativeDialogInUse)
|
||||
platformHelper()->_q_platformRunNativeAppModalPanel();
|
||||
}
|
||||
|
||||
void QColorDialogPrivate::retranslateStrings()
|
||||
{
|
||||
if (!smallDisplay) {
|
||||
|
|
@ -1912,8 +1918,11 @@ void QColorDialog::setVisible(bool visible)
|
|||
}
|
||||
#else
|
||||
|
||||
if (!(d->opts & DontUseNativeDialog) && qt_guiPlatformPlugin()->colorDialogSetVisible(this, visible)) {
|
||||
d->nativeDialogInUse = true;
|
||||
if (!(d->opts & DontUseNativeDialog))
|
||||
if (QPlatformDialogHelper *helper = d->platformHelper())
|
||||
d->nativeDialogInUse = helper->setVisible_sys(visible);
|
||||
|
||||
if (d->nativeDialogInUse) {
|
||||
// Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below
|
||||
// updates the state correctly, but skips showing the non-native version:
|
||||
setAttribute(Qt::WA_DontShowOnScreen);
|
||||
|
|
|
|||
|
|
@ -126,10 +126,7 @@ private:
|
|||
Q_PRIVATE_SLOT(d_func(), void _q_newColorTypedIn(QRgb rgb))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_newCustom(int, int))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_newStandard(int, int))
|
||||
#if defined(Q_WS_MAC)
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_macRunNativeAppModalPanel())
|
||||
#endif
|
||||
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_platformRunNativeAppModalPanel())
|
||||
friend class QColorShower;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ public:
|
|||
void retranslateStrings();
|
||||
|
||||
void _q_addCustom();
|
||||
void _q_platformRunNativeAppModalPanel();
|
||||
|
||||
void _q_newHsv(int h, int s, int v);
|
||||
void _q_newColorTypedIn(QRgb rgb);
|
||||
|
|
@ -114,7 +115,6 @@ public:
|
|||
QColorDialog::ColorDialogOptions opts;
|
||||
QPointer<QObject> receiverToDisconnectOnClose;
|
||||
QByteArray memberToDisconnectOnClose;
|
||||
bool nativeDialogInUse;
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
void openCocoaColorPanel(const QColor &initial,
|
||||
|
|
|
|||
|
|
@ -983,20 +983,18 @@ void QFontDialog::setVisible(bool visible)
|
|||
{
|
||||
if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden) != visible)
|
||||
return;
|
||||
#ifdef Q_WS_MAC
|
||||
Q_D(QFontDialog);
|
||||
if (d->canBeNativeDialog()){
|
||||
if (d->setVisible_sys(visible)){
|
||||
d->nativeDialogInUse = true;
|
||||
// Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below
|
||||
// updates the state correctly, but skips showing the non-native version:
|
||||
setAttribute(Qt::WA_DontShowOnScreen, true);
|
||||
} else {
|
||||
d->nativeDialogInUse = false;
|
||||
setAttribute(Qt::WA_DontShowOnScreen, false);
|
||||
}
|
||||
if (d->canBeNativeDialog())
|
||||
if (QPlatformDialogHelper *helper = d->platformHelper())
|
||||
d->nativeDialogInUse = helper->setVisible_sys(visible);
|
||||
if (d->nativeDialogInUse) {
|
||||
// Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below
|
||||
// updates the state correctly, but skips showing the non-native version:
|
||||
setAttribute(Qt::WA_DontShowOnScreen, true);
|
||||
} else {
|
||||
d->nativeDialogInUse = false;
|
||||
setAttribute(Qt::WA_DontShowOnScreen, false);
|
||||
}
|
||||
#endif // Q_WS_MAC
|
||||
QDialog::setVisible(visible);
|
||||
}
|
||||
|
||||
|
|
@ -1028,7 +1026,6 @@ void QFontDialog::done(int result)
|
|||
d->memberToDisconnectOnClose.clear();
|
||||
}
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
bool QFontDialogPrivate::canBeNativeDialog()
|
||||
{
|
||||
Q_Q(QFontDialog);
|
||||
|
|
@ -1043,7 +1040,6 @@ bool QFontDialogPrivate::canBeNativeDialog()
|
|||
QLatin1String dynamicName(q->metaObject()->className());
|
||||
return (staticName == dynamicName);
|
||||
}
|
||||
#endif // Q_WS_MAC
|
||||
|
||||
/*!
|
||||
\fn QFont QFontDialog::getFont(bool *ok, const QFont &initial, QWidget* parent, const char* name)
|
||||
|
|
|
|||
|
|
@ -138,6 +138,8 @@ public:
|
|||
QPointer<QObject> receiverToDisconnectOnClose;
|
||||
QByteArray memberToDisconnectOnClose;
|
||||
|
||||
bool canBeNativeDialog();
|
||||
void _q_runNativeAppModalPanel();
|
||||
#ifdef Q_WS_MAC
|
||||
static void setFont(void *delegate, const QFont &font);
|
||||
|
||||
|
|
@ -146,12 +148,9 @@ public:
|
|||
|
||||
void *delegate;
|
||||
void closeCocoaFontPanel();
|
||||
bool nativeDialogInUse;
|
||||
bool canBeNativeDialog();
|
||||
|
||||
bool setVisible_sys(bool visible);
|
||||
void createNSFontPanelDelegate();
|
||||
void _q_macRunNativeAppModalPanel();
|
||||
void mac_nativeDialogModalHelp();
|
||||
bool showCocoaFontPanel();
|
||||
bool hideCocoaFontPanel();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue