From 0fbf2304625cfe895f232b4c64a95bcf0584bd92 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 25 Nov 2009 15:16:35 +0100 Subject: Introduce QFileInfo benchmark Right now only a benchmark for the canonicalized path. Reviewed-by: TrustMe --- tests/benchmarks/benchmarks.pro | 1 + tests/benchmarks/qfileinfo/main.cpp | 81 ++++++++++++++++++++++++++++++++ tests/benchmarks/qfileinfo/qfileinfo.pro | 12 +++++ 3 files changed, 94 insertions(+) create mode 100644 tests/benchmarks/qfileinfo/main.cpp create mode 100644 tests/benchmarks/qfileinfo/qfileinfo.pro diff --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 evaluateWillCauseRepaint(); + void qObjectWrapperWithSameIdentity(); private: QString evalJS(const QString&s) { @@ -2785,6 +2786,43 @@ void tst_QWebFrame::evaluateWillCauseRepaint() QTest::qWait(2000); } +class TestFactory : public QObject +{ + Q_OBJECT +public: + TestFactory() + : obj(0), counter(0) + {} + + Q_INVOKABLE QObject* getNewObject() + { + delete obj; + obj = new QObject(this); + obj->setObjectName(QLatin1String("test") + QString::number(++counter)); + return obj; + + } + + QObject* obj; + int counter; +}; + +void tst_QWebFrame::qObjectWrapperWithSameIdentity() +{ + m_view->setHtml("" + "test"); + + QWebFrame* mainFrame = m_view->page()->mainFrame(); + QCOMPARE(mainFrame->toPlainText(), QString("test")); + + mainFrame->addToJavaScriptWindowObject("test", new TestFactory, QScriptEngine::ScriptOwnership); + + mainFrame->evaluateJavaScript("triggerBug();"); + QCOMPARE(mainFrame->toPlainText(), QString("test1")); + + mainFrame->evaluateJavaScript("triggerBug();"); + QCOMPARE(mainFrame->toPlainText(), QString("test2")); +} QTEST_MAIN(tst_QWebFrame) #include "tst_qwebframe.moc" 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 32002e7..ee1969d 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -1487,6 +1487,21 @@ void tst_QWebPage::inputMethods() QVERIFY(!(inputMethodHints(view) & Qt::ImhHiddenText)); #endif + page->mainFrame()->setHtml("

nothing to input here"); + viewEventSpy.clear(); + + QWebElement para = page->mainFrame()->findFirstElement("p"); + { + QMouseEvent evpres(QEvent::MouseButtonPress, para.geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier); + page->event(&evpres); + QMouseEvent evrel(QEvent::MouseButtonRelease, para.geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier); + page->event(&evrel); + } + +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + QVERIFY(!viewEventSpy.contains(QEvent::RequestSoftwareInputPanel)); +#endif + delete container; } -- cgit v0.12 From 84794dee63d9f90fc3e2d579644a6a2835513e9e Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 30 Nov 2009 11:33:39 +0100 Subject: Enable YARR when YARR_JIT is enabled Import fix for https://bugs.webkit.org/show_bug.cgi?id=30730 The fix was already applied for src/3rdparty/webkit but not for src/3rdparty/javascriptcore. Task-number: QTBUG-6311 Reviewed-by: Simon Hausmann --- src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri index 28328e7..a6fb2f8 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri +++ b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri @@ -39,10 +39,12 @@ win32-* { contains(JAVASCRIPTCORE_JIT,yes) { DEFINES+=ENABLE_JIT=1 DEFINES+=ENABLE_YARR_JIT=1 + DEFINES+=ENABLE_YARR=1 } contains(JAVASCRIPTCORE_JIT,no) { DEFINES+=ENABLE_JIT=0 DEFINES+=ENABLE_YARR_JIT=0 + DEFINES+=ENABLE_YARR=0 } # In debug mode JIT disabled until crash fixed -- cgit v0.12 From bd1370f577f486ac994c7856373f52306de23068 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 30 Nov 2009 13:16:14 +0100 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( 9de63cde0ac8aa08e207d4ffce2846df1a44a364 ) Changes in WebKit/qt since the last update: --- src/3rdparty/webkit/ChangeLog | 10 +++++++++ src/3rdparty/webkit/JavaScriptCore/ChangeLog | 26 ++++++++++++++++++++++ .../webkit/JavaScriptCore/runtime/MarkStack.h | 2 +- .../webkit/JavaScriptCore/wtf/TypeTraits.h | 2 +- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebKit.pri | 2 +- 6 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog index 26dbaf7..1e89d1e 100644 --- a/src/3rdparty/webkit/ChangeLog +++ b/src/3rdparty/webkit/ChangeLog @@ -1,3 +1,13 @@ +2009-11-30 Jan-Arve Sæther + + Reviewed by Simon Hausmann. + + [Qt] Fix compilation with win32-icc + + Include os-win32 for stdint.h since MS does not ship that in their PSDK. + + * WebKit.pri: + 2009-10-30 Adam Barth Reviewed by Mark Rowe. diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 1ef3b4d..d7d2d57 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,29 @@ +2009-11-30 Jan-Arve Sæther + + Reviewed by Simon Hausmann. + + [Qt] Fix compilation with win32-icc + + The Intel compiler does not support the __has_trivial_constructor type + trait. The Intel Compiler can report itself as _MSC_VER >= 1400. The + reason for that is that the Intel Compiler depends on the Microsoft + Platform SDK, and in order to try to be "fully" MS compatible it will + "pretend" to be the same MS compiler as was shipped with the MS PSDK. + (Thus, compiling with win32-icc with VC8 SDK will make the source code + "think" the compiler at hand supports this type trait). + + * wtf/TypeTraits.h: + +2009-11-28 Laszlo Gombos + + Reviewed by Eric Seidel. + + Apply workaround for the limitation of VirtualFree with MEM_RELEASE to all ports running on Windows + https://bugs.webkit.org/show_bug.cgi?id=31943 + + * runtime/MarkStack.h: + (JSC::MarkStack::MarkStackArray::shrinkAllocation): + 2009-11-18 Gabor Loki Reviewed by Darin Adler. diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h b/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h index ea09f54..a114ae0 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h @@ -153,7 +153,7 @@ namespace JSC { ASSERT(0 == (size % MarkStack::pageSize())); if (size == m_allocated) return; -#if PLATFORM(WIN) || PLATFORM(SYMBIAN) +#if PLATFORM(WIN_OS) || PLATFORM(SYMBIAN) // We cannot release a part of a region with VirtualFree. To get around this, // we'll release the entire region and reallocate the size that we want. releaseStack(m_data, m_allocated); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h b/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h index 6ce6a3e..9e75e7a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h @@ -155,7 +155,7 @@ namespace WTF { typedef IntegralConstant true_type; typedef IntegralConstant false_type; -#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) // VC8 (VS2005) and later have built-in compiler support for HasTrivialConstructor / HasTrivialDestructor, // but for some unexplained reason it doesn't work on built-in types. template struct HasTrivialConstructor : public IntegralConstant{ }; diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 0a73e06..62acbdf 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 - 37d059def88f94e4296a74dc524efda154c6bde6 + 9de63cde0ac8aa08e207d4ffce2846df1a44a364 diff --git a/src/3rdparty/webkit/WebKit.pri b/src/3rdparty/webkit/WebKit.pri index 10291b4..5188662 100644 --- a/src/3rdparty/webkit/WebKit.pri +++ b/src/3rdparty/webkit/WebKit.pri @@ -11,7 +11,7 @@ isEmpty(OUTPUT_DIR) { DEFINES += BUILDING_QT__=1 building-libs { - win32-msvc*: INCLUDEPATH += $$PWD/JavaScriptCore/os-win32 + win32-msvc*|win32-icc: INCLUDEPATH += $$PWD/JavaScriptCore/os-win32 } else { CONFIG(QTDIR_build) { QT += webkit -- cgit v0.12 From 00bb48127cf0954555402d59a18e55223c707a53 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 30 Nov 2009 13:27:05 +0100 Subject: QVector: fix const_iterator-=(int) Reviewed-by: Harald Fernengel --- src/corelib/tools/qvector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index f0de98d..9f10202 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -219,7 +219,7 @@ public: inline const_iterator &operator--() { i--; return *this; } inline const_iterator operator--(int) { T *n = i; i--; return n; } inline const_iterator &operator+=(int j) { i+=j; return *this; } - inline const_iterator &operator-=(int j) { i+=j; return *this; } + inline const_iterator &operator-=(int j) { i-=j; return *this; } inline const_iterator operator+(int j) const { return const_iterator(i+j); } inline const_iterator operator-(int j) const { return const_iterator(i-j); } inline int operator-(const_iterator j) const { return i - j.i; } -- cgit v0.12 From a812f864005cded35db2e51434d9c150a4d720d3 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Mon, 30 Nov 2009 14:19:50 +0100 Subject: Fix a documentation typo. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Samuel Rødal --- src/gui/painting/qpaintdevice.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc index ac1c3de..e923e90 100644 --- a/src/gui/painting/qpaintdevice.qdoc +++ b/src/gui/painting/qpaintdevice.qdoc @@ -82,7 +82,7 @@ horizontal and vertical resolution of the device in dots per inch. The physicalDpiX() and physicalDpiY() functions also return the resolution of the device in dots per inch, but note that if - the logical and vertical resolution differ, the corresponding + the logical and physical resolution differ, the corresponding QPaintEngine must handle the mapping. Finally, the colorCount() function returns the number of different colors available for the paint device. -- cgit v0.12 From 634a2c456732903b116a73e674f1391f77d530d8 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Mon, 30 Nov 2009 14:23:47 +0100 Subject: Make sure that cleanupTestCase() do not stat The benchmark of QDir is also used to minimize the number of stats(). The test initialization and cleanup should avoid stats(). Reviewed-by: Markus Goetz --- tests/benchmarks/qdir/tst_qdir.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/benchmarks/qdir/tst_qdir.cpp b/tests/benchmarks/qdir/tst_qdir.cpp index 2e4a28a..fd558d3 100644 --- a/tests/benchmarks/qdir/tst_qdir.cpp +++ b/tests/benchmarks/qdir/tst_qdir.cpp @@ -68,7 +68,8 @@ public slots: void cleanupTestCase() { { QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); - + testdir.setSorting(QDir::Unsorted); + testdir.setFilter(QDir::AllEntries | QDir::System | QDir::Hidden); foreach (const QString &filename, testdir.entryList()) { testdir.remove(filename); } -- cgit v0.12 From 132eccca92a90e4d67ba8b5a4052384a2b2cfdf9 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 30 Nov 2009 14:15:50 +0100 Subject: Fix garbage collection issue with script-owned objects with connections This reinstates the pre-4.6 behavior: A script-owned C++ object that's not referenced anymore should be garbage collected, even if it has connections. In order to achieve this, the "weak" reference to the C++ object's wrapper must be invalidated. Task-number: QTBUG-6366 Reviewed-by: Simon Hausmann --- src/script/api/qscriptengine.cpp | 21 ++++++++++---------- src/script/bridge/qscriptqobject.cpp | 27 +++++++++++++------------- tests/auto/qscriptengine/tst_qscriptengine.cpp | 18 +++++++++++++++++ 3 files changed, 43 insertions(+), 23 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index dc0e0d0..b6aa872 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -1101,16 +1101,6 @@ void QScriptEnginePrivate::mark(JSC::MarkStack& markStack) } } -#ifndef QT_NO_QOBJECT - { - QHash::const_iterator it; - for (it = m_qobjectData.constBegin(); it != m_qobjectData.constEnd(); ++it) { - QScript::QObjectData *qdata = it.value(); - qdata->mark(markStack); - } - } -#endif - { QHash::const_iterator it; for (it = m_typeInfos.constBegin(); it != m_typeInfos.constEnd(); ++it) { @@ -1134,6 +1124,17 @@ void QScriptEnginePrivate::mark(JSC::MarkStack& markStack) context = context->parentContext(); } } + +#ifndef QT_NO_QOBJECT + markStack.drain(); // make sure everything is marked before marking qobject data + { + QHash::const_iterator it; + for (it = m_qobjectData.constBegin(); it != m_qobjectData.constEnd(); ++it) { + QScript::QObjectData *qdata = it.value(); + qdata->mark(markStack); + } + } +#endif } bool QScriptEnginePrivate::isCollecting() const diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp index 559fcd3..63ba9ec 100644 --- a/src/script/bridge/qscriptqobject.cpp +++ b/src/script/bridge/qscriptqobject.cpp @@ -83,22 +83,23 @@ struct QObjectConnection void mark(JSC::MarkStack& markStack) { - // ### need to find out if senderWrapper is marked if (senderWrapper) { - // see if the sender should be marked or not + // see if the sender should be marked or not; + // if the C++ object is owned by script, we don't want + // it to stay alive due to a script connection. Q_ASSERT(senderWrapper.inherits(&QScriptObject::info)); QScriptObject *scriptObject = static_cast(JSC::asObject(senderWrapper)); - QScriptObjectDelegate *delegate = scriptObject->delegate(); - Q_ASSERT(delegate && (delegate->type() == QScriptObjectDelegate::QtObject)); - QObjectDelegate *inst = static_cast(delegate); - if ((inst->ownership() == QScriptEngine::ScriptOwnership) - || ((inst->ownership() == QScriptEngine::AutoOwnership) - && inst->value() && !inst->value()->parent())) { - // #### don't mark if not marked otherwise - //senderWrapper = JSC::JSValue(); - markStack.append(senderWrapper); - } else { - markStack.append(senderWrapper); + if (!JSC::Heap::isCellMarked(scriptObject)) { + QScriptObjectDelegate *delegate = scriptObject->delegate(); + Q_ASSERT(delegate && (delegate->type() == QScriptObjectDelegate::QtObject)); + QObjectDelegate *inst = static_cast(delegate); + if ((inst->ownership() == QScriptEngine::ScriptOwnership) + || ((inst->ownership() == QScriptEngine::AutoOwnership) + && inst->value() && !inst->value()->parent())) { + senderWrapper = JSC::JSValue(); + } else { + markStack.append(senderWrapper); + } } } if (receiver) diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 3bc2443..2d629b7 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -154,6 +154,7 @@ private slots: void functionScopes(); void nativeFunctionScopes(); void evaluateProgram(); + void collectGarbageAfterConnect(); void qRegExpInport_data(); void qRegExpInport(); @@ -4443,6 +4444,23 @@ void tst_QScriptEngine::evaluateProgram() } } +void tst_QScriptEngine::collectGarbageAfterConnect() +{ + // QTBUG-6366 + QScriptEngine engine; + QPointer widget = new QWidget; + engine.globalObject().setProperty( + "widget", engine.newQObject(widget, QScriptEngine::ScriptOwnership)); + QVERIFY(engine.evaluate("widget.customContextMenuRequested.connect(\n" + " function() { print('hello'); }\n" + ");") + .isUndefined()); + QVERIFY(widget != 0); + engine.evaluate("widget = null;"); + collectGarbage_helper(engine); + QVERIFY(widget == 0); +} + static QRegExp minimal(QRegExp r) { r.setMinimal(true); return r; } void tst_QScriptEngine::qRegExpInport_data() -- cgit v0.12 From b5bf6d68bdde5f5db1d72179f4e20dc1e21d20c4 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 30 Nov 2009 15:28:47 +0100 Subject: Unix: Avoid stat() when opening a file The open() syscall can open directories for reading, which we in QFile and file engines don't support. However, there is no need for stat() to find out if it is a directory if we open() with a write flag because then the syscall will fail anyway. Reviewed-by: joao --- src/corelib/io/qfsfileengine_unix.cpp | 32 ++++++++++++++++++++------------ tests/auto/qfile/tst_qfile.cpp | 13 ++++++++++++- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 8cbf6a3..71414ce 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -191,12 +191,16 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode) return false; } - QT_STATBUF statBuf; - if (QT_FSTAT(fd, &statBuf) != -1) { - if ((statBuf.st_mode & S_IFMT) == S_IFDIR) { - q->setError(QFile::OpenError, QLatin1String("file to open is a directory")); - QT_CLOSE(fd); - return false; + if (!(openMode & QIODevice::WriteOnly)) { + // we don't need this check if we tried to open for writing because then + // we had received EISDIR anyway. + QT_STATBUF statBuf; + if (QT_FSTAT(fd, &statBuf) != -1) { + if ((statBuf.st_mode & S_IFMT) == S_IFDIR) { + q->setError(QFile::OpenError, QLatin1String("file to open is a directory")); + QT_CLOSE(fd); + return false; + } } } @@ -230,12 +234,16 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode) return false; } - QT_STATBUF statBuf; - if (QT_FSTAT(fileno(fh), &statBuf) != -1) { - if ((statBuf.st_mode & S_IFMT) == S_IFDIR) { - q->setError(QFile::OpenError, QLatin1String("file to open is a directory")); - fclose(fh); - return false; + if (!(openMode & QIODevice::WriteOnly)) { + // we don't need this check if we tried to open for writing because then + // we had received EISDIR anyway. + QT_STATBUF statBuf; + if (QT_FSTAT(fileno(fh), &statBuf) != -1) { + if ((statBuf.st_mode & S_IFMT) == S_IFDIR) { + q->setError(QFile::OpenError, QLatin1String("file to open is a directory")); + fclose(fh); + return false; + } } } diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp index cf46ce1..7ee5665 100644 --- a/tests/auto/qfile/tst_qfile.cpp +++ b/tests/auto/qfile/tst_qfile.cpp @@ -2783,10 +2783,21 @@ void tst_QFile::mapOpenMode() void tst_QFile::openDirectory() { - QFile f1("resources"); + QFile f1(SRCDIR "resources"); + // it's a directory, it must exist + QVERIFY(f1.exists()); + + // ...but not be openable QVERIFY(!f1.open(QIODevice::ReadOnly)); f1.close(); QVERIFY(!f1.open(QIODevice::ReadOnly|QIODevice::Unbuffered)); + f1.close(); + QVERIFY(!f1.open(QIODevice::ReadWrite)); + f1.close(); + QVERIFY(!f1.open(QIODevice::WriteOnly)); + f1.close(); + QVERIFY(!f1.open(QIODevice::WriteOnly|QIODevice::Unbuffered)); + f1.close(); } void tst_QFile::openStandardStreams() -- cgit v0.12 From da3bf86ecea14a8658601803e14820a28e7470d6 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 30 Nov 2009 17:08:53 +0100 Subject: Fixes a crash on Mac with QFileInfo. realpath() crashes on mac if the input file path is the root ("/") - on 10.6 calling a free on the returned value shows a warning saying the memory was not allocated. To workaround that just added a special case - if the input string is '/', we don't need to use realpath as we already know that the path is canonical. Reviewed-by: Prasanth --- src/corelib/io/qfsfileengine.cpp | 6 +++++- tests/auto/qfileinfo/tst_qfileinfo.cpp | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index efc09a0..b8f6e2c 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -139,7 +139,11 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path) 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 + // FIXME let's see if this stuff works, then we might be able to remove some of the other code. + // baaad Mac: 10.5 and 10.6 crash if trying to free a value returned by + // realpath() if the input path is just the root component. + if (path.size() == 1 && path.at(0) == QLatin1Char('/')) + return path; char *ret = realpath(path.toLocal8Bit().constData(), (char*)0); if (ret) { QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret)); diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp index 21edbcf..cd58fd6 100644 --- a/tests/auto/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp @@ -513,6 +513,10 @@ void tst_QFileInfo::canonicalFilePath() QFileInfo info("/tmp/../../../../../../../../../../../../../../../../../"); info.canonicalFilePath(); + // This used to crash on Mac + QFileInfo dontCrash(QLatin1String("/")); + QCOMPARE(dontCrash.canonicalFilePath(), QLatin1String("/")); + #ifndef Q_OS_WIN // test symlinks QFile::remove("link.lnk"); -- cgit v0.12 From b2bbdc8424c07bd958f1e96fdd332101f21d3881 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 30 Nov 2009 20:09:34 +0100 Subject: fix for mingw+msys --- tests/auto/qlibrary/lib/lib.pro | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/auto/qlibrary/lib/lib.pro b/tests/auto/qlibrary/lib/lib.pro index 25a50b5..f8132ac 100644 --- a/tests/auto/qlibrary/lib/lib.pro +++ b/tests/auto/qlibrary/lib/lib.pro @@ -15,13 +15,17 @@ win32-borland: DEFINES += WIN32_BORLAND # For windows test if we can load a filename with multiple dots. win32: { - QMAKE_POST_LINK = copy /Y $(DESTDIR_TARGET) ..\mylib.dl2 && \ - copy /Y $(DESTDIR_TARGET) ..\system.trolltech.test.mylib.dll && \ - copy /Y $(DESTDIR_TARGET) ..\mylib_noextension + cp = $(COPY) $(DESTDIR_TARGET) ..$$QMAKE_DIR_SEP + QMAKE_POST_LINK = \ + $${cp}mylib.dl2 && \ + $${cp}system.trolltech.test.mylib.dll && \ + $${cp}mylib_noextension } unix:!symbian: { - QMAKE_POST_LINK = cp -f $(DESTDIR)$(TARGET) ../libmylib.so2 && \ - cp -f $(DESTDIR)$(TARGET) ../system.trolltech.test.mylib.so + cp = $(COPY) $(DESTDIR)$(TARGET) ../ + QMAKE_POST_LINK = \ + $${cp}libmylib.so2 && \ + $${cp}system.trolltech.test.mylib.so } #no special install rule for the library used by test -- cgit v0.12 From e127806a53e445df165ef1021e9c3d9029fbcac2 Mon Sep 17 00:00:00 2001 From: Bill King Date: Tue, 1 Dec 2009 09:14:03 +1000 Subject: Fixed QSqlRelationalTableModel doesn't correctly work with relation in other database schema PSQL doesn't like having schema scoping in "AS" aliasing of fields, so use everything after the last "." separator for generating the alias. Task-number: QTBUG-5373 Reviewed-by: Justin McPherson --- src/sql/models/qsqlrelationaltablemodel.cpp | 2 +- .../qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/sql/models/qsqlrelationaltablemodel.cpp b/src/sql/models/qsqlrelationaltablemodel.cpp index 5f0a35d..aec54d6 100644 --- a/src/sql/models/qsqlrelationaltablemodel.cpp +++ b/src/sql/models/qsqlrelationaltablemodel.cpp @@ -563,7 +563,7 @@ QString QSqlRelationalTableModel::selectStatement() const // If there are duplicate field names they must be aliased if (fieldNames.value(fieldList[i]) > 1) { - QString relTableName = relation.tableName(); + QString relTableName = relation.tableName().section(QChar::fromLatin1('.'), -1, -1); if (d->db.driver()->isIdentifierEscaped(relTableName, QSqlDriver::TableName)) relTableName = d->db.driver()->stripDelimiters(relTableName, QSqlDriver::TableName); QString displayColumn = relation.displayColumn(); diff --git a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp index 8c840cd..4ae5000 100644 --- a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp +++ b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp @@ -1212,10 +1212,11 @@ void tst_QSqlRelationalTableModel::psqlSchemaTest() QSqlQuery q(db); QVERIFY_SQL(q, exec("create schema "+qTableName("QTBUG_5373"))); QVERIFY_SQL(q, exec("create schema "+qTableName("QTBUG_5373_s2"))); - QVERIFY_SQL(q, exec("create table "+qTableName("QTBUG_5373")+"."+qTableName("user")+"(userid int primary key, relatingid int)")); - QVERIFY_SQL(q, exec("create table "+qTableName("QTBUG_5373_s2")+"."+qTableName("user2")+"(userid2 int primary key, username2 char(40))")); - model.setTable(qTableName("QTBUG_5373")+"."+qTableName("user")); - model.setRelation(1, QSqlRelation(qTableName("QTBUG_5373_s2")+"."+qTableName("user2"), "userid2", "username2")); + QVERIFY_SQL(q, exec("create table "+qTableName("QTBUG_5373")+"."+qTableName("document")+"(document_id int primary key, relatingid int, userid int)")); + QVERIFY_SQL(q, exec("create table "+qTableName("QTBUG_5373_s2")+"."+qTableName("user")+"(userid int primary key, username char(40))")); + model.setTable(qTableName("QTBUG_5373")+"."+qTableName("document")); + model.setRelation(1, QSqlRelation(qTableName("QTBUG_5373_s2")+"."+qTableName("user"), "userid", "username")); + model.setRelation(2, QSqlRelation(qTableName("QTBUG_5373_s2")+"."+qTableName("user"), "userid", "username")); QVERIFY_SQL(model, select()); } -- cgit v0.12 From dff56298f86925fa31f0215f1782e7cdec318fac Mon Sep 17 00:00:00 2001 From: Derick Hawcroft Date: Tue, 1 Dec 2009 11:00:15 +1000 Subject: remove unused line of code Task-number: QTBUG-6387 --- src/sql/drivers/db2/qsql_db2.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp index 3f13405..5d039cf 100644 --- a/src/sql/drivers/db2/qsql_db2.cpp +++ b/src/sql/drivers/db2/qsql_db2.cpp @@ -1025,7 +1025,6 @@ QVariant QDB2Result::data(int field) break; case QVariant::Double: { - QString value=qGetStringData(d->hStmt, field, info.length() + 1, isNull); switch(numericalPrecisionPolicy()) { case QSql::LowPrecisionInt32: v = new QVariant(qGetIntData(d->hStmt, field, isNull)); -- cgit v0.12 From ca7a80a29000f45fc1bd5b0c491abc2bc44b620f Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Tue, 1 Dec 2009 10:12:31 +0100 Subject: Fix a crash in QFSFileEnginePrivate::canonicalized() on Mac OS X 10.5 The realpath() extension we use in this function is only available from 10.6 onwards. For the time being this optimization is turned off on Mac. Reviewed-by: Markus Goetz --- src/corelib/io/qfsfileengine.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index b8f6e2c..2178fa9 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -138,12 +138,13 @@ 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. - // baaad Mac: 10.5 and 10.6 crash if trying to free a value returned by - // realpath() if the input path is just the root component. +#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) if (path.size() == 1 && path.at(0) == QLatin1Char('/')) return path; +#endif + // Mac OS X 10.5.x doesn't support the realpath(X,0) extenstion we use here. +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) char *ret = realpath(path.toLocal8Bit().constData(), (char*)0); if (ret) { QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret)); -- cgit v0.12 From 448bd8a0b69eab922df956bb0fbdb94abeb5c7ea Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 1 Dec 2009 10:46:43 +0100 Subject: Re-enabled realpath() on symbian. That was disabled by accident when we were disabling it for Mac. Reviewed-by: Prasanth --- src/corelib/io/qfsfileengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 2178fa9..37b0ea1 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -144,7 +144,7 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path) return path; #endif // Mac OS X 10.5.x doesn't support the realpath(X,0) extenstion we use here. -#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) +#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) || defined(Q_OS_SYMBIAN) char *ret = realpath(path.toLocal8Bit().constData(), (char*)0); if (ret) { QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret)); -- cgit v0.12 From 6c8d6127d29266310ee797a19f3388ca7daadd92 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Tue, 1 Dec 2009 10:54:23 +0100 Subject: Make sure file descriptors are valid in the dnotify implementation of QFileSystemWatcher Commit 71c3227ba260b964b0c9516f05ad4f2e6fa72f69 fixed a memory leak by calling closedir(), which would also close the file descriptor we were wanting to watch. Fix this by duplicating the file descriptor that we store. Reviewed-by: TrustMe --- src/corelib/io/qfilesystemwatcher_dnotify.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qfilesystemwatcher_dnotify.cpp b/src/corelib/io/qfilesystemwatcher_dnotify.cpp index 03172e5..1fab010 100644 --- a/src/corelib/io/qfilesystemwatcher_dnotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_dnotify.cpp @@ -269,8 +269,8 @@ QStringList QDnotifyFileSystemWatcherEngine::addPaths(const QStringList &paths, } } - fd = ::dirfd(d); - int parentFd = parent?::dirfd(parent):0; + fd = qt_safe_dup(::dirfd(d)); + int parentFd = parent ? qt_safe_dup(::dirfd(parent)) : 0; Q_ASSERT(fd); if(::fcntl(fd, F_SETSIG, SIGIO) || -- cgit v0.12 From ddc35a0fba647a9824ae45b135ff5cd098392684 Mon Sep 17 00:00:00 2001 From: ck Date: Tue, 1 Dec 2009 11:44:51 +0100 Subject: Assistant: Fix race condition in CLucene indexer. We need to make sure the running thread can respond to the cancel request before overwriting it. Reviewed-by: kh1 --- tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp | 1 + tools/assistant/lib/qhelpsearchindexwriter_default.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp b/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp index ab32537..b9aedbe 100644 --- a/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp +++ b/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp @@ -578,6 +578,7 @@ void QHelpSearchIndexWriter::cancelIndexing() void QHelpSearchIndexWriter::updateIndex(const QString &collectionFile, const QString &indexFilesFolder, bool reindex) { + wait(); mutex.lock(); this->m_cancel = false; this->m_reindex = reindex; diff --git a/tools/assistant/lib/qhelpsearchindexwriter_default.cpp b/tools/assistant/lib/qhelpsearchindexwriter_default.cpp index 06deb85..60b9642 100644 --- a/tools/assistant/lib/qhelpsearchindexwriter_default.cpp +++ b/tools/assistant/lib/qhelpsearchindexwriter_default.cpp @@ -184,6 +184,7 @@ void QHelpSearchIndexWriter::updateIndex(const QString &collectionFile, const QString &indexFilesFolder, bool reindex) { + wait(); QMutexLocker lock(&mutex); this->m_cancel = false; -- cgit v0.12 From b405b59dca7c3340ce424313c8e538dacbc2e824 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Tue, 1 Dec 2009 13:11:51 +0100 Subject: Fix regression in tst_QFileSystemWatcher Dnotify doesn't work on dup'ed file descriptors apparently, so we need to closedir() before using fcntl() to set the watches. Reviewed-by: TrustMe --- src/corelib/io/qfilesystemwatcher_dnotify.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/corelib/io/qfilesystemwatcher_dnotify.cpp b/src/corelib/io/qfilesystemwatcher_dnotify.cpp index 1fab010..c70232c 100644 --- a/src/corelib/io/qfilesystemwatcher_dnotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_dnotify.cpp @@ -272,6 +272,9 @@ QStringList QDnotifyFileSystemWatcherEngine::addPaths(const QStringList &paths, fd = qt_safe_dup(::dirfd(d)); int parentFd = parent ? qt_safe_dup(::dirfd(parent)) : 0; + ::closedir(d); + if(parent) ::closedir(parent); + Q_ASSERT(fd); if(::fcntl(fd, F_SETSIG, SIGIO) || ::fcntl(fd, F_NOTIFY, DN_MODIFY | DN_CREATE | DN_DELETE | @@ -279,10 +282,6 @@ QStringList QDnotifyFileSystemWatcherEngine::addPaths(const QStringList &paths, (parent && ::fcntl(parentFd, F_SETSIG, SIGIO)) || (parent && ::fcntl(parentFd, F_NOTIFY, DN_DELETE | DN_RENAME | DN_MULTISHOT))) { - - ::closedir(d); - if(parent) ::closedir(parent); - continue; // Could not set appropriate flags } @@ -295,9 +294,6 @@ 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 271936b063fb261293e3f77f7a2273e3a4dbb5d6 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Tue, 1 Dec 2009 14:54:40 +0100 Subject: Creator crashes when reloading externally modified .ui files on Mac On Mac QWidget::destroy() sends an AcceptDropsChange event after clearing the guards for QPointer. This was used to store a QPointer to the widget being deleted & that will never be cleared. The fix removed the setAcceptDrops() from destroy. And as an extra protection make sure designer will not treat that event as interesting. Task-number: QTCREATORBUG-307 Reviewed-by: Denis Dzyubenko Reviewed-by: Friedemann Kleint --- src/gui/kernel/qwidget_mac.mm | 2 -- tools/designer/src/components/formeditor/formwindowmanager.cpp | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 0d9f9ee..1907cca 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2617,8 +2617,6 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) releaseMouse(); if(mac_keyboard_grabber == this) releaseKeyboard(); - if(acceptDrops()) - setAcceptDrops(false); if(testAttribute(Qt::WA_ShowModal)) // just be sure we leave modal QApplicationPrivate::leaveModal(this); diff --git a/tools/designer/src/components/formeditor/formwindowmanager.cpp b/tools/designer/src/components/formeditor/formwindowmanager.cpp index 23d8580..246c56f 100644 --- a/tools/designer/src/components/formeditor/formwindowmanager.cpp +++ b/tools/designer/src/components/formeditor/formwindowmanager.cpp @@ -196,6 +196,7 @@ bool FormWindowManager::eventFilter(QObject *o, QEvent *e) case QEvent::HoverEnter: case QEvent::HoverLeave: case QEvent::HoverMove: + case QEvent::AcceptDropsChange: return false; default: break; -- cgit v0.12 From b8f6753b6490481a1b8bc84a85a742243ad1a785 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 1 Dec 2009 17:44:47 +0100 Subject: compile fix for Qt in namespace --- src/gui/styles/qgtkstyle_p.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/styles/qgtkstyle_p.cpp b/src/gui/styles/qgtkstyle_p.cpp index 5f4ebae..22dfc62 100644 --- a/src/gui/styles/qgtkstyle_p.cpp +++ b/src/gui/styles/qgtkstyle_p.cpp @@ -202,8 +202,12 @@ Ptr_gnome_vfs_init QGtkStylePrivate::gnome_vfs_init = 0; typedef int (*x11ErrorHandler)(Display*, XErrorEvent*); +QT_END_NAMESPACE + Q_DECLARE_METATYPE(QGtkStylePrivate*); +QT_BEGIN_NAMESPACE + static void gtkStyleSetCallback(GtkWidget*) { qRegisterMetaType(); -- cgit v0.12 From a635388887a869bac928f3b93d0e24e532af301f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 2 Dec 2009 11:32:53 +0100 Subject: less bizarre code; fix minor mistakes --- tests/auto/qlibrary/tst_qlibrary.cpp | 50 ++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/tests/auto/qlibrary/tst_qlibrary.cpp b/tests/auto/qlibrary/tst_qlibrary.cpp index ca6db9a..c7f52bc 100644 --- a/tests/auto/qlibrary/tst_qlibrary.cpp +++ b/tests/auto/qlibrary/tst_qlibrary.cpp @@ -218,22 +218,22 @@ void tst_QLibrary::load_data() #else QString currDir = QDir::currentPath(); #endif - QTest::newRow( "ok00" ) << currDir + "/mylib" << (bool)true; - QTest::newRow( "notexist" ) << currDir + "/nolib" << (bool)false; - QTest::newRow( "badlibrary" ) << currDir + "/qlibrary.pro" << (bool)false; + QTest::newRow( "ok00" ) << currDir + "/mylib" << true; + QTest::newRow( "notexist" ) << currDir + "/nolib" << false; + QTest::newRow( "badlibrary" ) << currDir + "/qlibrary.pro" << false; #ifdef Q_OS_MAC - QTest::newRow("ok (libmylib ver. 1)") << currDir + "/libmylib" <<(bool)true; + QTest::newRow("ok (libmylib ver. 1)") << currDir + "/libmylib" < Date: Wed, 2 Dec 2009 12:14:00 +0100 Subject: really fix mingw+msys i missed the fact that lib2/ was duplicating the magic (totally pointlessly). so now all the magic moved to lib2/, as lib/ is not used on symbian anyway. --- tests/auto/qlibrary/lib/lib.pro | 18 ------------------ tests/auto/qlibrary/lib2/lib2.pro | 22 +++++++++++++--------- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/tests/auto/qlibrary/lib/lib.pro b/tests/auto/qlibrary/lib/lib.pro index f8132ac..6d80881 100644 --- a/tests/auto/qlibrary/lib/lib.pro +++ b/tests/auto/qlibrary/lib/lib.pro @@ -10,24 +10,6 @@ wince*: DEFINES += WIN32_MSVC win32-msvc: DEFINES += WIN32_MSVC win32-borland: DEFINES += WIN32_BORLAND -# Force a copy of the library to have an extension that is non-standard. -# We want to test if we can load a shared library with *any* filename... - -# For windows test if we can load a filename with multiple dots. -win32: { - cp = $(COPY) $(DESTDIR_TARGET) ..$$QMAKE_DIR_SEP - QMAKE_POST_LINK = \ - $${cp}mylib.dl2 && \ - $${cp}system.trolltech.test.mylib.dll && \ - $${cp}mylib_noextension -} -unix:!symbian: { - cp = $(COPY) $(DESTDIR)$(TARGET) ../ - QMAKE_POST_LINK = \ - $${cp}libmylib.so2 && \ - $${cp}system.trolltech.test.mylib.so -} - #no special install rule for the library used by test INSTALLS = diff --git a/tests/auto/qlibrary/lib2/lib2.pro b/tests/auto/qlibrary/lib2/lib2.pro index fc00af8..da30a2d 100644 --- a/tests/auto/qlibrary/lib2/lib2.pro +++ b/tests/auto/qlibrary/lib2/lib2.pro @@ -14,15 +14,19 @@ win32-borland: DEFINES += WIN32_BORLAND # Force a copy of the library to have an extension that is non-standard. # We want to test if we can load a shared library with *any* filename... -# For windows test if we can load a filename with multiple dots. -win32: { - QMAKE_POST_LINK = copy /Y ..\mylib2.dll ..\mylib.dl2 && \ - copy /Y ..\mylib2.dll ..\system.trolltech.test.mylib.dll -} - -unix:!symbian: { - QMAKE_POST_LINK = cp -f $(DESTDIR)$(TARGET) ../libmylib.so2 && \ - cp -f $(DESTDIR)$(TARGET) ../system.trolltech.test.mylib.so +!symbian { + win32 { + src = $(DESTDIR_TARGET) + files = mylib.dl2 system.trolltech.test.mylib.dll + } else { + src = $(DESTDIR)$(TARGET) + files = libmylib.so2 system.trolltech.test.mylib.so + } + for(file, files) { + QMAKE_POST_LINK += $(COPY) $$src ..$$QMAKE_DIR_SEP$$file && + CLEAN_FILES += ../$$file + } + QMAKE_POST_LINK = $$member(QMAKE_POST_LINK, 0, -2) } symbian-abld: { -- cgit v0.12 From 1b4ff1bab4ccc4bdc403b84920314f76fbca02c5 Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 3 Dec 2009 09:49:49 +1000 Subject: Fixes: OCI QSqlDatabase.tables() does not work with system tables. Task-number: QTBUG-5298 Reviewed-by: Justin McPherson --- src/sql/drivers/oci/qsql_oci.cpp | 83 +++++++++++++++++----------- tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 16 ++++++ 2 files changed, 68 insertions(+), 31 deletions(-) diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index 17f2c92..f130087 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -2200,26 +2200,34 @@ bool QOCIDriver::rollbackTransaction() QStringList QOCIDriver::tables(QSql::TableType type) const { QStringList tl; + QStringList sysUsers = QStringList() << QLatin1String("MDSYS") + << QLatin1String("LBACSYS") + << QLatin1String("SYS") + << QLatin1String("SYSTEM") + << QLatin1String("WKSYS") + << QLatin1String("CTXSYS") + << QLatin1String("WMSYS"); + + QString user = d->user; + if ( isIdentifierEscaped(user, QSqlDriver::TableName)) + user = stripDelimiters(user, QSqlDriver::TableName); + else + user = user.toUpper(); + + if(sysUsers.contains(user)) + sysUsers.removeAll(user);; + if (!isOpen()) return tl; QSqlQuery t(createResult()); t.setForwardOnly(true); if (type & QSql::Tables) { - t.exec(QLatin1String("select owner, table_name from all_tables " - "where owner != 'MDSYS' " - "and owner != 'LBACSYS' " - "and owner != 'SYS' " - "and owner != 'SYSTEM' " - "and owner != 'WKSYS'" - "and owner != 'CTXSYS'" - "and owner != 'WMSYS'")); - - QString user = d->user; - if ( isIdentifierEscaped(user, QSqlDriver::TableName)) - user = stripDelimiters(user, QSqlDriver::TableName); - else - user = user.toUpper(); + QString query = QLatin1String("select owner, table_name from all_tables where "); + QStringList whereList; + foreach(const QString &sysUserName, sysUsers) + whereList << QLatin1String("owner != '") + sysUserName + QLatin1String("' "); + t.exec(query + whereList.join(QLatin1String(" and "))); while (t.next()) { if (t.value(0).toString().toUpper() != user.toUpper()) @@ -2229,30 +2237,21 @@ QStringList QOCIDriver::tables(QSql::TableType type) const } // list all table synonyms as well - t.exec(QLatin1String("select owner, synonym_name from all_synonyms " - "where owner != 'MDSYS' " - "and owner != 'LBACSYS' " - "and owner != 'SYS' " - "and owner != 'SYSTEM' " - "and owner != 'WKSYS'" - "and owner != 'CTXSYS'" - "and owner != 'WMSYS'")); + query = QLatin1String("select owner, synonym_name from all_synonyms where "); + t.exec(query + whereList.join(QLatin1String(" and "))); while (t.next()) { if (t.value(0).toString() != d->user) - tl.append(t.value(0).toString() + QLatin1String(".") + t.value(1).toString()); + tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString()); else tl.append(t.value(1).toString()); } } if (type & QSql::Views) { - t.exec(QLatin1String("select owner, view_name from all_views " - "where owner != 'MDSYS' " - "and owner != 'LBACSYS' " - "and owner != 'SYS' " - "and owner != 'SYSTEM' " - "and owner != 'WKSYS'" - "and owner != 'CTXSYS'" - "and owner != 'WMSYS'")); + QString query = QLatin1String("select owner, view_name from all_views where "); + QStringList whereList; + foreach(const QString &sysUserName, sysUsers) + whereList << QLatin1String("owner != '") + sysUserName + QLatin1String("' "); + t.exec(query + whereList.join(QLatin1String(" and "))); while (t.next()) { if (t.value(0).toString().toUpper() != d->user.toUpper()) tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString()); @@ -2265,6 +2264,28 @@ QStringList QOCIDriver::tables(QSql::TableType type) const while (t.next()) { tl.append(t.value(0).toString()); } + QString query = QLatin1String("select owner, table_name from all_tables where "); + QStringList whereList; + foreach(const QString &sysUserName, sysUsers) + whereList << QLatin1String("owner = '") + sysUserName + QLatin1String("' "); + t.exec(query + whereList.join(QLatin1String(" or "))); + + while (t.next()) { + if (t.value(0).toString().toUpper() != user.toUpper()) + tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString()); + else + tl.append(t.value(1).toString()); + } + + // list all table synonyms as well + query = QLatin1String("select owner, synonym_name from all_synonyms where "); + t.exec(query + whereList.join(QLatin1String(" or "))); + while (t.next()) { + if (t.value(0).toString() != d->user) + tl.append(t.value(0).toString() + QLatin1String(".") + t.value(1).toString()); + else + tl.append(t.value(1).toString()); + } } return tl; } diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index fe7c3ea..f840ca6 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -86,6 +86,8 @@ private slots: void open(); void tables_data() { generic_data(); } void tables(); + void oci_tables_data() { generic_data("QOCI"); } + void oci_tables(); void transaction_data() { generic_data(); } void transaction(); void eventNotification_data() { generic_data(); } @@ -380,6 +382,7 @@ void tst_QSqlDatabase::dropTestTables(QSqlDatabase db) if (db.driverName().startsWith("QOCI")) { q.exec("drop user "+qTableName("CREATOR")+" cascade"); q.exec("drop user "+qTableName("APPUSER")+" cascade"); + q.exec("DROP TABLE system."+qTableName("mypassword")); } } @@ -2481,5 +2484,18 @@ void tst_QSqlDatabase::mysql_savepointtest() QVERIFY_SQL(q, exec("savepoint foo")); } +void tst_QSqlDatabase::oci_tables() +{ + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + QSqlQuery q(db); + QString systemTableName("system."+qTableName("mypassword")); + QVERIFY_SQL(q, exec("CREATE TABLE "+systemTableName+"(name VARCHAR(20))")); + QVERIFY(!db.tables().contains(systemTableName.toUpper())); + qDebug() << db.tables(QSql::SystemTables); + QVERIFY(db.tables(QSql::SystemTables).contains(systemTableName.toUpper())); +} + QTEST_MAIN(tst_QSqlDatabase) #include "tst_qsqldatabase.moc" -- cgit v0.12 From 635a9da9c42834c0c9c3b2329db4aae408ce820a Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Wed, 2 Dec 2009 17:43:45 +0100 Subject: Added a placeholderText(*) property to QLineEdit. Please note: Qt for Maemo5 will already use it in 4.6, while the other platforms will be enabled in 4.7 (otherwise be would break BIC there) This commit adds a so-called placeholder text for line edits. If the widget doesn't have focus and the text() is empty, this placeholder will be shown. (*) also known as hint, click-message or descriptive text Reviewed-by: jasplin --- src/gui/widgets/qlineedit.cpp | 44 +++++++++++++++++++++++++++++++++++++++++++ src/gui/widgets/qlineedit.h | 10 ++++++++++ src/gui/widgets/qlineedit_p.h | 2 ++ 3 files changed, 56 insertions(+) diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 785b2bd..650b0ab 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -383,6 +383,38 @@ void QLineEdit::setText(const QString& text) d->control->setText(text); } +// ### Qt 4.7: remove this #if guard +#if (QT_VERSION >= 0x407000) || defined(Q_WS_MAEMO_5) +/*! + \since 4.7 + + \property QLineEdit::placeholderText + \brief the line edit's placeholder text + + Setting this property makes the line edit display a grayed-out + placeholder text as long as the text() is empty and the widget doesn't + have focus. + + By default, this property contains an empty string. + + \sa text() +*/ +QString QLineEdit::placeholderText() const +{ + Q_D(const QLineEdit); + return d->placeholderText; +} + +void QLineEdit::setPlaceholderText(const QString& placeholderText) +{ + Q_D(QLineEdit); + if (d->placeholderText != placeholderText) { + d->placeholderText = placeholderText; + if (!hasFocus()) + update(); + } +} +#endif /*! \property QLineEdit::displayText @@ -1829,6 +1861,18 @@ void QLineEdit::paintEvent(QPaintEvent *) } QRect lineRect(r.x() + d->horizontalMargin, d->vscroll, r.width() - 2*d->horizontalMargin, fm.height()); + if (d->control->text().isEmpty()) { + if (!hasFocus() && !d->placeholderText.isEmpty()) { + QColor col = pal.text().color(); + col.setAlpha(128); + QPen oldpen = p.pen(); + p.setPen(col); + p.drawText(lineRect, va, d->placeholderText); + p.setPen(oldpen); + return; + } + } + int cix = qRound(d->control->cursorToX()); // horizontal scrolling. d->hscroll is the left indent from the beginning diff --git a/src/gui/widgets/qlineedit.h b/src/gui/widgets/qlineedit.h index ac918c7..594e488 100644 --- a/src/gui/widgets/qlineedit.h +++ b/src/gui/widgets/qlineedit.h @@ -83,6 +83,10 @@ class Q_GUI_EXPORT QLineEdit : public QWidget Q_PROPERTY(bool undoAvailable READ isUndoAvailable) Q_PROPERTY(bool redoAvailable READ isRedoAvailable) Q_PROPERTY(bool acceptableInput READ hasAcceptableInput) +// ### Qt 4.7: remove this #if guard +#if (QT_VERSION >= 0x407000) || defined(Q_WS_MAEMO_5) + Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText) +#endif public: explicit QLineEdit(QWidget* parent=0); @@ -98,6 +102,12 @@ public: QString displayText() const; +// ### Qt 4.7: remove this #if guard +#if (QT_VERSION >= 0x407000) || defined(Q_WS_MAEMO_5) + QString placeholderText() const; + void setPlaceholderText(const QString &); +#endif + int maxLength() const; void setMaxLength(int); diff --git a/src/gui/widgets/qlineedit_p.h b/src/gui/widgets/qlineedit_p.h index 244d2be..dc648e8 100644 --- a/src/gui/widgets/qlineedit_p.h +++ b/src/gui/widgets/qlineedit_p.h @@ -142,6 +142,8 @@ public: int topTextMargin; int rightTextMargin; int bottomTextMargin; + + QString placeholderText; }; #endif // QT_NO_LINEEDIT -- cgit v0.12 From 68f4b46426e715540864046128617250a521d38a Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Wed, 2 Dec 2009 16:52:51 +0100 Subject: Fix for virtual keyboard poping up when it should not. Pressing and releasing the finger/stylus on an editable text widget should only trigger the input method if the release position is still within the widget's boundaries. Reviewed-by: axis --- src/gui/graphicsview/qgraphicsitem.cpp | 2 +- src/gui/widgets/qlineedit.cpp | 2 +- src/gui/widgets/qplaintextedit.cpp | 2 +- src/gui/widgets/qtextedit.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index bb45e7e..bc47872 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -9713,7 +9713,7 @@ void QGraphicsTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) } QWidget *widget = event->widget(); - if (widget) { + if (widget && (dd->control->textInteractionFlags() & Qt::TextEditable) && boundingRect().contains(event->pos())) { qt_widget_private(widget)->handleSoftwareInputPanel(event->button(), dd->clickCausedFocus); } dd->clickCausedFocus = 0; diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 650b0ab..2c1acdb 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1549,7 +1549,7 @@ void QLineEdit::mouseReleaseEvent(QMouseEvent* e) } #endif - if (!isReadOnly()) + if (!isReadOnly() && rect().contains(e->pos())) d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus); d->clickCausedFocus = 0; } diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index eae8b7d..89fe7b8 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -1969,7 +1969,7 @@ void QPlainTextEdit::mouseReleaseEvent(QMouseEvent *e) d->ensureCursorVisible(); } - if (!isReadOnly()) + if (!isReadOnly() && rect().contains(e->pos())) d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus); d->clickCausedFocus = 0; } diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index 1c49ef0..1bc0bf1 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -1578,7 +1578,7 @@ void QTextEdit::mouseReleaseEvent(QMouseEvent *e) d->autoScrollTimer.stop(); ensureCursorVisible(); } - if (!isReadOnly()) + if (!isReadOnly() && rect().contains(e->pos())) d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus); d->clickCausedFocus = 0; } -- cgit v0.12 From 696099f8e3179787114df40d6ce6fef97bfa33dc Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 4 Dec 2009 15:54:47 +1000 Subject: Fixed compile for S60. QObjectPrivate::isSignalConnected was inlined, update QtCoreu.def --- src/s60installs/eabi/QtCoreu.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def index 6a4cdbd..89fa76f 100644 --- a/src/s60installs/eabi/QtCoreu.def +++ b/src/s60installs/eabi/QtCoreu.def @@ -2556,7 +2556,7 @@ EXPORTS _ZNK14QObjectPrivate10senderListEv @ 2555 NONAME _ZNK14QObjectPrivate11signalIndexEPKc @ 2556 NONAME _ZNK14QObjectPrivate12receiverListEPKc @ 2557 NONAME - _ZNK14QObjectPrivate17isSignalConnectedEi @ 2558 NONAME + _ZNK14QObjectPrivate17isSignalConnectedEi @ 2558 NONAME ABSENT _ZNK14QObjectPrivate8isSenderEPK7QObjectPKc @ 2559 NONAME _ZNK14QStringMatcher7indexInEPK5QCharii @ 2560 NONAME _ZNK14QStringMatcher7indexInERK7QStringi @ 2561 NONAME -- cgit v0.12