Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

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

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/graphicsview/qgraphicswidget_p.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4545
    4646#include <QtCore/qdebug.h>
     47#include <QtCore/qnumeric.h>
    4748#include "qgraphicswidget_p.h"
    4849#include "qgraphicslayout.h"
     
    7172    windowFlags = wFlags;
    7273
    73     q->setParentItem(parentItem);
     74    if (parentItem)
     75        setParentItemHelper(parentItem, 0, 0);
     76
    7477    q->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred, QSizePolicy::DefaultType));
    7578    q->setGraphicsItem(q);
     
    7780    resolveLayoutDirection();
    7881    q->unsetWindowFrameMargins();
    79     q->setFlag(QGraphicsItem::ItemUsesExtendedStyleOption);
    80     q->setFlag(QGraphicsItem::ItemSendsGeometryChanges);
     82    flags |= QGraphicsItem::ItemUsesExtendedStyleOption;
     83    flags |= QGraphicsItem::ItemSendsGeometryChanges;
     84    if (windowFlags & Qt::Window)
     85        flags |= QGraphicsItem::ItemIsPanel;
    8186}
    8287
     
    250255void QGraphicsWidgetPrivate::resolveFont(uint inheritedMask)
    251256{
     257    Q_Q(QGraphicsWidget);
    252258    inheritedFontResolveMask = inheritedMask;
     259    if (QGraphicsWidget *p = q->parentWidget())
     260        inheritedFontResolveMask |= p->d_func()->inheritedFontResolveMask;
    253261    QFont naturalFont = naturalWidgetFont();
    254262    QFont resolvedFont = font.resolve(naturalFont);
     
    757765    QGraphicsWidget *firstOld = 0;
    758766    bool wasPreviousNew = true;
    759    
     767
    760768    while (w != q) {
    761769        bool isCurrentNew = q->isAncestorOf(w);
     
    792800
    793801    if (oldScene && newScene != oldScene)
    794         oldScene->d_func()->tabFocusFirst = firstOld;
     802        oldScene->d_func()->tabFocusFirst = (firstOld && firstOld->scene() == oldScene) ? firstOld : 0;
    795803
    796804    QGraphicsItem *topLevelItem = newParent ? newParent->topLevelItem() : 0;
     
    826834}
    827835
     836qreal QGraphicsWidgetPrivate::width() const
     837{
     838    Q_Q(const QGraphicsWidget);
     839    return q->geometry().width();
     840}
     841
     842void QGraphicsWidgetPrivate::setWidth(qreal w)
     843{
     844    if (qIsNaN(w))
     845        return;
     846    Q_Q(QGraphicsWidget);
     847    if (q->geometry().width() == w)
     848        return;
     849
     850    QRectF oldGeom = q->geometry();
     851
     852    q->setGeometry(QRectF(q->x(), q->y(), w, height()));
     853}
     854
     855void QGraphicsWidgetPrivate::resetWidth()
     856{
     857    Q_Q(QGraphicsWidget);
     858    q->setGeometry(QRectF(q->x(), q->y(), 0, height()));
     859}
     860
     861qreal QGraphicsWidgetPrivate::height() const
     862{
     863    Q_Q(const QGraphicsWidget);
     864    return q->geometry().height();
     865}
     866
     867void QGraphicsWidgetPrivate::setHeight(qreal h)
     868{
     869    if (qIsNaN(h))
     870        return;
     871    Q_Q(QGraphicsWidget);
     872    if (q->geometry().height() == h)
     873        return;
     874
     875    QRectF oldGeom = q->geometry();
     876
     877    q->setGeometry(QRectF(q->x(), q->y(), width(), h));
     878}
     879
     880void QGraphicsWidgetPrivate::resetHeight()
     881{
     882    Q_Q(QGraphicsWidget);
     883    q->setGeometry(QRectF(q->x(), q->y(), width(), 0));
     884}
     885
    828886void QGraphicsWidgetPrivate::setGeometryFromSetPos()
    829887{
Note: See TracChangeset for help on using the changeset viewer.