diff options
author | Jani Hautakangas <jani.hautakangas@nokia.com> | 2011-06-22 11:38:32 (GMT) |
---|---|---|
committer | Jani Hautakangas <jani.hautakangas@nokia.com> | 2011-06-22 11:38:32 (GMT) |
commit | 14f10211e72f2d04fa7f4e0faa430eb94c1f8f83 (patch) | |
tree | 1e8d1e2f758c1090a15123cbcb8f615d867caa47 /src/gui | |
parent | e4cce8849bf45be9a111072e3fca7bdf67364e8a (diff) | |
parent | 5e80b137d195625c0d57c1c27e5e8464d1ccfa33 (diff) | |
download | Qt-14f10211e72f2d04fa7f4e0faa430eb94c1f8f83.zip Qt-14f10211e72f2d04fa7f4e0faa430eb94c1f8f83.tar.gz Qt-14f10211e72f2d04fa7f4e0faa430eb94c1f8f83.tar.bz2 |
Merge remote branch 'origin/4.7' into qt-4.8-from-4.7
Conflicts:
src/opengl/qgl.cpp
src/opengl/qpixmapdata_symbiangl.cpp
src/opengl/qwindowsurface_gl.cpp
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/graphicsview/qgraphicslayout.cpp | 14 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicswidget.cpp | 19 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicswidget.h | 2 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicswidget_p.cpp | 14 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicswidget_p.h | 5 | ||||
-rw-r--r-- | src/gui/image/qpixmapdata_p.h | 5 | ||||
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 1 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 5 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_mac.mm | 12 |
9 files changed, 46 insertions, 31 deletions
diff --git a/src/gui/graphicsview/qgraphicslayout.cpp b/src/gui/graphicsview/qgraphicslayout.cpp index 76d2d04..6fbe849 100644 --- a/src/gui/graphicsview/qgraphicslayout.cpp +++ b/src/gui/graphicsview/qgraphicslayout.cpp @@ -269,18 +269,8 @@ void QGraphicsLayout::activate() return; Q_ASSERT(!parentItem->isLayout()); - if (QGraphicsLayout::instantInvalidatePropagation()) { - QGraphicsWidget *parentWidget = static_cast<QGraphicsWidget*>(parentItem); - if (!parentWidget->parentLayoutItem()) { - // we've reached the topmost widget, resize it - bool wasResized = parentWidget->testAttribute(Qt::WA_Resized); - parentWidget->resize(parentWidget->size()); - parentWidget->setAttribute(Qt::WA_Resized, wasResized); - } - - setGeometry(parentItem->contentsRect()); // relayout children - } else { - setGeometry(parentItem->contentsRect()); // relayout children + setGeometry(parentItem->contentsRect()); // relayout children + if (!QGraphicsLayout::instantInvalidatePropagation()) { parentLayoutItem()->updateGeometry(); } } diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 804394a..965b1b34 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -347,11 +347,10 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) { QGraphicsWidgetPrivate *wd = QGraphicsWidget::d_func(); QGraphicsLayoutItemPrivate *d = QGraphicsLayoutItem::d_ptr.data(); - QRectF newGeom; + QRectF newGeom = rect; QPointF oldPos = d->geom.topLeft(); if (!wd->inSetPos) { setAttribute(Qt::WA_Resized); - newGeom = rect; newGeom.setSize(rect.size().expandedTo(effectiveSizeHint(Qt::MinimumSize)) .boundedTo(effectiveSizeHint(Qt::MaximumSize))); @@ -405,14 +404,7 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) emit widthChanged(); if (oldSize.height() != newGeom.size().height()) emit heightChanged(); - QGraphicsLayout *lay = wd->layout; - if (QGraphicsLayout::instantInvalidatePropagation()) { - if (!lay || lay->isActivated()) { - QApplication::sendEvent(this, &re); - } - } else { - QApplication::sendEvent(this, &re); - } + QApplication::sendEvent(this, &re); } } @@ -1091,8 +1083,11 @@ void QGraphicsWidget::updateGeometry() * When the event is received, it will start flowing all the way down to the leaf * widgets in one go. This will make a relayout flicker-free. */ - if (QGraphicsLayout::instantInvalidatePropagation()) - QApplication::postEvent(static_cast<QGraphicsWidget *>(this), new QEvent(QEvent::LayoutRequest)); + if (QGraphicsLayout::instantInvalidatePropagation()) { + Q_D(QGraphicsWidget); + ++d->refCountInvokeRelayout; + QMetaObject::invokeMethod(this, "_q_relayout", Qt::QueuedConnection); + } } if (!QGraphicsLayout::instantInvalidatePropagation()) { bool wasResized = testAttribute(Qt::WA_Resized); diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h index 063be2d..5085817 100644 --- a/src/gui/graphicsview/qgraphicswidget.h +++ b/src/gui/graphicsview/qgraphicswidget.h @@ -234,6 +234,8 @@ protected: private: Q_DISABLE_COPY(QGraphicsWidget) Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QGraphicsWidget) + Q_PRIVATE_SLOT(d_func(), void _q_relayout()) + friend class QGraphicsScene; friend class QGraphicsScenePrivate; friend class QGraphicsView; diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp index 8649dec..ca6713b 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.cpp +++ b/src/gui/graphicsview/qgraphicswidget_p.cpp @@ -233,6 +233,18 @@ void QGraphicsWidgetPrivate::resolveLayoutDirection() } } +/* private slot */ +void QGraphicsWidgetPrivate::_q_relayout() +{ + --refCountInvokeRelayout; + if (refCountInvokeRelayout == 0) { + Q_Q(QGraphicsWidget); + bool wasResized = q->testAttribute(Qt::WA_Resized); + q->resize(q->size()); // this will restrict the size + q->setAttribute(Qt::WA_Resized, wasResized); + } +} + QPalette QGraphicsWidgetPrivate::naturalWidgetPalette() const { Q_Q(const QGraphicsWidget); @@ -903,4 +915,6 @@ void QGraphicsWidgetPrivate::setGeometryFromSetPos() QT_END_NAMESPACE +#include "moc_qgraphicswidget.cpp" + #endif //QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicswidget_p.h b/src/gui/graphicsview/qgraphicswidget_p.h index 398abc3..6ea2586 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.h +++ b/src/gui/graphicsview/qgraphicswidget_p.h @@ -81,6 +81,7 @@ public: polished(0), inSetPos(0), autoFillBackground(0), + refCountInvokeRelayout(0), focusPolicy(Qt::NoFocus), focusNext(0), focusPrev(0), @@ -106,6 +107,7 @@ public: QGraphicsLayout *layout; void setLayoutDirection_helper(Qt::LayoutDirection direction); void resolveLayoutDirection(); + void _q_relayout(); // Style QPalette palette; @@ -179,11 +181,14 @@ public: return false; return (attributes & (1 << bit)) != 0; } + // 32 bits + quint32 refCountInvokeRelayout : 16; quint32 attributes : 10; quint32 inSetGeometry : 1; quint32 polished: 1; quint32 inSetPos : 1; quint32 autoFillBackground : 1; + quint32 padding : 2; // feel free to use // Focus Qt::FocusPolicy focusPolicy; diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index 5b75aa1..f07843d 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -56,6 +56,10 @@ #include <QtGui/qpixmap.h> #include <QtCore/qatomic.h> +#ifdef Q_OS_SYMBIAN +#include <QtGui/private/qvolatileimage_p.h> +#endif + QT_BEGIN_NAMESPACE class QImageReader; @@ -135,6 +139,7 @@ public: } #if defined(Q_OS_SYMBIAN) + virtual QVolatileImage toVolatileImage() const { return QVolatileImage(); } virtual void* toNativeType(NativeType type); virtual void fromNativeType(void* pixmap, NativeType type); #endif diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index ebf0ff8..d603540 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -646,6 +646,7 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) { using namespace Qt; + reset(); commitTemporaryPreeditString(); const bool anynumbermodes = hints & (ImhDigitsOnly | ImhFormattedNumbersOnly | ImhDialableCharactersOnly); diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 31d02d4..086cfec 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1531,6 +1531,11 @@ void QSymbianControl::HandleResourceChange(int resourceType) QResizeEvent e(qt_desktopWidget->size(), qt_desktopWidget->size()); QApplication::sendEvent(qt_desktopWidget, &e); } + // Send resize event to dialogs so they can adjust their position if necessary. + if (qwidget->windowType() & Qt::Dialog) { + QResizeEvent e(qwidget->size(), qwidget->size()); + QApplication::sendEvent(qwidget, &e); + } break; } #endif diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 778f1f1..b3bf365 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -4551,6 +4551,11 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM QPoint oldp = q->pos(); QSize olds = q->size(); + // Apply size restrictions, applicable for Windows & Widgets. + if (QWExtra *extra = extraData()) { + w = qBound(extra->minw, w, extra->maxw); + h = qBound(extra->minh, h, extra->maxh); + } const bool isResize = (olds != QSize(w, h)); if (!realWindow && !isResize && QPoint(x, y) == oldp) @@ -4560,13 +4565,6 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM data.window_state = data.window_state & ~Qt::WindowMaximized; const bool visible = q->isVisible(); - // Apply size restrictions, applicable for Windows & Widgets. - if (QWExtra *extra = extraData()) { - w = qMin(w, extra->maxw); - h = qMin(h, extra->maxh); - w = qMax(w, extra->minw); - h = qMax(h, extra->minh); - } data.crect = QRect(x, y, w, h); if (realWindow) { |