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 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 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 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 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