Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/kernel/qwidget.cpp

    r677 r769  
    123123#include "private/qgesturemanager_p.h"
    124124
     125#ifdef QT_KEYPAD_NAVIGATION
     126#include "qtabwidget.h" // Needed in inTabWidget()
     127#endif // QT_KEYPAD_NAVIGATION
     128
    125129// widget/widget data creation count
    126130//#define QWIDGET_EXTRA_DEBUG
     
    197201      , isScrolled(0)
    198202      , isMoved(0)
     203      , isGLWidget(0)
    199204      , usesDoubleBufferedGLContext(0)
    200205#if defined(Q_WS_X11)
     
    207212#elif defined(Q_WS_MAC)
    208213      , needWindowChange(0)
    209       , isGLWidget(0)
    210214      , window_event(0)
    211215      , qd_hd(0)
     
    14461450#endif
    14471451
     1452#ifdef Q_OS_SYMBIAN
    14481453    if (d->extra && d->extra->topextra && d->extra->topextra->backingStore) {
    14491454        // Okay, we are about to destroy the top-level window that owns
     
    14551460        delete d->extra->topextra->backingStore;
    14561461        d->extra->topextra->backingStore = 0;
    1457     } else if (QWidgetBackingStore *bs = d->maybeBackingStore()) {
     1462    }
     1463#endif
     1464    if (QWidgetBackingStore *bs = d->maybeBackingStore()) {
    14581465        bs->removeDirtyWidget(this);
    14591466        if (testAttribute(Qt::WA_StaticContents))
     
    14871494        QWidgetPrivate::allWidgets->remove(this);
    14881495
    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    }
    14911502}
    14921503
     
    16761687        dirty = QRegion();
    16771688    } 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
    16781694        bs->sync();
     1695#endif
    16791696    }
    16801697}
     
    16841701    if (paintOnScreen())
    16851702        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
    16871709        bs->sync(q_func(), region);
     1710#endif
     1711    }
    16881712}
    16891713
     
    33683392    appear on screen. This also applies to windows.
    33693393
    3370     \sa pos, geometry, minimumSize, maximumSize, resizeEvent()
     3394    \sa pos, geometry, minimumSize, maximumSize, resizeEvent(), adjustSize()
    33713395*/
    33723396
     
    61106134            if (previousProxyFocus && previousProxyFocus->focusProxy())
    61116135                previousProxyFocus = previousProxyFocus->focusProxy();
     6136            if (previousProxyFocus == this && !topData->proxyWidget->d_func()->proxyIsGivingFocus)
     6137                return;
    61126138        }
    61136139    }
     
    75227548        if (!widget || widget->isWindow() || widget->testAttribute(Qt::WA_WState_Hidden))
    75237549            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
    75247567        if (spontaneous)
    75257568            widget->setAttribute(Qt::WA_Mapped, false);
     
    79167959    if(w && w->isWindow() && w->isVisible() && w->isEnabled()) {
    79177960        LONG dwStyle = GetWindowLong(w->winId(), GWL_STYLE);
     7961        LONG newStyle = dwStyle;
    79187962        if (setStyle)
    7919             dwStyle |= WS_DISABLED;
     7963            newStyle |= WS_DISABLED;
    79207964        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        }
    79257971    }
    79267972}
     
    82628308
    82638309#ifdef QT_SOFTKEYS_ENABLED
    8264         if (isWindow() && isActiveWindow())
     8310        if (isWindow())
    82658311            QSoftKeyManager::updateSoftKeys();
    82668312#endif
     
    1173111777    return targetWidget;
    1173211778}
     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*/
     11791bool 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
     11805to
     11806    interact with the value in the focussed widget, even though it currently has
     11807    not the editFocus.
     11808
     11809    \sa QWidget::hasEditFocus()
     11810*/
     11811bool 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}
    1173311818#endif
    1173411819
Note: See TracChangeset for help on using the changeset viewer.