/tests/auto/qcheckbox/

ff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro index a63fb41..9170039 100644 --- a/tests/benchmarks/benchmarks.pro +++ b/tests/benchmarks/benchmarks.pro @@ -3,6 +3,7 @@ SUBDIRS = containers-associative \ containers-sequential \ qanimation \ qbytearray \ + qfileinfo \ qfile_vs_qnetworkaccessmanager \ qpainter \ qtestlib-simple events \ diff --git a/tests/benchmarks/qfileinfo/main.cpp b/tests/benchmarks/qfileinfo/main.cpp new file mode 100644 index 0000000..7950f58 --- /dev/null +++ b/tests/benchmarks/qfileinfo/main.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite 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 +#include +#include +#include +#include + + +class qfileinfo : public QObject +{ + Q_OBJECT +private slots: + void canonicalFileNamePerformance(); + + void initTestCase(); + void cleanupTestCase(); +public: + qfileinfo() : QObject() {}; +}; + +void qfileinfo::initTestCase() +{ +} + +void qfileinfo::cleanupTestCase() +{ +} + +void qfileinfo::canonicalFileNamePerformance() +{ + QBENCHMARK { + for (int i = 0; i < 5000; i++) { + // this actually calls canonicalFilePath twice, once inside QCoreApplication. + QFileInfo fi(QCoreApplication::applicationFilePath()); + fi.canonicalFilePath(); + } + } +} + +QTEST_MAIN(qfileinfo) + +#include "main.moc" diff --git a/tests/benchmarks/qfileinfo/qfileinfo.pro b/tests/benchmarks/qfileinfo/qfileinfo.pro new file mode 100644 index 0000000..295cb50 --- /dev/null +++ b/tests/benchmarks/qfileinfo/qfileinfo.pro @@ -0,0 +1,12 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = qfileinfo +DEPENDPATH += . +INCLUDEPATH += . + +QT -= gui + +CONFIG += release + +# Input +SOURCES += main.cpp -- cgit v0.12 From cdc0b5fdf1197b07ad446cab339010e8c0fb8e8b Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 25 Nov 2009 16:12:43 +0100 Subject: Optimize QFSFileEnginePrivate::canonicalized() by using realpath() In our benchmark, this makes QFileInfo.canonical*Path() up to 50% faster. This should also improve application startup time. Let's see if it works on all Unices and Symbian. Reviewed-by: mariusSO --- src/corelib/io/qfsfileengine.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 3cf9b7e..6aace2c 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -55,6 +55,7 @@ #include "private/qcore_unix_p.h" #endif #include +#include QT_BEGIN_NAMESPACE @@ -137,6 +138,17 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path) if (path.isEmpty()) return path; +#if defined(Q_OS_UNIX) || defined(Q_OS_SYMBIAN) + // FIXME let's see if this stuff works, then we might be able to remove some of the other code + const char *fileName = path.toLocal8Bit().constData(); + char *ret = realpath(fileName, (char*)0); + if (ret) { + QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret)); + free(ret); + return canonicalPath; + } +#endif + QFileInfo fi; const QChar slash(QLatin1Char('/')); QString tmpPath = path; -- cgit v0.12 From dddd3e5fc9658ebbb5f94b343e7c7c0cd27eb7f2 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Wed, 25 Nov 2009 16:22:29 +0100 Subject: Fix crash of QtWebKit on any page with Flash when compiled witn MinGW. Early push of this fix which should be overwritten by the fix upstreamed in WebKit trunk later. Reviewed-by: Simon Hausmann --- src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp b/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp index 5ccce0e..b313afb 100644 --- a/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp @@ -145,7 +145,7 @@ HDC WINAPI PluginView::hookedBeginPaint(HWND hWnd, PAINTSTRUCT* lpPaint) "push %3\n" "call *%4\n" : "=a" (result) - : "a" (beginPaintSysCall), "g" (lpPaint), "g" (hWnd), "m" (*beginPaint) + : "a" (beginPaintSysCall), "g" (lpPaint), "g" (hWnd), "m" (beginPaint) : "memory" ); return result; @@ -175,7 +175,7 @@ BOOL WINAPI PluginView::hookedEndPaint(HWND hWnd, const PAINTSTRUCT* lpPaint) "push %3\n" "call *%4\n" : "=a" (result) - : "a" (endPaintSysCall), "g" (lpPaint), "g" (hWnd), "m" (*endPaint) + : "a" (endPaintSysCall), "g" (lpPaint), "g" (hWnd), "m" (endPaint) ); return result; #elif defined (_M_IX86) -- cgit v0.12 From aaae24808654d54bf8aca04f825c6aa786fe342f Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Wed, 25 Nov 2009 15:01:13 +0100 Subject: Use a pixmap instead of an image in the tablet example The transformations QImage->QPixmap are killing the performance of the tablet example. This is noticeable because of the number of events sent by the tablet (painting MUST be fast in tabletEvent()). Reviewed-by: David Boddie --- doc/src/examples/tablet.qdoc | 26 +++++++++++++------------- examples/widgets/tablet/tabletcanvas.cpp | 30 +++++++++++++++--------------- examples/widgets/tablet/tabletcanvas.h | 8 ++++---- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/doc/src/examples/tablet.qdoc b/doc/src/examples/tablet.qdoc index 3c3ced9..b0548d4 100644 --- a/doc/src/examples/tablet.qdoc +++ b/doc/src/examples/tablet.qdoc @@ -79,7 +79,7 @@ the examples menus and connect their slots and signals. \o The \c TabletCanvas class inherits QWidget and receives tablet events. It uses the events to paint on a - QImage, which it draws onto itself. + offscreen pixmap, which it draws onto itself. \o The \c TabletApplication class inherits QApplication. This class handles tablet events that are not sent to \c tabletEvent(). We will look at this later. @@ -214,16 +214,16 @@ alphaChannelType, \c colorSturationType, and \c penWidthType, which we provide access functions for. - We draw on a QImage with \c myPen and \c myBrush using \c + We draw on a QPixmap with \c myPen and \c myBrush using \c myColor. The \c saveImage() and \c loadImage() saves and loads - the QImage to disk. The image is drawn on the widget in \c + the QPixmap to disk. The pixmap is drawn on the widget in \c paintEvent(). The \c pointerType and \c deviceType keeps the type of pointer, which is either a pen or an eraser, and device currently used on the tablet, which is either a stylus or an airbrush. The interpretation of events from the tablet is done in \c - tabletEvent(); \c paintImage(), \c updateBrush(), and \c + tabletEvent(); \c paintPixmap(), \c updateBrush(), and \c brushPattern() are helper functions used by \c tabletEvent(). @@ -234,20 +234,20 @@ \snippet examples/widgets/tablet/tabletcanvas.cpp 0 In the constructor we initialize our class variables. We need - to draw the background of our image, as the default is gray. + to draw the background of our pixmap, as the default is gray. Here is the implementation of \c saveImage(): \snippet examples/widgets/tablet/tabletcanvas.cpp 1 - QImage implements functionality to save itself to disk, so we - simply call \l{QImage::}{save()}. + QPixmap implements functionality to save itself to disk, so we + simply call \l{QPixmap::}{save()}. Here is the implementation of \c loadImage(): \snippet examples/widgets/tablet/tabletcanvas.cpp 2 - We simply call \l{QImage::}{load()}, which loads the image in \a + We simply call \l{QPixmap::}{load()}, which loads the image in \a file. Here is the implementation of \c tabletEvent(): @@ -259,7 +259,7 @@ is pressed down on, leaves, or moves on the tablet. We set the \c deviceDown to true when a device is pressed down on the tablet; we then know when we should draw when we receive move events. We - have implemented the \c updateBrush() and \c paintImage() helper + have implemented the \c updateBrush() and \c paintPixmap() helper functions to update \c myBrush and \c myPen after the state of \c alphaChannelType, \c colorSaturationType, and \c lineWidthType. @@ -267,13 +267,13 @@ \snippet examples/widgets/tablet/tabletcanvas.cpp 4 - We simply draw the image to the top left of the widget. + We simply draw the pixmap to the top left of the widget. - Here is the implementation of \c paintImage(): + Here is the implementation of \c paintPixmap(): \snippet examples/widgets/tablet/tabletcanvas.cpp 5 - In this function we draw on the image based on the movement of the + In this function we draw on the pixmap based on the movement of the device. If the device used on the tablet is a stylus we want to draw a line between the positions of the stylus recorded in \c polyLine. We also assume that this is a reasonable handling of any unknown device, @@ -334,7 +334,7 @@ We finally check wether the pointer is the stylus or the eraser. If it is the eraser, we set the color to the background color of - the image an let the pressure decide the pen width, else we set + the pixmap an let the pressure decide the pen width, else we set the colors we have set up previously in the function. diff --git a/examples/widgets/tablet/tabletcanvas.cpp b/examples/widgets/tablet/tabletcanvas.cpp index 130498b..20b0d1e 100644 --- a/examples/widgets/tablet/tabletcanvas.cpp +++ b/examples/widgets/tablet/tabletcanvas.cpp @@ -50,7 +50,7 @@ TabletCanvas::TabletCanvas() resize(500, 500); myBrush = QBrush(); myPen = QPen(); - initImage(); + initPixmap(); setAutoFillBackground(true); deviceDown = false; myColor = Qt::red; @@ -60,29 +60,29 @@ TabletCanvas::TabletCanvas() lineWidthType = LineWidthPressure; } -void TabletCanvas::initImage() +void TabletCanvas::initPixmap() { - QImage newImage = QImage(width(), height(), QImage::Format_ARGB32); - QPainter painter(&newImage); - painter.fillRect(0, 0, newImage.width(), newImage.height(), Qt::white); - if (!image.isNull()) - painter.drawImage(0, 0, image); + QPixmap newPixmap = QPixmap(width(), height()); + newPixmap.fill(Qt::white); + QPainter painter(&newPixmap); + if (!pixmap.isNull()) + painter.drawPixmap(0, 0, pixmap); painter.end(); - image = newImage; + pixmap = newPixmap; } //! [0] //! [1] bool TabletCanvas::saveImage(const QString &file) { - return image.save(file); + return pixmap.save(file); } //! [1] //! [2] bool TabletCanvas::loadImage(const QString &file) { - bool success = image.load(file); + bool success = pixmap.load(file); if (success) { update(); @@ -114,8 +114,8 @@ void TabletCanvas::tabletEvent(QTabletEvent *event) if (deviceDown) { updateBrush(event); - QPainter painter(&image); - paintImage(painter, event); + QPainter painter(&pixmap); + paintPixmap(painter, event); } break; default: @@ -129,12 +129,12 @@ void TabletCanvas::tabletEvent(QTabletEvent *event) void TabletCanvas::paintEvent(QPaintEvent *) { QPainter painter(this); - painter.drawImage(QPoint(0, 0), image); + painter.drawPixmap(0, 0, pixmap); } //! [4] //! [5] -void TabletCanvas::paintImage(QPainter &painter, QTabletEvent *event) +void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event) { QPoint brushAdjust(10, 10); @@ -271,6 +271,6 @@ void TabletCanvas::updateBrush(QTabletEvent *event) void TabletCanvas::resizeEvent(QResizeEvent *) { - initImage(); + initPixmap(); polyLine[0] = polyLine[1] = polyLine[2] = QPoint(); } diff --git a/examples/widgets/tablet/tabletcanvas.h b/examples/widgets/tablet/tabletcanvas.h index 02b8794..5a2fb1d 100644 --- a/examples/widgets/tablet/tabletcanvas.h +++ b/examples/widgets/tablet/tabletcanvas.h @@ -43,7 +43,7 @@ #define TABLETCANVAS_H #include -#include +#include #include #include #include @@ -92,8 +92,8 @@ protected: void resizeEvent(QResizeEvent *event); private: - void initImage(); - void paintImage(QPainter &painter, QTabletEvent *event); + void initPixmap(); + void paintPixmap(QPainter &painter, QTabletEvent *event); Qt::BrushStyle brushPattern(qreal value); void updateBrush(QTabletEvent *event); @@ -104,7 +104,7 @@ private: QTabletEvent::TabletDevice myTabletDevice; QColor myColor; - QImage image; + QPixmap pixmap; QBrush myBrush; QPen myPen; bool deviceDown; -- cgit v0.12 From 5c2783411ad4bcd2772b2dcbc0d38694af72e414 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 18 Nov 2009 20:32:12 +0100 Subject: Fixed key handling in the documentation index widget On Mac up/down arrow keys move the cursor to the beginning/end of the lineedit, however if the lineedit is used to control the indexwidget in assistant, we need to prevent it to get those events and move the text cursor. Reviewed-by: kh --- tools/assistant/tools/assistant/indexwindow.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/assistant/tools/assistant/indexwindow.cpp b/tools/assistant/tools/assistant/indexwindow.cpp index 6d35649..97828c1 100644 --- a/tools/assistant/tools/assistant/indexwindow.cpp +++ b/tools/assistant/tools/assistant/indexwindow.cpp @@ -112,18 +112,22 @@ bool IndexWindow::eventFilter(QObject *obj, QEvent *e) case Qt::Key_Up: idx = m_indexWidget->model()->index(idx.row()-1, idx.column(), idx.parent()); - if (idx.isValid()) + if (idx.isValid()) { m_indexWidget->setCurrentIndex(idx); + return true; + } break; case Qt::Key_Down: idx = m_indexWidget->model()->index(idx.row()+1, idx.column(), idx.parent()); - if (idx.isValid()) + if (idx.isValid()) { m_indexWidget->setCurrentIndex(idx); + return true; + } break; case Qt::Key_Escape: emit escapePressed(); - break; + return true; default: ; // stop complaining } } else if (obj == m_indexWidget && e->type() == QEvent::ContextMenu) { -- cgit v0.12 From 0065225f9cb5c3be31fc03627f7178b158183abb Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 25 Nov 2009 18:15:15 +0100 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( 27984c8c8d021a6bff604da57520959d420a642c ) --- src/3rdparty/webkit/JavaScriptCore/ChangeLog | 10 +++++++++ .../JavaScriptCore/jit/ExecutableAllocator.h | 4 ++-- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 24 ++++++++++++++++++++++ .../platform/network/qt/QNetworkReplyHandler.cpp | 4 ++++ 5 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 382a8c7..1ef3b4d 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,13 @@ +2009-11-18 Gabor Loki + + Reviewed by Darin Adler. + + Fix the clobber list of cacheFlush for ARM and Thumb2 on Linux + https://bugs.webkit.org/show_bug.cgi?id=31631 + + * jit/ExecutableAllocator.h: + (JSC::ExecutableAllocator::cacheFlush): + 2009-11-23 Laszlo Gombos Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h index 5c43eeb..9ca62c8 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h @@ -203,7 +203,7 @@ public: "pop {r7}\n" : : "r" (code), "r" (reinterpret_cast(code) + size) - : "r0", "r1"); + : "r0", "r1", "r2"); } #elif PLATFORM(SYMBIAN) static void cacheFlush(void* code, size_t size) @@ -224,7 +224,7 @@ public: "pop {r7}\n" : : "r" (code), "r" (reinterpret_cast(code) + size) - : "r0", "r1"); + : "r0", "r1", "r2"); } #else #error "The cacheFlush support is missing on this platform." diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 5818e83..772d8d0 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - efa69b6181ce5c045097351cdcf6c158da3f4888 + 27984c8c8d021a6bff604da57520959d420a642c diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 9644470..268aaa1 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,27 @@ +2009-11-25 Jocelyn Turcotte + + Reviewed by Simon Hausmann. + + [Qt] Fix crash of QtWebKit on any page with Flash when compiled with MinGW. + + Fix inline assembly, don't dereference the function pointer twice. + + * plugins/win/PluginViewWin.cpp: + (WebCore::PluginView::hookedBeginPaint): + (WebCore::PluginView::hookedEndPaint): + +2009-11-22 Jakub Wieczorek + + Reviewed by Adam Barth. + + [Qt] Remove the Referer header when redirecting to a non-secure site + https://bugs.webkit.org/show_bug.cgi?id=31785 + + This makes Qt pass two tests introduced in r50226. + + * platform/network/qt/QNetworkReplyHandler.cpp: + (WebCore::QNetworkReplyHandler::sendResponseIfNeeded): + 2009-11-19 Olivier Goffart Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index 2f4722f..1ac80f6 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp @@ -325,6 +325,10 @@ void QNetworkReplyHandler::sendResponseIfNeeded() newRequest.setHTTPMethod("GET"); } + // Should not set Referer after a redirect from a secure resource to non-secure one. + if (!newRequest.url().protocolIs("https") && protocolIs(newRequest.httpReferrer(), "https")) + newRequest.clearHTTPReferrer(); + client->willSendRequest(m_resourceHandle, newRequest, response); m_redirected = true; m_request = newRequest.toNetworkRequest(m_resourceHandle->getInternal()->m_frame); -- cgit v0.12 From 70236685b09e76b48949cc16fa2a7a1f8350bbb7 Mon Sep 17 00:00:00 2001 From: Nils Christian Roscher-Nielsen Date: Wed, 25 Nov 2009 18:21:36 +0100 Subject: Checks for len = 0 in QIconvCodec::convertFromUnicode iconv hangs when len is initially 0 on some Solaris platforms. This can be seen in the standarddialogs example when calling QFileDialog::getOpenFileName() for instance. Reviewed-by: ddenis Task-number: QTBUG-4976 --- src/corelib/codecs/qiconvcodec.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp index 8c4cc82..0fb78d5 100644 --- a/src/corelib/codecs/qiconvcodec.cpp +++ b/src/corelib/codecs/qiconvcodec.cpp @@ -378,7 +378,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt } int invalidCount = 0; - do { + while (inBytesLeft != 0) { if (iconv(state->cd, inBytesPtr, &inBytesLeft, &outBytes, &outBytesLeft) == (size_t) -1) { if (errno == EINVAL && convState) { // buffer ends in a surrogate @@ -418,7 +418,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt } } } - } while (inBytesLeft != 0); + } // reset to initial state iconv(state->cd, 0, &inBytesLeft, 0, &outBytesLeft); -- cgit v0.12 From 1d55c88b66013f86be9c7ef069f0f8cdb598d1e2 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Thu, 26 Nov 2009 11:34:44 +0100 Subject: rename .qs files to .js QtScript _is_ JavaScript, there's no need to use a custom extension. Most of the other examples were already using .js, but there were two files that still had the .qs extension. Agreed with Simon. Reviewed-by: TrustMe --- doc/src/examples/helloscript.qdoc | 6 +++--- examples/script/helloscript/helloscript.js | 5 +++++ examples/script/helloscript/helloscript.qrc | 2 +- examples/script/helloscript/helloscript.qs | 5 ----- examples/script/helloscript/main.cpp | 2 +- examples/script/qsdbg/example.js | 17 +++++++++++++++++ examples/script/qsdbg/example.qs | 17 ----------------- examples/script/qsdbg/main.cpp | 2 +- 8 files changed, 28 insertions(+), 28 deletions(-) create mode 100644 examples/script/helloscript/helloscript.js delete mode 100644 examples/script/helloscript/helloscript.qs create mode 100644 examples/script/qsdbg/example.js delete mode 100644 examples/script/qsdbg/example.qs diff --git a/doc/src/examples/helloscript.qdoc b/doc/src/examples/helloscript.qdoc index 7142d8b..243b10f 100644 --- a/doc/src/examples/helloscript.qdoc +++ b/doc/src/examples/helloscript.qdoc @@ -69,7 +69,7 @@ The contents of the script file are read. - \snippet examples/script/helloscript/helloscript.qs 0 + \snippet examples/script/helloscript/helloscript.js 0 The script sets the \c text (note that the qTr() function is used to allow for translation) and \c styleSheet properties of the button, and calls the @@ -105,7 +105,7 @@ To generate the translation file, run \c lupdate as follows: \code - lupdate helloscript.qs -ts helloscript_la.ts + lupdate helloscript.js -ts helloscript_la.ts \endcode You should now have a file \c helloscript_la.ts in the current @@ -115,7 +115,7 @@ linguist helloscript_la.ts \endcode - You should now see the text "helloscript.qs" in the top left pane. + You should now see the text "helloscript.js" in the top left pane. Double-click it, then click on "Hello world!" and enter "Orbis, te saluto!" in the \gui Translation pane (the middle right of the window). Don't forget the exclamation mark! diff --git a/examples/script/helloscript/helloscript.js b/examples/script/helloscript/helloscript.js new file mode 100644 index 0000000..6d8e87c --- /dev/null +++ b/examples/script/helloscript/helloscript.js @@ -0,0 +1,5 @@ +//! [0] +button.text = qsTr('Hello World!'); +button.styleSheet = 'font-style: italic'; +button.show(); +//! [0] diff --git a/examples/script/helloscript/helloscript.qrc b/examples/script/helloscript/helloscript.qrc index dc93461..c52fa15 100644 --- a/examples/script/helloscript/helloscript.qrc +++ b/examples/script/helloscript/helloscript.qrc @@ -1,5 +1,5 @@ - helloscript.qs + helloscript.js diff --git a/examples/script/helloscript/helloscript.qs b/examples/script/helloscript/helloscript.qs deleted file mode 100644 index 6d8e87c..0000000 --- a/examples/script/helloscript/helloscript.qs +++ /dev/null @@ -1,5 +0,0 @@ -//! [0] -button.text = qsTr('Hello World!'); -button.styleSheet = 'font-style: italic'; -button.show(); -//! [0] diff --git a/examples/script/helloscript/main.cpp b/examples/script/helloscript/main.cpp index bc9a65e..55d63bf 100644 --- a/examples/script/helloscript/main.cpp +++ b/examples/script/helloscript/main.cpp @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) //! [2] //! [3] - QString fileName(":/helloscript.qs"); + QString fileName(":/helloscript.js"); QFile scriptFile(fileName); scriptFile.open(QIODevice::ReadOnly); QTextStream stream(&scriptFile); diff --git a/examples/script/qsdbg/example.js b/examples/script/qsdbg/example.js new file mode 100644 index 0000000..47c1363 --- /dev/null +++ b/examples/script/qsdbg/example.js @@ -0,0 +1,17 @@ +function bar() { + var x = 1; + var y = 2; + return x + y; +} + +function foo(a, b, c) { + var i = a + bar(); + var j = b - bar(); + var k = c * bar(); + return Math.cos(i) + Math.sin(j) - Math.atan(k); +} + +var first = foo(1, 2, 3); +var second = foo(4, 5, 6); +print("first was:", first, ", and second was:", second); + diff --git a/examples/script/qsdbg/example.qs b/examples/script/qsdbg/example.qs deleted file mode 100644 index 47c1363..0000000 --- a/examples/script/qsdbg/example.qs +++ /dev/null @@ -1,17 +0,0 @@ -function bar() { - var x = 1; - var y = 2; - return x + y; -} - -function foo(a, b, c) { - var i = a + bar(); - var j = b - bar(); - var k = c * bar(); - return Math.cos(i) + Math.sin(j) - Math.atan(k); -} - -var first = foo(1, 2, 3); -var second = foo(4, 5, 6); -print("first was:", first, ", and second was:", second); - diff --git a/examples/script/qsdbg/main.cpp b/examples/script/qsdbg/main.cpp index 526de0c..fdcc7cb 100644 --- a/examples/script/qsdbg/main.cpp +++ b/examples/script/qsdbg/main.cpp @@ -46,7 +46,7 @@ int main(int argc, char **argv) { if (argc < 2) { - fprintf(stderr, "*** you must specify a script file to evaluate (try example.qs)\n"); + fprintf(stderr, "*** you must specify a script file to evaluate (try example.js)\n"); return(-1); } -- cgit v0.12 From 2f00c76081f261e6f357c279206a6a18fdadc472 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Thu, 26 Nov 2009 11:39:48 +0100 Subject: create application object in qsdbg example Since 4.6, it's required that the Q(Core)Application object is constructed before QScriptEngine objects. Reviewed-by: TrustMe --- examples/script/qsdbg/main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/script/qsdbg/main.cpp b/examples/script/qsdbg/main.cpp index fdcc7cb..2a86c3d 100644 --- a/examples/script/qsdbg/main.cpp +++ b/examples/script/qsdbg/main.cpp @@ -39,12 +39,15 @@ ** ****************************************************************************/ +#include #include #include "scriptdebugger.h" int main(int argc, char **argv) { + QCoreApplication app(argc, argv); + if (argc < 2) { fprintf(stderr, "*** you must specify a script file to evaluate (try example.js)\n"); return(-1); -- cgit v0.12 From 0cf58948ac9bb9c35835e18a00737c362b08f3c7 Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Thu, 26 Nov 2009 14:59:09 +0100 Subject: Avoid using return value from a temporary object The temporary object goes away before the next line is executed, so the pointer to the const data is invalid. Just put it all on one line, and we're ok. Reviewed-by: Brad --- src/corelib/io/qfsfileengine.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 6aace2c..efc09a0 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -140,8 +140,7 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path) #if defined(Q_OS_UNIX) || defined(Q_OS_SYMBIAN) // FIXME let's see if this stuff works, then we might be able to remove some of the other code - const char *fileName = path.toLocal8Bit().constData(); - char *ret = realpath(fileName, (char*)0); + char *ret = realpath(path.toLocal8Bit().constData(), (char*)0); if (ret) { QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret)); free(ret); -- cgit v0.12 From bc2b222148648354fe15a6f8da9e01743a1e3e3f Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Thu, 26 Nov 2009 15:44:08 +0100 Subject: On Mac OS X, QLineEdit should handle MoveToStart/EndOfBlock On Mac OS X, with a QLineEdit, QKeySequence::MoveToStartOfBlock should move the cursor to the beginning of the input, and QKeySequence::MoveToEndOfBlock to the end of the block Same for selection. The shortcuts also had to be updated. Task-number: QTBUG-4679 Reviewed-by: Olivier Goffart --- src/gui/kernel/qkeysequence.cpp | 6 ++++-- src/gui/widgets/qlinecontrol.cpp | 8 ++++---- tests/auto/qlineedit/tst_qlineedit.cpp | 37 ++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index e3af683..2361dd0 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -282,8 +282,8 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni \row \i SelectPreviousPage \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp \row \i SelectStartOfLine \i Shift+Home \i Ctrl+Shift+Left \i Shift+Home \i Shift+Home \i Shift+Home \row \i SelectEndOfLine \i Shift+End \i Ctrl+Shift+Right \i Shift+End \i Shift+End \i Shift+End - \row \i SelectStartOfBlock \i (none) \i Alt+Shift+Up \i (none) \i (none) \i (none) - \row \i SelectEndOfBlock \i (none) \i Alt+Shift+Down \i (none) \i (none) \i (none) + \row \i SelectStartOfBlock \i (none) \i Alt+Shift+Up, Meta+Shift+A \i (none) \i (none) \i (none) + \row \i SelectEndOfBlock \i (none) \i Alt+Shift+Down, Meta+Shift+E \i (none) \i (none) \i (none) \row \i SelectStartOfDocument\i Ctrl+Shift+Home \i Ctrl+Shift+Up, Shift+Home \i Ctrl+Shift+Home\i Ctrl+Shift+Home \i Ctrl+Shift+Home \row \i SelectEndOfDocument \i Ctrl+Shift+End \i Ctrl+Shift+Down, Shift+End \i Ctrl+Shift+End \i Ctrl+Shift+End \i Ctrl+Shift+End \row \i DeleteStartOfWord \i Ctrl+Backspace \i Alt+Backspace \i Ctrl+Backspace \i Ctrl+Backspace \i (none) @@ -732,6 +732,8 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = { {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_Down, QApplicationPrivate::KB_Mac}, {QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_PageUp, QApplicationPrivate::KB_Mac}, {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_PageDown, QApplicationPrivate::KB_Mac}, + {QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, QApplicationPrivate::KB_Mac}, + {QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, QApplicationPrivate::KB_Mac}, {QKeySequence::SelectStartOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_Mac}, {QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_Mac} }; diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 9d533ae..06ef1db 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -1581,16 +1581,16 @@ void QLineControl::processKeyEvent(QKeyEvent* event) } } #endif //QT_NO_CLIPBOARD - else if (event == QKeySequence::MoveToStartOfLine) { + else if (event == QKeySequence::MoveToStartOfLine || event == QKeySequence::MoveToStartOfBlock) { home(0); } - else if (event == QKeySequence::MoveToEndOfLine) { + else if (event == QKeySequence::MoveToEndOfLine || event == QKeySequence::MoveToEndOfBlock) { end(0); } - else if (event == QKeySequence::SelectStartOfLine) { + else if (event == QKeySequence::SelectStartOfLine || event == QKeySequence::SelectStartOfBlock) { home(1); } - else if (event == QKeySequence::SelectEndOfLine) { + else if (event == QKeySequence::SelectEndOfLine || event == QKeySequence::SelectEndOfBlock) { end(1); } else if (event == QKeySequence::MoveToNextChar) { diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index b4dfbba..26294ac 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -261,6 +261,8 @@ private slots: void task241436_passwordEchoOnEditRestoreEchoMode(); void task248948_redoRemovedSelection(); void taskQTBUG_4401_enterKeyClearsPassword(); + void taskQTBUG_4679_moveToStartEndOfBlock(); + void taskQTBUG_4679_selectToStartEndOfBlock(); protected slots: #ifdef QT3_SUPPORT @@ -3548,5 +3550,40 @@ void tst_QLineEdit::taskQTBUG_4401_enterKeyClearsPassword() QTRY_COMPARE(testWidget->text(), password); } +void tst_QLineEdit::taskQTBUG_4679_moveToStartEndOfBlock() +{ +#ifdef Q_OS_MAC + const QString text("there are no blocks for lineEdit"); + testWidget->setText(text); + testWidget->setCursorPosition(5); + QCOMPARE(testWidget->cursorPosition(), 5); + testWidget->setFocus(); + QTest::keyPress(testWidget, Qt::Key_A, Qt::MetaModifier); + QCOMPARE(testWidget->cursorPosition(), 0); + QTest::keyPress(testWidget, Qt::Key_E, Qt::MetaModifier); + QCOMPARE(testWidget->cursorPosition(), text.size()); +#endif // Q_OS_MAC +} + +void tst_QLineEdit::taskQTBUG_4679_selectToStartEndOfBlock() +{ +#ifdef Q_OS_MAC + const QString text("there are no blocks for lineEdit, select all"); + testWidget->setText(text); + testWidget->setCursorPosition(5); + QCOMPARE(testWidget->cursorPosition(), 5); + testWidget->setFocus(); + QTest::keyPress(testWidget, Qt::Key_A, Qt::MetaModifier | Qt::ShiftModifier); + QCOMPARE(testWidget->cursorPosition(), 0); + QVERIFY(testWidget->hasSelectedText()); + QCOMPARE(testWidget->selectedText(), text.mid(0, 5)); + + QTest::keyPress(testWidget, Qt::Key_E, Qt::MetaModifier | Qt::ShiftModifier); + QCOMPARE(testWidget->cursorPosition(), text.size()); + QVERIFY(testWidget->hasSelectedText()); + QCOMPARE(testWidget->selectedText(), text.mid(5)); +#endif // Q_OS_MAC +} + QTEST_MAIN(tst_QLineEdit) #include "tst_qlineedit.moc" -- cgit v0.12 From c8de2b42348eb8665bee3948895c397c4a364251 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 27 Nov 2009 10:47:07 +0100 Subject: Fix miracously exported WTF symbols in QtScript with the Maemo 5 toolchain. Rename the WTF namespace. Task-number: http://bugreports.qt.nokia.com/browse/QTBUG-5513 Reviewed-by: Simon Hausmann --- src/script/script.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/script.pro b/src/script/script.pro index 008c556..771047a 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 jscyyparse=qtjscyyparse jscyylex=qtjscyylex jscyyerror=qtjscyyerror +DEFINES += JSC=QTJSC jscyyparse=qtjscyyparse jscyylex=qtjscyylex jscyyerror=qtjscyyerror WTF=QTWTF DEFINES += QT_BUILD_SCRIPT_LIB DEFINES += QT_NO_USING_NAMESPACE DEFINES += QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO -- cgit v0.12 From ef17dac74688a8754aa4434a24ddb19d2ab4dcc5 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Fri, 27 Nov 2009 10:55:56 +0100 Subject: Improve QFileInfo benchmark Reviewed-by: TrustMe --- src/corelib/io/qfsfileengine_p.h | 2 +- tests/benchmarks/qfileinfo/main.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h index 87f0737..41a6a1b 100644 --- a/src/corelib/io/qfsfileengine_p.h +++ b/src/corelib/io/qfsfileengine_p.h @@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE #define Q_USE_DEPRECATED_MAP_API 1 #endif -class QFSFileEnginePrivate : public QAbstractFileEnginePrivate +class Q_AUTOTEST_EXPORT QFSFileEnginePrivate : public QAbstractFileEnginePrivate { Q_DECLARE_PUBLIC(QFSFileEngine) diff --git a/tests/benchmarks/qfileinfo/main.cpp b/tests/benchmarks/qfileinfo/main.cpp index 7950f58..711209c 100644 --- a/tests/benchmarks/qfileinfo/main.cpp +++ b/tests/benchmarks/qfileinfo/main.cpp @@ -44,6 +44,7 @@ #include #include +#include "private/qfsfileengine_p.h" class qfileinfo : public QObject { @@ -67,11 +68,12 @@ void qfileinfo::cleanupTestCase() void qfileinfo::canonicalFileNamePerformance() { + QString appPath = QCoreApplication::applicationFilePath(); + QFSFileEnginePrivate::canonicalized(appPath); // warmup + QFSFileEnginePrivate::canonicalized(appPath); // more warmup QBENCHMARK { for (int i = 0; i < 5000; i++) { - // this actually calls canonicalFilePath twice, once inside QCoreApplication. - QFileInfo fi(QCoreApplication::applicationFilePath()); - fi.canonicalFilePath(); + QFSFileEnginePrivate::canonicalized(appPath); } } } -- cgit v0.12 From f21d183b26ea824fadb7c54a3ba9cdf66d99b726 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Fri, 27 Nov 2009 13:41:11 +0100 Subject: Fix performance regression of posted events Commit 31f1ff91028dd7f90925d5b3737e4d88b5fb07aa introduced a performance regression by using SetTimer() to delay the next call to sendPostedEvents(). SetTimer() has a minimum resolution, around 15-16ms, which is too slow for most uses. Fast timers and QWidget::update() use posted events to do their job, and suffered as a result. This commit goes away from using SetTimer() to using a GetMessage() hook that examines the input queue as soon as message are pulled from the queue. Now there is no large delay between calls to sendPostedEvents(), they are sent as quickly as possible (once all other input and timer messages have been delivered). Reviewed-by: Prasanth Ullattil Task-number: QTBUG-6083 --- src/corelib/kernel/qeventdispatcher_win.cpp | 68 +++++++++++++++++------------ src/corelib/kernel/qeventdispatcher_win_p.h | 1 + 2 files changed, 40 insertions(+), 29 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index b197b9d..c6eef5e 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -336,6 +336,7 @@ public: // internal window handle used for socketnotifiers/timers/etc HWND internalHwnd; + HHOOK getMessageHook; // for controlling when to send posted events QAtomicInt serialNumber; @@ -363,7 +364,7 @@ public: }; QEventDispatcherWin32Private::QEventDispatcherWin32Private() - : threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0), serialNumber(0), lastSerialNumber(0), wakeUps(0) + : threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0), getMessageHook(0), serialNumber(0), lastSerialNumber(0), wakeUps(0) { resolveTimerAPI(); } @@ -471,37 +472,11 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) } return 0; } else if (message == WM_TIMER) { - if (wp == SendPostedEventsTimerId) { - KillTimer(d->internalHwnd, wp); - int localSerialNumber = d->serialNumber; - (void) d->wakeUps.fetchAndStoreRelease(0); - if (localSerialNumber != d->lastSerialNumber) { - PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0); - } - } else { - Q_ASSERT(d != 0); - d->sendTimerEvent(wp); - } + Q_ASSERT(d != 0); + d->sendTimerEvent(wp); return 0; } else if (message == WM_QT_SENDPOSTEDEVENTS) { int localSerialNumber = d->serialNumber; - - if (GetQueueStatus(QS_INPUT | QS_RAWINPUT | QS_TIMER) != 0) { - // delay the next pass of sendPostedEvents() until we get the special - // WM_TIMER, which allows all pending Windows messages to be processed - if (SetTimer(d->internalHwnd, SendPostedEventsTimerId, 0, 0) == 0) { - // failed to start the timer, oops, clear wakeUps in an attempt to keep things running - qErrnoWarning("Qt: INTERNAL ERROR: failed to start sendPostedEvents() timer"); - d->wakeUps.fetchAndStoreRelease(0); - } else { - // SetTimer() succeeded, nothing to do now - ; - } - } else { - // nothing pending in the queue, let sendPostedEvents go through - d->wakeUps.fetchAndStoreRelease(0); - } - if (localSerialNumber != d->lastSerialNumber) { d->lastSerialNumber = localSerialNumber; QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData); @@ -512,6 +487,31 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) return DefWindowProc(hwnd, message, wp, lp); } +LRESULT CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp) +{ + if (wp == PM_REMOVE) { + QEventDispatcherWin32 *q = qobject_cast(QAbstractEventDispatcher::instance()); + Q_ASSERT(q != 0); + if (q) { + QEventDispatcherWin32Private *d = q->d_func(); + int localSerialNumber = d->serialNumber; + if (HIWORD(GetQueueStatus(QS_INPUT | QS_RAWINPUT | QS_TIMER)) == 0) { + // no more input or timer events in the message queue, we can allow posted events to be + // sent now + (void) d->wakeUps.fetchAndStoreRelease(0); + MSG *msg = (MSG *) lp; + if (localSerialNumber != d->lastSerialNumber + // if this message IS the one that triggers sendPostedEvents(), no need to post it again + && msg->hwnd != d->internalHwnd + && msg->message != WM_QT_SENDPOSTEDEVENTS) { + PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0); + } + } + } + } + return CallNextHookEx(0, code, wp, lp); +} + static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatcher) { // make sure that multiple Qt's can coexist in the same process @@ -636,6 +636,12 @@ void QEventDispatcherWin32::createInternalHwnd() return; d->internalHwnd = qt_create_internal_window(this); + // setup GetMessage hook needed to drive our posted events + d->getMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC) qt_GetMessageHook, NULL, GetCurrentThreadId()); + if (!d->getMessageHook) { + qFatal("Qt: INTERNALL ERROR: failed to install GetMessage hook"); + } + // register all socket notifiers QList sockets = (d->sn_read.keys().toSet() + d->sn_write.keys().toSet() @@ -1058,6 +1064,10 @@ void QEventDispatcherWin32::closingDown() d->unregisterTimer(d->timerVec.at(i), true); d->timerVec.clear(); d->timerDict.clear(); + + if (d->getMessageHook) + UnhookWindowsHookEx(d->getMessageHook); + d->getMessageHook = 0; } bool QEventDispatcherWin32::event(QEvent *e) diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index a5ef4d4..7f0e87d 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -102,6 +102,7 @@ public: private: friend LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp); + friend LRESULT CALLBACK qt_GetMessageHook(int, WPARAM, LPARAM); }; QT_END_NAMESPACE -- cgit v0.12 From 71c3227ba260b964b0c9516f05ad4f2e6fa72f69 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Fri, 27 Nov 2009 15:10:16 +0100 Subject: Fix memory leak in the DNotify implementation of QFileSystemWatcher Make sure that all calls to opendir() are paired with a call closedir(). Reviewed-by: Marius Storm-Olsen Task-number: QTBUG-4840 --- src/corelib/io/qfilesystemwatcher_dnotify.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/corelib/io/qfilesystemwatcher_dnotify.cpp b/src/corelib/io/qfilesystemwatcher_dnotify.cpp index 17ac9c6..03172e5 100644 --- a/src/corelib/io/qfilesystemwatcher_dnotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_dnotify.cpp @@ -295,6 +295,9 @@ QStringList QDnotifyFileSystemWatcherEngine::addPaths(const QStringList &paths, pathToFD.insert(path, fd); if(parentFd) parentToFD.insert(parentFd, fd); + + ::closedir(d); + if(parent) ::closedir(parent); } Directory &directory = fdToDirectory[fd]; -- cgit v0.12 From 10b5653ad4f25c6f37d640facf4a5ef01fe25926 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Fri, 27 Nov 2009 15:14:45 +0100 Subject: QNetworkReply autotest: adapt to QNetworkCookieJar change with commit 0d20ec8604b318ceafd6c35dfe1d73519bf024d3 I changed QNetworkCookieJar behavior, this commit adapts the QNetworkReply autotest to it. Reviewed-by: TrustMe --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 5fe716a..6d43c1d 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -3241,8 +3241,11 @@ void tst_QNetworkReply::receiveCookiesFromHttp_data() cookie = QNetworkCookie("a", "b"); cookie.setPath("/not/part-of-path"); header << cookie; + cookie.setDomain(QtNetworkSettings::serverName()); + jar << cookie; QTest::newRow("invalid-cookie-path") << "a=b; path=/not/part-of-path" << header << jar; + jar.clear(); cookie = QNetworkCookie("a", "b"); cookie.setDomain(".example.com"); header.clear(); -- cgit v0.12 From bdd34f907b919ea0742f28ba25b6a3c1ebe97e86 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 30 Nov 2009 00:00:26 +0100 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( 37d059def88f94e4296a74dc524efda154c6bde6 ) Changes in WebKit/qt since the last update: ++ b/WebKit/qt/ChangeLog 2009-11-28 Simon Hausmann Reviewed by Kenneth Rohde Christiansen. [Qt] SoftwareInputPanelRequest event sent when clicking in newly loaded page https://bugs.webkit.org/show_bug.cgi?id=31401 Don't set the event unless there is a focused node we can use for editing afterwards. * Api/qwebpage.cpp: (QWebPagePrivate::handleSoftwareInputPanel): * tests/qwebpage/tst_qwebpage.cpp: (tst_QWebPage::inputMethods): 2009-11-23 David Boddie Reviewed by Simon Hausmann. Updated the QWebElement documentation with links to examples and external resources. Fixed the project file for the webelement snippet and tidied up the markers used for quoting the code. * Api/qwebelement.cpp: * docs/webkitsnippets/webelement/main.cpp: (findAll): * docs/webkitsnippets/webelement/webelement.pro: 2009-11-23 Simon Hausmann Reviewed by Kenneth Rohde Christiansen. [Qt] Wrong runtime instance objects of wrapped QObjects may be used if the wrapped object died before the gc removed the instance. https://bugs.webkit.org/show_bug.cgi?id=31681 Added a unit-test to verify that wrapping a QObject with the same identity as a previously but now dead object works. * tests/qwebframe/tst_qwebframe.cpp: --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 17 +++++++++ .../webkit/WebCore/bridge/qt/qt_instance.cpp | 15 ++++++-- .../webkit/WebCore/bridge/qt/qt_instance.h | 1 + src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp | 14 +++++-- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 5 +++ src/3rdparty/webkit/WebKit/qt/ChangeLog | 44 ++++++++++++++++++++++ .../qt/docs/webkitsnippets/webelement/main.cpp | 4 +- .../docs/webkitsnippets/webelement/webelement.pro | 3 ++ .../WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 38 +++++++++++++++++++ .../WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 15 ++++++++ 11 files changed, 147 insertions(+), 11 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 772d8d0..0a73e06 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - 27984c8c8d021a6bff604da57520959d420a642c + 37d059def88f94e4296a74dc524efda154c6bde6 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 268aaa1..4f6146f 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,20 @@ +2009-11-23 Simon Hausmann + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Wrong runtime instance objects of wrapped QObjects may be used if + the wrapped object died before the gc removed the instance. + + https://bugs.webkit.org/show_bug.cgi?id=31681 + + Before using a cached instance, verify that its wrapped QObject is + still alive. + + * bridge/qt/qt_instance.cpp: + (JSC::Bindings::QtInstance::getQtInstance): + * bridge/qt/qt_instance.h: + (JSC::Bindings::QtInstance::hashKey): + 2009-11-25 Jocelyn Turcotte Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp index 0546014..ec362ec 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp @@ -111,10 +111,17 @@ PassRefPtr QtInstance::getQtInstance(QObject* o, PassRefPtrrootObject() == rootObject) - return instance; - } + foreach(QtInstance* instance, cachedInstances.values(o)) + if (instance->rootObject() == rootObject) { + // The garbage collector removes instances, but it may happen that the wrapped + // QObject dies before the gc kicks in. To handle that case we have to do an additional + // check if to see if the instance's wrapped object is still alive. If it isn't, then + // we have to create a new wrapper. + if (!instance->getObject()) + cachedInstances.remove(instance->hashKey()); + else + return instance; + } RefPtr ret = QtInstance::create(o, rootObject, ownership); cachedInstances.insert(o, ret.get()); diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h index 00aaa5b..0afc6c7 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h @@ -59,6 +59,7 @@ public: JSValue booleanValue() const; QObject* getObject() const { return m_object; } + QObject* hashKey() const { return m_hashkey; } static PassRefPtr getQtInstance(QObject*, PassRefPtr, QScriptEngine::ValueOwnership ownership); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp index 8922150..441bec7 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp @@ -99,6 +99,14 @@ public: It is possible to replace the contents of child elements using setPlainText() and setInnerXml(). To replace the element itself and its contents, use setOuterXml(). + + \section1 Examples + + The \l{DOM Traversal Example} shows one way to traverse documents in a running + example. + + The \l{Simple Selector Example} can be used to experiment with the searching + features of this class and provides sample code you can start working with. */ /*! @@ -195,8 +203,7 @@ bool QWebElement::isNull() const \a selectorQuery. If there are no matching elements, an empty list is returned. - \l{http://www.w3.org/TR/REC-CSS2/selector.html#q1}{Standard CSS2 selector} - syntax is used for the query. + \l{Standard CSS2 selector} syntax is used for the query. \note This search is performed recursively. @@ -211,8 +218,7 @@ QWebElementCollection QWebElement::findAll(const QString &selectorQuery) const Returns the first child element that matches the given CSS selector \a selectorQuery. - \l{http://www.w3.org/TR/REC-CSS2/selector.html#q1}{Standard CSS2 selector} - syntax is used for the query. + \l{Standard CSS2 selector} syntax is used for the query. \note This search is performed recursively. diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index aedf95a..1bdc3ed 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -864,7 +864,12 @@ void QWebPagePrivate::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev) void QWebPagePrivate::handleSoftwareInputPanel(Qt::MouseButton button) { #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + Frame* frame = page->focusController()->focusedFrame(); + if (!frame) + return; + if (client && client->inputMethodEnabled() + && frame->document()->focusedNode() && button == Qt::LeftButton && qApp->autoSipEnabled()) { QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( client->ownerWidget()->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 2408dd4..2f0bf17 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,47 @@ +2009-11-28 Simon Hausmann + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] SoftwareInputPanelRequest event sent when clicking in newly loaded page + + https://bugs.webkit.org/show_bug.cgi?id=31401 + + Don't set the event unless there is a focused node we can use + for editing afterwards. + + * Api/qwebpage.cpp: + (QWebPagePrivate::handleSoftwareInputPanel): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::inputMethods): + +2009-11-23 David Boddie + + Reviewed by Simon Hausmann. + + Updated the QWebElement documentation with links to examples and + external resources. + Fixed the project file for the webelement snippet and tidied up the + markers used for quoting the code. + + * Api/qwebelement.cpp: + * docs/webkitsnippets/webelement/main.cpp: + (findAll): + * docs/webkitsnippets/webelement/webelement.pro: + +2009-11-23 Simon Hausmann + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Wrong runtime instance objects of wrapped QObjects may be used if + the wrapped object died before the gc removed the instance. + + https://bugs.webkit.org/show_bug.cgi?id=31681 + + Added a unit-test to verify that wrapping a QObject with the + same identity as a previously but now dead object works. + + * tests/qwebframe/tst_qwebframe.cpp: + 2009-11-19 Olivier Goffart Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp index d437a6f..2707ffb 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp +++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp @@ -22,7 +22,6 @@ #include #include #include -#include static QWebFrame *frame; @@ -53,9 +52,10 @@ static void findAll()

*/ +//! [FindAll intro] QList allSpans = document.findAll("span"); QList introSpans = document.findAll("p.intro span"); -//! [FindAll] +//! [FindAll intro] //! [FindAll] } int main(int argc, char *argv[]) diff --git a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro index f9b403b..8ca4b59 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro +++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro @@ -1,5 +1,8 @@ TEMPLATE = app CONFIG -= app_bundle +CONFIG(QTDIR_build) { + QT += webkit +} SOURCES = main.cpp include(../../../../../WebKit.pri) QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index d88d905..8cc7953 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -605,6 +605,7 @@ private slots: void render(); void scrollPosition(); void evaluateWillCauseRepain