diff options
Diffstat (limited to 'src/gui')
73 files changed, 926 insertions, 1405 deletions
diff --git a/src/gui/accessible/qaccessible_mac_p.h b/src/gui/accessible/qaccessible_mac_p.h index 4ee3a2d..e417cb6 100644 --- a/src/gui/accessible/qaccessible_mac_p.h +++ b/src/gui/accessible/qaccessible_mac_p.h @@ -122,7 +122,7 @@ private: QAccessibleInterfaceWrapper wrapper class. It has the same API as QAccessibleInterface, minus the child parameter - in the funcitons. + in the functions. */ class Q_AUTOTEST_EXPORT QAInterface : public QAccessible { @@ -432,7 +432,7 @@ public: /* QAccessibleHierarchyManager bridges the Mac and Qt accessibility hierarchies. There is a one-to-one relationship between QAElements on the Mac side - and QAInterfaces on the Qt side, and this class provies lookup funcitons + and QAInterfaces on the Qt side, and this class provides lookup functions that translates between these to items. The identity of a QAInterface is determined by its QAccessibleInterface and diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 624610b..1b9d127 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -3261,7 +3261,10 @@ QString QFSCompleter::pathFromIndex(const QModelIndex &index) const if (currentLocation == QDir::separator()) return path.mid(currentLocation.length()); #endif - return path.mid(currentLocation.length() + 1); + if (currentLocation.endsWith('/')) + return path.mid(currentLocation.length()); + else + return path.mid(currentLocation.length()+1); } return index.data(QFileSystemModel::FilePathRole).toString(); } diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/gui/dialogs/qfiledialog_win.cpp index 98860c4..feec804 100644 --- a/src/gui/dialogs/qfiledialog_win.cpp +++ b/src/gui/dialogs/qfiledialog_win.cpp @@ -60,7 +60,6 @@ #endif #ifdef Q_WS_WINCE -#include <shlobj.h> #include <commdlg.h> bool qt_priv_ptr_valid = false; #else diff --git a/src/gui/dialogs/qprintdialog.qdoc b/src/gui/dialogs/qprintdialog.qdoc index bd406c1..b75fe2e 100644 --- a/src/gui/dialogs/qprintdialog.qdoc +++ b/src/gui/dialogs/qprintdialog.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/gui/embedded/qcopchannel_qws.cpp b/src/gui/embedded/qcopchannel_qws.cpp index 5786866..0d9d9d3 100644 --- a/src/gui/embedded/qcopchannel_qws.cpp +++ b/src/gui/embedded/qcopchannel_qws.cpp @@ -502,7 +502,7 @@ void QCopChannel::answer(QWSClient *cl, const QString& ch, bool known = qcopServerMap && qcopServerMap->contains(c) && !((*qcopServerMap)[c]).isEmpty(); // Yes, it's a typo, it's not user-visible, and we choose not to fix it for compatibility - QLatin1String ans = QLatin1String(known ? "known" : "unkown"); + QLatin1String ans = QLatin1String(known ? "known" : "unknown"); QWSServerPrivate::sendQCopEvent(cl, QLatin1String(""), ans, data, true); return; diff --git a/src/gui/embedded/qkbd_qws.cpp b/src/gui/embedded/qkbd_qws.cpp index a325b28..1999ddb 100644 --- a/src/gui/embedded/qkbd_qws.cpp +++ b/src/gui/embedded/qkbd_qws.cpp @@ -470,6 +470,8 @@ void QWSKeyboardHandler::endAutoRepeat() /*! \fn QWSKeyboardHandler::KeycodeAction QWSKeyboardHandler::processKeycode(quint16 keycode, bool isPress, bool autoRepeat) + \since 4.6 + Maps \a keycode according to a keymap and sends that key event to the \l{Qt for Embedded Linux} server application. diff --git a/src/gui/embedded/qtransportauth_qws.cpp b/src/gui/embedded/qtransportauth_qws.cpp index 9a50702..90e90d1 100644 --- a/src/gui/embedded/qtransportauth_qws.cpp +++ b/src/gui/embedded/qtransportauth_qws.cpp @@ -445,7 +445,7 @@ QIODevice *QTransportAuth::passThroughByClient( QWSClient *client ) const /*! \internal Return a QIODevice pointer (to an internal QBuffer) which can be used - to receive data after authorisation on transport \a d. + to receive data after authorization on transport \a d. The return QIODevice will act as a pass-through. @@ -468,7 +468,7 @@ QAuthDevice *QTransportAuth::recvBuf( QTransportAuth::Data *data, QIODevice *iod /*! Return a QIODevice pointer (to an internal QBuffer) which can be used - to write data onto, for authorisation on transport \a d. + to write data onto, for authorization on transport \a d. The return QIODevice will act as a pass-through. diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 3ad8f33..e9a2f9f 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -3322,8 +3322,7 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim */ void QGraphicsItem::clearFocus() { - if (hasFocus()) - d_ptr->clearFocusHelper(/* giveFocusToParent = */ true); + d_ptr->clearFocusHelper(/* giveFocusToParent = */ true); } /*! @@ -3337,8 +3336,14 @@ void QGraphicsItemPrivate::clearFocusHelper(bool giveFocusToParent) QGraphicsItem *p = parent; while (p) { if (p->flags() & QGraphicsItem::ItemIsFocusScope) { - p->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ false, - /* focusFromHide = */ false); + if (p->d_ptr->focusScopeItem == q_ptr) { + p->d_ptr->focusScopeItem = 0; + if (!q_ptr->hasFocus()) //if it has focus, focusScopeItemChange is called elsewhere + focusScopeItemChange(false); + } + if (q_ptr->hasFocus()) + p->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ false, + /* focusFromHide = */ false); return; } p = p->d_ptr->parent; @@ -3346,10 +3351,10 @@ void QGraphicsItemPrivate::clearFocusHelper(bool giveFocusToParent) } } - // Invisible items with focus must explicitly clear subfocus. - clearSubFocus(q_ptr); - if (q_ptr->hasFocus()) { + // Invisible items with focus must explicitly clear subfocus. + clearSubFocus(q_ptr); + // If this item has the scene's input focus, clear it. scene->setFocusItem(0); } @@ -3706,6 +3711,8 @@ void QGraphicsItem::setPos(const QPointF &pos) d_ptr->setPosHelper(pos); if (d_ptr->isWidget) static_cast<QGraphicsWidget *>(this)->d_func()->setGeometryFromSetPos(); + if (d_ptr->scenePosDescendants) + d_ptr->sendScenePosChange(); return; } @@ -4388,8 +4395,10 @@ void QGraphicsItem::setTransform(const QTransform &matrix, bool combine) return; // Update and set the new transformation. - if (!(d_ptr->flags & ItemSendsGeometryChanges)) { + if (!(d_ptr->flags & (ItemSendsGeometryChanges | ItemSendsScenePositionChanges))) { d_ptr->setTransformHelper(newTransform); + if (d_ptr->scenePosDescendants) + d_ptr->sendScenePosChange(); return; } diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 8480c19..1b7aa97 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -722,7 +722,7 @@ public: /*! Returns true if \a item1 is on top of \a item2. - The items dont need to be siblings. + The items don't need to be siblings. \internal */ @@ -776,7 +776,7 @@ inline bool qt_closestItemFirst(const QGraphicsItem *item1, const QGraphicsItem /*! Returns true if \a item2 is on top of \a item1. - The items dont need to be siblings. + The items don't need to be siblings. \internal */ diff --git a/src/gui/graphicsview/qgraphicslayoutitem.cpp b/src/gui/graphicsview/qgraphicslayoutitem.cpp index 34ec4e0..fab1bbb 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem.cpp +++ b/src/gui/graphicsview/qgraphicslayoutitem.cpp @@ -140,11 +140,9 @@ QSizeF *QGraphicsLayoutItemPrivate::effectiveSizeHints(const QSizeF &constraint) if (!sizeHintCacheDirty && cachedConstraint == constraint) return cachedSizeHints; - const bool hasConstraint = constraint.width() >= 0 || constraint.height() >= 0; - for (int i = 0; i < Qt::NSizeHints; ++i) { cachedSizeHints[i] = constraint; - if (userSizeHints && !hasConstraint) + if (userSizeHints) combineSize(cachedSizeHints[i], userSizeHints[i]); } diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 5b1da9e..981fbbc 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -3461,7 +3461,8 @@ bool QGraphicsScene::event(QEvent *event) break; } case QEvent::Leave: - d->leaveScene(); + // hackieshly unpacking the viewport pointer from the leave event. + d->leaveScene(reinterpret_cast<QWidget *>(event->d)); break; case QEvent::GraphicsSceneHelp: helpEvent(static_cast<QGraphicsSceneHelpEvent *>(event)); @@ -3933,20 +3934,19 @@ bool QGraphicsScenePrivate::dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEv Handles all actions necessary to clean up the scene when the mouse leaves the view. */ -void QGraphicsScenePrivate::leaveScene() +void QGraphicsScenePrivate::leaveScene(QWidget *viewport) { - Q_Q(QGraphicsScene); #ifndef QT_NO_TOOLTIP QToolTip::hideText(); #endif + QGraphicsView *view = qobject_cast<QGraphicsView *>(viewport->parent()); // Send HoverLeave events to all existing hover items, topmost first. - QGraphicsView *senderWidget = qobject_cast<QGraphicsView *>(q->sender()); QGraphicsSceneHoverEvent hoverEvent; - hoverEvent.setWidget(senderWidget); + hoverEvent.setWidget(viewport); - if (senderWidget) { + if (view) { QPoint cursorPos = QCursor::pos(); - hoverEvent.setScenePos(senderWidget->mapToScene(senderWidget->mapFromGlobal(cursorPos))); + hoverEvent.setScenePos(view->mapToScene(viewport->mapFromGlobal(cursorPos))); hoverEvent.setLastScenePos(hoverEvent.scenePos()); hoverEvent.setScreenPos(cursorPos); hoverEvent.setLastScreenPos(hoverEvent.screenPos()); diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index f28dfe9..2818fb2 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -201,7 +201,7 @@ public: bool dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEvent); bool itemAcceptsHoverEvents_helper(const QGraphicsItem *item) const; - void leaveScene(); + void leaveScene(QWidget *viewport); void cloneDragDropEvent(QGraphicsSceneDragDropEvent *dest, QGraphicsSceneDragDropEvent *source); diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 2db29b9..0d39bb5 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -2790,6 +2790,9 @@ bool QGraphicsView::viewportEvent(QEvent *event) d->scene->d_func()->removePopup(d->scene->d_func()->popupWidgets.first()); } d->useLastMouseEvent = false; + // a hack to pass a viewport pointer to the scene inside the leave event + Q_ASSERT(event->d == 0); + event->d = reinterpret_cast<QEventPrivate *>(viewport()); QApplication::sendEvent(d->scene, event); break; #ifndef QT_NO_TOOLTIP diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 1bfe266..4a733be 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -750,6 +750,22 @@ QSizeF QGraphicsWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) c /*! \property QGraphicsWidget::layout \brief The layout of the widget + + Any existing layout manager is deleted before the new layout is assigned. If + \a layout is 0, the widget is left without a layout. Existing subwidgets' + geometries will remain unaffected. + + QGraphicsWidget takes ownership of \a layout. + + All widgets that are currently managed by \a layout or all of its + sublayouts, are automatically reparented to this item. The layout is then + invalidated, and the child widget geometries are adjusted according to + this item's geometry() and contentsMargins(). Children who are not + explicitly managed by \a layout remain unaffected by the layout after + it has been assigned to this widget. + + If no layout is currently managing this widget, layout() will return 0. + */ /*! diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp index f8cd593..7f8d574 100644 --- a/src/gui/graphicsview/qgridlayoutengine.cpp +++ b/src/gui/graphicsview/qgridlayoutengine.cpp @@ -631,14 +631,17 @@ QRectF QGridLayoutItem::geometryWithin(qreal x, qreal y, qreal width, qreal heig qreal cellWidth = width; qreal cellHeight = height; - QSize constraint; + + QSizeF size = effectiveMaxSize(QSizeF(-1,-1)); if (hasDynamicConstraint()) { - if (dynamicConstraintOrientation() == Qt::Vertical) - constraint.setWidth(cellWidth); - else - constraint.setHeight(cellHeight); + if (dynamicConstraintOrientation() == Qt::Vertical) { + if (size.width() > cellWidth) + size = effectiveMaxSize(QSizeF(cellWidth, -1)); + } else if(size.height() > cellHeight) { + size = effectiveMaxSize(QSizeF(-1, cellHeight)); + } } - QSizeF size = effectiveMaxSize(constraint).boundedTo(QSizeF(cellWidth, cellHeight)); + size = size.boundedTo(QSizeF(cellWidth, cellHeight)); width = size.width(); height = size.height(); @@ -714,7 +717,7 @@ QSizeF QGridLayoutItem::effectiveMaxSize(const QSizeF &constraint) const } if (!size.isValid()) { - QSizeF maxSize = layoutItem()->effectiveSizeHint(Qt::MaximumSize, constraint); + QSizeF maxSize = layoutItem()->effectiveSizeHint(Qt::MaximumSize, size); if (size.width() == -1) size.setWidth(maxSize.width()); if (size.height() == -1) @@ -1111,20 +1114,76 @@ QRectF QGridLayoutEngine::cellRect(const QLayoutStyleInfo &styleInfo, QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHint which, const QSizeF &constraint) const { - ensureColumnAndRowData(styleInfo); + QGridLayoutBox sizehint_totalBoxes[NOrientations]; - if (hasDynamicConstraint()) - return dynamicallyConstrainedSizeHint(which, constraint); + if(rowCount() < 1 || columnCount() < 1 || !hasDynamicConstraint()) { + //No items with height for width, so it doesn't matter which order we do these in + if(q_cachedDataForStyleInfo != styleInfo) { + ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal); + ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical); + } else { + sizehint_totalBoxes[Hor] = q_totalBoxes[Hor]; + sizehint_totalBoxes[Ver] = q_totalBoxes[Ver]; + } + } else if(constraintOrientation() == Qt::Vertical) { + //We have items whose width depends on their height + if(q_cachedDataForStyleInfo != styleInfo) + ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal); + else + sizehint_totalBoxes[Hor] = q_totalBoxes[Hor]; + QVector<qreal> sizehint_xx; + QVector<qreal> sizehint_widths; + + sizehint_xx.resize(columnCount()); + sizehint_widths.resize(columnCount()); + qreal width = constraint.width(); + if(width < 0) { + /* It's not obvious what the behaviour should be. */ +/* if(which == Qt::MaximumSize) + width = sizehint_totalBoxes[Hor].q_maximumSize; + else if(which == Qt::MinimumSize) + width = sizehint_totalBoxes[Hor].q_minimumSize; + else*/ + width = sizehint_totalBoxes[Hor].q_preferredSize; + } + //Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as + //constraints to find the row heights + q_columnData.calculateGeometries(0, columnCount(), width, sizehint_xx.data(), sizehint_widths.data(), + 0, sizehint_totalBoxes[Hor]); + ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, sizehint_xx.data(), sizehint_widths.data(), Qt::Vertical); + } else { + //We have items whose height depends on their width + ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical); + QVector<qreal> sizehint_yy; + QVector<qreal> sizehint_heights; + + sizehint_yy.resize(rowCount()); + sizehint_heights.resize(rowCount()); + qreal height = constraint.height(); + if(height < 0) { +/* if(which == Qt::MaximumSize) + height = sizehint_totalBoxes[Ver].q_maximumSize; + else if(which == Qt::MinimumSize) + height = sizehint_totalBoxes[Ver].q_minimumSize; + else*/ + height = sizehint_totalBoxes[Ver].q_preferredSize; + } + //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as + //constraints to find the column widths + q_rowData.calculateGeometries(0, rowCount(), height, sizehint_yy.data(), sizehint_heights.data(), + 0, sizehint_totalBoxes[Ver]); + ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, sizehint_yy.data(), sizehint_heights.data(), Qt::Vertical); + } switch (which) { case Qt::MinimumSize: - return QSizeF(q_totalBoxes[Hor].q_minimumSize, q_totalBoxes[Ver].q_minimumSize); + return QSizeF(sizehint_totalBoxes[Hor].q_minimumSize, sizehint_totalBoxes[Ver].q_minimumSize); case Qt::PreferredSize: - return QSizeF(q_totalBoxes[Hor].q_preferredSize, q_totalBoxes[Ver].q_preferredSize); + return QSizeF(sizehint_totalBoxes[Hor].q_preferredSize, sizehint_totalBoxes[Ver].q_preferredSize); case Qt::MaximumSize: - return QSizeF(q_totalBoxes[Hor].q_maximumSize, q_totalBoxes[Ver].q_maximumSize); + return QSizeF(sizehint_totalBoxes[Hor].q_maximumSize, sizehint_totalBoxes[Ver].q_maximumSize); case Qt::MinimumDescent: - return QSizeF(-1.0, q_totalBoxes[Hor].q_minimumDescent); // ### doesn't work + return QSizeF(-1.0, sizehint_totalBoxes[Hor].q_minimumDescent); // ### doesn't work default: break; } @@ -1300,6 +1359,7 @@ void QGridLayoutEngine::insertOrRemoveRows(int row, int delta, Qt::Orientation o } void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutStyleInfo &styleInfo, + qreal *colPositions, qreal *colSizes, Qt::Orientation orientation) const { const int ButtonMask = QSizePolicy::ButtonBox | QSizePolicy::PushButton; @@ -1413,11 +1473,21 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutSt box = &multiCell.q_box; multiCell.q_stretch = itemStretch; } - // Items with constraints are not included in the orientation that - // they are constrained (since it depends on the hfw/constraint function). - // They must be combined at a later stage. - if (!item->hasDynamicConstraint() || orientation != item->dynamicConstraintOrientation()) + // Items with constraints need to be passed the constraint + if (colSizes && colPositions && item->hasDynamicConstraint() && orientation == item->dynamicConstraintOrientation()) { + /* Get the width of the item by summing up the widths of the columns that it spans. + * We need to have already calculated the widths of the columns by calling + * q_columns->calculateGeometries() before hand and passing the value in the colSizes + * and colPositions parameters. + * The variable name is still colSizes even when it actually has the row sizes + */ + qreal length = colSizes[item->lastColumn(orientation)]; + if (item->columnSpan(orientation) != 1) + length += colPositions[item->lastColumn(orientation)] - colPositions[item->firstColumn(orientation)]; + box->combine(item->box(orientation, length)); + } else { box->combine(item->box(orientation)); + } if (effectiveRowSpan == 1) { QSizePolicy::ControlTypes controls = item->controlTypes(top); @@ -1554,115 +1624,18 @@ void QGridLayoutEngine::ensureEffectiveFirstAndLastRows() const } } -void QGridLayoutEngine::ensureColumnAndRowData(const QLayoutStyleInfo &styleInfo) const +void QGridLayoutEngine::ensureColumnAndRowData(QGridLayoutRowData *rowData, QGridLayoutBox *totalBox, + const QLayoutStyleInfo &styleInfo, + qreal *colPositions, qreal *colSizes, + Qt::Orientation orientation) const { - if (q_cachedDataForStyleInfo == styleInfo) - return; - - q_columnData.reset(columnCount()); - q_rowData.reset(rowCount()); - - fillRowData(&q_columnData, styleInfo, Qt::Horizontal); - fillRowData(&q_rowData, styleInfo, Qt::Vertical); - - q_columnData.distributeMultiCells(); - q_rowData.distributeMultiCells(); - - q_totalBoxes[Hor] = q_columnData.totalBox(0, columnCount()); - q_totalBoxes[Ver] = q_rowData.totalBox(0, rowCount()); - - q_cachedDataForStyleInfo = styleInfo; + rowData->reset(rowCount(orientation)); + fillRowData(rowData, styleInfo, colPositions, colSizes, orientation); + rowData->distributeMultiCells(); + *totalBox = rowData->totalBox(0, rowCount(orientation)); + //We have items whose width depends on their height } -QSizeF QGridLayoutEngine::dynamicallyConstrainedSizeHint(Qt::SizeHint which, - const QSizeF &constraint) const -{ - Q_ASSERT(hasDynamicConstraint()); - if (constraint.width() < 0 && constraint.height() < 0) { - // Process the hfw / wfh items that we did not process in fillRowData() - const Qt::Orientation constraintOrient = constraintOrientation(); - - QGridLayoutRowData rowData = constraintOrient == Qt::Vertical ? q_rowData : q_columnData; - for (int i = q_items.count() - 1; i >= 0; --i) { - QGridLayoutItem *item = q_items.at(i); - if (item->hasDynamicConstraint()) { - QGridLayoutBox box = item->box(constraintOrient); - QGridLayoutBox &rowBox = rowData.boxes[item->firstRow(constraintOrient)]; - rowBox.combine(box); - } - } - - QGridLayoutBox totalBoxes[2]; - if (constraintOrient == Qt::Vertical) { - totalBoxes[Hor] = q_columnData.totalBox(0, columnCount()); - totalBoxes[Ver] = rowData.totalBox(0, rowCount()); - } else { - totalBoxes[Hor] = rowData.totalBox(0, columnCount()); - totalBoxes[Ver] = q_rowData.totalBox(0, rowCount()); - } - return QSizeF(totalBoxes[Hor].q_sizes(which), totalBoxes[Ver].q_sizes(which)); - } - - - Q_ASSERT(constraint.width() >= 0 || constraint.height() >= 0); - q_xx.resize(columnCount()); - q_yy.resize(rowCount()); - q_widths.resize(columnCount()); - q_heights.resize(rowCount()); - q_descents.resize(rowCount()); - - - const Qt::Orientation orientation = constraintOrientation(); - QGridLayoutRowData *colData; - QGridLayoutRowData constrainedRowData; - QGridLayoutBox *totalBox; - qreal *sizes; - qreal *pos; - qreal *descents; - qreal targetSize; - qreal cCount; - qreal rCount; - - if (orientation == Qt::Vertical) { - // height for width - colData = &q_columnData; - totalBox = &q_totalBoxes[Hor]; - sizes = q_widths.data(); - pos = q_xx.data(); - descents = 0; - targetSize = constraint.width(); - cCount = columnCount(); - rCount = rowCount(); - constrainedRowData = q_rowData; - } else { - // width for height - colData = &q_rowData; - totalBox = &q_totalBoxes[Ver]; - sizes = q_heights.data(); - pos = q_yy.data(); - descents = q_descents.data(); - targetSize = constraint.height(); - cCount = rowCount(); - rCount = columnCount(); - constrainedRowData = q_columnData; - } - colData->calculateGeometries(0, cCount, targetSize, pos, sizes, descents, *totalBox); - for (int i = q_items.count() - 1; i >= 0; --i) { - QGridLayoutItem *item = q_items.at(i); - - if (item->hasDynamicConstraint()) { - const qreal size = sizes[item->firstColumn(orientation)]; - QGridLayoutBox box = item->box(orientation, size); - QGridLayoutBox &rowBox = constrainedRowData.boxes[item->firstRow(orientation)]; - rowBox.combine(box); - } - } - const qreal newSize = constrainedRowData.totalBox(0, rCount).q_sizes(which); - - return (orientation == Qt::Vertical) ? QSizeF(targetSize, newSize) : QSizeF(newSize, targetSize); -} - - /** returns false if the layout has contradicting constraints (i.e. some items with a horizontal constraint and other items with a vertical constraint) @@ -1709,85 +1682,41 @@ Qt::Orientation QGridLayoutEngine::constraintOrientation() const void QGridLayoutEngine::ensureGeometries(const QLayoutStyleInfo &styleInfo, const QSizeF &size) const { - ensureColumnAndRowData(styleInfo); - if (q_cachedSize == size) + if (q_cachedDataForStyleInfo == styleInfo && q_cachedSize == size) return; + q_cachedDataForStyleInfo = styleInfo; + q_cachedSize = size; + q_xx.resize(columnCount()); - q_yy.resize(rowCount()); q_widths.resize(columnCount()); + q_yy.resize(rowCount()); q_heights.resize(rowCount()); q_descents.resize(rowCount()); - - Qt::Orientation orientation = Qt::Vertical; - if (hasDynamicConstraint()) - orientation = constraintOrientation(); - - /* - In order to do hfw we need to first distribute the columns, then the rows. - In order to do wfh we need to first distribute the rows, then the columns. - - If there is no constraint, the order of distributing the rows or columns first is irrelevant. - We choose horizontal just to keep the same behaviour as before (however, there shouldn't - be any behaviour difference). - */ - - QGridLayoutRowData *colData; - QGridLayoutRowData rowData; - qreal *widths; - qreal *heights; - qreal *xx; - qreal *yy; - qreal *xdescents = 0; - qreal *ydescents = 0; - qreal cCount; - qreal rCount; - QSizeF oSize = size; - if (orientation == Qt::Vertical) { - // height for width - colData = &q_columnData; - rowData = q_rowData; - widths = q_widths.data(); - heights = q_heights.data(); - xx = q_xx.data(); - yy = q_yy.data(); - cCount = columnCount(); - rCount = rowCount(); - ydescents = q_descents.data(); + if(constraintOrientation() != Qt::Horizontal) { + //We might have items whose width depends on their height + ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal); + //Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as + //constraints to find the row heights + q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), + 0, q_totalBoxes[Hor]); + ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], styleInfo, q_xx.data(), q_widths.data(), Qt::Vertical); + //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() + q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), + q_descents.data(), q_totalBoxes[Ver]); } else { - // width for height - colData = &q_rowData; - rowData = q_columnData; - widths = q_heights.data(); - heights = q_widths.data(); - xx = q_yy.data(); - yy = q_xx.data(); - cCount = rowCount(); - rCount = columnCount(); - xdescents = q_descents.data(); - oSize.transpose(); + //We have items whose height depends on their width + ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical); + //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as + //constraints to find the column widths + q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), + q_descents.data(), q_totalBoxes[Ver]); + ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], styleInfo, q_yy.data(), q_heights.data(), Qt::Horizontal); + //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() + q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), + 0, q_totalBoxes[Hor]); } - - colData->calculateGeometries(0, cCount, oSize.width(), xx, widths, - xdescents, q_totalBoxes[orientation == Qt::Horizontal]); - for (int i = q_items.count() - 1; i >= 0; --i) { - QGridLayoutItem *item = q_items.at(i); - const int col = item->firstColumn(orientation); - const int row = item->firstRow(orientation); - if (item->hasDynamicConstraint()) { - const qreal sz = widths[col]; - QGridLayoutBox box = item->box(orientation, sz); - rowData.boxes[row].combine(box); - } - } - - QGridLayoutBox &totalBox = q_totalBoxes[orientation == Qt::Vertical]; - totalBox = rowData.totalBox(0, rCount); - rowData.calculateGeometries(0, rCount, oSize.height(), yy, heights, - ydescents, totalBox); - - q_cachedSize = size; } QT_END_NAMESPACE diff --git a/src/gui/graphicsview/qgridlayoutengine_p.h b/src/gui/graphicsview/qgridlayoutengine_p.h index 55451d7..7c77b2a 100644 --- a/src/gui/graphicsview/qgridlayoutengine_p.h +++ b/src/gui/graphicsview/qgridlayoutengine_p.h @@ -93,8 +93,8 @@ enum LayoutSide { enum { NoConstraint, - HorizontalConstraint, - VerticalConstraint, + HorizontalConstraint, // Width depends on the height + VerticalConstraint, // Height depends on the width UnknownConstraint, // need to update cache UnfeasibleConstraint // not feasible, it be has some items with Vertical and others with Horizontal constraints }; @@ -411,9 +411,14 @@ private: void setItemAt(int row, int column, QGridLayoutItem *item); void insertOrRemoveRows(int row, int delta, Qt::Orientation orientation = Qt::Vertical); void fillRowData(QGridLayoutRowData *rowData, const QLayoutStyleInfo &styleInfo, - Qt::Orientation orientation = Qt::Vertical) const; + qreal *colPositions, qreal *colSizes, + Qt::Orientation orientation = Qt::Vertical) const; void ensureEffectiveFirstAndLastRows() const; - void ensureColumnAndRowData(const QLayoutStyleInfo &styleInfo) const; + void ensureColumnAndRowData(QGridLayoutRowData *rowData, QGridLayoutBox *totalBox, + const QLayoutStyleInfo &styleInfo, + qreal *colPositions, qreal *colSizes, + Qt::Orientation orientation) const; + void ensureGeometries(const QLayoutStyleInfo &styleInfo, const QSizeF &size) const; // User input diff --git a/src/gui/image/qpixmap_x11_p.h b/src/gui/image/qpixmap_x11_p.h index f171281..7eab64c 100644 --- a/src/gui/image/qpixmap_x11_p.h +++ b/src/gui/image/qpixmap_x11_p.h @@ -115,7 +115,7 @@ private: friend class QEglContext; // Needs gl_surface friend class QGLContext; // Needs gl_surface friend class QX11GLPixmapData; // Needs gl_surface - friend class QMeeGoGraphicsSystem; // Needs gl_surface and flags + friend class QMeeGoLivePixmapData; // Needs gl_surface and flags friend bool qt_createEGLSurfaceForPixmap(QPixmapData*, bool); // Needs gl_surface void release(); diff --git a/src/gui/image/qtiffhandler.cpp b/src/gui/image/qtiffhandler.cpp index 2e8b998..dd2bd10 100644 --- a/src/gui/image/qtiffhandler.cpp +++ b/src/gui/image/qtiffhandler.cpp @@ -611,6 +611,7 @@ QVariant QTiffHandler::option(ImageOption option) const TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &width); TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &height); imageSize = QSize(width, height); + TIFFClose(tiff); } device()->seek(pos); if (imageSize.isValid()) diff --git a/src/gui/inputmethod/qinputcontextfactory.cpp b/src/gui/inputmethod/qinputcontextfactory.cpp index 865c1b2..afe5095 100644 --- a/src/gui/inputmethod/qinputcontextfactory.cpp +++ b/src/gui/inputmethod/qinputcontextfactory.cpp @@ -205,7 +205,7 @@ QStringList QInputContextFactory::keys() This function contains pure Symbian exception handling code for getting S60 language list. - Returned object ownership is transfered to caller. + Returned object ownership is transferred to caller. */ static CAknInputLanguageList* s60LangListL() { @@ -224,7 +224,7 @@ static CAknInputLanguageList* s60LangListL() \internal This function utility function return S60 language list. - Returned object ownership is transfered to caller. + Returned object ownership is transferred to caller. */ static CAknInputLanguageList* s60LangList() { diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index b5ca812..a9612a2 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -1366,7 +1366,7 @@ bool QAbstractItemView::dragEnabled() const Note that the model used needs to provide support for drag and drop operations. - \sa setDragDropMode() {Using drag & drop with item views} + \sa setDragDropMode() {Using drag and drop with item views} */ /*! diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp index 7156b87..7b892c5 100644 --- a/src/gui/itemviews/qitemselectionmodel.cpp +++ b/src/gui/itemviews/qitemselectionmodel.cpp @@ -781,7 +781,7 @@ void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged() savedPersistentIndexes.clear(); savedPersistentCurrentIndexes.clear(); - // optimisation for when all indexes are selected + // optimization for when all indexes are selected // (only if there is lots of items (1000) because this is not entirely correct) if (ranges.isEmpty() && currentSelection.count() == 1) { QItemSelectionRange range = currentSelection.first(); @@ -1068,6 +1068,19 @@ void QItemSelectionModel::select(const QItemSelection &selection, QItemSelection // store old selection QItemSelection sel = selection; + // If d->ranges is non-empty when the source model is reset the persistent indexes + // it contains will be invalid. We can't clear them in a modelReset slot because that might already + // be too late if another model observer is connected to the same modelReset slot and is invoked first + // it might call select() on this selection model before any such QItemSelectionModelPrivate::_q_modelReset() slot + // is invoked, so it would not be cleared yet. We clear it invalid ranges in it here. + QItemSelection::iterator it = d->ranges.begin(); + while (it != d->ranges.end()) { + if (!it->isValid()) + it = d->ranges.erase(it); + else + ++it; + } + QItemSelection old = d->ranges; old.merge(d->currentSelection, d->currentCommand); diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index ce1f0e5..d1ef354 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -1490,19 +1490,20 @@ void QListView::updateGeometries() // if the scroll bars are turned off, we resize the contents to the viewport if (d->movement == Static && !d->isWrapping()) { - d->layoutChildren(); // we need the viewport size to be updated + const QSize maxSize = maximumViewportSize(); if (d->flow == TopToBottom) { if (horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) { - d->setContentsSize(viewport()->width(), contentsSize().height()); + d->setContentsSize(maxSize.width(), contentsSize().height()); horizontalScrollBar()->setRange(0, 0); // we see all the contents anyway } } else { // LeftToRight if (verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) { - d->setContentsSize(contentsSize().width(), viewport()->height()); + d->setContentsSize(contentsSize().width(), maxSize.height()); verticalScrollBar()->setRange(0, 0); // we see all the contents anyway } } } + } /*! diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index a32a957..1dab738 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -115,12 +115,25 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c # if defined(Q_WS_WINCE) # include <bldver.h> # endif -# include <winable.h> +# if !defined(Q_WS_WINCE) +# include <winable.h> +# endif +#endif + +#ifndef QT_NO_GESTURES +# ifndef GID_ZOOM +# define GID_ZOOM 3 +# define GID_TWOFINGERTAP 6 +# define GID_PRESSANDTAP 7 +# define GID_ROLLOVER GID_PRESSANDTAP +# endif #endif #ifndef WM_TOUCH # define WM_TOUCH 0x0240 +#endif +#ifndef TOUCHEVENTF_MOVE # define TOUCHEVENTF_MOVE 0x0001 # define TOUCHEVENTF_DOWN 0x0002 # define TOUCHEVENTF_UP 0x0004 diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index d905639..cbc2356 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -3741,7 +3741,7 @@ int QApplication::x11ProcessEvent(XEvent* event) // toplevel reparented... QWidget *newparent = QWidget::find(event->xreparent.parent); if (! newparent || (newparent->windowType() == Qt::Desktop)) { - // we dont' know about the new parent (or we've been + // we don't know about the new parent (or we've been // reparented to root), perhaps a window manager // has been (re)started? reset the focus model to unknown X11->focus_model = QX11Data::FM_Unknown; diff --git a/src/gui/kernel/qclipboard_s60.cpp b/src/gui/kernel/qclipboard_s60.cpp index f07e066..c9b1d23 100644 --- a/src/gui/kernel/qclipboard_s60.cpp +++ b/src/gui/kernel/qclipboard_s60.cpp @@ -50,16 +50,18 @@ #include "qwidget.h" #include "qevent.h" #include "private/qcore_symbian_p.h" +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include "txtclipboard.h" +#endif +#include "txtetext.h" #include <QtDebug> // Symbian's clipboard #include <baclipb.h> QT_BEGIN_NAMESPACE -//### Mime Type mapping to UIDs - const TUid KQtCbDataStream = {0x2001B2DD}; - +const TInt KPlainTextBegin = 0; class QClipboardData { @@ -141,7 +143,6 @@ void writeToStreamLX(const QMimeData* aData, RWriteStream& aStream) { HBufC* stringData = TPtrC(reinterpret_cast<const TUint16*>((*iter).utf16())).AllocLC(); QByteArray ba = aData->data((*iter)); - qDebug() << "copy to clipboard mime: " << *iter << " data: " << ba; // mime type aStream << TCardinality(stringData->Size()); aStream << *(stringData); @@ -152,6 +153,43 @@ void writeToStreamLX(const QMimeData* aData, RWriteStream& aStream) } } +void writeToSymbianStoreLX(const QMimeData* aData, CClipboard* clipboard) +{ + // This function both leaves and throws exceptions. There must be no destructor + // dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects. + if (aData->hasText()) { + CPlainText* text = CPlainText::NewL(); + CleanupStack::PushL(text); + + TPtrC textPtr(qt_QString2TPtrC(aData->text())); + text->InsertL(KPlainTextBegin, textPtr); + text->CopyToStoreL(clipboard->Store(), clipboard->StreamDictionary(), + KPlainTextBegin, textPtr.Length()); + CleanupStack::PopAndDestroy(text); + } +} + +void readSymbianStoreLX(QMimeData* aData, CClipboard* clipboard) +{ + // This function both leaves and throws exceptions. There must be no destructor + // dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects. + CPlainText* text = CPlainText::NewL(); + CleanupStack::PushL(text); + TInt dataLength = text->PasteFromStoreL(clipboard->Store(), clipboard->StreamDictionary(), + KPlainTextBegin); + if (dataLength == 0) { + User::Leave(KErrNotFound); + } + HBufC* hBuf = HBufC::NewL(dataLength); + TPtr buf = hBuf->Des(); + text->Extract(buf, KPlainTextBegin, dataLength); + + QString string = qt_TDesC2QString(buf); + CleanupStack::PopAndDestroy(text); + + aData->setText(string); +} + void readFromStreamLX(QMimeData* aData,RReadStream& aStream) { // This function both leaves and throws exceptions. There must be no destructor @@ -174,7 +212,6 @@ void readFromStreamLX(QMimeData* aData,RReadStream& aStream) ba.reserve(dataSize); aStream.ReadL(reinterpret_cast<uchar*>(ba.data_ptr()->data),dataSize); ba.data_ptr()->size = dataSize; - qDebug() << "paste from clipboard mime: " << mimeType << " data: " << ba; aData->setData(mimeType,ba); } } @@ -192,18 +229,41 @@ const QMimeData* QClipboard::mimeData(Mode mode) const { if (mode != Clipboard) return 0; QClipboardData *d = clipboardData(); + bool dataExists(false); if (d) { TRAPD(err,{ RFs fs = qt_s60GetRFs(); CClipboard* cb = CClipboard::NewForReadingLC(fs); Q_ASSERT(cb); + //stream for qt RStoreReadStream stream; TStreamId stid = (cb->StreamDictionary()).At(KQtCbDataStream); - stream.OpenLC(cb->Store(),stid); - QT_TRYCATCH_LEAVING(readFromStreamLX(d->source(),stream)); - CleanupStack::PopAndDestroy(2,cb); - return d->source(); + if (stid != 0) { + stream.OpenLC(cb->Store(),stid); + QT_TRYCATCH_LEAVING(readFromStreamLX(d->source(),stream)); + CleanupStack::PopAndDestroy(&stream); + dataExists = true; + } + else { + //symbian clipboard + RStoreReadStream symbianStream; + TStreamId symbianStId = (cb->StreamDictionary()).At(KClipboardUidTypePlainText); + if (symbianStId != 0) { + symbianStream.OpenLC(cb->Store(), symbianStId); + QT_TRYCATCH_LEAVING(readSymbianStoreLX(d->source(), cb)); + CleanupStack::PopAndDestroy(&symbianStream); + dataExists = true; + } + } + CleanupStack::PopAndDestroy(cb); + if (dataExists) { + return d->source(); + } + else { + return 0; + } + }); if (err != KErrNone){ qDebug()<< "clipboard is empty/err: " << err; @@ -223,6 +283,7 @@ void QClipboard::setMimeData(QMimeData* src, Mode mode) TRAPD(err,{ RFs fs = qt_s60GetRFs(); CClipboard* cb = CClipboard::NewForWritingLC(fs); + //stream for qt RStoreWriteStream stream; TStreamId stid = stream.CreateLC(cb->Store()); QT_TRYCATCH_LEAVING(writeToStreamLX(src,stream)); @@ -230,7 +291,14 @@ void QClipboard::setMimeData(QMimeData* src, Mode mode) stream.CommitL(); (cb->StreamDictionary()).AssignL(KQtCbDataStream,stid); cb->CommitL(); - CleanupStack::PopAndDestroy(2,cb); + + //stream for symbian + RStoreWriteStream symbianStream; + TStreamId symbianStId = symbianStream.CreateLC(cb->Store()); + QT_TRYCATCH_LEAVING(writeToSymbianStoreLX(src, cb)); + (cb->StreamDictionary()).AssignL(KClipboardUidTypePlainText, symbianStId); + cb->CommitL(); + CleanupStack::PopAndDestroy(3,cb); }); if (err != KErrNone){ qDebug()<< "clipboard write err :" << err; diff --git a/src/gui/kernel/qclipboard_win.cpp b/src/gui/kernel/qclipboard_win.cpp index 63ca9e5..c2e29fd 100644 --- a/src/gui/kernel/qclipboard_win.cpp +++ b/src/gui/kernel/qclipboard_win.cpp @@ -141,7 +141,7 @@ public: clipBoardViewer = new QWidget(); clipBoardViewer->createWinId(); clipBoardViewer->setObjectName(QLatin1String("internal clipboard owner")); - // We dont need this internal widget to appear in QApplication::topLevelWidgets() + // We don't need this internal widget to appear in QApplication::topLevelWidgets() if (QWidgetPrivate::allWidgets) QWidgetPrivate::allWidgets->remove(clipBoardViewer); } diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp index 55548ef..62c861d 100644 --- a/src/gui/kernel/qclipboard_x11.cpp +++ b/src/gui/kernel/qclipboard_x11.cpp @@ -132,7 +132,7 @@ void setupOwner() requestor = new QWidget(0); requestor->createWinId(); requestor->setObjectName(QLatin1String("internal clipboard requestor")); - // We dont need this internal widgets to appear in QApplication::topLevelWidgets() + // We don't need this internal widgets to appear in QApplication::topLevelWidgets() if (QWidgetPrivate::allWidgets) { QWidgetPrivate::allWidgets->remove(owner); QWidgetPrivate::allWidgets->remove(requestor); @@ -769,7 +769,7 @@ QByteArray QX11Data::clipboardReadIncrementalProperty(Window win, Atom property, delete requestor; requestor = new QWidget(0); requestor->setObjectName(QLatin1String("internal clipboard requestor")); - // We dont need this internal widget to appear in QApplication::topLevelWidgets() + // We don't need this internal widget to appear in QApplication::topLevelWidgets() if (QWidgetPrivate::allWidgets) QWidgetPrivate::allWidgets->remove(requestor); diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 49f7d7f..dfcc2e6 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -964,10 +964,6 @@ static int qCocoaViewCount = 0; } } #endif //QT_NO_WHEELEVENT - - if (!wheelOK) { - return [super scrollWheel:theEvent]; - } } - (void)tabletProximity:(NSEvent *)tabletEvent diff --git a/src/gui/kernel/qdesktopwidget.qdoc b/src/gui/kernel/qdesktopwidget.qdoc index 2d72bf9..c550082 100644 --- a/src/gui/kernel/qdesktopwidget.qdoc +++ b/src/gui/kernel/qdesktopwidget.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 5725a22..e3339c4 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -260,6 +260,27 @@ QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const /*! \property QPanGesture::acceleration + \brief the acceleration in the motion of the touch point for this gesture +*/ + +/*! + \property QPanGesture::horizontalVelocity + \brief the horizontal component of the motion of the touch point for this + gesture + \since 4.7.1 + \internal + + \sa verticalVelocity, acceleration +*/ + +/*! + \property QPanGesture::verticalVelocity + \brief the vertical component of the motion of the touch point for this + gesture + \since 4.7.1 + \internal + + \sa horizontalVelocity, acceleration */ /*! @@ -633,6 +654,12 @@ void QPinchGesture::setRotationAngle(qreal value) */ /*! + \property QSwipeGesture::velocity + \since 4.7.1 + \internal +*/ + +/*! \internal */ QSwipeGesture::QSwipeGesture(QObject *parent) diff --git a/src/gui/kernel/qguifunctions_wince.cpp b/src/gui/kernel/qguifunctions_wince.cpp index 6e2ed76..572698e 100644 --- a/src/gui/kernel/qguifunctions_wince.cpp +++ b/src/gui/kernel/qguifunctions_wince.cpp @@ -112,6 +112,9 @@ struct AygSIPINFO #ifndef SPI_GETSIPINFO #define SPI_GETSIPINFO 225 #endif +#ifndef SPI_GETPLATFORMTYPE +#define SPI_GETPLATFORMTYPE 257 +#endif typedef BOOL (*AygInitDialog)(AygSHINITDLGINFO*); typedef BOOL (*AygFullScreen)(HWND, DWORD); diff --git a/src/gui/kernel/qkeymapper_mac.cpp b/src/gui/kernel/qkeymapper_mac.cpp index 3dc6afc..300e5ca 100644 --- a/src/gui/kernel/qkeymapper_mac.cpp +++ b/src/gui/kernel/qkeymapper_mac.cpp @@ -749,7 +749,7 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, EventHandlerCallRef e } return false; } - // Once we process the key down , we dont need to send the saved event again from + // Once we process the key down , we don't need to send the saved event again from // kEventTextInputUnicodeForKeyEvent, so clear it. if (currentContext && ekind == kEventRawKeyDown) { QMacInputContext *context = qobject_cast<QMacInputContext*>(currentContext); diff --git a/src/gui/kernel/qsizepolicy.qdoc b/src/gui/kernel/qsizepolicy.qdoc index f6a350c..504821e 100644 --- a/src/gui/kernel/qsizepolicy.qdoc +++ b/src/gui/kernel/qsizepolicy.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp index fee1580..c81d75f 100644 --- a/src/gui/kernel/qsoftkeymanager_s60.cpp +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -265,7 +265,7 @@ bool QSoftKeyManagerPrivateS60::setSoftkeyImage(CEikButtonGroupContainer *cba, CFbsBitmap* nMask = softkeyAlpha.toSymbianCFbsBitmap(); CEikImage* myimage = new (ELeave) CEikImage; - myimage->SetPicture( nBitmap, nMask ); // nBitmap and nMask ownership transfered + myimage->SetPicture( nBitmap, nMask ); // nBitmap and nMask ownership transferred EikSoftkeyImage::SetImage(cba, *myimage, left); // Takes myimage ownership cbaHasImage[position] = true; diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index 893ba2b..1821c3d 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -198,25 +198,22 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state, d->startPosition[0] = p1.screenPos(); d->startPosition[1] = p2.screenPos(); } - QLineF line(p1.screenPos(), p2.screenPos()); - QLineF lastLine(p1.lastScreenPos(), p2.lastScreenPos()); - QLineF tmp(line); - tmp.setLength(line.length() / 2.); - QPointF centerPoint = tmp.p2(); d->lastCenterPoint = d->centerPoint; - d->centerPoint = centerPoint; - d->changeFlags |= QPinchGesture::CenterPointChanged; + d->centerPoint = (p1.screenPos() + p2.screenPos()) / 2.0; - const qreal scaleFactor = line.length() / lastLine.length(); + d->changeFlags |= QPinchGesture::CenterPointChanged; if (d->isNewSequence) { - d->lastScaleFactor = scaleFactor; + d->scaleFactor = 1.0; + d->lastScaleFactor = 1.0; } else { d->lastScaleFactor = d->scaleFactor; + QLineF line(p1.screenPos(), p2.screenPos()); + QLineF lastLine(p1.lastScreenPos(), p2.lastScreenPos()); + d->scaleFactor = line.length() / lastLine.length(); } - d->scaleFactor = scaleFactor; - d->totalScaleFactor = d->totalScaleFactor * scaleFactor; + d->totalScaleFactor = d->totalScaleFactor * d->scaleFactor; d->changeFlags |= QPinchGesture::ScaleFactorChanged; qreal angle = QLineF(p1.screenPos(), p2.screenPos()).angle(); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 4e17f0f..8b643ef 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -68,6 +68,7 @@ # include "qt_cocoa_helpers_mac_p.h" # include "qmainwindow.h" # include "qtoolbar.h" +# include <private/qmainwindowlayout_p.h> #endif #if defined(Q_WS_QWS) # include "qwsdisplay_qws.h" @@ -739,9 +740,9 @@ void QWidget::setAutoFillBackground(bool enabled) \list \i mouseMoveEvent() is called whenever the mouse moves while a mouse button is held down. This can be useful during drag and drop - operations. If you call setMouseTracking(true), you get mouse move - events even when no buttons are held down. (See also the \l{Drag - and Drop} guide.) + operations. If you call \l{setMouseTracking()}{setMouseTracking}(true), + you get mouse move events even when no buttons are held down. + (See also the \l{Drag and Drop} guide.) \i keyReleaseEvent() is called whenever a key is released and while it is held down (if the key is auto-repeating). In that case, the widget will receive a pair of key release and key press event for @@ -3019,6 +3020,15 @@ bool QWidget::isFullScreen() const */ void QWidget::showFullScreen() { +#ifdef Q_WS_MAC + // If the unified toolbar is enabled, we have to disable it before going fullscreen. + QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this); + if (mainWindow && mainWindow->unifiedTitleAndToolBarOnMac()) { + mainWindow->setUnifiedTitleAndToolBarOnMac(false); + QMainWindowLayout *mainLayout = qobject_cast<QMainWindowLayout*>(mainWindow->layout()); + mainLayout->activateUnifiedToolbarAfterFullScreen = true; + } +#endif // Q_WS_MAC ensurePolished(); #ifdef QT3_SUPPORT if (parent()) @@ -3051,6 +3061,18 @@ void QWidget::showMaximized() setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen)) | Qt::WindowMaximized); +#ifdef Q_WS_MAC + // If the unified toolbar was enabled before going fullscreen, we have to enable it back. + QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this); + if (mainWindow) + { + QMainWindowLayout *mainLayout = qobject_cast<QMainWindowLayout*>(mainWindow->layout()); + if (mainLayout->activateUnifiedToolbarAfterFullScreen) { + mainWindow->setUnifiedTitleAndToolBarOnMac(true); + mainLayout->activateUnifiedToolbarAfterFullScreen = false; + } + } +#endif // Q_WS_MAC show(); } @@ -3072,6 +3094,18 @@ void QWidget::showNormal() setWindowState(windowState() & ~(Qt::WindowMinimized | Qt::WindowMaximized | Qt::WindowFullScreen)); +#ifdef Q_WS_MAC + // If the unified toolbar was enabled before going fullscreen, we have to enable it back. + QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this); + if (mainWindow) + { + QMainWindowLayout *mainLayout = qobject_cast<QMainWindowLayout*>(mainWindow->layout()); + if (mainLayout->activateUnifiedToolbarAfterFullScreen) { + mainWindow->setUnifiedTitleAndToolBarOnMac(true); + mainLayout->activateUnifiedToolbarAfterFullScreen = false; + } + } +#endif // Q_WS_MAC show(); } @@ -8693,8 +8727,8 @@ bool QWidget::event(QEvent *event) /*! This event handler can be reimplemented to handle state changes. - The state being changed in this event can be retrieved through event \a - event. + The state being changed in this event can be retrieved through the \a event + supplied. Change events include: QEvent::ToolBarChange, QEvent::ActivationChange, QEvent::EnabledChange, QEvent::FontChange, diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 017541c..fc94616 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2794,19 +2794,38 @@ void QWidgetPrivate::transferChildren() #ifdef QT_MAC_USE_COCOA void QWidgetPrivate::setSubWindowStacking(bool set) { + // This will set/remove a visual relationship between parent and child on screen. + // The reason for doing this is to ensure that a child always stacks infront of + // its parent. Unfortunatly is turns out that [NSWindow addChildWindow] has + // several unwanted side-effects, one of them being the moving of a child when + // moving the parent, which we choose to accept. A way tougher side-effect is + // that Cocoa will hide the parent if you hide the child. And in the case of + // a tool window, since it will normally hide when you deactivate the + // application, Cocoa will hide the parent upon deactivate as well. The result often + // being no more visible windows on screen. So, to make a long story short, we only + // allow parent-child relationships between windows that both are either a plain window + // or a dialog. + Q_Q(QWidget); - if (!q->isWindow() || !q->testAttribute(Qt::WA_WState_Created)) + if (!q->isWindow()) + return; + NSWindow *qwin = [qt_mac_nativeview_for(q) window]; + if (!qwin) + return; + Qt::WindowType qtype = q->windowType(); + if (set && !(qtype == Qt::Window || qtype == Qt::Dialog)) + return; + if (set && ![qwin isVisible]) return; if (QWidget *parent = q->parentWidget()) { - if (parent->testAttribute(Qt::WA_WState_Created)) { + if (NSWindow *pwin = [qt_mac_nativeview_for(parent) window]) { if (set) { - if (parent->isVisible()) { - NSWindow *childwin = qt_mac_window_for(q); - [qt_mac_window_for(parent) addChildWindow:childwin ordered:NSWindowAbove]; - } + Qt::WindowType ptype = parent->window()->windowType(); + if ([pwin isVisible] && (ptype == Qt::Window || ptype == Qt::Dialog) && ![qwin parentWindow]) + [pwin addChildWindow:qwin ordered:NSWindowAbove]; } else { - [qt_mac_window_for(parent) removeChildWindow:qt_mac_window_for(q)]; + [pwin removeChildWindow:qwin]; } } } @@ -2814,12 +2833,15 @@ void QWidgetPrivate::setSubWindowStacking(bool set) QList<QWidget *> widgets = q->findChildren<QWidget *>(); for (int i=0; i<widgets.size(); ++i) { QWidget *child = widgets.at(i); - if (child->isWindow() && child->testAttribute(Qt::WA_WState_Created) && child->isVisibleTo(q)) { - if (set) { - NSWindow *childwin = qt_mac_window_for(child); - [qt_mac_window_for(q) addChildWindow:childwin ordered:NSWindowAbove]; - } else { - [qt_mac_window_for(q) removeChildWindow:qt_mac_window_for(child)]; + if (child && child->isWindow()) { + if (NSWindow *cwin = [qt_mac_nativeview_for(child) window]) { + if (set) { + Qt::WindowType ctype = child->window()->windowType(); + if ([cwin isVisible] && (ctype == Qt::Window || ctype == Qt::Dialog) && ![cwin parentWindow]) + [qwin addChildWindow:cwin ordered:NSWindowAbove]; + } else { + [qwin removeChildWindow:qt_mac_window_for(child)]; + } } } } @@ -3442,7 +3464,6 @@ void QWidgetPrivate::show_sys() #else // sync the opacity value back (in case of a fade). [window setAlphaValue:q->windowOpacity()]; - setSubWindowStacking(true); QWidget *top = 0; if (QApplicationPrivate::tryModalHelper(q, &top)) { @@ -3461,6 +3482,7 @@ void QWidgetPrivate::show_sys() [modalWin orderFront:window]; } } + setSubWindowStacking(true); #endif if (q->windowType() == Qt::Popup) { if (q->focusWidget()) diff --git a/src/gui/kernel/qwidget_qws.cpp b/src/gui/kernel/qwidget_qws.cpp index 3145136..c6cbbd0 100644 --- a/src/gui/kernel/qwidget_qws.cpp +++ b/src/gui/kernel/qwidget_qws.cpp @@ -1017,6 +1017,30 @@ int QWidget::metric(PaintDeviceMetric m) const return static_cast<QWidget *>(d->parent)->metric(m); const QScreen *screen = d->getScreen(); return qRound(screen->height() / double(screen->physicalHeight() / 25.4)); + } else if (m == PdmNumColors) { + QScreen *screen = d->getScreen(); + int ret = screen->colorCount(); + if (!ret) { + const int depth = qwsDisplay()->depth(); + switch (depth) { + case 1: + ret = 2; + break; + case 8: + ret = 256; + break; + case 16: + ret = 65536; + break; + case 24: + ret = 16777216; + break; + case 32: + ret = 2147483647; + break; + } + } + return ret; } else { val = QPaintDevice::metric(m);// XXX } diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 41ce11e..9ceb197 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -548,7 +548,7 @@ void QWidgetPrivate::show_sys() id->MakeVisible(true); - if(q->isWindow()) + if(q->isWindow()&&!q->testAttribute(Qt::WA_ShowWithoutActivating)) id->setFocusSafely(true); } @@ -581,7 +581,7 @@ void QWidgetPrivate::hide_sys() QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId()); if (id) { - //Incorrect optimisation - for popup windows, Qt's focus is moved before + //Incorrect optimization - 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 diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 6eb4bd4..099619c 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -244,13 +244,14 @@ embedded { symbian { - HEADERS += painting/qwindowsurface_s60_p.h + HEADERS += painting/qwindowsurface_s60_p.h \ + painting/qdrawhelper_arm_simd_p.h SOURCES += painting/qwindowsurface_s60.cpp armccIfdefBlock = \ "$${LITERAL_HASH}if defined(ARMV6)" \ + "MACRO QT_HAVE_ARM_SIMD" \ "SOURCEPATH painting" \ - "SOURCE qblendfunctions_armv6_rvct.s" \ - "SOURCE qdrawhelper_armv6_rvct.s" \ + "SOURCE qdrawhelper_arm_simd.cpp" \ "$${LITERAL_HASH}endif" MMP_RULES += armccIfdefBlock diff --git a/src/gui/painting/qblendfunctions_armv6_rvct.s b/src/gui/painting/qblendfunctions_armv6_rvct.s deleted file mode 100644 index 1e3faa9..0000000 --- a/src/gui/painting/qblendfunctions_armv6_rvct.s +++ /dev/null @@ -1,222 +0,0 @@ -;**************************************************************************** -;** -;** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -;** All rights reserved. -;** Contact: Nokia Corporation (qt-info@nokia.com) -;** -;** This file is part of the QtGui module of the Qt Toolkit. -;** -;** $QT_BEGIN_LICENSE:LGPL$ -;** No Commercial Usage -;** This file contains pre-release code and may not be distributed. -;** You may use this file in accordance with the terms and conditions -;** contained in the Technology Preview License Agreement accompanying -;** this package. -;** -;** GNU Lesser General Public License Usage -;** Alternatively, this file may be used under the terms of the GNU Lesser -;** General Public License version 2.1 as published by the Free Software -;** Foundation and appearing in the file LICENSE.LGPL included in the -;** packaging of this file. Please review the following information to -;** ensure the GNU Lesser General Public License version 2.1 requirements -;** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -;** -;** In addition, as a special exception, Nokia gives you certain additional -;** rights. These rights are described in the Nokia Qt LGPL Exception -;** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -;** -;** If you have questions regarding the use of this file, please contact -;** Nokia at qt-info@nokia.com. -;** -;** -;** -;** -;** -;** -;** -;** -;** $QT_END_LICENSE$ -;** -;**************************************************************************** - -; -; W A R N I N G -; ------------- -; -; This file is not part of the Qt API. It exists purely as an -; implementation detail. This header file may change from version to -; version without notice, or even be removed. -; -; We mean it. -; - - - ARM - PRESERVE8 - - INCLUDE qdrawhelper_armv6_rvct.inc - - -;----------------------------------------------------------------------------- -; qt_blend_rgb32_on_rgb32_arm -; -; @brief -; -; @param dest Destination pixels (r0) -; @param dbpl Destination bytes per line (r1) -; @param src Source pixels (r2) -; @param sbpl Source bytes per line (r3) -; @param w Width (s0 -> r4) -; @param h Height (s1 -> r5) -; @param const_alpha Constant alpha (s2 -> r6) -; -;--------------------------------------------------------------------------- -qt_blend_rgb32_on_rgb32_armv6 Function - stmfd sp!, {r4-r12, r14} - - ; read arguments off the stack - add r8, sp, #10 * 4 - ldmia r8, {r9-r11} - - ; Reorganize registers - - mov r4, r10 - mov r5, r1 - mov r6, r3 - - mov r1, r2 - mov r2, r9 - mov r3, r11 - - ; Now we have registers - ; @param dest Destination pixels (r0) - ; @param src Source pixels (r1) - ; @param w Width (r2) - ; @param const_alpha Constant alpha (r3) - ; @param h Height (r4) - ; @param dbpl Destination bytes per line (r5) - ; @param sbpl Source bytes per line (r6) - - cmp r3, #256 ; test if we have fully opaque constant alpha value - bne rgb32_blend_const_alpha ; branch if not - -rgb32_blend_loop - - subs r4, r4, #1 - bmi rgb32_blend_exit ; while(h--) - -rgb321 PixCpySafe r0, r1, r2 - - add r0, r0, r5 ; dest = dest + dbpl - add r1, r1, r6 ; src = src + sbpl - - b rgb32_blend_loop - - -rgb32_blend_const_alpha - - ;ldr r14, =ComponentHalf ; load 0x800080 to r14 - mov r14, #0x800000 - add r14, r14, #0x80 - - sub r3, r3, #1 ; const_alpha -= 1; - -rgb32_blend_loop_const_alpha - - subs r4, r4, #1 - bmi rgb32_blend_exit ; while(h--) - -rgb322 BlendRowSafe PixelSourceOverConstAlpha - - add r0, r0, r5 ; dest = dest + dbpl - add r1, r1, r6 ; src = src + sbpl - - b rgb32_blend_loop_const_alpha - -rgb32_blend_exit - - ldmfd sp!, {r4-r12, pc} ; pop and return - - - -;----------------------------------------------------------------------------- -; qt_blend_argb32_on_argb32_arm -; -; @brief -; -; @param dest Destination pixels (r0) -; @param dbpl Destination bytes per line (r1) -; @param src Source pixels (r2) -; @param sbpl Source bytes per line (r3) -; @param w Width (s0 -> r4) -; @param h Height (s1 -> r5) -; @param const_alpha Constant alpha (s2 -> r6) -; -;--------------------------------------------------------------------------- -qt_blend_argb32_on_argb32_armv6 Function - stmfd sp!, {r4-r12, r14} - - ; read arguments off the stack - add r8, sp, #10 * 4 - ldmia r8, {r9-r11} - - ; Reorganize registers - - mov r4, r10 - mov r5, r1 - mov r6, r3 - - mov r1, r2 - mov r2, r9 - mov r3, r11 - - ; Now we have registers - ; @param dest Destination pixels (r0) - ; @param src Source pixels (r1) - ; @param w Width (r2) - ; @param const_alpha Constant alpha (r3) - ; @param h Height (r4) - ; @param dbpl Destination bytes per line (r5) - ; @param sbpl Source bytes per line (r6) - - ;ldr r14, =ComponentHalf ; load 0x800080 to r14 - mov r14, #0x800000 - add r14, r14, #0x80 - - cmp r3, #256 ; test if we have fully opaque constant alpha value - bne argb32_blend_const_alpha ; branch if not - -argb32_blend_loop - - subs r4, r4, #1 - bmi argb32_blend_exit ; while(h--) - -argb321 BlendRowSafe PixelSourceOver - - add r0, r0, r5 ; dest = dest + dbpl - add r1, r1, r6 ; src = src + sbpl - - b argb32_blend_loop - -argb32_blend_const_alpha - - sub r3, r3, #1 ; const_alpha -= 1; - -argb32_blend_loop_const_alpha - - subs r4, r4, #1 - bmi argb32_blend_exit ; while(h--) - -argb322 BlendRowSafe PixelSourceOverConstAlpha - - add r0, r0, r5 ; dest = dest + dbpl - add r1, r1, r6 ; src = src + sbpl - - b argb32_blend_loop_const_alpha - -argb32_blend_exit - - ldmfd sp!, {r4-r12, pc} ; pop and return - - - END ; File end diff --git a/src/gui/painting/qcolormap.qdoc b/src/gui/painting/qcolormap.qdoc index ec3d2ba..96fd6a0 100644 --- a/src/gui/painting/qcolormap.qdoc +++ b/src/gui/painting/qcolormap.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 5f190ba..a4ab278 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -43,7 +43,7 @@ #include <private/qpaintengine_raster_p.h> #include <private/qpainter_p.h> #include <private/qdrawhelper_x86_p.h> -#include <private/qdrawhelper_armv6_p.h> +#include <private/qdrawhelper_arm_simd_p.h> #include <private/qdrawhelper_neon_p.h> #include <private/qmath_p.h> #include <qmath.h> @@ -7678,96 +7678,6 @@ static void qt_memfill16_setup(quint16 *dest, quint16 value, int count); qt_memfill32_func qt_memfill32 = qt_memfill32_setup; qt_memfill16_func qt_memfill16 = qt_memfill16_setup; -#if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6) -// Move these to qdrawhelper_arm.c when all -// functions are implemented using arm assembly. -static CompositionFunctionSolid qt_functionForModeSolid_ARMv6[numCompositionFunctions] = { - comp_func_solid_SourceOver, - comp_func_solid_DestinationOver, - comp_func_solid_Clear, - comp_func_solid_Source, - comp_func_solid_Destination, - comp_func_solid_SourceIn, - comp_func_solid_DestinationIn, - comp_func_solid_SourceOut, - comp_func_solid_DestinationOut, - comp_func_solid_SourceAtop, - comp_func_solid_DestinationAtop, - comp_func_solid_XOR, - comp_func_solid_Plus, - comp_func_solid_Multiply, - comp_func_solid_Screen, - comp_func_solid_Overlay, - comp_func_solid_Darken, - comp_func_solid_Lighten, - comp_func_solid_ColorDodge, - comp_func_solid_ColorBurn, - comp_func_solid_HardLight, - comp_func_solid_SoftLight, - comp_func_solid_Difference, - comp_func_solid_Exclusion, - rasterop_solid_SourceOrDestination, - rasterop_solid_SourceAndDestination, - rasterop_solid_SourceXorDestination, - rasterop_solid_NotSourceAndNotDestination, - rasterop_solid_NotSourceOrNotDestination, - rasterop_solid_NotSourceXorDestination, - rasterop_solid_NotSource, - rasterop_solid_NotSourceAndDestination, - rasterop_solid_SourceAndNotDestination -}; - -static CompositionFunction qt_functionForMode_ARMv6[numCompositionFunctions] = { - comp_func_SourceOver_armv6, - comp_func_DestinationOver, - comp_func_Clear, - comp_func_Source_armv6, - comp_func_Destination, - comp_func_SourceIn, - comp_func_DestinationIn, - comp_func_SourceOut, - comp_func_DestinationOut, - comp_func_SourceAtop, - comp_func_DestinationAtop, - comp_func_XOR, - comp_func_Plus, - comp_func_Multiply, - comp_func_Screen, - comp_func_Overlay, - comp_func_Darken, - comp_func_Lighten, - comp_func_ColorDodge, - comp_func_ColorBurn, - comp_func_HardLight, - comp_func_SoftLight, - comp_func_Difference, - comp_func_Exclusion, - rasterop_SourceOrDestination, - rasterop_SourceAndDestination, - rasterop_SourceXorDestination, - rasterop_NotSourceAndNotDestination, - rasterop_NotSourceOrNotDestination, - rasterop_NotSourceXorDestination, - rasterop_NotSource, - rasterop_NotSourceAndDestination, - rasterop_SourceAndNotDestination -}; - -static void qt_blend_color_argb_armv6(int count, const QSpan *spans, void *userData) -{ - QSpanData *data = reinterpret_cast<QSpanData *>(userData); - - CompositionFunctionSolid func = qt_functionForModeSolid_ARMv6[data->rasterBuffer->compositionMode]; - while (count--) { - uint *target = ((uint *)data->rasterBuffer->scanLine(spans->y)) + spans->x; - func(target, spans->len, data->solid.color, spans->coverage); - ++spans; - } -} - -#endif // Q_CC_RVCT && QT_HAVE_ARMV6 - - void qInitDrawhelperAsm() { @@ -7938,46 +7848,39 @@ void qInitDrawhelperAsm() } #endif // IWMMXT -#if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6) - functionForModeAsm = qt_functionForMode_ARMv6; - functionForModeSolidAsm = qt_functionForModeSolid_ARMv6; +#if defined(QT_HAVE_ARM_SIMD) + qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_arm_simd; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_arm_simd; + qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_arm_simd; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_arm_simd; +#elif defined(QT_HAVE_NEON) + if (features & NEON) { + qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; + qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; + qBlendFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_rgb16_neon; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB16] = qt_blend_rgb16_on_argb32_neon; + qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_neon; + + qScaleFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_rgb16_neon; + qScaleFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_scale_image_rgb16_on_rgb16_neon; - qt_memfill32 = qt_memfill32_armv6; + qTransformFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_transform_image_argb32_on_rgb16_neon; + qTransformFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_transform_image_rgb16_on_rgb16_neon; - qDrawHelper[QImage::Format_ARGB32_Premultiplied].blendColor = qt_blend_color_argb_armv6; + qDrawHelper[QImage::Format_RGB16].alphamapBlit = qt_alphamapblit_quint16_neon; - qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_armv6; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_armv6; - qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_armv6; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_armv6; -#elif defined(QT_HAVE_NEON) - if (features & NEON) { - qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; - qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; - qBlendFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_rgb16_neon; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB16] = qt_blend_rgb16_on_argb32_neon; - qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_neon; - - qScaleFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_rgb16_neon; - qScaleFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_scale_image_rgb16_on_rgb16_neon; - - qTransformFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_transform_image_argb32_on_rgb16_neon; - qTransformFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_transform_image_rgb16_on_rgb16_neon; - - qDrawHelper[QImage::Format_RGB16].alphamapBlit = qt_alphamapblit_quint16_neon; - - functionForMode_C[QPainter::CompositionMode_SourceOver] = qt_blend_argb32_on_argb32_scanline_neon; - functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_neon; - functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_neon; - destFetchProc[QImage::Format_RGB16] = qt_destFetchRGB16_neon; - destStoreProc[QImage::Format_RGB16] = qt_destStoreRGB16_neon; - - qMemRotateFunctions[QImage::Format_RGB16][0] = qt_memrotate90_16_neon; - qMemRotateFunctions[QImage::Format_RGB16][2] = qt_memrotate270_16_neon; - qt_memfill32 = qt_memfill32_neon; - } + functionForMode_C[QPainter::CompositionMode_SourceOver] = qt_blend_argb32_on_argb32_scanline_neon; + functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_neon; + functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_neon; + destFetchProc[QImage::Format_RGB16] = qt_destFetchRGB16_neon; + destStoreProc[QImage::Format_RGB16] = qt_destStoreRGB16_neon; + + qMemRotateFunctions[QImage::Format_RGB16][0] = qt_memrotate90_16_neon; + qMemRotateFunctions[QImage::Format_RGB16][2] = qt_memrotate270_16_neon; + qt_memfill32 = qt_memfill32_neon; + } #endif if (functionForModeSolidAsm) { diff --git a/src/gui/painting/qdrawhelper_arm_simd.cpp b/src/gui/painting/qdrawhelper_arm_simd.cpp new file mode 100644 index 0000000..61dac5e --- /dev/null +++ b/src/gui/painting/qdrawhelper_arm_simd.cpp @@ -0,0 +1,313 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdrawhelper_arm_simd_p.h" + +#include <private/qpaintengine_raster_p.h> +#include <private/qblendfunctions_p.h> + +#ifdef QT_HAVE_ARM_SIMD + +#if defined(Q_OS_SYMBIAN) +#include <u32std.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT) +__asm void qt_blend_argb32_on_argb32_arm_simd(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha) +{ +#ifndef __ARMCC__ + __SWITCH_TO_ARM; +#else + CODE32 +#endif // __ARMCC__ + + stmfd sp!, {r4-r12, r14} + + // read arguments off the stack + add r8, sp, #10 * 4 + ldmia r8, {r4-r6} + + // adjust dbpl and sbpl + mov r14, #4 + mul r14, r4, r14 + sub r1, r1, r14 + sub r3, r3, r14 + + // load 0xFF00FF00 to r12 + mov r12, #0xFF000000 + add r12, r12, #0xFF00 + + // load 0x800080 to r14 + mov r14, #0x800000 + add r14, r14, #0x80 + + /* + Registers: + r0 dst + r1 dbpl + r2 src + r3 sbpl + r4 w + r5 h + r6 const_alpha + r12 0xFF0000 + r14 0x800080 + */ + + cmp r6, #256 //test if we have fully opaque constant alpha value + bne argb32constalpha // branch if not + +argb32_next_row + + mov r7, r4 + +argb32_next_pixel + + ldr r8, [r2], #4 // load src pixel + + // Negate r8 and extract src alpha + mvn r11, r8 // bitwise not + uxtb r11, r11, ror #24 + + cmp r11, #0 // test for full src opacity (negated) + beq argb32_no_blend + + cmp r11, #255 // test for full src transparency (negated) + addeq r0, #4 + beq argb32_nop + + ldr r9, [r0] // load dst pixel + + // blend + uxtb16 r10, r9 + uxtb16 r6, r9, ror #8 + mla r10, r11, r10, r14 + mla r9, r6, r11, r14 + uxtab16 r10, r10, r10, ror #8 + uxtab16 r9, r9, r9, ror #8 + and r9, r9, r12 + uxtab16 r10, r9, r10, ror #8 + + uqadd8 r8, r10, r8 + +argb32_no_blend + + str r8, [r0], #4 + +argb32_nop + + subs r7, r7, #1 + bgt argb32_next_pixel + + add r0, r0, r1 // dest = dest + dbpl + add r2, r2, r3 // src = src + sbpl + + subs r5, r5, #1 + bgt argb32_next_row + + b argb32_blend_exit + +argb32constalpha + + cmp r6, #0 + beq argb32_blend_exit + + ; const_alpha = (const_alpha * 255) >> 8; + mov r11, #255 + mul r6, r6, r11 + mov r11, r6, lsr #8 + +argb32constalpha_next_row + + mov r7, r4 + +argb32constalpha_next_pixel + + ldr r9, [r2], #4 // load src pixel + + // blend + uxtb16 r10, r9 + uxtb16 r6, r9, ror #8 + mla r10, r11, r10, r14 + mla r9, r6, r11, r14 + uxtab16 r10, r10, r10, ror #8 + uxtab16 r9, r9, r9, ror #8 + and r9, r9, r12 + uxtab16 r8, r9, r10, ror #8 + + ldr r9, [r0] // load dst pixel + + // blend + uxtb16 r10, r9 + uxtb16 r6, r9, ror #8 + + // Negate r11 and extract src alpha + mvn r9, r11 // bitwise not + uxtb r9, r9, ror #24 + + mla r10, r9, r10, r14 + mla r9, r6, r9, r14 + uxtab16 r10, r10, r10, ror #8 + uxtab16 r9, r9, r9, ror #8 + and r9, r9, r12 + uxtab16 r10, r9, r10, ror #8 + + uqadd8 r8, r10, r8 + + str r8, [r0], #4 + + subs r7, r7, #1 + bgt argb32constalpha_next_pixel + + add r0, r0, r1 // dest = dest + dbpl + add r2, r2, r3 // src = src + sbpl + + subs r5, r5, #1 + bgt argb32constalpha_next_row + +argb32_blend_exit + + // Restore registers + ldmfd sp!, {r4-r12, lr} + bx lr + + __END_ARM +} + +void qt_blend_rgb32_on_rgb32_arm_simd(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha) +{ + if (const_alpha != 256) { + qt_blend_argb32_on_argb32_arm_simd(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); + return; + } + + const uint *src = (const uint *) srcPixels; + uint *dst = (uint *) destPixels; + if (w <= 64) { + for (int y=0; y<h; ++y) { + qt_memconvert(dst, src, w); + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } else { + int len = w * 4; + for (int y=0; y<h; ++y) { + memcpy(dst, src, len); + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } +} + +#else // defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT) + +// TODO: add GNU assembler instructions and support for other platforms. +// Default to C code for now + +void qt_blend_argb32_on_argb32_arm_simd(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha) +{ + const uint *src = (const uint *) srcPixels; + uint *dst = (uint *) destPixels; + if (const_alpha == 256) { + for (int y=0; y<h; ++y) { + for (int x=0; x<w; ++x) { + uint s = src[x]; + if (s >= 0xff000000) + dst[x] = s; + else if (s != 0) + dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); + } + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } else if (const_alpha != 0) { + const_alpha = (const_alpha * 255) >> 8; + for (int y=0; y<h; ++y) { + for (int x=0; x<w; ++x) { + uint s = BYTE_MUL(src[x], const_alpha); + dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); + } + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } +} + +void qt_blend_rgb32_on_rgb32_arm_simd(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha) +{ + if (const_alpha != 256) { + qt_blend_argb32_on_argb32_arm_simd(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); + return; + } + + const uint *src = (const uint *) srcPixels; + uint *dst = (uint *) destPixels; + if (w <= 64) { + for (int y=0; y<h; ++y) { + qt_memconvert(dst, src, w); + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } else { + int len = w * 4; + for (int y=0; y<h; ++y) { + memcpy(dst, src, len); + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } +} + +#endif + +#endif // QT_HAVE_ARMV_SIMD diff --git a/src/gui/painting/qdrawhelper_armv6_p.h b/src/gui/painting/qdrawhelper_arm_simd_p.h index e58f8bb..6c96a84 100644 --- a/src/gui/painting/qdrawhelper_armv6_p.h +++ b/src/gui/painting/qdrawhelper_arm_simd_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QDRAWHELPER_ARMV6_P_H -#define QDRAWHELPER_ARMV6_P_H +#ifndef QDRAWHELPER_ARM_SIMD_P_H +#define QDRAWHELPER_ARM_SIMD_P_H // // W A R N I N G @@ -57,25 +57,20 @@ QT_BEGIN_NAMESPACE -#if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6) +#if defined(QT_HAVE_ARM_SIMD) -extern "C" void qt_blend_rgb32_on_rgb32_armv6(uchar *destPixels, int dbpl, +void qt_blend_argb32_on_argb32_arm_simd(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, int w, int h, int const_alpha); -extern "C" void qt_blend_argb32_on_argb32_armv6(uchar *destPixels, int dbpl, +void qt_blend_rgb32_on_rgb32_arm_simd(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, int w, int h, int const_alpha); -extern "C" void qt_memfill32_armv6(quint32 *dest, quint32 value, int count); - -extern "C" void comp_func_Source_armv6(uint *dest, const uint *src, int length, uint const_alpha); -extern "C" void comp_func_SourceOver_armv6(uint *dest, const uint *src, int length, uint const_alpha); - -#endif // QT_HAVE_ARMV6 +#endif // QT_HAVE_ARM_SIMD QT_END_NAMESPACE -#endif // QDRAWHELPER_ARMV6_P_H +#endif // QDRAWHELPER_ARM_SIMD_P_H diff --git a/src/gui/painting/qdrawhelper_armv6_rvct.inc b/src/gui/painting/qdrawhelper_armv6_rvct.inc deleted file mode 100644 index 8c6d803..0000000 --- a/src/gui/painting/qdrawhelper_armv6_rvct.inc +++ /dev/null @@ -1,496 +0,0 @@ -;**************************************************************************** -;** -;** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -;** All rights reserved. -;** Contact: Nokia Corporation (qt-info@nokia.com) -;** -;** This file is part of the QtGui module of the Qt Toolkit. -;** -;** $QT_BEGIN_LICENSE:LGPL$ -;** No Commercial Usage -;** This file contains pre-release code and may not be distributed. -;** You may use this file in accordance with the terms and conditions -;** contained in the Technology Preview License Agreement accompanying -;** this package. -;** -;** GNU Lesser General Public License Usage -;** Alternatively, this file may be used under the terms of the GNU Lesser -;** General Public License version 2.1 as published by the Free Software -;** Foundation and appearing in the file LICENSE.LGPL included in the -;** packaging of this file. Please review the following information to -;** ensure the GNU Lesser General Public License version 2.1 requirements -;** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -;** -;** In addition, as a special exception, Nokia gives you certain additional -;** rights. These rights are described in the Nokia Qt LGPL Exception -;** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -;** -;** If you have questions regarding the use of this file, please contact -;** Nokia at qt-info@nokia.com. -;** -;** -;** -;** -;** -;** -;** -;** -;** $QT_END_LICENSE$ -;** -;**************************************************************************** - -; -; W A R N I N G -; ------------- -; -; This file is not part of the Qt API. It exists purely as an -; implementation detail. This header file may change from version to -; version without notice, or even be removed. -; -; We mean it. -; - -;----------------------------------------------------------------------------- -; Globals. -; Earch marcro expects that caller has loaded 0x800080 to r14. -;----------------------------------------------------------------------------- - -ComponentHalf EQU 0x800080 - -;----------------------------------------------------------------------------- -; ARM assembly implementations of accelerated graphics operations. -; -; Conventions: -; -; - r0 = Target buffer pointer -; - r1 = Source buffer pointer -; - r2 = Length of the buffer to blend -; - r3 = Constant alpha for source buffer -; -;----------------------------------------------------------------------------- - -; A macro for transparently defining ARM functions - MACRO -$func Function - AREA Function_$func, CODE - GLOBAL $func - ALIGN 4 - CODE32 -$func - MEND - - -;----------------------------------------------------------------------------- -; Armv6 boosted implementation of BYTE_MUL(...) function found in qdrawhelper_p.h. -; -; @param dst Destination register where to store the result -; @param x Value to multiply -; @param a Multiplicator byte -; @param r14 Component half 0x800080 -; -; @note Trashes x, r8 -;----------------------------------------------------------------------------- - MACRO - ByteMul $dst, $x, $a - - ; static inline uint BYTE_MUL(uint x, uint a) - - ; uint r8 = (x & 0xff00ff) * a + 0x800080 - uxtb16 r8, $x ; r8 = r8 & 0x00FF00FF - mla r8, r8, $a, r14 - - ; x = ((r >> 8) & 0xff00ff) * a + 0x800080 - uxtb16 $x, $x, ror #8 - mla $x, $x, $a, r14 - - - ; r8 = (r8 + ((r8 >> 8) & 0xff00ff) ) >> 8 - ; r8 &= 0xff00ff - uxtab16 r8, r8, r8, ror #8 - uxtb16 r8, r8, ror #8 - - ; x = x + ((x >>8) & 0xff00ff) - uxtab16 $x, $x, $x, ror #8 - - ; x &= 0xff00ff00 - ; x |= r8 - uxtb16 $x, $x, ror #8 - orr $dst, r8, $x, lsl #8 - - MEND - -;----------------------------------------------------------------------------- -; Armv6 boosted implementation of INTERPOLATE_PIXEL_255(...) function found in -; qdrawhelper_p.h. -; -; @param dst Destination register where to store the result -; @param x First value to multiply -; @param a Multiplicator byte for first value -; @param y Second value to multiply -; @param b Multiplicator byte for second value -; @param r14 Component half 0x800080 -; -; -; @note Trashes x, r8, r14 -;----------------------------------------------------------------------------- - MACRO - InterpolatePixel255 $dst, $x, $a, $y, $b - - ; static inline uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) - - ; First calculate the parts where we need 0x800080 - - ; uint r8 = (((x & 0xff00ff) * a) + 0x800080) - uxtb16 r8, $x ; r8 = r8 & 0x00FF00FF - mla r8, r8, $a, r14 - - ; x = ((((x >> 8) & 0xff00ff) * a) + 0x800080) - uxtb16 $x, $x, ror #8 - mla $x, $x, $a, r14 - - ; Now we are trashing r14 to free it for other purposes - - ; uint r14 = (y & 0xff00ff) * b - uxtb16 r14, $y ; r14 = y & 0x00FF00FF - mul r14, r14, $b - - ; r8 = r8 + r14 - add r8, r8, r14 - - ; r8 = (r8 + ((r8 >> 8) & 0xff00ff) ) >> 8 - ; r8 &= 0xff00ff - uxtab16 r8, r8, r8, ror #8 - uxtb16 r8, r8, ror #8 - - ; r14 = ((y >> 8) & 0xff00ff) * b - uxtb16 r14, $y, ror #8 ; r14 = ((y >> 8) & 0xFF00FF) - mul r14, r14, $b - - ; x = x + r14 - add $x, $x, r14 - - ; x = x + ((x >>8) & 0xff00ff) - uxtab16 $x, $x, $x, ror #8 - - ; x &= 0xff00ff00 - ; x |= r8 - uxtb16 $x, $x, ror #8 - orr $dst, r8, $x, lsl #8 - - MEND - -;----------------------------------------------------------------------------- -; -;----------------------------------------------------------------------------- - MACRO -$label Blend4Pixels $BlendPixel - - ; Blend first 4 pixels - - ldmia r1!, {r4-r7} - ldm r0, {r9-r12} - -b4p1_$label $BlendPixel r9, r4, r3 -b4p2_$label $BlendPixel r10, r5, r3 -b4p3_$label $BlendPixel r11, r6, r3 -b4p4_$label $BlendPixel r12, r7, r3 - - stmia r0!, {r9-r12} - - MEND - -;----------------------------------------------------------------------------- -; -;----------------------------------------------------------------------------- - MACRO -$label Blend8Pixels $BlendPixel - -b8p1_$label Blend4Pixels $BlendPixel -b8p2_$label Blend4Pixels $BlendPixel - - MEND - -;----------------------------------------------------------------------------- -; -;----------------------------------------------------------------------------- - MACRO -$label Blend16Pixels $BlendPixel - -b16p1_$label Blend8Pixels $BlendPixel -b16p2_$label Blend8Pixels $BlendPixel - - MEND - -;----------------------------------------------------------------------------- -; -;----------------------------------------------------------------------------- - MACRO -$label Blend32Pixels $BlendPixel - -b32p1_$label Blend16Pixels $BlendPixel -b32p2_$label Blend16Pixels $BlendPixel - - MEND - -;----------------------------------------------------------------------------- -; A macro for source over compositing one row of pixels and saving the results -; to destination buffer. -; -; @param dest Destination buffer (r0) -; @param src Source buffer (r1) -; @param length Length (r2) -; @param const_alpha Constant alpha (r3) -; @param r14 Component Half (0x800080) (r14) -; -; @note Advances r0, r1 -; @note Trashes r2, r4-r12 -;----------------------------------------------------------------------------- - MACRO -$label BlendRow $BlendPixel - - pld [r1] - -bloop_$label - ; Blend 32 pixels per loop iteration - subs r2, r2, #32 - bmi b_remaining_$label - -brp1_$label Blend32Pixels $BlendPixel - - b bloop_$label - -b_remaining_$label - - ; Remaining 31 pixels - - addmi r2, r2, #32 - - ; Blend 16 pixels - tst r2, #16 - beq b_remaining8_$label - -brp2_$label Blend16Pixels $BlendPixel - -b_remaining8_$label - - ; Blend 8 pixels - tst r2, #8 - beq b_remaining4_$label - -brp3_$label Blend8Pixels $BlendPixel - -b_remaining4_$label - - ; Blend 4 pixels - tst r2, #4 - beq b_remaining3_$label - -brp4_$label Blend4Pixels $BlendPixel - -b_remaining3_$label - - ; Remaining 3 pixels - - tst r2, #2 - beq b_last_$label - - ldmia r1!, {r4-r5} - ldm r0, {r9-r10} - -brp5_$label $BlendPixel r9, r4, r3 -brp6_$label $BlendPixel r10, r5, r3 - - stmia r0!, {r9-r10} - -b_last_$label - - tst r2, #1 - beq bexit_$label - - ldr r4, [r1] - ldr r9, [r0] - -bpl_$label $BlendPixel r9, r4, r3 - - str r9, [r0] - -bexit_$label - - MEND - -;----------------------------------------------------------------------------- -; A macro for source over compositing one row of pixels and saving the results -; to destination buffer. Restores all registers. -; -; @param dest Destination buffer (r0) -; @param src Source buffer (r1) -; @param length Length (r2) -; @param const_alpha Constant alpha (r3) -; @param r14 Component Half (0x800080) (r14) -; -; @note Advances r0, r1 -; @note Trashes r2, r4-r12 -;----------------------------------------------------------------------------- - MACRO -$label BlendRowSafe $BlendPixel - - stmfd sp!, {r0-r6} ; Preserves registers only up to r6 - -brs_$label BlendRow $BlendPixel - - ldmfd sp!, {r0-r6} - - MEND - - -;----------------------------------------------------------------------------- -; Pix Copy. -; NOTE! Cache line size of ARM1136JF-S and ARM1136J-S is 32 bytes (8 pixels). -; -; @param dst Destination pixels (r0) -; @param src Source pixels (r1) -; @param len Length (r2) -; -; @note Trashes r3-r10 -;----------------------------------------------------------------------------- - MACRO -$label PixCpy $dst, $src, $len - - pld [$src] - -pcpy_loop_$label - ; Copy 8 pixels per loop iteration - pld [$src, #96] - subs $len, $len, #8 - ldmgeia $src!, {r3-r10} - stmgeia $dst!, {r3-r10} - bgt pcpy_loop_$label - -pcpy_remaining_$label - - ; Copy up to 7 remaining pixels - - ; Copy 4 pixels - tst $len, #4 - ldmneia $src!, {r3-r6} - stmneia $dst!, {r3-r6} - - tst $len, #2 - ldmneia $src!, {r3-r4} - stmneia $dst!, {r3-r4} - - tst $len, #1 - ldrne r3, [$src] - strne r3, [$dst] - - MEND - -;----------------------------------------------------------------------------- -; General Pix Copy. Maximum 8 pixels at time. Restores all registers. -; -; @param dst Destination pixels (r0) -; @param src Source pixels (r1) -; @param len Length (r2) -; -; @note Trashes r3-r10 -;----------------------------------------------------------------------------- - MACRO -$label PixCpySafe $dst, $src, $len - - stmfd sp!, {r0-r6} ; Preserves registers only up to r6 - -pcs_$label PixCpy $dst, $src, $len - - ldmfd sp!, {r0-r6} ; pop - - MEND - - -;----------------------------------------------------------------------------- -; A macro for source over compositing one pixel and saving the result to -; dst register. -; -; @param dst Destination register, must contain destination pixel upon entry -; @param src Source register, must contain source pixel upon entry -; @param const_alpha Constant source alpha -; @param r14 Component half 0x800080 -; -; @note Trashes const_alpha, r8 -;----------------------------------------------------------------------------- - MACRO -$label PixelSourceOver $dst, $src, $const_alpha - - ; Negate src and extract alpha - mvn $const_alpha, $src ; bitwise not - uxtb $const_alpha, $const_alpha, ror #24 ; r3 = ((r3 & 0xFF000000) >> 24); - - ;cmp $const_alpha, #255 ; test for full transparency ( negated ) - ;beq exit_$label - cmp $const_alpha, #0 ; test for full opacity ( negated ) - moveq $dst, $src - beq exit_$label - - ByteMul $dst, $dst, $const_alpha - add $dst, $src, $dst - -exit_$label - MEND - -;----------------------------------------------------------------------------- -; A macro for source over compositing one pixel and saving the result to -; dst register. -; -; @param dst Destination register, must contain destination pixel upon entry -; @param src Source register, must contain source pixel upon entry -; @param const_alpha Constant source alpha -; @param r14 Component half 0x800080 -; -; @note Trashes src, const_alpha, r8 -;----------------------------------------------------------------------------- - MACRO -$label PixelSourceOverConstAlpha $dst, $src, $const_alpha - - ; store alpha because we are going to trash it - stmfd sp!, {$const_alpha} - - ByteMul $src, $src, $const_alpha - - ; Negate src and extract alpha - mvn $const_alpha, $src ; bitwise not - uxtb $const_alpha, $const_alpha, ror #24 ; r3 = ((r3 & 0xFF000000) >> 24); - - ByteMul $dst, $dst, $const_alpha - - add $dst, $src, $dst - - ; recover alpha - ldmfd sp!, {$const_alpha} - - MEND - -;----------------------------------------------------------------------------- -; A macro for source over compositing one pixel and saving the result to -; a register. -; -; @param dst Destination register, must contain destination pixel upon entry -; @param src Source register, must contain source pixel upon entry -; @param const_alpha Constant source alpha -; @param r14 Component half 0x800080 -; -; @note Trashes src, r8 -;----------------------------------------------------------------------------- - MACRO -$label PixelSourceConstAlpha $dst, $src, $const_alpha - - ; store r2 and r14 because we are going to trash them - stmfd sp!, {r2, r14} - - rsb r2, $const_alpha, #255 - InterpolatePixel255 $dst, $src, $const_alpha, $dst, r2 - - ; recover r2 and r14 - ldmfd sp!, {r2, r14} - - MEND - - END ; File end diff --git a/src/gui/painting/qdrawhelper_armv6_rvct.s b/src/gui/painting/qdrawhelper_armv6_rvct.s deleted file mode 100644 index 180980a..0000000 --- a/src/gui/painting/qdrawhelper_armv6_rvct.s +++ /dev/null @@ -1,177 +0,0 @@ -;**************************************************************************** -;** -;** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -;** All rights reserved. -;** Contact: Nokia Corporation (qt-info@nokia.com) -;** -;** This file is part of the QtGui module of the Qt Toolkit. -;** -;** $QT_BEGIN_LICENSE:LGPL$ -;** No Commercial Usage -;** This file contains pre-release code and may not be distributed. -;** You may use this file in accordance with the terms and conditions -;** contained in the Technology Preview License Agreement accompanying -;** this package. -;** -;** GNU Lesser General Public License Usage -;** Alternatively, this file may be used under the terms of the GNU Lesser -;** General Public License version 2.1 as published by the Free Software -;** Foundation and appearing in the file LICENSE.LGPL included in the -;** packaging of this file. Please review the following information to -;** ensure the GNU Lesser General Public License version 2.1 requirements -;** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -;** -;** In addition, as a special exception, Nokia gives you certain additional -;** rights. These rights are described in the Nokia Qt LGPL Exception -;** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -;** -;** If you have questions regarding the use of this file, please contact -;** Nokia at qt-info@nokia.com. -;** -;** -;** -;** -;** -;** -;** -;** -;** $QT_END_LICENSE$ -;** -;**************************************************************************** - -; -; W A R N I N G -; ------------- -; -; This file is not part of the Qt API. It exists purely as an -; implementation detail. This header file may change from version to -; version without notice, or even be removed. -; -; We mean it. -; - - ARM - PRESERVE8 - - INCLUDE qdrawhelper_armv6_rvct.inc - -;----------------------------------------------------------------------------- -; qt_memfill32_armv6 -; -; @brief Not yet in use! -; -; @param dest Destination buffer (r0) -; @param value Value (r1) -; @param count Count (r2) -; -;--------------------------------------------------------------------------- -qt_memfill32_armv6 Function - stmfd sp!, {r4-r12, r14} - - mov r3, r1 - mov r4, r1 - mov r5, r1 - mov r6, r1 - mov r7, r1 - mov r8, r1 - mov r9, r1 - -mfill_loop - ; Fill 32 pixels per loop iteration - subs r2, r2, #32 - stmgeia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - stmgeia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - stmgeia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - stmgeia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - bgt mfill_loop - -mfill_remaining - - ; Fill up to 31 remaining pixels - - ; Fill 16 pixels - tst r2, #16 - stmneia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - stmneia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - - ; Fill 8 pixels - tst r2, #8 - stmneia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - - ; Fill 4 pixels - tst r2, #4 - stmneia r0!, {r1, r3, r4, r5} - - ; Fill 2 pixels - tst r2, #2 - stmneia r0!, {r1, r3} - - ; Fill last one - tst r2, #1 - strne r1, [r0] - - ldmfd sp!, {r4-r12, pc} ; pop and return - -;----------------------------------------------------------------------------- -; comp_func_Source_arm -; -; @brief -; -; @param dest Destination buffer (r0) -; @param src Source buffer (r1) -; @param length Length (r2) -; @param const_alpha Constant alpha (r3) -; -;--------------------------------------------------------------------------- -comp_func_Source_armv6 Function - stmfd sp!, {r4-r12, r14} - - cmp r3, #255 ; if(r3 == 255) - bne src2 ; branch if not - -src1 PixCpy r0, r1, r2 - - ldmfd sp!, {r4-r12, pc} ; pop and return - -src2 - ;ldr r14, =ComponentHalf ; load 0x800080 to r14 - mov r14, #0x800000 - add r14, r14, #0x80 - -src22 BlendRow PixelSourceConstAlpha - - ldmfd sp!, {r4-r12, pc} ; pop and return - -;----------------------------------------------------------------------------- -; comp_func_SourceOver_arm -; -; @brief -; -; @param dest Destination buffer (r0) -; @param src Source buffer (r1) -; @param length Length (r2) -; @param const_alpha Constant alpha (r3) -; -;--------------------------------------------------------------------------- -comp_func_SourceOver_armv6 Function - stmfd sp!, {r4-r12, r14} - - ;ldr r14, =ComponentHalf ; load 0x800080 to r14 - mov r14, #0x800000 - add r14, r14, #0x80 - - cmp r3, #255 ; if(r3 == 255) - bne srcovr2 ; branch if not - -srcovr1 BlendRow PixelSourceOver - - ldmfd sp!, {r4-r12, pc} ; pop and return - -srcovr2 - -srcovr22 BlendRow PixelSourceOverConstAlpha - - ldmfd sp!, {r4-r12, pc} ; pop and return - - - END ; File end diff --git a/src/gui/painting/qgraphicssystem_qws.cpp b/src/gui/painting/qgraphicssystem_qws.cpp index f5dab4b..03a0d11 100644 --- a/src/gui/painting/qgraphicssystem_qws.cpp +++ b/src/gui/painting/qgraphicssystem_qws.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE QPixmapData *QWSGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const { if (screen->pixmapDataFactory()) - return screen->pixmapDataFactory()->create(type); //### For 4.4 compatability + return screen->pixmapDataFactory()->create(type); //### For 4.4 compatibility else return new QRasterPixmapData(type); } diff --git a/src/gui/painting/qimagescale.cpp b/src/gui/painting/qimagescale.cpp index 8580775..7383308 100644 --- a/src/gui/painting/qimagescale.cpp +++ b/src/gui/painting/qimagescale.cpp @@ -304,7 +304,7 @@ QImageScaleInfo* QImageScale::qimageCalcScaleInfo(const QImage &img, return(isi); } -/* FIXME: NEED to optimise ScaleAARGBA - currently its "ok" but needs work*/ +/* FIXME: NEED to optimize ScaleAARGBA - currently its "ok" but needs work*/ /* scale by area sampling */ static void qt_qimageScaleAARGBA(QImageScaleInfo *isi, unsigned int *dest, diff --git a/src/gui/painting/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc index 38a1575..5290766 100644 --- a/src/gui/painting/qpaintdevice.qdoc +++ b/src/gui/painting/qpaintdevice.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 8cfa3db..1690e67 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -1101,7 +1101,7 @@ void QRasterPaintEnginePrivate::updateMatrixData(QSpanData *spanData, const QBru Q_Q(QRasterPaintEngine); bool bilinear = q->state()->flags.bilinear; - if (b.d->transform.type() > QTransform::TxNone) { // FALCON: optimise + if (b.d->transform.type() > QTransform::TxNone) { // FALCON: optimize spanData->setupMatrix(b.transform() * m, bilinear); } else { if (m.type() <= QTransform::TxTranslate) { diff --git a/src/gui/painting/qprinterinfo.qdoc b/src/gui/painting/qprinterinfo.qdoc index 7374675..9193213 100644 --- a/src/gui/painting/qprinterinfo.qdoc +++ b/src/gui/painting/qprinterinfo.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h index bd3aebd..91d82e0 100644 --- a/src/gui/painting/qregion.h +++ b/src/gui/painting/qregion.h @@ -204,7 +204,7 @@ private: Region rgn; void *xrectangles; #elif defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA) - mutable RgnHandle unused; // Here for binary compatability reasons. ### Qt 5 remove. + mutable RgnHandle unused; // Here for binary compatibility reasons. ### Qt 5 remove. #endif #if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) QRegionPrivate *qt_rgn; diff --git a/src/gui/painting/qwindowsurface_x11.cpp b/src/gui/painting/qwindowsurface_x11.cpp index cadf264..d7f54ea 100644 --- a/src/gui/painting/qwindowsurface_x11.cpp +++ b/src/gui/painting/qwindowsurface_x11.cpp @@ -149,6 +149,8 @@ void QX11WindowSurface::setGeometry(const QRect &rect) return; #ifndef QT_NO_XRENDER if (d_ptr->translucentBackground) { + QPixmap::x11SetDefaultScreen(d_ptr->widget->x11Info().screen()); + QX11PixmapData *data = new QX11PixmapData(QPixmapData::PixmapType); data->xinfo = d_ptr->widget->x11Info(); data->resize(size.width(), size.height()); diff --git a/src/gui/styles/qmacstyle.qdoc b/src/gui/styles/qmacstyle.qdoc index a86f2ed..3efabe1 100644 --- a/src/gui/styles/qmacstyle.qdoc +++ b/src/gui/styles/qmacstyle.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 89f54bc..5ebaf4c 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -837,11 +837,8 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); QApplication::setPalette(widgetPalette, "QLineEdit"); QApplication::setPalette(widgetPalette, "QTextEdit"); - widgetPalette = *palette; - - widgetPalette.setColor(QPalette::HighlightedText, - s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); QApplication::setPalette(widgetPalette, "QComboBox"); + QApplication::setPalette(widgetPalette, "QSpinBox"); widgetPalette = *palette; widgetPalette.setColor(QPalette::WindowText, s60Color(QS60StyleEnums::CL_QsnTextColors, 7, 0)); @@ -2620,6 +2617,8 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); break; } + if (!sz.isValid()) + sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget); return sz; } diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index f185c0d..6ded280 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -302,7 +302,7 @@ HWND QWindowsXPStylePrivate::winId(const QWidget *widget) limboWidget = new QWidget(0); limboWidget->createWinId(); limboWidget->setObjectName(QLatin1String("xp_limbo_widget")); - // We dont need this internal widget to appear in QApplication::topLevelWidgets() + // We don't need this internal widget to appear in QApplication::topLevelWidgets() if (QWidgetPrivate::allWidgets) QWidgetPrivate::allWidgets->remove(limboWidget); } diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp index a7aa2ce..ecc4690 100644 --- a/src/gui/text/qfontdatabase_x11.cpp +++ b/src/gui/text/qfontdatabase_x11.cpp @@ -1891,6 +1891,18 @@ QFontEngine *QFontDatabase::loadXlfd(int screen, int script, const QFontDef &req return fe; } +#if (defined(QT_ARCH_ARM) || defined(QT_ARCH_ARMV6)) && defined(Q_CC_GNU) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 3) +#define NEEDS_GCC_BUG_WORKAROUND +#endif + +#ifdef NEEDS_GCC_BUG_WORKAROUND +static inline void gccBugWorkaround(const QFontDef &req) +{ + char buffer[8]; + snprintf(buffer, 8, "%f", req.pixelSize); +} +#endif + /*! \internal Loads a QFontEngine for the specified \a script that matches the QFontDef \e request member variable. @@ -1902,9 +1914,15 @@ void QFontDatabase::load(const QFontPrivate *d, int script) // normalize the request to get better caching QFontDef req = d->request; if (req.pixelSize <= 0) - req.pixelSize = floor(qt_pixelSize(req.pointSize, d->dpi) * 100 + 0.5) / 100; + req.pixelSize = qFloor(qt_pixelSize(req.pointSize, d->dpi) * 100.0 + 0.5) * 0.01; if (req.pixelSize < 1) req.pixelSize = 1; + +#ifdef NEEDS_GCC_BUG_WORKAROUND + // req.pixelSize ends up with a bogus value unless this workaround is called + gccBugWorkaround(req); +#endif + if (req.weight == 0) req.weight = QFont::Normal; if (req.stretch == 0) @@ -1940,7 +1958,6 @@ void QFontDatabase::load(const QFontPrivate *d, int script) #ifndef QT_NO_FONTCONFIG } else if (X11->has_fontconfig) { fe = loadFc(d, script, req); - if (fe != 0 && fe->fontDef.pixelSize != req.pixelSize && mainThread && qt_is_gui_used) { QFontEngine *xlfdFontEngine = loadXlfd(d->screen, script, req); if (xlfdFontEngine->fontDef.family == fe->fontDef.family) { @@ -1989,7 +2006,7 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) FcFontSet *set = FcConfigGetFonts(config, FcSetApplication); if (!set) { - FcConfigAppFontAddFile(config, (const FcChar8 *)":/non-existant"); + FcConfigAppFontAddFile(config, (const FcChar8 *)":/non-existent"); set = FcConfigGetFonts(config, FcSetApplication); // try again if (!set) return; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index e919d12..6d6daaa 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -167,7 +167,7 @@ public: virtual QFixed emSquareSize() const { return ascent(); } - /* returns 0 as glyph index for non existant glyphs */ + /* returns 0 as glyph index for non existent glyphs */ virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const = 0; /** diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index a941dab..cf4fbda 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -1209,7 +1209,7 @@ QImage QFontEngineWin::alphaMapForGlyph(glyph_t glyph, const QTransform &xform) QImage indexed(mask->width(), mask->height(), QImage::Format_Indexed8); - // ### This part is kinda pointless, but we'll crash later if we dont because some + // ### This part is kinda pointless, but we'll crash later if we don't because some // code paths expects there to be colortables for index8-bit... QVector<QRgb> colors(256); for (int i=0; i<256; ++i) diff --git a/src/gui/text/qfontsubset.cpp b/src/gui/text/qfontsubset.cpp index e49f5b4..2283358 100644 --- a/src/gui/text/qfontsubset.cpp +++ b/src/gui/text/qfontsubset.cpp @@ -697,7 +697,7 @@ static QTtfTable generateHead(const qttf_head_table &head) // Bits 5-10: These should be set according to Apple's specification . However, they are not implemented in OpenType. // Bit 11: Font data is 'lossless,' as a result of having been compressed and decompressed with the Agfa MicroType Express engine. // Bit 12: Font converted (produce compatible metrics) -// Bit 13: Font optimised for ClearType +// Bit 13: Font optimized for ClearType // Bit 14: Reserved, set to 0 // Bit 15: Reserved, set to 0 << quint16(0) @@ -1008,7 +1008,7 @@ static void convertPath(const QPainterPath &path, QList<TTF_POINT> *points, QLis np.x = (i1_x + i2_x) >> 1; np.y = (i1_y + i2_y) >> 1; if (try_reduce) { - // see if we can optimise out the last onCurve point + // see if we can optimize out the last onCurve point int mx = (points->at(points->size() - 2).x + base[2].x) >> 1; int my = (points->at(points->size() - 2).y + base[2].y) >> 1; if (qAbs(mx - base[3].x) <= split_limit && qAbs(my = base[3].y) <= split_limit) diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index 213db7e..0bdd20d 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -320,7 +320,7 @@ void QTextDocumentPrivate::setLayout(QAbstractTextDocumentLayout *layout) void QTextDocumentPrivate::insert_string(int pos, uint strPos, uint length, int format, QTextUndoCommand::Operation op) { - // ##### optimise when only appending to the fragment! + // ##### optimize when only appending to the fragment! Q_ASSERT(noBlockInString(text.mid(strPos, length))); split(pos); @@ -1446,7 +1446,7 @@ void QTextDocumentPrivate::clearFrame(QTextFrame *f) void QTextDocumentPrivate::scan_frames(int pos, int charsRemoved, int charsAdded) { - // ###### optimise + // ###### optimize Q_UNUSED(pos); Q_UNUSED(charsRemoved); Q_UNUSED(charsAdded); diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index fad6c3b2..dad5371 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1687,7 +1687,7 @@ void QTextLine::setLineWidth(qreal width) if (line.length && line.textWidth <= line.width && line.from + line.length == eng->layoutData->string.length()) - // no need to do anything if the line is already layouted and the last one. This optimisation helps + // no need to do anything if the line is already layouted and the last one. This optimization helps // when using things in a single line layout. return; line.length = 0; diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp index e718212..71a0171 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/gui/util/qcompleter.cpp @@ -220,7 +220,7 @@ QModelIndex QCompletionModel::mapToSource(const QModelIndex& index) const { Q_D(const QCompletionModel); if (!index.isValid()) - return QModelIndex(); + return engine->curParent; int row; QModelIndex parent = engine->curParent; @@ -782,7 +782,8 @@ QMatchData QUnsortedModelEngine::filter(const QString& part, const QModelIndex& /////////////////////////////////////////////////////////////////////////////// QCompleterPrivate::QCompleterPrivate() : widget(0), proxy(0), popup(0), cs(Qt::CaseSensitive), role(Qt::EditRole), column(0), - maxVisibleItems(7), sorting(QCompleter::UnsortedModel), wrap(true), eatFocusOut(true) + maxVisibleItems(7), sorting(QCompleter::UnsortedModel), wrap(true), eatFocusOut(true), + hiddenBecauseNoMatch(false) { } @@ -921,12 +922,14 @@ void QCompleterPrivate::showPopup(const QRect& rect) void QCompleterPrivate::_q_fileSystemModelDirectoryLoaded(const QString &path) { Q_Q(QCompleter); -#ifndef QT_NO_LINEEDIT - QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget); - //the path given by QFileSystemModel does not end with / - if (lineEdit && !lineEdit->text().isEmpty() && !q->completionPrefix().isEmpty() && q->completionPrefix() != path + QLatin1Char('/')) + // Slot called when QFileSystemModel has finished loading. + // If we hide the popup because there was no match because the model was not loaded yet, + // we re-start the completion when we get the results + if (hiddenBecauseNoMatch + && prefix.startsWith(path) && prefix != (path + '/') + && widget) { q->complete(); -#endif + } } /*! @@ -1200,6 +1203,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e) Q_D(QCompleter); if (d->eatFocusOut && o == d->widget && e->type() == QEvent::FocusOut) { + d->hiddenBecauseNoMatch = false; if (d->popup && d->popup->isVisible()) return true; } @@ -1378,6 +1382,7 @@ void QCompleter::complete(const QRect& rect) { Q_D(QCompleter); QModelIndex idx = d->proxy->currentIndex(false); + d->hiddenBecauseNoMatch = false; if (d->mode == QCompleter::InlineCompletion) { if (idx.isValid()) d->_q_complete(idx, true); @@ -1389,6 +1394,7 @@ void QCompleter::complete(const QRect& rect) || (d->mode == QCompleter::UnfilteredPopupCompletion && d->proxy->rowCount() == 0)) { if (d->popup) d->popup->hide(); // no suggestion, hide + d->hiddenBecauseNoMatch = true; return; } diff --git a/src/gui/util/qcompleter_p.h b/src/gui/util/qcompleter_p.h index 8f00793..19b76e5 100644 --- a/src/gui/util/qcompleter_p.h +++ b/src/gui/util/qcompleter_p.h @@ -93,6 +93,7 @@ public: bool eatFocusOut; QRect popupRect; + bool hiddenBecauseNoMatch; void showPopup(const QRect&); void _q_complete(QModelIndex, bool = false); diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index f38bae7..a8b39f4 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -722,7 +722,7 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb #else // Native UI-elements on Mac can scroll hundreds of lines at a time as // a result of acceleration. So keep the same behaviour in Qt, and - // dont restrict stepsToScroll to certain maximum (pageStep): + // don't restrict stepsToScroll to certain maximum (pageStep): stepsToScroll = int(offset_accumulated); #endif offset_accumulated -= int(offset_accumulated); diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index b857e94..ced0d73f 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -2486,7 +2486,7 @@ void QComboBox::showPopup() listRect.setWidth(listRect.height()); //by default popup is centered on screen in landscape listRect.moveCenter(screen.center()); - if (staConTopRect.IsEmpty()) { + if (staConTopRect.IsEmpty() && AknLayoutUtils::CbaLocation() != AknLayoutUtils::EAknCbaLocationBottom) { // landscape without stacon, menu should be at the right (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) : listRect.setLeft(screen.left()); diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp index 36a3147..f2e8fd2 100644 --- a/src/gui/widgets/qdatetimeedit.cpp +++ b/src/gui/widgets/qdatetimeedit.cpp @@ -832,11 +832,11 @@ QString QDateTimeEdit::sectionText(Section section) const This format is the same as the one used described in QDateTime::toString() and QDateTime::fromString() - Example format strings(assuming that the date is 2nd of July 1969): + Example format strings (assuming that the date is 2nd of July 1969): \table \header \i Format \i Result - \row \i dd.MM.yyyy \i 02.07.1969 + \row \i dd.MM.yyyy \i 02.07.1969 \row \i MMM d yy \i Jul 2 69 \row \i MMMM d yy \i July 2 69 \endtable diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index caaef68..0a33220 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -139,7 +139,10 @@ void QLineEdit::initStyleOption(QStyleOptionFrame *option) const The length of the text can be constrained to maxLength(). The text can be arbitrarily constrained using a validator() or an - inputMask(), or both. + inputMask(), or both. When switching between a validator and an input mask + on the same line edit, it is best to clear the validator or input mask to + prevent undefined behavior. + A related class is QTextEdit which allows multi-line, rich text editing. diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index d4118bd..da902d5 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -78,6 +78,7 @@ public: : layout(0), explicitIconSize(false), toolButtonStyle(Qt::ToolButtonIconOnly) #ifdef Q_WS_MAC , useHIToolBar(false) + , activateUnifiedToolbarAfterFullScreen(false) #endif #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR) , hasOldCursor(false) , cursorAdjusted(false) @@ -89,6 +90,7 @@ public: Qt::ToolButtonStyle toolButtonStyle; #ifdef Q_WS_MAC bool useHIToolBar; + bool activateUnifiedToolbarAfterFullScreen; #endif void init(); QList<int> hoverSeparator; @@ -502,7 +504,7 @@ void QMainWindow::setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle) */ QMenuBar *QMainWindow::menuBar() const { - QMenuBar *menuBar = qobject_cast<QMenuBar *>(d_func()->layout->menuBar()); + QMenuBar *menuBar = qobject_cast<QMenuBar *>(layout()->menuBar()); if (!menuBar) { QMainWindow *self = const_cast<QMainWindow *>(this); menuBar = new QMenuBar(self); @@ -1501,8 +1503,6 @@ bool QMainWindow::event(QEvent *event) \i Before Qt 4.5, if you called showFullScreen() on the main window, the QToolbar would disappear since it is considered to be part of the title bar. Qt 4.5 and up will now work around this by pulling the toolbars out and back into the regular toolbar and vice versa when you swap out. - However, a good practice would be that turning off the unified toolbar before you call - showFullScreen() and restoring it after you call showNormal(). \endlist Setting this back to false will remove these restrictions. diff --git a/src/gui/widgets/qmainwindowlayout_p.h b/src/gui/widgets/qmainwindowlayout_p.h index e882d11..a372216 100644 --- a/src/gui/widgets/qmainwindowlayout_p.h +++ b/src/gui/widgets/qmainwindowlayout_p.h @@ -339,6 +339,7 @@ public: void cleanUpMacToolbarItems(); void fixSizeInUnifiedToolbar(QToolBar *tb) const; bool useHIToolBar; + bool activateUnifiedToolbarAfterFullScreen; void syncUnifiedToolbarVisibility(); bool blockVisiblityCheck; diff --git a/src/gui/widgets/qmenu.h b/src/gui/widgets/qmenu.h index 7708e05..77f3b1a 100644 --- a/src/gui/widgets/qmenu.h +++ b/src/gui/widgets/qmenu.h @@ -51,6 +51,10 @@ #include <QtGui/qpixmap.h> #endif +#ifdef Q_WS_WINCE +#include <windef.h> // for HMENU +#endif + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index df16f7f..ae56fa5 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -1628,10 +1628,10 @@ bool QMenuBar::eventFilter(QObject *object, QEvent *event) } /*! - \internal + Returns the QAction at \a pt. Returns 0 if there is no action at \a pt or if +the location has a separator. - Return the item at \a pt, or 0 if there is no item there or if it is - a separator item. + \sa addAction(), addSeparator() */ QAction *QMenuBar::actionAt(const QPoint &pt) const { @@ -1640,9 +1640,9 @@ QAction *QMenuBar::actionAt(const QPoint &pt) const } /*! - \internal + Returns the geometry of action \a act as a QRect. - Returns the geometry of action \a act. + \sa actionAt() */ QRect QMenuBar::actionGeometry(QAction *act) const { @@ -1836,10 +1836,17 @@ void QMenuBarPrivate::_q_updateLayout() } /*! - \internal + \fn void QMenuBar::setCornerWidget(QWidget *widget, Qt::Corner corner) - This sets widget \a w to be shown directly on the left of the first or - the right of the last menu item, depending on \a corner. + This sets the given \a widget to be shown directly on the left of the first + menu item, or on the right of the last menu item, depending on \a corner. + + The menu bar takes ownership of \a widget, reparenting it into the menu bar. + However, if the \a corner already contains a widget, this previous widget + will no longer be managed and will still be a visible child of the menu bar. + + \note Using a corner other than Qt::TopRightCorner or Qt::TopLeftCorner + will result in a warning. */ void QMenuBar::setCornerWidget(QWidget *w, Qt::Corner corner) { @@ -1869,10 +1876,11 @@ void QMenuBar::setCornerWidget(QWidget *w, Qt::Corner corner) } /*! - \internal + Returns the widget on the left of the first or on the right of the last menu + item, depending on \a corner. - Returns the widget in the left of the first or the right of the last menu - item, depending on \a corner. + \note Using a corner other than Qt::TopRightCorner or Qt::TopLeftCorner + will result in a warning. */ QWidget *QMenuBar::cornerWidget(Qt::Corner corner) const { |