diff options
Diffstat (limited to 'src')
39 files changed, 299 insertions, 200 deletions
diff --git a/src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp b/src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp index 0733617..977b284 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/Localizations.cpp @@ -444,7 +444,7 @@ String localizedMediaControlElementHelpText(const String& name) String localizedMediaTimeDescription(float time) { if (!isfinite(time)) - return QCoreApplication::translate("QWebPage," "Indefinite time", "Media time description"); + return QCoreApplication::translate("QWebPage", "Indefinite time", "Media time description"); int seconds = (int)fabsf(time); int days = seconds / (60 * 60 * 24); @@ -453,18 +453,18 @@ String localizedMediaTimeDescription(float time) seconds %= 60; if (days) { - return QCoreApplication::translate("QWebPage," "%1 days %2 hours %3 minutes %4 seconds", "Media time description").arg(days).arg(hours).arg(minutes).arg(seconds); + return QCoreApplication::translate("QWebPage", "%1 days %2 hours %3 minutes %4 seconds", "Media time description").arg(days).arg(hours).arg(minutes).arg(seconds); } if (hours) { - return QCoreApplication::translate("QWebPage," "%1 hours %2 minutes %3 seconds", "Media time description").arg(hours).arg(minutes).arg(seconds); + return QCoreApplication::translate("QWebPage", "%1 hours %2 minutes %3 seconds", "Media time description").arg(hours).arg(minutes).arg(seconds); } if (minutes) { - return QCoreApplication::translate("QWebPage," "%1 minutes %2 seconds", "Media time description").arg(minutes).arg(seconds); + return QCoreApplication::translate("QWebPage", "%1 minutes %2 seconds", "Media time description").arg(minutes).arg(seconds); } - return QCoreApplication::translate("QWebPage," "%1 seconds", "Media time description").arg(seconds); + return QCoreApplication::translate("QWebPage", "%1 seconds", "Media time description").arg(seconds); } #endif // ENABLE(VIDEO) diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index c575137..47a1426 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -208,7 +208,7 @@ public: public slots: bool shouldInterruptJavaScript() { - return true; + return true; } }; @@ -348,7 +348,7 @@ void tst_QWebPage::userStyleSheet() m_page->settings()->setUserStyleSheetUrl(QUrl("data:text/css,p { background-image: url('http://does.not/exist.png');}")); m_view->setHtml("<p>hello world</p>"); - QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool)))); + QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool)), 1000)); QVERIFY(networkManager->requestedUrls.count() >= 2); QCOMPARE(networkManager->requestedUrls.at(0), QUrl("data:text/css,p { background-image: url('http://does.not/exist.png');}")); @@ -674,7 +674,7 @@ void tst_QWebPage::multiplePageGroupsAndLocalStorage() view1.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); view1.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(QDir::currentPath() + "/path1")); qt_webpage_setGroupName(view1.page(), "group1"); - view2.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); + view2.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); view2.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(QDir::currentPath() + "/path2")); qt_webpage_setGroupName(view2.page(), "group2"); QCOMPARE(qt_webpage_groupName(view1.page()), QString("group1")); @@ -945,7 +945,7 @@ void tst_QWebPage::textSelection() QVERIFY(page->action(QWebPage::SelectStartOfDocument) != 0); QVERIFY(page->action(QWebPage::SelectEndOfDocument) != 0); - // right now they are disabled because contentEditable is false and + // right now they are disabled because contentEditable is false and // there isn't an existing selection to modify QCOMPARE(page->action(QWebPage::SelectNextChar)->isEnabled(), false); QCOMPARE(page->action(QWebPage::SelectPreviousChar)->isEnabled(), false); @@ -1114,14 +1114,14 @@ void tst_QWebPage::textEditing() QCOMPARE(page->action(QWebPage::AlignJustified)->isEnabled(), true); QCOMPARE(page->action(QWebPage::AlignLeft)->isEnabled(), true); QCOMPARE(page->action(QWebPage::AlignRight)->isEnabled(), true); - + // make sure these are disabled since there isn't a selection QCOMPARE(page->action(QWebPage::Cut)->isEnabled(), false); QCOMPARE(page->action(QWebPage::RemoveFormat)->isEnabled(), false); - + // make sure everything is selected page->triggerAction(QWebPage::SelectAll); - + // this is only true if there is an editable selection QCOMPARE(page->action(QWebPage::Cut)->isEnabled(), true); QCOMPARE(page->action(QWebPage::RemoveFormat)->isEnabled(), true); diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 3d3eafd..6306882 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -214,14 +214,18 @@ void QUnifiedTimer::timerEvent(QTimerEvent *event) time.start(); } } else if (event->timerId() == animationTimer.timerId()) { - const int delta = lastTick - oldLastTick; - for (currentAnimationIdx = 0; currentAnimationIdx < animations.count(); ++currentAnimationIdx) { - QAbstractAnimation *animation = animations.at(currentAnimationIdx); - int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime - + (animation->direction() == QAbstractAnimation::Forward ? delta : -delta); - animation->setCurrentTime(elapsed); + //we make sure we only call update time if the time has actually changed + //it might happen in some cases that the time doesn't change because events are delayed + //when the CPU load is high + if (const int delta = lastTick - oldLastTick) { + for (currentAnimationIdx = 0; currentAnimationIdx < animations.count(); ++currentAnimationIdx) { + QAbstractAnimation *animation = animations.at(currentAnimationIdx); + int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime + + (animation->direction() == QAbstractAnimation::Forward ? delta : -delta); + animation->setCurrentTime(elapsed); + } + currentAnimationIdx = 0; } - currentAnimationIdx = 0; } } diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.cpp b/src/corelib/io/qfilesystemwatcher_fsevents.cpp index f648016..be2125a 100644 --- a/src/corelib/io/qfilesystemwatcher_fsevents.cpp +++ b/src/corelib/io/qfilesystemwatcher_fsevents.cpp @@ -223,6 +223,11 @@ QStringList QFSEventsFileSystemWatcherEngine::addPaths(const QStringList &paths, } } } + + if (!pathsToWatch && failedToAdd.size() == paths.size()) { + return failedToAdd; + } + if (CFArrayGetCount(tmpArray) > 0) { if (pathsToWatch) { CFArrayAppendArray(tmpArray, pathsToWatch, CFRangeMake(0, CFArrayGetCount(pathsToWatch))); @@ -230,6 +235,7 @@ QStringList QFSEventsFileSystemWatcherEngine::addPaths(const QStringList &paths, } pathsToWatch = CFArrayCreateCopy(kCFAllocatorDefault, tmpArray); } + FSEventStreamContext context = { 0, this, 0, 0, 0 }; fsStream = FSEventStreamCreate(kCFAllocatorDefault, QFSEventsFileSystemWatcherEngine::fseventsCallback, diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index e54bad6..4ec5772 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -899,7 +899,7 @@ QString QFSFileEngine::fileName(FileName file) const // Clean up the path bool isDir = ret.endsWith(slashChar); ret = QDir::cleanPath(ret); - if (isDir) + if (isDir && !ret.endsWith(slashChar)) ret += slashChar; if (file == AbsolutePathName) { diff --git a/src/corelib/io/qnoncontiguousbytedevice_p.h b/src/corelib/io/qnoncontiguousbytedevice_p.h index e55a46c..34d6980 100644 --- a/src/corelib/io/qnoncontiguousbytedevice_p.h +++ b/src/corelib/io/qnoncontiguousbytedevice_p.h @@ -72,9 +72,11 @@ public: void disableReset(); virtual qint64 size() = 0; + virtual ~QNonContiguousByteDevice(); + protected: QNonContiguousByteDevice(); - virtual ~QNonContiguousByteDevice(); + bool resetDisabled; Q_SIGNALS: diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 9283730..c575509 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1788,6 +1788,8 @@ bool QCoreApplicationPrivate::isTranslatorInstalled(QTranslator *translator) In Symbian this function will return the application private directory, not the path to executable itself, as those are always in \c {/sys/bin}. + If the application is in a read only drive, i.e. ROM, then the private path + on the system drive will be returned. \sa applicationFilePath() */ @@ -1803,42 +1805,39 @@ QString QCoreApplication::applicationDirPath() #if defined(Q_OS_SYMBIAN) { QString appPath; - RProcess proc; - TInt err = proc.Open(proc.Id()); + RFs& fs = qt_s60GetRFs(); + TChar driveChar; + QChar qDriveChar; + driveChar = (RProcess().FileName())[0]; + + //Check if the process is installed in a read only drive (typically ROM), + //and use the system drive (typically C:) if so. + TInt drive; + TDriveInfo driveInfo; + TInt err = fs.CharToDrive(driveChar, drive); if (err == KErrNone) { - QChar driveChar; -#if defined(Q_CC_NOKIAX86) - // In emulator, always resolve the private dir on C-drive - driveChar = QLatin1Char('C'); -#else - driveChar = QLatin1Char((proc.FileName())[0]); -#endif - proc.Close(); + err = fs.Drive(driveInfo, drive); + } + if (err != KErrNone || (driveInfo.iDriveAtt & KDriveAttRom) || (driveInfo.iMediaAtt + & KMediaAttWriteProtected)) { + driveChar = fs.GetSystemDriveChar(); + drive = fs.GetSystemDrive(); + } - driveChar = driveChar.toUpper(); + qDriveChar = QChar(QLatin1Char(driveChar)).toUpper(); - TFileName privatePath; - RFs& fs = qt_s60GetRFs(); - fs.PrivatePath(privatePath); - appPath = qt_TDesC2QString(privatePath); - appPath.prepend(QLatin1Char(':')).prepend(driveChar); - - // Create the appPath if it doesn't exist. Non-existing appPath will cause - // Platform Security violations later on if the app doesn't have AllFiles capability. - // Can't create appPath for ROM unfortunately, so applications meant for - // ROM should always deploy something to their private dir to ensure appPath exists, - // if the PlatSec violations are an issue. - char driveDiff = QLatin1Char('Z').toLatin1() - driveChar.toLatin1(); - TInt driveId = EDriveZ - static_cast<TInt>(driveDiff); - if (driveId != EDriveZ) { - TInt err = fs.CreatePrivatePath(driveId); - if (err != KErrNone) - qWarning("QCoreApplication::applicationDirPath: Failed to create private path."); - } - } + TFileName privatePath; + fs.PrivatePath(privatePath); + appPath = qt_TDesC2QString(privatePath); + appPath.prepend(QLatin1Char(':')).prepend(qDriveChar); + + // Create the appPath if it doesn't exist. Non-existing appPath will cause + // Platform Security violations later on if the app doesn't have AllFiles capability. + err = fs.CreatePrivatePath(drive); + if (err != KErrNone) + qWarning("QCoreApplication::applicationDirPath: Failed to create private path."); - QFileInfo fi(appPath); - d->cachedApplicationDirPath = fi.exists() ? fi.canonicalFilePath() : QString(); + d->cachedApplicationDirPath = QFileInfo(appPath).path(); } #else d->cachedApplicationDirPath = QFileInfo(applicationFilePath()).path(); diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 0145499..3249bb1 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -982,12 +982,10 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent) QGraphicsItem *p = newParent; while (p) { if (p->flags() & QGraphicsItem::ItemIsFocusScope) { - // ### We really want the parent's focus scope item to point - // to this item's focusItem... - if (q_ptr->flags() & QGraphicsItem::ItemIsFocusScope) - p->d_ptr->focusScopeItem = q_ptr; - else - p->d_ptr->focusScopeItem = subFocusItem ? subFocusItem : parentFocusScopeItem; + p->d_ptr->focusScopeItem = subFocusItem ? subFocusItem : parentFocusScopeItem; + // ### The below line might not make sense... + if (subFocusItem) + subFocusItem->d_ptr->clearSubFocus(); break; } p = p->d_ptr->parent; @@ -2812,15 +2810,12 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim if (scene && scene->focusItem() == f) return; - // Update the child focus chain. - setSubFocus(); - // Update focus scope item ptr. QGraphicsItem *p = parent; while (p) { if (p->flags() & QGraphicsItem::ItemIsFocusScope) { p->d_ptr->focusScopeItem = q_ptr; - if (!q_ptr->isActive()) + if (!q_ptr->isActive() || !p->focusItem()) return; break; } @@ -2830,10 +2825,11 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim if (climb) { while (f->d_ptr->focusScopeItem && f->d_ptr->focusScopeItem->isVisible()) f = f->d_ptr->focusScopeItem; - if (f != q_ptr) - f->d_ptr->setSubFocus(); } + // Update the child focus chain. + f->d_ptr->setSubFocus(); + // Update the scene's focus item. if (scene) { QGraphicsItem *p = q_ptr->panel(); @@ -2858,13 +2854,15 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim void QGraphicsItem::clearFocus() { // Pass focus to the closest parent focus scope. - QGraphicsItem *p = d_ptr->parent; - while (p) { - if (p->flags() & ItemIsFocusScope) { - p->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ false); - return; + if (!d_ptr->inDestructor) { + QGraphicsItem *p = d_ptr->parent; + while (p) { + if (p->flags() & ItemIsFocusScope) { + p->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ false); + return; + } + p = p->d_ptr->parent; } - p = p->d_ptr->parent; } // Invisible items with focus must explicitly clear subfocus. diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index f6e0aaf..0655ecc 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -925,19 +925,19 @@ QList<QGraphicsItem *> QGraphicsScenePrivate::itemsAtPosition(const QPoint &scre Q_Q(const QGraphicsScene); QGraphicsView *view = widget ? qobject_cast<QGraphicsView *>(widget->parentWidget()) : 0; if (!view) - return q->items(scenePos, Qt::IntersectsItemShape, Qt::AscendingOrder, QTransform()); + return q->items(scenePos, Qt::IntersectsItemShape, Qt::DescendingOrder, QTransform()); const QRectF pointRect(QPointF(widget->mapFromGlobal(screenPos)), QSizeF(1, 1)); if (!view->isTransformed()) - return q->items(pointRect, Qt::IntersectsItemShape, Qt::AscendingOrder); + return q->items(pointRect, Qt::IntersectsItemShape, Qt::DescendingOrder); const QTransform viewTransform = view->viewportTransform(); if (viewTransform.type() <= QTransform::TxScale) { return q->items(viewTransform.inverted().mapRect(pointRect), Qt::IntersectsItemShape, - Qt::AscendingOrder, viewTransform); + Qt::DescendingOrder, viewTransform); } return q->items(viewTransform.inverted().map(pointRect), Qt::IntersectsItemShape, - Qt::AscendingOrder, viewTransform); + Qt::DescendingOrder, viewTransform); } /*! @@ -1584,7 +1584,7 @@ void QGraphicsScene::setItemIndexMethod(ItemIndexMethod method) d->indexMethod = method; - QList<QGraphicsItem *> oldItems = d->index->items(Qt::AscendingOrder); + QList<QGraphicsItem *> oldItems = d->index->items(Qt::DescendingOrder); delete d->index; if (method == BspTreeIndex) d->index = new QGraphicsSceneBspTreeIndex(this); @@ -1693,7 +1693,7 @@ QRectF QGraphicsScene::itemsBoundingRect() const QList<QGraphicsItem *> QGraphicsScene::items() const { Q_D(const QGraphicsScene); - return d->index->items(Qt::AscendingOrder); + return d->index->items(Qt::DescendingOrder); } /*! @@ -1724,7 +1724,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(Qt::SortOrder order) const QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos) const { Q_D(const QGraphicsScene); - return d->index->items(pos, Qt::IntersectsItemShape, Qt::AscendingOrder); + return d->index->items(pos, Qt::IntersectsItemShape, Qt::DescendingOrder); } /*! @@ -1746,7 +1746,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos) const QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rectangle, Qt::ItemSelectionMode mode) const { Q_D(const QGraphicsScene); - return d->index->items(rectangle, mode, Qt::AscendingOrder); + return d->index->items(rectangle, mode, Qt::DescendingOrder); } /*! @@ -1794,7 +1794,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rectangle, Qt::ItemSe QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode) const { Q_D(const QGraphicsScene); - return d->index->items(polygon, mode, Qt::AscendingOrder); + return d->index->items(polygon, mode, Qt::DescendingOrder); } /*! @@ -1816,7 +1816,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemS QList<QGraphicsItem *> QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode) const { Q_D(const QGraphicsScene); - return d->index->items(path, mode, Qt::AscendingOrder); + return d->index->items(path, mode, Qt::DescendingOrder); } /*! @@ -1928,7 +1928,7 @@ QList<QGraphicsItem *> QGraphicsScene::collidingItems(const QGraphicsItem *item, // Does not support ItemIgnoresTransformations. QList<QGraphicsItem *> tmp; - foreach (QGraphicsItem *itemInVicinity, d->index->estimateItems(item->sceneBoundingRect(), Qt::AscendingOrder)) { + foreach (QGraphicsItem *itemInVicinity, d->index->estimateItems(item->sceneBoundingRect(), Qt::DescendingOrder)) { if (item != itemInVicinity && item->collidesWithItem(itemInVicinity, mode)) tmp << itemInVicinity; } @@ -1972,7 +1972,7 @@ QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position) const QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position, const QTransform &deviceTransform) const { QList<QGraphicsItem *> itemsAtPoint = items(position, Qt::IntersectsItemShape, - Qt::AscendingOrder, deviceTransform); + Qt::DescendingOrder, deviceTransform); return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first(); } @@ -2127,7 +2127,7 @@ void QGraphicsScene::setSelectionArea(const QPainterPath &path, Qt::ItemSelectio bool changed = false; // Set all items in path to selected. - foreach (QGraphicsItem *item, items(path, mode, Qt::AscendingOrder, deviceTransform)) { + foreach (QGraphicsItem *item, items(path, mode, Qt::DescendingOrder, deviceTransform)) { if (item->flags() & QGraphicsItem::ItemIsSelectable) { if (!item->isSelected()) changed = true; @@ -2434,17 +2434,8 @@ void QGraphicsScene::addItem(QGraphicsItem *item) // Ensure that newly added items that have subfocus set, gain // focus automatically if there isn't a focus item already. - if (!d->focusItem) { - if (item->focusItem() == item && item != d->lastFocusItem) { - QGraphicsItem *fi = item->focusItem() ? item->focusItem() : item->focusScopeItem(); - if (fi) { - QGraphicsItem *fsi; - while ((fsi = fi->focusScopeItem()) && fsi->isVisible()) - fi = fsi; - fi->setFocus(); - } - } - } + if (!d->focusItem && item != d->lastFocusItem && item->focusItem() == item) + item->focusItem()->setFocus(); d->updateInputMethodSensitivityInViews(); } @@ -4380,7 +4371,7 @@ void QGraphicsScenePrivate::drawItems(QPainter *painter, const QTransform *const if (viewTransform) exposedSceneRect = viewTransform->inverted().mapRect(exposedSceneRect); } - const QList<QGraphicsItem *> tli = index->estimateTopLevelItems(exposedSceneRect, Qt::DescendingOrder); + const QList<QGraphicsItem *> tli = index->estimateTopLevelItems(exposedSceneRect, Qt::AscendingOrder); for (int i = 0; i < tli.size(); ++i) drawSubtreeRecursive(tli.at(i), painter, viewTransform, exposedRegion, widget); } diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index 7c46144..e21183a 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -480,23 +480,23 @@ void QGraphicsSceneBspTreeIndexPrivate::sortItems(QList<QGraphicsItem *> *itemLi return; if (onlyTopLevelItems) { - if (order == Qt::AscendingOrder) + if (order == Qt::DescendingOrder) qSort(itemList->begin(), itemList->end(), qt_closestLeaf); - else if (order == Qt::DescendingOrder) + else if (order == Qt::AscendingOrder) qSort(itemList->begin(), itemList->end(), qt_notclosestLeaf); return; } if (sortCacheEnabled) { - if (order == Qt::AscendingOrder) { + if (order == Qt::DescendingOrder) { qSort(itemList->begin(), itemList->end(), closestItemFirst_withCache); - } else if (order == Qt::DescendingOrder) { + } else if (order == Qt::AscendingOrder) { qSort(itemList->begin(), itemList->end(), closestItemLast_withCache); } } else { - if (order == Qt::AscendingOrder) { + if (order == Qt::DescendingOrder) { qSort(itemList->begin(), itemList->end(), closestItemFirst_withoutCache); - } else if (order == Qt::DescendingOrder) { + } else if (order == Qt::AscendingOrder) { qSort(itemList->begin(), itemList->end(), closestItemLast_withoutCache); } } @@ -605,7 +605,7 @@ QList<QGraphicsItem *> QGraphicsSceneBspTreeIndex::estimateTopLevelItems(const Q } /*! - \fn QList<QGraphicsItem *> QGraphicsSceneBspTreeIndex::items(Qt::SortOrder order = Qt::AscendingOrder) const; + \fn QList<QGraphicsItem *> QGraphicsSceneBspTreeIndex::items(Qt::SortOrder order = Qt::DescendingOrder) const; Return all items in the BSP index and sort them using \a order. */ diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index cf85ba8..0a86bb7 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -81,7 +81,7 @@ public: QList<QGraphicsItem *> estimateItems(const QRectF &rect, Qt::SortOrder order) const; QList<QGraphicsItem *> estimateTopLevelItems(const QRectF &rect, Qt::SortOrder order) const; - QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::AscendingOrder) const; + QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::DescendingOrder) const; int bspTreeDepth(); void setBspTreeDepth(int depth); diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index e01ad10..3ea957f 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -542,7 +542,7 @@ QList<QGraphicsItem *> QGraphicsSceneIndex::estimateTopLevelItems(const QRectF & Q_UNUSED(rect); QGraphicsScenePrivate *scened = d->scene->d_func(); scened->ensureSortedTopLevelItems(); - if (order == Qt::AscendingOrder) { + if (order == Qt::DescendingOrder) { QList<QGraphicsItem *> sorted; for (int i = scened->topLevelItems.size() - 1; i >= 0; --i) sorted << scened->topLevelItems.at(i); @@ -552,7 +552,7 @@ QList<QGraphicsItem *> QGraphicsSceneIndex::estimateTopLevelItems(const QRectF & } /*! - \fn QList<QGraphicsItem *> QGraphicsSceneIndex::items(Qt::SortOrder order = Qt::AscendingOrder) const + \fn QList<QGraphicsItem *> QGraphicsSceneIndex::items(Qt::SortOrder order = Qt::DescendingOrder) const This pure virtual function all items in the index and sort them using \a order. diff --git a/src/gui/graphicsview/qgraphicssceneindex_p.h b/src/gui/graphicsview/qgraphicssceneindex_p.h index ab7b38c..768c724 100644 --- a/src/gui/graphicsview/qgraphicssceneindex_p.h +++ b/src/gui/graphicsview/qgraphicssceneindex_p.h @@ -88,7 +88,7 @@ public: QGraphicsScene *scene() const; - virtual QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::AscendingOrder) const = 0; + virtual QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::DescendingOrder) const = 0; virtual QList<QGraphicsItem *> items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; virtual QList<QGraphicsItem *> items(const QRectF &rect, Qt::ItemSelectionMode mode, @@ -154,10 +154,10 @@ inline void QGraphicsSceneIndexPrivate::items_helper(const QRectF &rect, QGraphi Qt::ItemSelectionMode mode, Qt::SortOrder order) const { Q_Q(const QGraphicsSceneIndex); - const QList<QGraphicsItem *> tli = q->estimateTopLevelItems(rect, Qt::DescendingOrder); + const QList<QGraphicsItem *> tli = q->estimateTopLevelItems(rect, Qt::AscendingOrder); for (int i = 0; i < tli.size(); ++i) recursive_items_helper(tli.at(i), rect, intersector, items, viewTransform, mode, order); - if (order == Qt::AscendingOrder) { + if (order == Qt::DescendingOrder) { const int n = items->size(); for (int i = 0; i < n / 2; ++i) items->swap(i, n - i - 1); diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex.cpp b/src/gui/graphicsview/qgraphicsscenelinearindex.cpp index 70fed64..d6faf05 100644 --- a/src/gui/graphicsview/qgraphicsscenelinearindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenelinearindex.cpp @@ -62,7 +62,7 @@ */ /*! - \fn QList<QGraphicsItem *> QGraphicsSceneLinearIndex::items(Qt::SortOrder order = Qt::AscendingOrder) const; + \fn QList<QGraphicsItem *> QGraphicsSceneLinearIndex::items(Qt::SortOrder order = Qt::DescendingOrder) const; Return all items in the index and sort them using \a order. */ diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h index 4c4aa9f..0aaee14 100644 --- a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenelinearindex_p.h @@ -76,7 +76,7 @@ public: QGraphicsSceneLinearIndex(QGraphicsScene *scene = 0) : QGraphicsSceneIndex(scene) { } - QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::AscendingOrder) const + QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::DescendingOrder) const { Q_UNUSED(order); return m_items; } virtual QList<QGraphicsItem *> estimateItems(const QRectF &rect, Qt::SortOrder order) const diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index b0829c5..98b2c9c 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -971,7 +971,7 @@ QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedReg *allItems = true; // All items are guaranteed within the exposed region. - return scene->items(Qt::DescendingOrder); + return scene->items(Qt::AscendingOrder); } // Step 2) If the expose region is a simple rect and the view is only @@ -981,7 +981,7 @@ QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedReg if (simpleRectLookup) { return scene->items(exposedRegionSceneBounds, Qt::IntersectsItemBoundingRect, - Qt::DescendingOrder, viewTransform); + Qt::AscendingOrder, viewTransform); } // If the region is complex or the view has a complex transform, adjust @@ -993,7 +993,7 @@ QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedReg const QPainterPath exposedScenePath(q->mapToScene(qt_regionToPath(adjustedRegion))); return scene->items(exposedScenePath, Qt::IntersectsItemBoundingRect, - Qt::DescendingOrder, viewTransform); + Qt::AscendingOrder, viewTransform); } /*! @@ -2055,13 +2055,13 @@ QList<QGraphicsItem *> QGraphicsView::items(const QPoint &pos) const QTransform xinv = viewportTransform().inverted(); return d->scene->items(xinv.mapRect(QRectF(pos.x(), pos.y(), 1, 1)), Qt::IntersectsItemShape, - Qt::AscendingOrder, + Qt::DescendingOrder, viewportTransform()); } // Use the polygon version return d->scene->items(mapToScene(pos.x(), pos.y(), 1, 1), Qt::IntersectsItemShape, - Qt::AscendingOrder, + Qt::DescendingOrder, viewportTransform()); } @@ -2089,7 +2089,7 @@ QList<QGraphicsItem *> QGraphicsView::items(const QRect &rect, Qt::ItemSelection Q_D(const QGraphicsView); if (!d->scene) return QList<QGraphicsItem *>(); - return d->scene->items(mapToScene(rect), mode, Qt::AscendingOrder, viewportTransform()); + return d->scene->items(mapToScene(rect), mode, Qt::DescendingOrder, viewportTransform()); } /*! @@ -2117,7 +2117,7 @@ QList<QGraphicsItem *> QGraphicsView::items(const QPolygon &polygon, Qt::ItemSel Q_D(const QGraphicsView); if (!d->scene) return QList<QGraphicsItem *>(); - return d->scene->items(mapToScene(polygon), mode, Qt::AscendingOrder, viewportTransform()); + return d->scene->items(mapToScene(polygon), mode, Qt::DescendingOrder, viewportTransform()); } /*! @@ -2137,7 +2137,7 @@ QList<QGraphicsItem *> QGraphicsView::items(const QPainterPath &path, Qt::ItemSe Q_D(const QGraphicsView); if (!d->scene) return QList<QGraphicsItem *>(); - return d->scene->items(mapToScene(path), mode, Qt::AscendingOrder, viewportTransform()); + return d->scene->items(mapToScene(path), mode, Qt::DescendingOrder, viewportTransform()); } /*! diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp index a9bcca2..1b61484 100644 --- a/src/gui/image/qpixmap_win.cpp +++ b/src/gui/image/qpixmap_win.cpp @@ -387,12 +387,30 @@ QPixmap QPixmap::fromWinHICON(HICON icon) ReleaseDC(0, screenDevice); ICONINFO iconinfo; - bool result = GetIconInfo(icon, &iconinfo); //x and y Hotspot describes the icon center + bool result = GetIconInfo(icon, &iconinfo); if (!result) qWarning("QPixmap::fromWinHICON(), failed to GetIconInfo()"); - int w = iconinfo.xHotspot * 2; - int h = iconinfo.yHotspot * 2; + int w = 0; + int h = 0; + if (!iconinfo.xHotspot || !iconinfo.yHotspot) { + // We could not retrieve the icon size via GetIconInfo, + // so we try again using the icon bitmap. + BITMAP bm; + int result = GetObject(iconinfo.hbmColor, sizeof(BITMAP), &bm); + if (!result) result = GetObject(iconinfo.hbmMask, sizeof(BITMAP), &bm); + if (!result) { + qWarning("QPixmap::fromWinHICON(), failed to retrieve icon size"); + return QPixmap(); + } + w = bm.bmWidth; + h = bm.bmHeight; + } else { + // x and y Hotspot describes the icon center + w = iconinfo.xHotspot * 2; + h = iconinfo.yHotspot * 2; + } + const DWORD dwImageSize = w * h * 4; BITMAPINFO bmi; memset(&bmi, 0, sizeof(bmi)); @@ -402,44 +420,44 @@ QPixmap QPixmap::fromWinHICON(HICON icon) bmi.bmiHeader.biPlanes = 1; bmi.bmiHeader.biBitCount = 32; bmi.bmiHeader.biCompression = BI_RGB; - bmi.bmiHeader.biSizeImage = size*size*4; + bmi.bmiHeader.biSizeImage = dwImageSize; uchar* bits; HBITMAP winBitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, (void**) &bits, 0, 0); if (winBitmap ) - memset(bits, 0xff, size*size*4); + memset(bits, 0xff, dwImageSize); if (!winBitmap) { qWarning("QPixmap::fromWinHICON(), failed to CreateDIBSection()"); return QPixmap(); } HGDIOBJ oldhdc = (HBITMAP)SelectObject(hdc, winBitmap); - if (!DrawIconEx( hdc, 0, 0, icon, size, size, 0, 0, DI_NORMAL)) + if (!DrawIconEx( hdc, 0, 0, icon, w, h, 0, 0, DI_NORMAL)) qWarning("QPixmap::fromWinHICON(), failed to DrawIcon()"); uint mask = 0xff000000; // Create image and copy data into image. - QImage image(size, size, QImage::Format_ARGB32); + QImage image(w, h, QImage::Format_ARGB32); if (!image.isNull()) { // failed to alloc? - int bytes_per_line = size * sizeof(QRgb); - for (int y=0; y<size; ++y) { + int bytes_per_line = w * sizeof(QRgb); + for (int y=0; y < h; ++y) { QRgb *dest = (QRgb *) image.scanLine(y); const QRgb *src = (const QRgb *) (bits + y * bytes_per_line); - for (int x=0; x<size; ++x) { + for (int x=0; x < w; ++x) { dest[x] = src[x]; } } } - if (!DrawIconEx( hdc, 0, 0, icon, size, size, 0, 0, DI_MASK)) + if (!DrawIconEx( hdc, 0, 0, icon, w, h, 0, 0, DI_MASK)) qWarning("QPixmap::fromWinHICON(), failed to DrawIcon()"); if (!image.isNull()) { // failed to alloc? - int bytes_per_line = size * sizeof(QRgb); - for (int y=0; y<size; ++y) { + int bytes_per_line = w * sizeof(QRgb); + for (int y=0; y < h; ++y) { QRgb *dest = (QRgb *) image.scanLine(y); const QRgb *src = (const QRgb *) (bits + y * bytes_per_line); - for (int x=0; x<size; ++x) { + for (int x=0; x < w; ++x) { if (!src[x]) dest[x] = dest[x] | mask; } diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index b198ae1..fc55a0f 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -98,7 +98,9 @@ QCoeFepInputContext::~QCoeFepInputContext() void QCoeFepInputContext::reset() { - CCoeEnv::Static()->Fep()->CancelTransaction(); + CCoeFep* fep = CCoeEnv::Static()->Fep(); + if (fep) + fep->CancelTransaction(); } void QCoeFepInputContext::ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType) @@ -626,7 +628,9 @@ void QCoeFepInputContext::commitCurrentString(bool triggeredBySymbian) m_isEditing = false; if (!triggeredBySymbian) { - CCoeEnv::Static()->Fep()->CancelTransaction(); + CCoeFep* fep = CCoeEnv::Static()->Fep(); + if (fep) + fep->CancelTransaction(); } } diff --git a/src/gui/itemviews/qdirmodel.cpp b/src/gui/itemviews/qdirmodel.cpp index 26e1557..2973741 100644 --- a/src/gui/itemviews/qdirmodel.cpp +++ b/src/gui/itemviews/qdirmodel.cpp @@ -190,6 +190,9 @@ void QDirModelPrivate::invalidate() \ingroup model-view + \note The usage of QDirModel is not recommended anymore. The + QFileSystemModel class is a more performant alternative. + This class provides access to the local filesystem, providing functions for renaming and removing files and directories, and for creating new directories. In the simplest case, it can be used with a suitable display @@ -228,10 +231,7 @@ void QDirModelPrivate::invalidate() \note QDirModel requires an instance of a GUI application. - \note The usage of QDirModel is not recommended anymore. The - QFileSystemModel class is a more performant alternative. - - \sa nameFilters(), setFilter(), filter(), QListView, QTreeView, QFileSystemModel + \sa nameFilters(), setFilter(), filter(), QListView, QTreeView, QFileSystemModel, {Dir View Example}, {Model Classes} */ diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index a4cebe3..9b0b00f 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -2429,7 +2429,7 @@ void QIconModeViewBase::appendHiddenRow(int row) void QIconModeViewBase::removeHiddenRow(int row) { - QCommonListViewBase::appendHiddenRow(row); + QCommonListViewBase::removeHiddenRow(row); if (row >= 0 && row < items.count()) //insert item tree.insertLeaf(items.at(row).rect(), row); } diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index b43c950..aa39f9d 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -101,11 +101,11 @@ public: int virtualMouseAccel; int virtualMouseMaxAccel; #ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS - bool brokenPointerCursors; + int brokenPointerCursors : 1; #endif - bool hasTouchscreen; - bool mouseInteractionEnabled; - bool virtualMouseRequired; + int hasTouchscreen : 1; + int mouseInteractionEnabled : 1; + int virtualMouseRequired : 1; int qtOwnsS60Environment : 1; static inline void updateScreenSize(); static inline RWsSession& wsSession(); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index e68a72d..6f5781c 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -2106,6 +2106,13 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrus painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft()); } #endif // Q_WS_MAC + + } else if (brush.gradient() + && brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode) { + painter->save(); + painter->setClipRegion(rgn); + painter->fillRect(0, 0, painter->device()->width(), painter->device()->height(), brush); + painter->restore(); } else { const QVector<QRect> &rects = rgn.rects(); for (int i = 0; i < rects.size(); ++i) @@ -2146,7 +2153,6 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int if (q->autoFillBackground()) fillRegion(painter, rgn, autoFillBrush); - if (q->testAttribute(Qt::WA_StyledBackground)) { painter->setClipRegion(rgn); QStyleOption opt; @@ -4991,7 +4997,7 @@ QGraphicsEffect *QWidget::graphicsEffect() const /*! \brief The setGraphicsEffect function is for setting the widget's graphics effect. - + Sets \a effect as the widget's effect. If there already is an effect installed on this widget, QWidget will delete the existing effect before installing the new \a effect. diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index effc99e..6037bd5 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3663,6 +3663,7 @@ void QRasterPaintEngine::drawEllipse(const QRectF &rect) ensurePen(); if (((qpen_style(s->lastPen) == Qt::SolidLine && s->flags.fast_pen) || (qpen_style(s->lastPen) == Qt::NoPen && !s->flags.antialiased)) + && qMax(rect.width(), rect.height()) < QT_RASTER_COORD_LIMIT #ifdef FLOATING_POINT_BUGGY_OR_NO_FPU && qMax(rect.width(), rect.height()) < 128 // integer math breakdown #endif diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp index d53a280..23d25bd 100644 --- a/src/gui/styles/gtksymbols.cpp +++ b/src/gui/styles/gtksymbols.cpp @@ -423,27 +423,32 @@ static void init_gtk_window() static QString themeName; if (!gtkWidgetMap()->contains(QLS("GtkWindow")) && themeName.isEmpty()) { themeName = getThemeName(); - // Due to namespace conflicts with Qt3 and obvious recursion with Qt4, - // we cannot support the GTK_Qt Gtk engine - if (!(themeName.isEmpty() || themeName == QLS("Qt") || themeName == QLS("Qt4"))) { - resolveGtk(); - if (QGtk::gtk_init) { - // Gtk will set the Qt error handler so we have to reset it afterwards - x11ErrorHandler qt_x_errhandler = XSetErrorHandler(0); - QGtk::gtk_init (NULL, NULL); - XSetErrorHandler(qt_x_errhandler); - - GtkWidget* gtkWindow = QGtk::gtk_window_new(GTK_WINDOW_POPUP); - QGtk::gtk_widget_realize(gtkWindow); - if (displayDepth == -1) - displayDepth = QGtk::gdk_drawable_get_depth(gtkWindow->window); - gtkWidgetMap()->insert(QLS("GtkWindow"), gtkWindow); - } - else { - qWarning("QGtkStyle could not resolve GTK. Make sure you have installed the proper libraries."); - } - } else { + + if (themeName.isEmpty()) { + qWarning("QGtkStyle was unable to detect the current GTK+ theme."); + return; + } else if (themeName == QLS("Qt") || themeName == QLS("Qt4")) { + // Due to namespace conflicts with Qt3 and obvious recursion with Qt4, + // we cannot support the GTK_Qt Gtk engine qWarning("QGtkStyle cannot be used together with the GTK_Qt engine."); + return; + } + + resolveGtk(); + + if (QGtk::gtk_init) { + // Gtk will set the Qt error handler so we have to reset it afterwards + x11ErrorHandler qt_x_errhandler = XSetErrorHandler(0); + QGtk::gtk_init (NULL, NULL); + XSetErrorHandler(qt_x_errhandler); + + GtkWidget* gtkWindow = QGtk::gtk_window_new(GTK_WINDOW_POPUP); + QGtk::gtk_widget_realize(gtkWindow); + if (displayDepth == -1) + displayDepth = QGtk::gdk_drawable_get_depth(gtkWindow->window); + gtkWidgetMap()->insert(QLS("GtkWindow"), gtkWindow); + } else { + qWarning("QGtkStyle could not resolve GTK. Make sure you have installed the proper libraries."); } } } diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index f3dc4ac..414580e 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -3063,14 +3063,14 @@ QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComple if (!arrowWidget) return QCleanlooksStyle::subControlRect(control, option, subControl, widget); - QRect buttonRect(arrowWidget->allocation.x, arrowWidget->allocation.y, + QRect buttonRect(option->rect.left() + arrowWidget->allocation.x, + option->rect.top() + arrowWidget->allocation.y, arrowWidget->allocation.width, arrowWidget->allocation.height); switch (subControl) { case SC_ComboBoxArrow: // Note: this indicates the arrowbutton for editable combos rect = buttonRect; - break; case SC_ComboBoxEditField: { diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index f5aadb8..2ed9303 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -926,6 +926,7 @@ static const char *const question_xpm[] = { #endif //QT_NO_IMAGEFORMAT_XPM +#ifdef Q_OS_WIN static QPixmap loadIconFromShell32( int resourceId, int size ) { #ifdef Q_OS_WINCE @@ -943,6 +944,7 @@ static QPixmap loadIconFromShell32( int resourceId, int size ) } return QPixmap(); } +#endif /*! \reimp diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index a4b2e7e..788417a 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -647,8 +647,14 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format) { defaultFormat = format; this->antialias = antialias; + if (!antialias) glyphFormat = QFontEngineGlyphCache::Raster_Mono; + else if (format == Format_A8) + glyphFormat = QFontEngineGlyphCache::Raster_A8; + else if (format == Format_A32) + glyphFormat = QFontEngineGlyphCache::Raster_RGBMask; + face_id = faceId; freetype = QFreetypeFace::getFace(face_id); if (!freetype) { diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index f8b0cbc..39a8bb8 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1720,10 +1720,15 @@ void QTextLine::layout_helper(int maxGlyphs) goto found; QFixed x = line.x + line.textWidth + lbh.tmpData.textWidth + lbh.spaceData.textWidth; - lbh.spaceData.textWidth += eng->calculateTabWidth(item, x); + QFixed tabWidth = eng->calculateTabWidth(item, x); + + lbh.spaceData.textWidth += tabWidth; lbh.spaceData.length++; newItem = item + 1; - ++lbh.glyphCount; + + QFixed averageCharWidth = eng->fontEngine(current)->averageCharWidth(); + lbh.glyphCount += qRound(tabWidth / averageCharWidth); + if (lbh.checkFullOtherwiseExtend(line)) goto found; } else if (current.analysis.flags == QScriptAnalysis::LineOrParagraphSeparator) { diff --git a/src/gui/widgets/qmenu.h b/src/gui/widgets/qmenu.h index 1f77442..3d41727 100644 --- a/src/gui/widgets/qmenu.h +++ b/src/gui/widgets/qmenu.h @@ -61,8 +61,8 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) #ifdef Q_WS_S60 - IMPORT_C void qt_symbian_show_toplevel(CEikMenuPane* menuPane); - IMPORT_C void qt_symbian_show_submenu(CEikMenuPane* menuPane, int id); +void qt_symbian_show_toplevel(CEikMenuPane* menuPane); +void qt_symbian_show_submenu(CEikMenuPane* menuPane, int id); #endif // Q_WS_S60 #ifndef QT_NO_MENU diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index 13830ba..6fc4371 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -222,7 +222,7 @@ static void rebuildMenu() } #ifdef Q_WS_S60 -Q_GUI_EXPORT void qt_symbian_show_toplevel( CEikMenuPane* menuPane) +void qt_symbian_show_toplevel( CEikMenuPane* menuPane) { if (!menuExists()) return; @@ -231,7 +231,7 @@ Q_GUI_EXPORT void qt_symbian_show_toplevel( CEikMenuPane* menuPane) QT_TRAP_THROWING(menuPane->AddMenuItemL(symbianMenus.at(i)->menuItemData)); } -Q_GUI_EXPORT void qt_symbian_show_submenu( CEikMenuPane* menuPane, int id) +void qt_symbian_show_submenu( CEikMenuPane* menuPane, int id) { SymbianMenuItem* menu = qt_symbian_find_menu(id, symbianMenus); if (menu) { diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp index a727b2b..40c0b02 100644 --- a/src/gui/widgets/qtoolbar.cpp +++ b/src/gui/widgets/qtoolbar.cpp @@ -307,6 +307,8 @@ bool QToolBarPrivate::mouseReleaseEvent(QMouseEvent*) return true; } else { #ifdef Q_WS_MAC + if (!macWindowDragging) + return false; macWindowDragging = false; macWindowDragPressPosition = QPoint(); return true; diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 83afddd..c20812e 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -573,6 +573,8 @@ QNetworkReplyImpl::~QNetworkReplyImpl() Q_D(QNetworkReplyImpl); if (d->isCachingEnabled()) d->networkCache()->remove(url()); + if (d->outgoingDataBuffer) + delete d->outgoingDataBuffer; } void QNetworkReplyImpl::abort() diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index fb493e6..25f4184 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -289,9 +289,18 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph) { QImage mask = textureMapForGlyph(glyph); + const int maskWidth = mask.width(); + const int maskHeight = mask.height(); + + if (mask.format() == QImage::Format_Mono) { + mask = mask.convertToFormat(QImage::Format_Indexed8); + for (int y = 0; y < maskHeight; ++y) { + uchar *src = (uchar *) mask.scanLine(y); + for (int x = 0; x < maskWidth; ++x) + src[x] = -src[x]; + } + } - const uint maskWidth = mask.width(); - const uint maskHeight = mask.height(); glBindTexture(GL_TEXTURE_2D, m_texture); if (mask.format() == QImage::Format_RGB32) { @@ -309,7 +318,7 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph) // by converting it to a format with four bytes per pixel. Another is to copy one line at a // time. - for (uint i = 0; i < maskHeight; ++i) + for (int i = 0; i < maskHeight; ++i) glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, maskWidth, 1, GL_ALPHA, GL_UNSIGNED_BYTE, mask.scanLine(i)); #endif } @@ -1226,21 +1235,27 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem if (ti.fontEngine->fontDef.pixelSize * qSqrt(s->matrix.determinant()) >= 64) drawCached = false; - if (d->glyphCacheType == QFontEngineGlyphCache::Raster_RGBMask + QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0 + ? QFontEngineGlyphCache::Type(ti.fontEngine->glyphFormat) + : d->glyphCacheType; + + if (glyphType == QFontEngineGlyphCache::Raster_RGBMask && state()->composition_mode != QPainter::CompositionMode_Source - && state()->composition_mode != QPainter::CompositionMode_SourceOver) { + && state()->composition_mode != QPainter::CompositionMode_SourceOver) + { drawCached = false; } if (drawCached) { - d->drawCachedGlyphs(p, ti); + d->drawCachedGlyphs(p, glyphType, ti); return; } QPaintEngineEx::drawTextItem(p, ti); } -void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, const QTextItemInt &ti) +void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGlyphCache::Type glyphType, + const QTextItemInt &ti) { Q_Q(QGL2PaintEngineEx); QOpenGL2PaintEngineState *s = q->state(); @@ -1250,10 +1265,6 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, const QTextIte QTransform matrix = QTransform::fromTranslate(p.x(), p.y()); ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); - QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0 - ? QFontEngineGlyphCache::Type(ti.fontEngine->glyphFormat) - : glyphCacheType; - QGLTextureGlyphCache *cache = (QGLTextureGlyphCache *) ti.fontEngine->glyphCache(ctx, s->matrix); @@ -1300,13 +1311,7 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, const QTextIte QBrush pensBrush = q->state()->pen.brush(); setBrush(&pensBrush); - if (glyphType == QFontEngineGlyphCache::Raster_A8) { - - // Greyscale antialiasing - - shaderManager->setMaskType(QGLEngineShaderManager::PixelMask); - prepareForDraw(false); // Text always causes src pixels to be transparent - } else if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) { + if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) { // Subpixel antialiasing without gamma correction @@ -1380,6 +1385,11 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, const QTextIte glBlendFunc(GL_ONE, GL_ONE); } compositionModeDirty = true; + } else { + // Greyscale/mono glyphs + + shaderManager->setMaskType(QGLEngineShaderManager::PixelMask); + prepareForDraw(false); // Text always causes src pixels to be transparent } //### TODO: Gamma correction @@ -1707,6 +1717,8 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) state()->depthTestEnabled = true; break; } + default: + break; } glDepthFunc(GL_LESS); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 049994f..738626f 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -182,7 +182,7 @@ public: void fill(const QVectorPath &path); void drawOutline(const QVectorPath& path); void drawTexture(const QGLRect& dest, const QGLRect& src, const QSize &textureSize, bool opaque, bool pattern = false); - void drawCachedGlyphs(const QPointF &p, const QTextItemInt &ti); + void drawCachedGlyphs(const QPointF &p, QFontEngineGlyphCache::Type glyphType, const QTextItemInt &ti); void drawVertexArrays(QGL2PEXVertexArray& vertexArray, GLenum primitive); // ^ draws whatever is in the vertex array diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 7a910d2..71194d3 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -508,6 +508,7 @@ JSC::JSValue JSC_HOST_CALL functionDisconnect(JSC::ExecState *exec, JSC::JSObjec slot = arg1; else { // ### don't go via QScriptValue + QScript::SaveFrameHelper saveFrame(engine, exec); QScriptValue tmp = engine->scriptValueFromJSCValue(arg0); QString propertyName(arg1.toString(exec)); slot = engine->scriptValueToJSCValue(tmp.property(propertyName, QScriptValue::ResolvePrototype)); @@ -591,6 +592,7 @@ JSC::JSValue JSC_HOST_CALL functionConnect(JSC::ExecState *exec, JSC::JSObject * slot = arg1; else { // ### don't go via QScriptValue + QScript::SaveFrameHelper saveFrame(engine, exec); QScriptValue tmp = engine->scriptValueFromJSCValue(arg0); QString propertyName = arg1.toString(exec); slot = engine->scriptValueToJSCValue(tmp.property(propertyName, QScriptValue::ResolvePrototype)); diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index c7db276..ec41cc9 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -265,6 +265,29 @@ public: #endif }; +namespace QScript +{ + +class SaveFrameHelper +{ +public: + SaveFrameHelper(QScriptEnginePrivate *eng, + JSC::ExecState *newFrame) + : engine(eng), oldFrame(eng->currentFrame) + { + eng->currentFrame = newFrame; + } + ~SaveFrameHelper() + { + engine->currentFrame = oldFrame; + } +private: + QScriptEnginePrivate *engine; + JSC::ExecState *oldFrame; +}; + +} // namespace QScript + inline QScriptValuePrivate *QScriptEnginePrivate::allocateScriptValuePrivate(size_t size) { if (freeScriptValues) { diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 6a6381e..2a33aea 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -2409,12 +2409,16 @@ void QScriptValue::setScriptClass(QScriptClass *scriptClass) return; } QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(d->jscValue)); - QScriptObjectDelegate *delegate = scriptObject->delegate(); - if (!delegate || (delegate->type() != QScriptObjectDelegate::ClassObject)) { - delegate = new QScript::ClassObjectDelegate(scriptClass); - scriptObject->setDelegate(delegate); + if (!scriptClass) { + scriptObject->setDelegate(0); + } else { + QScriptObjectDelegate *delegate = scriptObject->delegate(); + if (!delegate || (delegate->type() != QScriptObjectDelegate::ClassObject)) { + delegate = new QScript::ClassObjectDelegate(scriptClass); + scriptObject->setDelegate(delegate); + } + static_cast<QScript::ClassObjectDelegate*>(delegate)->setScriptClass(scriptClass); } - static_cast<QScript::ClassObjectDelegate*>(delegate)->setScriptClass(scriptClass); } /*! diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp index a5dc670..c1e386b 100644 --- a/src/script/bridge/qscriptclassobject.cpp +++ b/src/script/bridge/qscriptclassobject.cpp @@ -77,6 +77,7 @@ QScriptClass *ClassObjectDelegate::scriptClass() const void ClassObjectDelegate::setScriptClass(QScriptClass *scriptClass) { + Q_ASSERT(scriptClass != 0); m_scriptClass = scriptClass; } @@ -90,12 +91,13 @@ bool ClassObjectDelegate::getOwnPropertySlot(QScriptObject* object, const JSC::Identifier &propertyName, JSC::PropertySlot &slot) { + QScriptEnginePrivate *engine = scriptEngineFromExec(exec); + QScript::SaveFrameHelper saveFrame(engine, exec); // for compatibility with the old back-end, normal JS properties // are queried first. if (QScriptObjectDelegate::getOwnPropertySlot(object, exec, propertyName, slot)) return true; - QScriptEnginePrivate *engine = scriptEngineFromExec(exec); QScriptValue scriptObject = engine->scriptValueFromJSCValue(object); QScriptString scriptName; QScriptStringPrivate scriptName_d(engine, propertyName, QScriptStringPrivate::StackAllocated); @@ -116,6 +118,7 @@ void ClassObjectDelegate::put(QScriptObject* object, JSC::ExecState *exec, JSC::JSValue value, JSC::PutPropertySlot &slot) { QScriptEnginePrivate *engine = scriptEngineFromExec(exec); + QScript::SaveFrameHelper saveFrame(engine, exec); QScriptValue scriptObject = engine->scriptValueFromJSCValue(object); QScriptString scriptName; QScriptStringPrivate scriptName_d(engine, propertyName, QScriptStringPrivate::StackAllocated); @@ -136,6 +139,7 @@ bool ClassObjectDelegate::deleteProperty(QScriptObject* object, JSC::ExecState * { // ### avoid duplication of put() QScriptEnginePrivate *engine = scriptEngineFromExec(exec); + QScript::SaveFrameHelper saveFrame(engine, exec); QScriptValue scriptObject = engine->scriptValueFromJSCValue(object); QScriptString scriptName; QScriptStringPrivate scriptName_d(engine, propertyName, QScriptStringPrivate::StackAllocated); @@ -157,6 +161,7 @@ bool ClassObjectDelegate::getPropertyAttributes(const QScriptObject* object, JSC unsigned &attribs) const { QScriptEnginePrivate *engine = scriptEngineFromExec(exec); + QScript::SaveFrameHelper saveFrame(engine, exec); QScriptValue scriptObject = engine->scriptValueFromJSCValue(object); QScriptString scriptName; QScriptStringPrivate scriptName_d(engine, propertyName, QScriptStringPrivate::StackAllocated); @@ -188,6 +193,7 @@ void ClassObjectDelegate::getPropertyNames(QScriptObject* object, JSC::ExecState unsigned listedAttributes) { QScriptEnginePrivate *engine = scriptEngineFromExec(exec); + QScript::SaveFrameHelper saveFrame(engine, exec); QScriptValue scriptObject = engine->scriptValueFromJSCValue(object); QScriptClassPropertyIterator *it = m_scriptClass->newIterator(scriptObject); if (it != 0) { @@ -267,6 +273,7 @@ bool ClassObjectDelegate::hasInstance(QScriptObject* object, JSC::ExecState *exe return QScriptObjectDelegate::hasInstance(object, exec, value, proto); QScriptValueList args; QScriptEnginePrivate *eng_p = scriptEngineFromExec(exec); + QScript::SaveFrameHelper saveFrame(eng_p, exec); args << eng_p->scriptValueFromJSCValue(object) << eng_p->scriptValueFromJSCValue(value); QVariant result = scriptClass()->extension(QScriptClass::HasInstance, qVariantFromValue(args)); return result.toBool(); diff --git a/src/script/script.pro b/src/script/script.pro index 860080d..c844d89 100644 --- a/src/script/script.pro +++ b/src/script/script.pro @@ -1,7 +1,7 @@ TARGET = QtScript QPRO_PWD = $$PWD QT = core -DEFINES += JSC=QTJSC +DEFINES += JSC=QTJSC jscyyparse=qtjscyyparse jscyylex=qtjscyylex jscyyerror=qtjscyyerror DEFINES += QT_BUILD_SCRIPT_LIB DEFINES += QT_NO_USING_NAMESPACE DEFINES += QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO |