Changeset 769 for trunk/src/gui/dialogs/qfontdialog.cpp
- Timestamp:
- Aug 2, 2010, 9:27:30 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.3 (added) merged: 768 /branches/vendor/nokia/qt/current merged: 767 /branches/vendor/nokia/qt/4.6.2 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/dialogs/qfontdialog.cpp
r651 r769 990 990 { 991 991 Q_D(QFontDialog); 992 if (visible) 993 d->selectedFont = QFont(); 994 995 #if defined(Q_WS_MAC) 996 bool isCurrentlyVisible = (isVisible() || d->delegate); 997 998 if (!visible == !isCurrentlyVisible) 992 if (visible) { 993 if (testAttribute(Qt::WA_WState_ExplicitShowHide) && !testAttribute(Qt::WA_WState_Hidden)) 994 return; 995 } else if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden)) 999 996 return; 1000 1001 if (visible) { 1002 if (!(d->opts & DontUseNativeDialog) && QFontDialogPrivate::sharedFontPanelAvailable) { 1003 d->delegate = QFontDialogPrivate::openCocoaFontPanel( 1004 currentFont(), parentWidget(), windowTitle(), options(), d); 1005 QFontDialogPrivate::sharedFontPanelAvailable = false; 1006 return; 997 #ifdef Q_WS_MAC 998 if (d->canBeNativeDialog()){ 999 if (d->setVisible_sys(visible)){ 1000 d->nativeDialogInUse = true; 1001 // Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below 1002 // updates the state correctly, but skips showing the non-native version: 1003 setAttribute(Qt::WA_DontShowOnScreen, true); 1004 } else { 1005 d->nativeDialogInUse = false; 1006 setAttribute(Qt::WA_DontShowOnScreen, false); 1007 1007 } 1008 1009 setWindowFlags(windowModality() == Qt::WindowModal ? Qt::Sheet : DefaultWindowFlags); 1010 } else { 1011 if (d->delegate) { 1012 QFontDialogPrivate::closeCocoaFontPanel(d->delegate); 1013 d->delegate = 0; 1014 QFontDialogPrivate::sharedFontPanelAvailable = true; 1015 return; 1016 } 1017 } 1018 #endif 1019 1008 } 1009 #endif // Q_WS_MAC 1020 1010 QDialog::setVisible(visible); 1021 1011 } … … 1033 1023 QDialog::done(result); 1034 1024 if (result == Accepted) { 1035 d->selectedFont = currentFont(); 1025 // We check if this is the same font we had before, if so we emit currentFontChanged 1026 QFont selectedFont = currentFont(); 1027 if(selectedFont != d->selectedFont) 1028 emit(currentFontChanged(selectedFont)); 1029 d->selectedFont = selectedFont; 1036 1030 emit fontSelected(d->selectedFont); 1037 } else {1031 } else 1038 1032 d->selectedFont = QFont(); 1039 }1040 1033 if (d->receiverToDisconnectOnClose) { 1041 1034 disconnect(this, SIGNAL(fontSelected(QFont)), … … 1046 1039 } 1047 1040 1041 #ifdef Q_WS_MAC 1042 bool QFontDialogPrivate::canBeNativeDialog() 1043 { 1044 Q_Q(QFontDialog); 1045 if (nativeDialogInUse) 1046 return true; 1047 if (q->testAttribute(Qt::WA_DontShowOnScreen)) 1048 return false; 1049 if (opts & QFontDialog::DontUseNativeDialog) 1050 return false; 1051 1052 QLatin1String staticName(QFontDialog::staticMetaObject.className()); 1053 QLatin1String dynamicName(q->metaObject()->className()); 1054 return (staticName == dynamicName); 1055 } 1056 #endif // Q_WS_MAC 1057 1048 1058 /*! 1049 1059 \fn QFont QFontDialog::getFont(bool *ok, const QFont &initial, QWidget* parent, const char* name)
Note:
See TracChangeset
for help on using the changeset viewer.