Changeset 769 for trunk/src/gui/kernel/qwidget.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/kernel/qwidget.cpp
r677 r769 123 123 #include "private/qgesturemanager_p.h" 124 124 125 #ifdef QT_KEYPAD_NAVIGATION 126 #include "qtabwidget.h" // Needed in inTabWidget() 127 #endif // QT_KEYPAD_NAVIGATION 128 125 129 // widget/widget data creation count 126 130 //#define QWIDGET_EXTRA_DEBUG … … 197 201 , isScrolled(0) 198 202 , isMoved(0) 203 , isGLWidget(0) 199 204 , usesDoubleBufferedGLContext(0) 200 205 #if defined(Q_WS_X11) … … 207 212 #elif defined(Q_WS_MAC) 208 213 , needWindowChange(0) 209 , isGLWidget(0)210 214 , window_event(0) 211 215 , qd_hd(0) … … 1446 1450 #endif 1447 1451 1452 #ifdef Q_OS_SYMBIAN 1448 1453 if (d->extra && d->extra->topextra && d->extra->topextra->backingStore) { 1449 1454 // Okay, we are about to destroy the top-level window that owns … … 1455 1460 delete d->extra->topextra->backingStore; 1456 1461 d->extra->topextra->backingStore = 0; 1457 } else if (QWidgetBackingStore *bs = d->maybeBackingStore()) { 1462 } 1463 #endif 1464 if (QWidgetBackingStore *bs = d->maybeBackingStore()) { 1458 1465 bs->removeDirtyWidget(this); 1459 1466 if (testAttribute(Qt::WA_StaticContents)) … … 1487 1494 QWidgetPrivate::allWidgets->remove(this); 1488 1495 1489 QEvent e(QEvent::Destroy); 1490 QCoreApplication::sendEvent(this, &e); 1496 QT_TRY { 1497 QEvent e(QEvent::Destroy); 1498 QCoreApplication::sendEvent(this, &e); 1499 } QT_CATCH(const std::exception&) { 1500 // if this fails we can't do anything about it but at least we are not allowed to throw. 1501 } 1491 1502 } 1492 1503 … … 1676 1687 dirty = QRegion(); 1677 1688 } else if (QWidgetBackingStore *bs = maybeBackingStore()) { 1689 #ifdef QT_MAC_USE_COCOA 1690 Q_UNUSED(bs); 1691 void qt_mac_set_needs_display(QWidget *, QRegion); 1692 qt_mac_set_needs_display(q_func(), QRegion()); 1693 #else 1678 1694 bs->sync(); 1695 #endif 1679 1696 } 1680 1697 } … … 1684 1701 if (paintOnScreen()) 1685 1702 repaint_sys(region); 1686 else if (QWidgetBackingStore *bs = maybeBackingStore()) 1703 else if (QWidgetBackingStore *bs = maybeBackingStore()) { 1704 #ifdef QT_MAC_USE_COCOA 1705 Q_UNUSED(bs); 1706 void qt_mac_set_needs_display(QWidget *, QRegion); 1707 qt_mac_set_needs_display(q_func(), region); 1708 #else 1687 1709 bs->sync(q_func(), region); 1710 #endif 1711 } 1688 1712 } 1689 1713 … … 3368 3392 appear on screen. This also applies to windows. 3369 3393 3370 \sa pos, geometry, minimumSize, maximumSize, resizeEvent() 3394 \sa pos, geometry, minimumSize, maximumSize, resizeEvent(), adjustSize() 3371 3395 */ 3372 3396 … … 6110 6134 if (previousProxyFocus && previousProxyFocus->focusProxy()) 6111 6135 previousProxyFocus = previousProxyFocus->focusProxy(); 6136 if (previousProxyFocus == this && !topData->proxyWidget->d_func()->proxyIsGivingFocus) 6137 return; 6112 6138 } 6113 6139 } … … 7522 7548 if (!widget || widget->isWindow() || widget->testAttribute(Qt::WA_WState_Hidden)) 7523 7549 continue; 7550 #ifdef QT_MAC_USE_COCOA 7551 // Before doing anything we need to make sure that we don't leave anything in a non-consistent state. 7552 // When hiding a widget we need to make sure that no mouse_down events are active, because 7553 // the mouse_up event will never be received by a hidden widget or one of its descendants. 7554 // The solution is simple, before going through with this we check if there are any mouse_down events in 7555 // progress, if so we check if it is related to this widget or not. If so, we just reset the mouse_down and 7556 // then we continue. 7557 // In X11 and Windows we send a mouse_release event, however we don't do that here because we were already 7558 // ignoring that from before. I.e. Carbon did not send the mouse release event, so we will not send the 7559 // mouse release event. There are two ways to interpret this: 7560 // 1. If we don't send the mouse release event, the widget might get into an inconsistent state, i.e. it 7561 // might be waiting for a release event that will never arrive. 7562 // 2. If we send the mouse release event, then the widget might decide to trigger an action that is not 7563 // supposed to trigger because it is not visible. 7564 if(widget == qt_button_down) 7565 qt_button_down = 0; 7566 #endif // QT_MAC_USE_COCOA 7524 7567 if (spontaneous) 7525 7568 widget->setAttribute(Qt::WA_Mapped, false); … … 7916 7959 if(w && w->isWindow() && w->isVisible() && w->isEnabled()) { 7917 7960 LONG dwStyle = GetWindowLong(w->winId(), GWL_STYLE); 7961 LONG newStyle = dwStyle; 7918 7962 if (setStyle) 7919 dwStyle |= WS_DISABLED;7963 newStyle |= WS_DISABLED; 7920 7964 else 7921 dwStyle &= ~WS_DISABLED; 7922 SetWindowLong(w->winId(), GWL_STYLE, dwStyle); 7923 // we might need to repaint in some situations (eg. menu) 7924 w->repaint(); 7965 newStyle &= ~WS_DISABLED; 7966 if (newStyle != dwStyle) { 7967 SetWindowLong(w->winId(), GWL_STYLE, newStyle); 7968 // we might need to repaint in some situations (eg. menu) 7969 w->repaint(); 7970 } 7925 7971 } 7926 7972 } … … 8262 8308 8263 8309 #ifdef QT_SOFTKEYS_ENABLED 8264 if (isWindow() && isActiveWindow())8310 if (isWindow()) 8265 8311 QSoftKeyManager::updateSoftKeys(); 8266 8312 #endif … … 11731 11777 return targetWidget; 11732 11778 } 11779 11780 /*! 11781 \internal 11782 11783 Tells us if it there is currently a reachable widget by keypad navigation in 11784 a certain \a orientation. 11785 If no navigation is possible, occuring key events in that \a orientation may 11786 be used to interact with the value in the focussed widget, even though it 11787 currently has not the editFocus. 11788 11789 \sa QWidgetPrivate::widgetInNavigationDirection(), QWidget::hasEditFocus() 11790 */ 11791 bool QWidgetPrivate::canKeypadNavigate(Qt::Orientation orientation) 11792 { 11793 return orientation == Qt::Horizontal? 11794 (QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionEast) 11795 || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionWest)) 11796 :(QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionNorth) 11797 || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionSouth)); 11798 } 11799 /*! 11800 \internal 11801 11802 Checks, if the \a widget is inside a QTabWidget. If is is inside 11803 one, left/right key events will be used to switch between tabs in keypad 11804 navigation. If there is no QTabWidget, the horizontal key events can be used 11805 to 11806 interact with the value in the focussed widget, even though it currently has 11807 not the editFocus. 11808 11809 \sa QWidget::hasEditFocus() 11810 */ 11811 bool QWidgetPrivate::inTabWidget(QWidget *widget) 11812 { 11813 for (QWidget *tabWidget = widget; tabWidget; tabWidget = tabWidget->parentWidget()) 11814 if (qobject_cast<const QTabWidget*>(tabWidget)) 11815 return true; 11816 return false; 11817 } 11733 11818 #endif 11734 11819
Note:
See TracChangeset
for help on using the changeset viewer.