diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2009-10-09 11:35:16 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2009-10-09 11:35:16 (GMT) |
commit | 6a5be55e5f96758daeca44899bc8598c76c214e7 (patch) | |
tree | 84d1c808bd491a29bbd265e515563ef79dbc3213 /src/gui | |
parent | b8eb2784a1c1a9812d09fca7c8722624f12dbd1c (diff) | |
parent | 2caa16ff98348b043ecc3598e5b9af4a2e2ae3bc (diff) | |
download | Qt-6a5be55e5f96758daeca44899bc8598c76c214e7.zip Qt-6a5be55e5f96758daeca44899bc8598c76c214e7.tar.gz Qt-6a5be55e5f96758daeca44899bc8598c76c214e7.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/dialogs/qprintdialog_mac.mm | 6 | ||||
-rw-r--r-- | src/gui/egl/qeglproperties.cpp | 4 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 53 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsanchorlayout_p.h | 6 | ||||
-rw-r--r-- | src/gui/itemviews/qheaderview.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_mac.mm | 26 | ||||
-rw-r--r-- | src/gui/kernel/qkeymapper_win.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 3 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_s60.cpp | 11 | ||||
-rw-r--r-- | src/gui/painting/qpen.cpp | 14 | ||||
-rw-r--r-- | src/gui/styles/qplastiquestyle.cpp | 2 | ||||
-rw-r--r-- | src/gui/styles/qs60style.cpp | 11 | ||||
-rw-r--r-- | src/gui/text/qfontengine_mac.mm | 7 | ||||
-rw-r--r-- | src/gui/widgets/qabstractslider.cpp | 3 |
14 files changed, 98 insertions, 56 deletions
diff --git a/src/gui/dialogs/qprintdialog_mac.mm b/src/gui/dialogs/qprintdialog_mac.mm index a7587b1..667fc40 100644 --- a/src/gui/dialogs/qprintdialog_mac.mm +++ b/src/gui/dialogs/qprintdialog_mac.mm @@ -166,6 +166,12 @@ QT_USE_NAMESPACE } // Keep us in sync with file output PMDestinationType dest; + + // If the user selected print to file, the session has been + // changed behind our back and our d->ep->session object is a + // dangling pointer. Update it based on the "current" session + d->ep->session = static_cast<PMPrintSession>([d->ep->printInfo PMPrintSession]); + PMSessionGetDestinationType(d->ep->session, d->ep->settings, &dest); if (dest == kPMDestinationFile) { QCFType<CFURLRef> file; diff --git a/src/gui/egl/qeglproperties.cpp b/src/gui/egl/qeglproperties.cpp index 02ae729..c61e1d3 100644 --- a/src/gui/egl/qeglproperties.cpp +++ b/src/gui/egl/qeglproperties.cpp @@ -313,7 +313,7 @@ QString QEglProperties::toString() const int alpha = value(EGL_ALPHA_SIZE); int bufferSize = value(EGL_BUFFER_SIZE); if (bufferSize == (red + green + blue + alpha)) - bufferSize = EGL_DONT_CARE; + bufferSize = 0; str += QLatin1String(" rgba="); str += QString::number(red); str += QLatin1Char(','); @@ -322,7 +322,7 @@ QString QEglProperties::toString() const str += QString::number(blue); str += QLatin1Char(','); str += QString::number(alpha); - if (bufferSize != EGL_DONT_CARE) { + if (bufferSize != 0) { // Only report buffer size if different than r+g+b+a. str += QLatin1String(" buffer-size="); str += QString::number(bufferSize); diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index e3cd4f9..f9b5c8c 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -275,8 +275,8 @@ static qreal getFactor(qreal value, qreal min, qreal pref, qreal max) } } -static qreal getExpandingFactor(qreal expSize, qreal sizeAtPreferred, - qreal sizeAtExpanding, qreal sizeAtMaximum) +static qreal getExpandingFactor(const qreal &expSize, const qreal &sizeAtPreferred, + const qreal &sizeAtExpanding, const qreal &sizeAtMaximum) { const qreal lower = qMin(sizeAtPreferred, sizeAtMaximum); const qreal upper = qMax(sizeAtPreferred, sizeAtMaximum); @@ -1842,10 +1842,10 @@ void QGraphicsAnchorLayoutPrivate::findPaths(Orientation orientation) } } - // We will walk through every reachable items (non-float) and mark them - // by keeping their references on m_nonFloatItems. With this we can easily - // identify non-float and float items. - identifyNonFloatItems(visited, orientation); + // We will walk through every reachable items (non-float) store them in a temporary set. + // We them create a set of all items and subtract the non-floating items from the set in + // order to get the floating items. The floating items is then stored in m_floatItems + identifyFloatItems(visited, orientation); } /*! @@ -2008,14 +2008,20 @@ QGraphicsAnchorLayoutPrivate::getGraphParts(Orientation orientation) Use all visited Anchors on findPaths() so we can identify non-float Items. */ -void QGraphicsAnchorLayoutPrivate::identifyNonFloatItems(QSet<AnchorData *> visited, Orientation orientation) +void QGraphicsAnchorLayoutPrivate::identifyFloatItems(const QSet<AnchorData *> &visited, Orientation orientation) { - m_nonFloatItems[orientation].clear(); + QSet<QGraphicsLayoutItem *> nonFloating; foreach (const AnchorData *ad, visited) - identifyNonFloatItems_helper(ad, orientation); + identifyNonFloatItems_helper(ad, &nonFloating); + + QSet<QGraphicsLayoutItem *> allItems; + foreach (QGraphicsLayoutItem *item, items) + allItems.insert(item); + m_floatItems[orientation] = allItems - nonFloating; } + /*! \internal @@ -2023,22 +2029,22 @@ void QGraphicsAnchorLayoutPrivate::identifyNonFloatItems(QSet<AnchorData *> visi If the anchor is Sequential or Parallel, we must iterate on its children recursively until we reach internal anchors (items). */ -void QGraphicsAnchorLayoutPrivate::identifyNonFloatItems_helper(const AnchorData *ad, Orientation orientation) +void QGraphicsAnchorLayoutPrivate::identifyNonFloatItems_helper(const AnchorData *ad, QSet<QGraphicsLayoutItem *> *nonFloatingItemsIdentifiedSoFar) { Q_Q(QGraphicsAnchorLayout); switch(ad->type) { case AnchorData::Normal: if (ad->from->m_item == ad->to->m_item && ad->to->m_item != q) - m_nonFloatItems[orientation].insert(ad->to->m_item); + nonFloatingItemsIdentifiedSoFar->insert(ad->to->m_item); break; case AnchorData::Sequential: foreach (const AnchorData *d, static_cast<const SequentialAnchorData *>(ad)->m_edges) - identifyNonFloatItems_helper(d, orientation); + identifyNonFloatItems_helper(d, nonFloatingItemsIdentifiedSoFar); break; case AnchorData::Parallel: - identifyNonFloatItems_helper(static_cast<const ParallelAnchorData *>(ad)->firstEdge, orientation); - identifyNonFloatItems_helper(static_cast<const ParallelAnchorData *>(ad)->secondEdge, orientation); + identifyNonFloatItems_helper(static_cast<const ParallelAnchorData *>(ad)->firstEdge, nonFloatingItemsIdentifiedSoFar); + identifyNonFloatItems_helper(static_cast<const ParallelAnchorData *>(ad)->secondEdge, nonFloatingItemsIdentifiedSoFar); break; } } @@ -2070,7 +2076,10 @@ void QGraphicsAnchorLayoutPrivate::setItemsGeometries(const QRectF &geom) foreach (QGraphicsLayoutItem *item, items) { QRectF newGeom; QSizeF itemPreferredSize = item->effectiveSizeHint(Qt::PreferredSize); - if (m_nonFloatItems[Horizontal].contains(item)) { + if (m_floatItems[Horizontal].contains(item)) { + newGeom.setLeft(0); + newGeom.setRight(itemPreferredSize.width()); + } else { firstH = internalVertex(item, Qt::AnchorLeft); secondH = internalVertex(item, Qt::AnchorRight); @@ -2081,20 +2090,17 @@ void QGraphicsAnchorLayoutPrivate::setItemsGeometries(const QRectF &geom) newGeom.setLeft(right - secondH->distance); newGeom.setRight(right - firstH->distance); } - } else { - newGeom.setLeft(0); - newGeom.setRight(itemPreferredSize.width()); } - if (m_nonFloatItems[Vertical].contains(item)) { + if (m_floatItems[Vertical].contains(item)) { + newGeom.setTop(0); + newGeom.setBottom(itemPreferredSize.height()); + } else { firstV = internalVertex(item, Qt::AnchorTop); secondV = internalVertex(item, Qt::AnchorBottom); newGeom.setTop(top + firstV->distance); newGeom.setBottom(top + secondV->distance); - } else { - newGeom.setTop(0); - newGeom.setBottom(itemPreferredSize.height()); } item->setGeometry(newGeom); @@ -2554,8 +2560,7 @@ bool QGraphicsAnchorLayoutPrivate::hasConflicts() const QGraphicsAnchorLayoutPrivate *that = const_cast<QGraphicsAnchorLayoutPrivate*>(this); that->calculateGraphs(); - bool floatConflict = (m_nonFloatItems[0].size() < items.size()) - || (m_nonFloatItems[1].size() < items.size()); + bool floatConflict = !m_floatItems[0].isEmpty() || !m_floatItems[1].isEmpty(); return graphHasConflicts[0] || graphHasConflicts[1] || floatConflict; } diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index 24b25de..9ac0e19 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -443,8 +443,8 @@ public: void constraintsFromPaths(Orientation orientation); QList<QSimplexConstraint *> constraintsFromSizeHints(const QList<AnchorData *> &anchors); QList<QList<QSimplexConstraint *> > getGraphParts(Orientation orientation); - void identifyNonFloatItems(QSet<AnchorData *> visited, Orientation orientation); - void identifyNonFloatItems_helper(const AnchorData *ad, Orientation orientation); + void identifyFloatItems(const QSet<AnchorData *> &visited, Orientation orientation); + void identifyNonFloatItems_helper(const AnchorData *ad, QSet<QGraphicsLayoutItem *> *nonFloatingItemsIdentifiedSoFar); inline AnchorVertex *internalVertex(const QPair<QGraphicsLayoutItem*, Qt::AnchorPoint> &itemEdge) const { @@ -511,7 +511,7 @@ public: // ### bool graphSimplified[2]; bool graphHasConflicts[2]; - QSet<QGraphicsLayoutItem *> m_nonFloatItems[2]; + QSet<QGraphicsLayoutItem *> m_floatItems[2]; uint calculateGraphCacheDirty : 1; }; diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index fc9820f..a754579 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -524,8 +524,10 @@ QSize QHeaderView::sizeHint() const Q_D(const QHeaderView); if (d->cachedSizeHint.isValid()) return d->cachedSizeHint; - d->cachedSizeHint = QSize(0, 0); //reinitialize the cached size hint + int width = 0; + int height = 0; const int sectionCount = count(); + d->executePostedLayout(); // get size hint for the first n sections int i = 0; diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index a95ae9d..f9c8aa3 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -1708,12 +1708,30 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event sizeof(axis), 0, &axis); // The 'new' event has acceleration applied by the OS, while the old (on - // Carbon only), has not. So we introduce acceleration here to be consistent: - int scrollFactor = 120 * qMin(5, qAbs(mdelt)); + // Carbon only), has not. So we introduce acceleration here to be consistent. + // The acceleration is trying to respect both pixel based and line scrolling, + // which turns out to be rather difficult. + int linesToScroll = mdelt > 0 ? 1 : -1; + static QTime t; + int elapsed = t.elapsed(); + t.restart(); + if (elapsed < 20) + linesToScroll *= 120; + else if (elapsed < 30) + linesToScroll *= 60; + else if (elapsed < 50) + linesToScroll *= 30; + else if (elapsed < 100) + linesToScroll *= 6; + else if (elapsed < 200) + linesToScroll *= 3; + else if (elapsed < 300) + linesToScroll *= 2; + if (axis == kEventMouseWheelAxisX) - wheel_deltaX = mdelt * scrollFactor; + wheel_deltaX = linesToScroll * 120; else - wheel_deltaY = mdelt * scrollFactor; + wheel_deltaY = linesToScroll * 120; } } diff --git a/src/gui/kernel/qkeymapper_win.cpp b/src/gui/kernel/qkeymapper_win.cpp index 10958f3..be207df 100644 --- a/src/gui/kernel/qkeymapper_win.cpp +++ b/src/gui/kernel/qkeymapper_win.cpp @@ -905,8 +905,8 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool if(msg.wParam == VK_PROCESSKEY) return true; - // Ignore invalid virtual keycode (see bug 127424) - if (msg.wParam == 0xFF) + // Ignore invalid virtual keycodes (see bugs 127424, QTBUG-3630) + if (msg.wParam == 0 || msg.wParam == 0xFF) return true; // Translate VK_* (native) -> Key_* (Qt) keys diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 4cbf762..56602f7 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -901,9 +901,8 @@ void QWidget::setAutoFillBackground(bool enabled) \sa QEvent, QPainter, QGridLayout, QBoxLayout \section1 Softkeys - \since 4.6 - Softkeys are usually physical keys on a device that have a corresponding label or + Since Qt 4.6, Softkeys are usually physical keys on a device that have a corresponding label or other visual representation on the screen that is generally located next to its physical counterpart. They are most often found on mobile phone platforms. In modern touch based user interfaces it is also possible to have softkeys that do diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 3328cee..b0d405a 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -434,7 +434,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de void QWidgetPrivate::show_sys() { Q_Q(QWidget); - + if (q->testAttribute(Qt::WA_OutsideWSRange)) return; @@ -490,7 +490,12 @@ void QWidgetPrivate::hide_sys() QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId()); if (id) { - if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged() + //Incorrect optimisation - for popup windows, Qt's focus is moved before + //hide_sys is called, resulting in the popup window keeping its elevated + //position in the CONE control stack. + //This can result in keyboard focus being in an invisible widget in some + //conditions - e.g. QTBUG-4733 + //if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged() id->setFocusSafely(false); id->MakeVisible(false); if (QWidgetBackingStore *bs = maybeBackingStore()) @@ -1253,7 +1258,7 @@ void QWidget::grabMouse() WId id = effectiveWinId(); id->SetPointerCapture(true); QWidgetPrivate::mouseGrabber = this; - + #ifndef QT_NO_CURSOR QApplication::setOverrideCursor(cursor()); #endif diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index a050cb2..41efc80 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -411,6 +411,8 @@ Qt::PenStyle QPen::style() const pattern using the setDashPattern() function which implicitly converts the style of the pen to Qt::CustomDashLine. + \note This function resets the dash offset to zero. + \sa style(), {QPen#Pen Style}{Pen Style} */ @@ -420,7 +422,9 @@ void QPen::setStyle(Qt::PenStyle s) return; detach(); d->style = s; - static_cast<QPenData *>(d)->dashPattern.clear(); + QPenData *dd = static_cast<QPenData *>(d); + dd->dashPattern.clear(); + dd->dashOffset = 0; } /*! @@ -538,8 +542,12 @@ void QPen::setDashOffset(qreal offset) if (qFuzzyCompare(offset, static_cast<QPenData *>(d)->dashOffset)) return; detach(); - static_cast<QPenData *>(d)->dashOffset = offset; - d->style = Qt::CustomDashLine; + QPenData *dd = static_cast<QPenData *>(d); + dd->dashOffset = offset; + if (d->style != Qt::CustomDashLine) { + dd->dashPattern = dashPattern(); + d->style = Qt::CustomDashLine; + } } /*! diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index 5052755..ce2109a 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -3309,7 +3309,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op // Draw the text centered QFont font = painter->font(); - font.setPointSize(font.pointSize() - 1); + font.setPointSize(QFontInfo(font).pointSize() - 1); painter->setFont(font); painter->setPen(dockWidget->palette.windowText().color()); painter->drawText(titleRect, diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 6bdb79e..4fa1d03 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -706,11 +706,10 @@ void QS60StylePrivate::setThemePalette(QPalette *palette) const palette->setColor(QPalette::AlternateBase, Qt::transparent); palette->setBrush(QPalette::Base, Qt::transparent); // set button and tooltipbase based on pixel colors -// After natitive pixmap support, colorFromFrameGraphics caused reproducable crashes on some setups. -// const QColor buttonColor = colorFromFrameGraphics(SF_ButtonNormal); -// palette->setColor(QPalette::Button, buttonColor); -// const QColor toolTipColor = colorFromFrameGraphics(SF_ToolTip); -// palette->setColor(QPalette::ToolTipBase, toolTipColor); + const QColor buttonColor = colorFromFrameGraphics(SF_ButtonNormal); + palette->setColor(QPalette::Button, buttonColor); + const QColor toolTipColor = colorFromFrameGraphics(SF_ToolTip); + palette->setColor(QPalette::ToolTipBase, toolTipColor); palette->setColor(QPalette::Light, palette->color(QPalette::Button).lighter()); palette->setColor(QPalette::Dark, palette->color(QPalette::Button).darker()); palette->setColor(QPalette::Midlight, palette->color(QPalette::Button).lighter(125)); @@ -1865,7 +1864,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, painter->save(); painter->setRenderHint(QPainter::Antialiasing); painter->setOpacity(opacity); - painter->setPen(QPen(option->palette.color(QPalette::Highlight), penWidth)); + painter->setPen(QPen(option->palette.color(QPalette::Text), penWidth)); painter->drawRoundedRect(adjustedRect, roundRectRadius, roundRectRadius); painter->restore(); } diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm index 40db7b4..758d8af 100644 --- a/src/gui/text/qfontengine_mac.mm +++ b/src/gui/text/qfontengine_mac.mm @@ -138,9 +138,10 @@ QCoreTextFontEngineMulti::QCoreTextFontEngineMulti(const ATSFontFamilyRef &, con QCFString name; ATSFontGetName(atsFontRef, kATSOptionFlagsDefault, &name); - QCFType<CTFontDescriptorRef> descriptor = CTFontDescriptorCreateWithNameAndSize(name, fontDef.pointSize); - QCFType<CTFontRef> baseFont = CTFontCreateWithFontDescriptor(descriptor, fontDef.pointSize, 0); - ctfont = CTFontCreateCopyWithSymbolicTraits(baseFont, fontDef.pointSize, 0, symbolicTraits, symbolicTraits); + + QCFType<CTFontDescriptorRef> descriptor = CTFontDescriptorCreateWithNameAndSize(name, fontDef.pixelSize); + QCFType<CTFontRef> baseFont = CTFontCreateWithFontDescriptor(descriptor, fontDef.pixelSize, 0); + ctfont = CTFontCreateCopyWithSymbolicTraits(baseFont, fontDef.pixelSize, 0, symbolicTraits, symbolicTraits); // CTFontCreateCopyWithSymbolicTraits returns NULL if we ask for a trait that does // not exist for the given font. (for example italic) diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index 19a8b63..588a48e 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -715,8 +715,7 @@ void QAbstractSlider::wheelEvent(QWheelEvent * e) #else stepsToScroll = int(d->offset_accumulated) * QApplication::wheelScrollLines() * d->singleStep; #endif - if (qAbs(stepsToScroll) > d->pageStep) - stepsToScroll = currentOffset > 0 ? d->pageStep : -d->pageStep; + stepsToScroll = qBound(-d->pageStep, stepsToScroll, d->pageStep); } if (d->invertedControls) |