summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2012-10-26 12:28:31 +0200
committerTor Arne Vestbø <tor.arne.vestbo@digia.com>2012-10-26 12:28:53 +0200
commit6e5818f2bbc8443b9308252a5e1543e014ef439d (patch)
tree07922adee2f13e818b9439c8a0bdf871dda59039 /src/corelib
parent32aac0a1c009ee940920fd12f277180dd80b8eff (diff)
parentdeac55becd18efa4504eb686a1bb8081a5cd488a (diff)
Merge remote-tracking branch 'gerrit/master' into newdocs
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/Qt5CoreMacros.cmake16
-rw-r--r--src/corelib/corelib.pro2
-rw-r--r--src/corelib/doc/snippets/eventfilters/filterobject.cpp74
-rw-r--r--src/corelib/doc/snippets/eventfilters/filterobject.h59
-rw-r--r--src/corelib/doc/snippets/eventfilters/main.cpp54
-rw-r--r--src/corelib/doc/snippets/events/events.cpp97
-rw-r--r--src/corelib/doc/src/datastreamformat.qdoc58
-rw-r--r--src/corelib/doc/src/eventsandfilters.qdoc220
-rw-r--r--src/corelib/global/qconfig-minimal.h13
-rw-r--r--src/corelib/global/qconfig-small.h17
-rw-r--r--src/corelib/global/qfeatures.h10
-rw-r--r--src/corelib/global/qfeatures.txt13
-rw-r--r--src/corelib/io/qfilesystemengine.cpp49
-rw-r--r--src/corelib/io/qfilesystemiterator_p.h4
-rw-r--r--src/corelib/io/qfilesystemiterator_unix.cpp18
-rw-r--r--src/corelib/io/qprocess.cpp6
-rw-r--r--src/corelib/io/qprocess_win.cpp4
-rw-r--r--src/corelib/io/qurl.cpp7
-rw-r--r--src/corelib/io/qwinoverlappedionotifier_p.h2
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.cpp128
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.h4
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel_p.h6
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp4
-rw-r--r--src/corelib/kernel/qcoreapplication.h12
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix.cpp2
-rw-r--r--src/corelib/kernel/qeventloop_p.h2
-rw-r--r--src/corelib/kernel/qobject.cpp2
-rw-r--r--src/corelib/kernel/qobject.h6
-rw-r--r--src/corelib/kernel/qsocketnotifier.cpp2
-rw-r--r--src/corelib/kernel/qsocketnotifier.h6
-rw-r--r--src/corelib/kernel/qtimer.cpp2
-rw-r--r--src/corelib/kernel/qtimer.h6
-rw-r--r--src/corelib/kernel/qwineventnotifier.cpp2
-rw-r--r--src/corelib/kernel/qwineventnotifier.h6
-rw-r--r--src/corelib/statemachine/qstate.cpp6
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp56
-rw-r--r--src/corelib/statemachine/qstatemachine.h2
-rw-r--r--src/corelib/thread/qbasicatomic.h2
-rw-r--r--src/corelib/thread/qthread.cpp27
-rw-r--r--src/corelib/thread/qthread.h3
-rw-r--r--src/corelib/thread/qthread_p.h1
-rw-r--r--src/corelib/thread/qthread_unix.cpp7
-rw-r--r--src/corelib/thread/qthread_win.cpp10
-rw-r--r--src/corelib/tools/qdatetime.cpp18
-rw-r--r--src/corelib/tools/qlocale.cpp2
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h2
-rw-r--r--src/corelib/tools/qvector.h10
47 files changed, 837 insertions, 222 deletions
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake
index 089445a184..614b79ab88 100644
--- a/src/corelib/Qt5CoreMacros.cmake
+++ b/src/corelib/Qt5CoreMacros.cmake
@@ -217,29 +217,29 @@ endfunction()
if (NOT CMAKE_VERSION VERSION_LESS 2.8.9)
- function(qt5_use_modules _target _link_type)
+ macro(qt5_use_modules _target _link_type)
if (NOT TARGET ${_target})
message(FATAL_ERROR "The first argument to qt5_use_modules must be an existing target.")
endif()
if ("${_link_type}" STREQUAL "LINK_PUBLIC" OR "${_link_type}" STREQUAL "LINK_PRIVATE" )
- set(modules ${ARGN})
- set(link_type ${_link_type})
+ set(_qt5_modules ${ARGN})
+ set(_qt5_link_type ${_link_type})
else()
- set(modules ${_link_type} ${ARGN})
+ set(_qt5_modules ${_link_type} ${ARGN})
endif()
- if ("${modules}" STREQUAL "")
+ if ("${_qt5_modules}" STREQUAL "")
message(FATAL_ERROR "qt5_use_modules requires at least one Qt module to use.")
endif()
- foreach(_module ${modules})
+ foreach(_module ${_qt5_modules})
if (NOT Qt5${_module}_FOUND)
find_package(Qt5${_module} PATHS ${_qt5_corelib_install_prefix} NO_DEFAULT_PATH)
if (NOT Qt5${_module}_FOUND)
message(FATAL_ERROR "Can not use \"${_module}\" module which has not yet been found.")
endif()
endif()
- target_link_libraries(${_target} ${link_type} ${Qt5${_module}_LIBRARIES})
+ target_link_libraries(${_target} ${_qt5_link_type} ${Qt5${_module}_LIBRARIES})
set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${Qt5${_module}_INCLUDE_DIRS})
set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS ${Qt5${_module}_COMPILE_DEFINITIONS})
set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG)
@@ -248,5 +248,5 @@ if (NOT CMAKE_VERSION VERSION_LESS 2.8.9)
set_property(TARGET ${_target} PROPERTY POSITION_INDEPENDENT_CODE ${Qt5_POSITION_INDEPENDENT_CODE})
endif()
endforeach()
- endfunction()
+ endmacro()
endif()
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index b83b2bac1e..ba9488cbff 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -1,5 +1,3 @@
-load(qt_build_config)
-
TARGET = QtCore
QT =
CONFIG += exceptions
diff --git a/src/corelib/doc/snippets/eventfilters/filterobject.cpp b/src/corelib/doc/snippets/eventfilters/filterobject.cpp
new file mode 100644
index 0000000000..81591f4f3d
--- /dev/null
+++ b/src/corelib/doc/snippets/eventfilters/filterobject.cpp
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "filterobject.h"
+
+FilterObject::FilterObject(QObject *parent)
+ : QObject(parent), target(0)
+{
+}
+
+//! [0]
+bool FilterObject::eventFilter(QObject *object, QEvent *event)
+{
+ if (object == target && event->type() == QEvent::KeyPress) {
+ QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
+ if (keyEvent->key() == Qt::Key_Tab) {
+ // Special tab handling
+ return true;
+ } else
+ return false;
+ }
+ return false;
+}
+//! [0]
+
+void FilterObject::setFilteredObject(QObject *object)
+{
+ if (target)
+ target->removeEventFilter(this);
+
+ target = object;
+
+ if (target)
+ target->installEventFilter(this);
+}
diff --git a/src/corelib/doc/snippets/eventfilters/filterobject.h b/src/corelib/doc/snippets/eventfilters/filterobject.h
new file mode 100644
index 0000000000..8c9d2e72cd
--- /dev/null
+++ b/src/corelib/doc/snippets/eventfilters/filterobject.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef FILTEROBJECT_H
+#define FILTEROBJECT_H
+
+#include <QObject>
+
+class FilterObject : public QObject
+{
+ Q_OBJECT
+
+public:
+ FilterObject(QObject *parent = 0);
+ bool eventFilter(QObject *object, QEvent *event);
+ void setFilteredObject(QObject *object);
+
+private:
+ QObject *target;
+};
+
+#endif
diff --git a/src/corelib/doc/snippets/eventfilters/main.cpp b/src/corelib/doc/snippets/eventfilters/main.cpp
new file mode 100644
index 0000000000..7f6bde4987
--- /dev/null
+++ b/src/corelib/doc/snippets/eventfilters/main.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QTextEdit>
+
+#include "filterobject.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ QTextEdit editor;
+ FilterObject filter;
+ filter.setFilteredObject(&editor);
+ editor.show();
+ return app.exec();
+}
diff --git a/src/corelib/doc/snippets/events/events.cpp b/src/corelib/doc/snippets/events/events.cpp
new file mode 100644
index 0000000000..a3a95d6935
--- /dev/null
+++ b/src/corelib/doc/snippets/events/events.cpp
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QCheckBox>
+#include <QMouseEvent>
+
+class MyCheckBox : public QCheckBox
+{
+public:
+ void mousePressEvent(QMouseEvent *event);
+};
+
+//! [0]
+void MyCheckBox::mousePressEvent(QMouseEvent *event)
+{
+ if (event->button() == Qt::LeftButton) {
+ // handle left mouse button here
+ } else {
+ // pass on other buttons to base class
+ QCheckBox::mousePressEvent(event);
+ }
+}
+//! [0]
+
+class MyWidget : public QWidget
+{
+public:
+ bool event(QEvent *event);
+};
+
+static const int MyCustomEventType = 1099;
+
+class MyCustomEvent : public QEvent
+{
+public:
+ MyCustomEvent() : QEvent((QEvent::Type)MyCustomEventType) {}
+};
+
+//! [1]
+bool MyWidget::event(QEvent *event)
+{
+ if (event->type() == QEvent::KeyPress) {
+ QKeyEvent *ke = static_cast<QKeyEvent *>(event);
+ if (ke->key() == Qt::Key_Tab) {
+ // special tab handling here
+ return true;
+ }
+ } else if (event->type() == MyCustomEventType) {
+ MyCustomEvent *myEvent = static_cast<MyCustomEvent *>(event);
+ // custom event handling here
+ return true;
+ }
+
+ return QWidget::event(event);
+}
+//! [1]
+
+int main()
+{
+}
diff --git a/src/corelib/doc/src/datastreamformat.qdoc b/src/corelib/doc/src/datastreamformat.qdoc
index e9f0139a8b..8c3b592276 100644
--- a/src/corelib/doc/src/datastreamformat.qdoc
+++ b/src/corelib/doc/src/datastreamformat.qdoc
@@ -213,22 +213,22 @@
\endlist
\row \li QMatrix4x4
\li \list
- \li m11 (double)
- \li m12 (double)
- \li m13 (double)
- \li m14 (double)
- \li m21 (double)
- \li m22 (double)
- \li m23 (double)
- \li m24 (double)
- \li m31 (double)
- \li m32 (double)
- \li m33 (double)
- \li m34 (double)
- \li m41 (double)
- \li m42 (double)
- \li m43 (double)
- \li m44 (double)
+ \li m11 (float)
+ \li m12 (float)
+ \li m13 (float)
+ \li m14 (float)
+ \li m21 (float)
+ \li m22 (float)
+ \li m23 (float)
+ \li m24 (float)
+ \li m31 (float)
+ \li m32 (float)
+ \li m33 (float)
+ \li m34 (float)
+ \li m41 (float)
+ \li m42 (float)
+ \li m43 (float)
+ \li m44 (float)
\endlist
\row \li QPair<T1, T2>
\li \list
@@ -278,10 +278,10 @@
\endlist
\row \li QQuaternion
\li \list
- \li The scalar component (double)
- \li The x coordinate (double)
- \li The y coordinate (double)
- \li The z coordinate (double)
+ \li The scalar component (float)
+ \li The x coordinate (float)
+ \li The y coordinate (float)
+ \li The z coordinate (float)
\endlist
\row \li QRect
\li \list
@@ -347,21 +347,21 @@
\endlist
\row \li QVector2D
\li \list
- \li the x coordinate (double)
- \li the y coordinate (double)
+ \li the x coordinate (float)
+ \li the y coordinate (float)
\endlist
\row \li QVector3D
\li \list
- \li the x coordinate (double)
- \li the y coordinate (double)
- \li the z coordinate (double)
+ \li the x coordinate (float)
+ \li the y coordinate (float)
+ \li the z coordinate (float)
\endlist
\row \li QVector4D
\li \list
- \li the x coordinate (double)
- \li the y coordinate (double)
- \li the z coordinate (double)
- \li the w coordinate (double)
+ \li the x coordinate (float)
+ \li the y coordinate (float)
+ \li the z coordinate (float)
+ \li the w coordinate (float)
\endlist
\row \li QVector<T>
\li \list
diff --git a/src/corelib/doc/src/eventsandfilters.qdoc b/src/corelib/doc/src/eventsandfilters.qdoc
new file mode 100644
index 0000000000..5fe444538d
--- /dev/null
+++ b/src/corelib/doc/src/eventsandfilters.qdoc
@@ -0,0 +1,220 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \group events
+ \title Event Classes
+ \ingroup groups
+
+ \brief Classes used to create and handle events.
+
+ These classes are used to create and handle events.
+
+ For more information see the \link object.html Object model\endlink
+ and \link signalsandslots.html Signals and Slots\endlink.
+*/
+
+/*!
+ \page eventsandfilters.html
+ \title The Event System
+ \ingroup qt-basic-concepts
+ \brief A guide to event handling in Qt.
+
+ \ingroup frameworks-technologies
+
+ In Qt, events are objects, derived from the abstract QEvent class,
+ that represent things that have happened either within an application
+ or as a result of outside activity that the application needs to know
+ about. Events can be received and handled by any instance of a
+ QObject subclass, but they are especially relevant to widgets. This
+ document describes how events are delivered and handled in a typical
+ application.
+
+ \section1 How Events are Delivered
+
+ When an event occurs, Qt creates an event object to represent it by
+ constructing an instance of the appropriate QEvent subclass, and
+ delivers it to a particular instance of QObject (or one of its
+ subclasses) by calling its \l{QObject::}{event()} function.
+
+ This function does not handle the event itself; based on the type
+ of event delivered, it calls an event handler for that specific
+ type of event, and sends a response based on whether the event
+ was accepted or ignored.
+
+ \omit
+ Event delivery means that an
+ event has occurred, the QEvent indicates precisely what, and the
+ QObject needs to respond. Most events are specific to QWidget and its
+ subclasses, but there are important events that aren't related to
+ graphics (e.g., \l{QTimer}{timer events}).
+ \endomit
+
+ Some events, such as QMouseEvent and QKeyEvent, come from the
+ window system; some, such as QTimerEvent, come from other sources;
+ some come from the application itself.
+
+ \section1 Event Types
+
+ Most events types have special classes, notably QResizeEvent,
+ QPaintEvent, QMouseEvent, QKeyEvent, and QCloseEvent. Each class
+ subclasses QEvent and adds event-specific functions. For example,
+ QResizeEvent adds \l{QResizeEvent::}{size()} and
+ \l{QResizeEvent::}{oldSize()} to enable widgets to discover how
+ their dimensions have been changed.
+
+ Some classes support more than one actual event type. QMouseEvent
+ supports mouse button presses, double-clicks, moves, and other
+ related operations.
+
+ Each event has an associated type, defined in QEvent::Type, and this
+ can be used as a convenient source of run-time type information to
+ quickly determine which subclass a given event object was constructed
+ from.
+
+ Since programs need to react in varied and complex ways, Qt's
+ event delivery mechanisms are flexible. The documentation for
+ QCoreApplication::notify() concisely tells the whole story; the
+ \e{Qt Quarterly} article
+ \l{http://doc.qt.nokia.com/qq/qq11-events.html}{Another Look at Events}
+ rehashes it less concisely. Here we will explain enough for 95%
+ of applications.
+
+ \section1 Event Handlers
+
+ The normal way for an event to be delivered is by calling a virtual
+ function. For example, QPaintEvent is delivered by calling
+ QWidget::paintEvent(). This virtual function is responsible for
+ reacting appropriately, normally by repainting the widget. If you
+ do not perform all the necessary work in your implementation of the
+ virtual function, you may need to call the base class's implementation.
+
+ For example, the following code handles left mouse button clicks on
+ a custom checkbox widget while passing all other button clicks to the
+ base QCheckBox class:
+
+ \snippet events/events.cpp 0
+
+ If you want to replace the base class's function, you must
+ implement everything yourself. However, if you only want to extend
+ the base class's functionality, then you implement what you want and
+ call the base class to obtain the default behavior for any cases you
+ do not want to handle.
+
+ Occasionally, there isn't such an event-specific function, or the
+ event-specific function isn't sufficient. The most common example
+ involves Tab key presses. Normally, QWidget intercepts these to
+ move the keyboard focus, but a few widgets need the Tab key for
+ themselves.
+
+ These objects can reimplement QObject::event(), the general event
+ handler, and either do their event handling before or after the usual
+ handling, or they can replace the function completely. A very unusual
+ widget that both interprets Tab and has an application-specific
+ custom event might contain the following \l{QObject::event()}{event()}
+ function:
+
+ \snippet events/events.cpp 1
+
+ Note that QWidget::event() is still called for all of the cases not
+ handled, and that the return value indicates whether an event was
+ dealt with; a \c true value prevents the event from being sent on
+ to other objects.
+
+ \section1 Event Filters
+
+ Sometimes an object needs to look at, and possibly intercept, the
+ events that are delivered to another object. For example, dialogs
+ commonly want to filter key presses for some widgets; for example,
+ to modify Return-key handling.
+
+ The QObject::installEventFilter() function enables this by setting
+ up an \e{event filter}, causing a nominated filter object to receive
+ the events for a target object in its QObject::eventFilter()
+ function. An event filter gets to process events before the target
+ object does, allowing it to inspect and discard the events as
+ required. An existing event filter can be removed using the
+ QObject::removeEventFilter() function.
+
+ When the filter object's \l{QObject::}{eventFilter()} implementation
+ is called, it can accept or reject the event, and allow or deny
+ further processing of the event. If all the event filters allow
+ further processing of an event (by each returning \c false), the event
+ is sent to the target object itself. If one of them stops processing
+ (by returning \c true), the target and any later event filters do not
+ get to see the event at all.
+
+ \snippet eventfilters/filterobject.cpp 0
+
+ The above code shows another way to intercept Tab key press
+ events sent to a particular target widget. In this case, the filter
+ handles the relevant events and returns \c true to stop them from
+ being processed any further. All other events are ignored, and the
+ filter returns \c false to allow them to be sent on to the target
+ widget, via any other event filters that are installed on it.
+
+ It is also possible to filter \e all events for the entire application,
+ by installing an event filter on the QApplication or QCoreApplication
+ object. Such global event filters are called before the object-specific
+ filters. This is very powerful, but it also slows down event delivery
+ of every single event in the entire application; the other techniques
+ discussed should generally be used instead.
+
+ \section1 Sending Events
+
+ Many applications want to create and send their own events. You can
+ send events in exactly the same ways as Qt's own event loop by
+ constructing suitable event objects and sending them with
+ QCoreApplication::sendEvent() and QCoreApplication::postEvent().
+
+ \l{QCoreApplication::}{sendEvent()} processes the event immediately.
+ When it returns, the event filters and/or the object itself have
+ already processed the event. For many event classes there is a function
+ called isAccepted() that tells you whether the event was accepted
+ or rejected by the last handler that was called.
+
+ \l{QCoreApplication::}{postEvent()} posts the event on a queue for
+ later dispatch. The next time Qt's main event loop runs, it dispatches
+ all posted events, with some optimization. For example, if there are
+ several resize events, they are compressed into one. The same
+ applies to paint events: QWidget::update() calls
+ \l{QCoreApplication::}{postEvent()}, which eliminates flickering and
+ increases speed by avoiding multiple repaints.
+
+ \l{QCoreApplication::}{postEvent()} is also used during object
+ initialization, since the posted event will typically be dispatched
+ very soon after the initialization of the object is complete.
+ When implementing a widget, it is important to realise that events
+ can be delivered very early in its lifetime so, in its constructor,
+ be sure to initialize member variables early on, before there's any
+ chance that it might receive an event.
+
+ To create events of a custom type, you need to define an event
+ number, which must be greater than QEvent::User, and you may need to
+ subclass QEvent in order to pass specific information about your
+ custom event. See the QEvent documentation for further details.
+*/
diff --git a/src/corelib/global/qconfig-minimal.h b/src/corelib/global/qconfig-minimal.h
index 9c95d124ab..28cb8fbede 100644
--- a/src/corelib/global/qconfig-minimal.h
+++ b/src/corelib/global/qconfig-minimal.h
@@ -376,17 +376,8 @@
#endif
/* Styles */
-#ifndef QT_NO_STYLE_MOTIF
-# define QT_NO_STYLE_MOTIF
-#endif
-#ifndef QT_NO_STYLE_CDE
-# define QT_NO_STYLE_CDE
-#endif
-#ifndef QT_NO_STYLE_CLEANLOOKS
-# define QT_NO_STYLE_CLEANLOOKS
-#endif
-#ifndef QT_NO_STYLE_PLASTIQUE
-# define QT_NO_STYLE_PLASTIQUE
+#ifndef QT_NO_STYLE_FUSION
+# define QT_NO_STYLE_FUSION
#endif
#ifndef QT_NO_STYLE_STYLESHEET
# define QT_NO_STYLE_STYLESHEET
diff --git a/src/corelib/global/qconfig-small.h b/src/corelib/global/qconfig-small.h
index b3a056b815..9d72cd5d4c 100644
--- a/src/corelib/global/qconfig-small.h
+++ b/src/corelib/global/qconfig-small.h
@@ -209,23 +209,14 @@
#endif
/* Styles */
-#ifndef QT_NO_STYLE_MOTIF
-# define QT_NO_STYLE_MOTIF
-#endif
-#ifndef QT_NO_STYLE_CDE
-# define QT_NO_STYLE_CDE
-#endif
-#ifndef QT_NO_STYLE_CLEANLOOKS
-# define QT_NO_STYLE_CLEANLOOKS
-#endif
-#ifndef QT_NO_STYLE_PLASTIQUE
-# define QT_NO_STYLE_PLASTIQUE
+#ifndef QT_NO_STYLE_FUSION
+# define QT_NO_STYLE_FUSION
#endif
#ifndef QT_NO_STYLE_STYLESHEET
# define QT_NO_STYLE_STYLESHEET
#endif
-#ifndef QT_NO_STYLE_WINDOWSXP
-# define QT_NO_STYLE_WINDOWSXP
+#ifndef QT_NO_STYLE_WINDOWSVISTA
+# define QT_NO_STYLE_WINDOWSVISTA
#endif
/* Utilities */
diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h
index 90ef47cf5b..b4b73a9aaa 100644
--- a/src/corelib/global/qfeatures.h
+++ b/src/corelib/global/qfeatures.h
@@ -396,16 +396,6 @@
#define QT_NO_SCROLLAREA
#endif
-// QCleanLooksStyle
-#if !defined(QT_NO_STYLE_CLEANLOOKS) && (defined(QT_NO_STYLE_WINDOWS) || defined(QT_NO_IMAGEFORMAT_XPM))
-#define QT_NO_STYLE_CLEANLOOKS
-#endif
-
-// QPlastiqueStyle
-#if !defined(QT_NO_STYLE_PLASTIQUE) && (defined(QT_NO_STYLE_WINDOWS) || defined(QT_NO_IMAGEFORMAT_XPM))
-#define QT_NO_STYLE_PLASTIQUE
-#endif
-
// QWindowsCEStyle
#if !defined(QT_NO_STYLE_WINDOWSCE) && (defined(QT_NO_STYLE_WINDOWS) || defined(QT_NO_IMAGEFORMAT_XPM))
#define QT_NO_STYLE_WINDOWSCE
diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt
index 3b3af8a3fc..7f31259c16 100644
--- a/src/corelib/global/qfeatures.txt
+++ b/src/corelib/global/qfeatures.txt
@@ -727,11 +727,11 @@ Requires:
Name: QWindowsStyle
SeeAlso: ???
-Feature: STYLE_PLASTIQUE
-Description: Supports a widget style similar to the Plastik style available in KDE.
+Feature: STYLE_FUSION
+Description: Supports a modern platform independent widget style.
Section: Styles
Requires: STYLE_WINDOWS IMAGEFORMAT_XPM
-Name: QPlastiqueStyle
+Name: QFusionStyle
SeeAlso: ???
Feature: STYLE_WINDOWSXP
@@ -748,13 +748,6 @@ Requires: STYLE_WINDOWSXP
Name: QWindowsVistaStyle
SeeAlso: ???
-Feature: STYLE_CLEANLOOKS
-Description: Supports a Gnome CleanLooks-like look and feel.
-Section: Styles
-Requires: STYLE_WINDOWS IMAGEFORMAT_XPM
-Name: QCleanLooksStyle
-SeeAlso: ???
-
Feature: STYLE_WINDOWSCE
Description: WindowsCE look and feel
Section: Styles
diff --git a/src/corelib/io/qfilesystemengine.cpp b/src/corelib/io/qfilesystemengine.cpp
index 74ceeb11c1..fe06210fb9 100644
--- a/src/corelib/io/qfilesystemengine.cpp
+++ b/src/corelib/io/qfilesystemengine.cpp
@@ -224,6 +224,19 @@ bool QFileSystemEngine::fillMetaData(int fd, QFileSystemMetaData &data)
return false;
}
+#if defined(Q_OS_QNX)
+static void fillStat64fromStat32(struct stat64 *statBuf64, const struct stat &statBuf32)
+{
+ statBuf64->st_mode = statBuf32.st_mode;
+ statBuf64->st_size = statBuf32.st_size;
+ statBuf64->st_ctime = statBuf32.st_ctime;
+ statBuf64->st_mtime = statBuf32.st_mtime;
+ statBuf64->st_atime = statBuf32.st_atime;
+ statBuf64->st_uid = statBuf32.st_uid;
+ statBuf64->st_gid = statBuf32.st_gid;
+}
+#endif
+
void QFileSystemMetaData::fillFromStatBuf(const QT_STATBUF &statBuffer)
{
// Permissions
@@ -277,7 +290,41 @@ void QFileSystemMetaData::fillFromStatBuf(const QT_STATBUF &statBuffer)
void QFileSystemMetaData::fillFromDirEnt(const QT_DIRENT &entry)
{
-#if defined(_DIRENT_HAVE_D_TYPE) || defined(Q_OS_BSD4)
+#if defined(Q_OS_QNX)
+ knownFlagsMask = 0;
+ entryFlags = 0;
+ for (dirent_extra *extra = _DEXTRA_FIRST(&entry); _DEXTRA_VALID(extra, &entry);
+ extra = _DEXTRA_NEXT(extra)) {
+ if (extra->d_type == _DTYPE_STAT || extra->d_type == _DTYPE_LSTAT) {
+
+ const struct dirent_extra_stat * const extra_stat =
+ reinterpret_cast<struct dirent_extra_stat *>(extra);
+
+ // For symlinks, the extra type _DTYPE_LSTAT doesn't work for filling out the meta data,
+ // as we need the stat() information there, not the lstat() information.
+ // In this case, don't use the extra information.
+ // Unfortunately, readdir() never seems to return extra info of type _DTYPE_STAT, so for
+ // symlinks, we always incur the cost of an extra stat() call later.
+ if (S_ISLNK(extra_stat->d_stat.st_mode) && extra->d_type == _DTYPE_LSTAT)
+ continue;
+
+#if defined(__EXT_LF64SRC)
+ // Even with large file support, d_stat is always of type struct stat, not struct stat64,
+ // so it needs to be converted
+ struct stat64 statBuf;
+ fillStat64fromStat32(&statBuf, extra_stat->d_stat);
+ fillFromStatBuf(statBuf);
+#else
+ fillFromStatBuf(extra_stat->d_stat);
+#endif
+ knownFlagsMask |= QFileSystemMetaData::PosixStatFlags;
+ if (!S_ISLNK(extra_stat->d_stat.st_mode)) {
+ knownFlagsMask |= QFileSystemMetaData::ExistsAttribute;
+ entryFlags |= QFileSystemMetaData::ExistsAttribute;
+ }
+ }
+ }
+#elif defined(_DIRENT_HAVE_D_TYPE) || defined(Q_OS_BSD4)
// BSD4 includes Mac OS X
// ### This will clear all entry flags and knownFlagsMask
diff --git a/src/corelib/io/qfilesystemiterator_p.h b/src/corelib/io/qfilesystemiterator_p.h
index 87395ec2cf..a68615ca05 100644
--- a/src/corelib/io/qfilesystemiterator_p.h
+++ b/src/corelib/io/qfilesystemiterator_p.h
@@ -98,6 +98,10 @@ private:
#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN)
// for readdir_r
QScopedPointer<QT_DIRENT, QScopedPointerPodDeleter> mt_file;
+#if defined(Q_OS_QNX) && defined(__EXT_QNX__READDIR_R)
+ // for _readdir_r
+ size_t direntSize;
+#endif
#endif
int lastError;
#endif
diff --git a/src/corelib/io/qfilesystemiterator_unix.cpp b/src/corelib/io/qfilesystemiterator_unix.cpp
index 9ab186d119..28f5e36bb8 100644
--- a/src/corelib/io/qfilesystemiterator_unix.cpp
+++ b/src/corelib/io/qfilesystemiterator_unix.cpp
@@ -54,6 +54,9 @@ QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Fi
: nativePath(entry.nativeFilePath())
, dir(0)
, dirEntry(0)
+#if defined(Q_OS_QNX) && defined(__EXT_QNX__READDIR_R)
+ , direntSize(0)
+#endif
, lastError(0)
{
Q_UNUSED(filters)
@@ -78,6 +81,15 @@ QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Fi
Q_CHECK_PTR(p);
mt_file.reset(p);
+#if defined(Q_OS_QNX) && defined(__EXT_QNX__READDIR_R)
+ direntSize = maxPathName;
+
+ // Include extra stat information in the readdir() call (d_stat member of dirent_extra_stat).
+ // This is used in QFileSystemMetaData::fillFromDirEnt() to avoid extra stat() calls when iterating
+ // over directories
+ if (dircntl(dir, D_SETFLAG, D_FLAG_STAT) == -1)
+ lastError = errno;
+#endif
#endif
}
}
@@ -93,7 +105,11 @@ bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaDa
if (!dir)
return false;
-#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN)
+#if defined(Q_OS_QNX) && defined(__EXT_QNX__READDIR_R)
+ lastError = _readdir_r(dir, mt_file.data(), &dirEntry, direntSize);
+ if (lastError)
+ return false;
+#elif defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_CYGWIN)
lastError = QT_READDIR_R(dir, mt_file.data(), &dirEntry);
if (lastError)
return false;
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index b115310d63..395effaff9 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -41,8 +41,9 @@
//#define QPROCESS_DEBUG
-#if defined QPROCESS_DEBUG
#include <qdebug.h>
+#include <qdir.h>
+#if defined QPROCESS_DEBUG
#include <qstring.h>
#include <ctype.h>
#if !defined(Q_OS_WINCE)
@@ -1147,7 +1148,8 @@ QProcess::~QProcess()
{
Q_D(QProcess);
if (d->processState != NotRunning) {
- qWarning("QProcess: Destroyed while process is still running.");
+ qWarning().nospace()
+ << "QProcess: Destroyed while process (" << QDir::toNativeSeparators(program()) << ") is still running.";
kill();
waitForFinished();
}
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index dd5cf4819e..d19ab695ea 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -520,8 +520,8 @@ void QProcessPrivate::startProcess()
q->setProcessState(QProcess::Running);
// User can call kill()/terminate() from the stateChanged() slot
- // so check before proceeding
- if (!pid)
+ // so check before proceeding
+ if (!pid)
return;
if (threadData->eventDispatcher) {
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index be87e1f34f..a7a722bc46 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -78,9 +78,10 @@
Call isValid() to check if the URL is valid. This can be done at
any point during the constructing of a URL.
- Constructing a query is particularly convenient through the use
- of setQueryItems(), addQueryItem() and removeQueryItem(). Use
- setQueryDelimiters() to customize the delimiters used for
+ Constructing a query is particularly convenient through the use of the \l
+ QUrlQuery class and its methods QUrlQuery::setQueryItems(),
+ QUrlQuery::addQueryItem() and QUrlQuery::removeQueryItem(). Use
+ QUrlQuery::setQueryDelimiters() to customize the delimiters used for
generating the query string.
For the convenience of generating encoded URL strings or query
diff --git a/src/corelib/io/qwinoverlappedionotifier_p.h b/src/corelib/io/qwinoverlappedionotifier_p.h
index 326df584d7..331d915ccc 100644
--- a/src/corelib/io/qwinoverlappedionotifier_p.h
+++ b/src/corelib/io/qwinoverlappedionotifier_p.h
@@ -61,8 +61,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
-
class Q_CORE_EXPORT QWinOverlappedIoNotifier : public QObject
{
Q_OBJECT
diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp
index 4b9391d285..d1cbd7f461 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.cpp
+++ b/src/corelib/itemmodels/qitemselectionmodel.cpp
@@ -284,12 +284,21 @@ QItemSelectionRange QItemSelectionRange::intersected(const QItemSelectionRange &
*/
-/*
- \internal
-
- utility function for getting the indexes from a range
- it avoid concatenating list and works on one
- */
+static void rowLengthsFromRange(const QItemSelectionRange &range, QVector<QPair<QPersistentModelIndex, uint> > &result)
+{
+ if (range.isValid() && range.model()) {
+ const QModelIndex topLeft = range.topLeft();
+ const int bottom = range.bottom();
+ const uint width = range.width();
+ const int column = topLeft.column();
+ for (int row = topLeft.row(); row <= bottom; ++row) {
+ // We don't need to keep track of ItemIsSelectable and ItemIsEnabled here. That is
+ // required in indexesFromRange() because that method is called from public API
+ // which requires the limitation.
+ result.push_back(qMakePair(QPersistentModelIndex(topLeft.sibling(row, column)), width));
+ }
+ }
+}
template<typename ModelIndexContainer>
static void indexesFromRange(const QItemSelectionRange &range, ModelIndexContainer &result)
@@ -468,6 +477,14 @@ static QVector<QPersistentModelIndex> qSelectionPersistentindexes(const QItemSel
return result;
}
+static QVector<QPair<QPersistentModelIndex, uint> > qSelectionPersistentRowLengths(const QItemSelection &sel)
+{
+ QVector<QPair<QPersistentModelIndex, uint> > result;
+ Q_FOREACH (const QItemSelectionRange &range, sel)
+ rowLengthsFromRange(range, result);
+ return result;
+}
+
/*!
Merges the \a other selection with this QItemSelection using the
\a command given. This method guarantees that no ranges are overlapping.
@@ -599,10 +616,10 @@ void QItemSelectionModelPrivate::initModel(QAbstractItemModel *model)
q, SLOT(_q_layoutChanged()));
QObject::connect(model, SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)),
q, SLOT(_q_layoutChanged()));
- QObject::connect(model, SIGNAL(layoutAboutToBeChanged()),
- q, SLOT(_q_layoutAboutToBeChanged()));
- QObject::connect(model, SIGNAL(layoutChanged()),
- q, SLOT(_q_layoutChanged()));
+ QObject::connect(model, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)),
+ q, SLOT(_q_layoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)));
+ QObject::connect(model, SIGNAL(layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)),
+ q, SLOT(_q_layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)));
}
}
@@ -812,10 +829,12 @@ void QItemSelectionModelPrivate::_q_rowsAboutToBeInserted(const QModelIndex &par
preparation for the layoutChanged() signal, where the indexes can be
merged again.
*/
-void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged()
+void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged(const QList<QPersistentModelIndex> &, QAbstractItemModel::LayoutChangeHint hint)
{
savedPersistentIndexes.clear();
savedPersistentCurrentIndexes.clear();
+ savedPersistentRowLengths.clear();
+ savedPersistentCurrentRowLengths.clear();
// optimization for when all indexes are selected
// (only if there is lots of items (1000) because this is not entirely correct)
@@ -836,8 +855,53 @@ void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged()
}
tableSelected = false;
- savedPersistentIndexes = qSelectionPersistentindexes(ranges);
- savedPersistentCurrentIndexes = qSelectionPersistentindexes(currentSelection);
+ if (hint == QAbstractItemModel::VerticalSortHint) {
+ // Special case when we know we're sorting vertically. We can assume that all indexes for columns
+ // are displaced the same way, and therefore we only need to track an index from one column per
+ // row with a QPersistentModelIndex together with the length of items to the right of it
+ // which are displaced the same way.
+ // An algorithm which contains the same assumption is used to process layoutChanged.
+ savedPersistentRowLengths = qSelectionPersistentRowLengths(ranges);
+ savedPersistentCurrentRowLengths = qSelectionPersistentRowLengths(currentSelection);
+ } else {
+ savedPersistentIndexes = qSelectionPersistentindexes(ranges);
+ savedPersistentCurrentIndexes = qSelectionPersistentindexes(currentSelection);
+ }
+}
+/*!
+ \internal
+*/
+static QItemSelection mergeRowLengths(const QVector<QPair<QPersistentModelIndex, uint> > &rowLengths)
+{
+ if (rowLengths.isEmpty())
+ return QItemSelection();
+
+ QItemSelection result;
+ int i = 0;
+ while (i < rowLengths.count()) {
+ const QPersistentModelIndex &tl = rowLengths.at(i).first;
+ if (!tl.isValid()) {
+ ++i;
+ continue;
+ }
+ QPersistentModelIndex br = tl;
+ const uint length = rowLengths.at(i).second;
+ while (++i < rowLengths.count()) {
+ const QPersistentModelIndex &next = rowLengths.at(i).first;
+ if (!next.isValid())
+ continue;
+ const uint nextLength = rowLengths.at(i).second;
+ if ((nextLength == length)
+ && (next.row() == br.row() + 1)
+ && (next.parent() == br.parent())) {
+ br = next;
+ } else {
+ break;
+ }
+ }
+ result.append(QItemSelectionRange(tl, br.sibling(br.row(), length - 1)));
+ }
+ return result;
}
/*!
@@ -913,7 +977,7 @@ static QItemSelection mergeIndexes(const QVector<QPersistentModelIndex> &indexes
Merge the selected indexes into selection ranges again.
*/
-void QItemSelectionModelPrivate::_q_layoutChanged()
+void QItemSelectionModelPrivate::_q_layoutChanged(const QList<QPersistentModelIndex> &, QAbstractItemModel::LayoutChangeHint hint)
{
// special case for when all indexes are selected
if (tableSelected && tableColCount == model->columnCount(tableParent)
@@ -930,26 +994,42 @@ void QItemSelectionModelPrivate::_q_layoutChanged()
return;
}
- if (savedPersistentCurrentIndexes.isEmpty() && savedPersistentIndexes.isEmpty()) {
+ if ((hint != QAbstractItemModel::VerticalSortHint && savedPersistentCurrentIndexes.isEmpty() && savedPersistentIndexes.isEmpty())
+ || (hint == QAbstractItemModel::VerticalSortHint && savedPersistentRowLengths.isEmpty() && savedPersistentCurrentRowLengths.isEmpty())) {
// either the selection was actually empty, or we
// didn't get the layoutAboutToBeChanged() signal
return;
}
+
// clear the "old" selection
ranges.clear();
currentSelection.clear();
- // sort the "new" selection, as preparation for merging
- qStableSort(savedPersistentIndexes.begin(), savedPersistentIndexes.end());
- qStableSort(savedPersistentCurrentIndexes.begin(), savedPersistentCurrentIndexes.end());
+ if (hint != QAbstractItemModel::VerticalSortHint) {
+ // sort the "new" selection, as preparation for merging
+ qStableSort(savedPersistentIndexes.begin(), savedPersistentIndexes.end());
+ qStableSort(savedPersistentCurrentIndexes.begin(), savedPersistentCurrentIndexes.end());
- // update the selection by merging the individual indexes
- ranges = mergeIndexes(savedPersistentIndexes);
- currentSelection = mergeIndexes(savedPersistentCurrentIndexes);
+ // update the selection by merging the individual indexes
+ ranges = mergeIndexes(savedPersistentIndexes);
+ currentSelection = mergeIndexes(savedPersistentCurrentIndexes);
- // release the persistent indexes
- savedPersistentIndexes.clear();
- savedPersistentCurrentIndexes.clear();
+ // release the persistent indexes
+ savedPersistentIndexes.clear();
+ savedPersistentCurrentIndexes.clear();
+ } else {
+ // sort the "new" selection, as preparation for merging
+ qStableSort(savedPersistentRowLengths.begin(), savedPersistentRowLengths.end());
+ qStableSort(savedPersistentCurrentRowLengths.begin(), savedPersistentCurrentRowLengths.end());
+
+ // update the selection by merging the individual indexes
+ ranges = mergeRowLengths(savedPersistentRowLengths);
+ currentSelection = mergeRowLengths(savedPersistentCurrentRowLengths);
+
+ // release the persistent indexes
+ savedPersistentRowLengths.clear();
+ savedPersistentCurrentRowLengths.clear();
+ }
}
/*!
diff --git a/src/corelib/itemmodels/qitemselectionmodel.h b/src/corelib/itemmodels/qitemselectionmodel.h
index 555401e621..79a8a25470 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.h
+++ b/src/corelib/itemmodels/qitemselectionmodel.h
@@ -222,8 +222,8 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_rowsAboutToBeRemoved(const QModelIndex&, int, int))
Q_PRIVATE_SLOT(d_func(), void _q_columnsAboutToBeInserted(const QModelIndex&, int, int))
Q_PRIVATE_SLOT(d_func(), void _q_rowsAboutToBeInserted(const QModelIndex&, int, int))
- Q_PRIVATE_SLOT(d_func(), void _q_layoutAboutToBeChanged())
- Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged())
+ Q_PRIVATE_SLOT(d_func(), void _q_layoutAboutToBeChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoHint))
+ Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoHint))
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QItemSelectionModel::SelectionFlags)
diff --git a/src/corelib/itemmodels/qitemselectionmodel_p.h b/src/corelib/itemmodels/qitemselectionmodel_p.h
index cc278346ff..9439bb772b 100644
--- a/src/corelib/itemmodels/qitemselectionmodel_p.h
+++ b/src/corelib/itemmodels/qitemselectionmodel_p.h
@@ -76,8 +76,8 @@ public:
void _q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
void _q_rowsAboutToBeInserted(const QModelIndex &parent, int start, int end);
void _q_columnsAboutToBeInserted(const QModelIndex &parent, int start, int end);
- void _q_layoutAboutToBeChanged();
- void _q_layoutChanged();
+ void _q_layoutAboutToBeChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint);
+ void _q_layoutChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint);
inline void remove(QList<QItemSelectionRange> &r)
{
@@ -100,6 +100,8 @@ public:
QItemSelectionModel::SelectionFlags currentCommand;
QVector<QPersistentModelIndex> savedPersistentIndexes;
QVector<QPersistentModelIndex> savedPersistentCurrentIndexes;
+ QVector<QPair<QPersistentModelIndex, uint> > savedPersistentRowLengths;
+ QVector<QPair<QPersistentModelIndex, uint> > savedPersistentCurrentRowLengths;
// optimization when all indexes are selected
bool tableSelected;
QPersistentModelIndex tableParent;
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index df0ffce12d..8ff4aa7c54 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1003,7 +1003,7 @@ int QCoreApplication::exec()
if (self) {
self->d_func()->in_exec = false;
if (!self->d_func()->aboutToQuitEmitted)
- emit self->aboutToQuit();
+ emit self->aboutToQuit(QPrivateSignal());
self->d_func()->aboutToQuitEmitted = true;
sendPostedEvents(0, QEvent::DeferredDelete);
}
@@ -1796,8 +1796,6 @@ QString QCoreApplication::applicationFilePath()
if (!executables.empty()) {
//We assume that there is only one executable in the folder
return dir.absoluteFilePath(executables.first());
- } else {
- return QString();
}
#elif defined(Q_OS_MAC)
QString qAppFileName_str = qAppFileName();
diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h
index 622139e6f8..46eab4e740 100644
--- a/src/corelib/kernel/qcoreapplication.h
+++ b/src/corelib/kernel/qcoreapplication.h
@@ -166,8 +166,16 @@ public Q_SLOTS:
static void quit();
Q_SIGNALS:
- void aboutToQuit();
- void unixSignal(int);
+ void aboutToQuit(
+#if !defined(qdoc)
+ QPrivateSignal
+#endif
+ );
+ void unixSignal(int
+#if !defined(qdoc)
+ , QPrivateSignal
+#endif
+ );
protected:
bool event(QEvent *);
diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp
index ded1f27f4f..44715b0553 100644
--- a/src/corelib/kernel/qeventdispatcher_unix.cpp
+++ b/src/corelib/kernel/qeventdispatcher_unix.cpp
@@ -191,7 +191,7 @@ int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags,
for (int i = 0; i < NSIG; ++i) {
if (signals_fired[i]) {
signals_fired[i] = 0;
- emit QCoreApplication::instance()->unixSignal(i);
+ emit QCoreApplication::instance()->unixSignal(i, QCoreApplication::QPrivateSignal());
}
}
}
diff --git a/src/corelib/kernel/qeventloop_p.h b/src/corelib/kernel/qeventloop_p.h
index f0eec41137..9594789944 100644
--- a/src/corelib/kernel/qeventloop_p.h
+++ b/src/corelib/kernel/qeventloop_p.h
@@ -48,8 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
-
class QEventLoopPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QEventLoop)
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 58e8fcb24d..268677ee1b 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -1004,7 +1004,7 @@ void QObject::setObjectName(const QString &name)
if (d->extraData->objectName != name) {
d->extraData->objectName = name;
- emit objectNameChanged(d->extraData->objectName);
+ emit objectNameChanged(d->extraData->objectName, QPrivateSignal());
}
}
diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h
index 653cc6a42e..689946b6c4 100644
--- a/src/corelib/kernel/qobject.h
+++ b/src/corelib/kernel/qobject.h
@@ -348,7 +348,11 @@ public:
Q_SIGNALS:
void destroyed(QObject * = 0);
- void objectNameChanged(const QString &objectName);
+ void objectNameChanged(const QString &objectName
+#if !defined(qdoc)
+ , QPrivateSignal
+#endif
+ );
public:
inline QObject *parent() const { return d_ptr->parent; }
diff --git a/src/corelib/kernel/qsocketnotifier.cpp b/src/corelib/kernel/qsocketnotifier.cpp
index cf65ea895c..f1b8741242 100644
--- a/src/corelib/kernel/qsocketnotifier.cpp
+++ b/src/corelib/kernel/qsocketnotifier.cpp
@@ -298,7 +298,7 @@ bool QSocketNotifier::event(QEvent *e)
}
QObject::event(e); // will activate filters
if ((e->type() == QEvent::SockAct) || (e->type() == QEvent::SockClose)) {
- emit activated(d->sockfd);
+ emit activated(d->sockfd, QPrivateSignal());
return true;
}
return false;
diff --git a/src/corelib/kernel/qsocketnotifier.h b/src/corelib/kernel/qsocketnotifier.h
index 177ce224bd..35e73b790b 100644
--- a/src/corelib/kernel/qsocketnotifier.h
+++ b/src/corelib/kernel/qsocketnotifier.h
@@ -69,7 +69,11 @@ public Q_SLOTS:
void setEnabled(bool);
Q_SIGNALS:
- void activated(int socket);
+ void activated(int socket
+#if !defined(qdoc)
+ , QPrivateSignal
+#endif
+ );
protected:
bool event(QEvent *);
diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp
index a685973bd7..9dea666363 100644
--- a/src/corelib/kernel/qtimer.cpp
+++ b/src/corelib/kernel/qtimer.cpp
@@ -247,7 +247,7 @@ void QTimer::timerEvent(QTimerEvent *e)
if (e->timerId() == id) {
if (single)
stop();
- emit timeout();
+ emit timeout(QPrivateSignal());
}
}
diff --git a/src/corelib/kernel/qtimer.h b/src/corelib/kernel/qtimer.h
index b934440275..a3cc1c7813 100644
--- a/src/corelib/kernel/qtimer.h
+++ b/src/corelib/kernel/qtimer.h
@@ -88,7 +88,11 @@ public Q_SLOTS:
void stop();
Q_SIGNALS:
- void timeout();
+ void timeout(
+#if !defined(qdoc)
+ QPrivateSignal
+#endif
+ );
protected:
void timerEvent(QTimerEvent *);
diff --git a/src/corelib/kernel/qwineventnotifier.cpp b/src/corelib/kernel/qwineventnotifier.cpp
index 9a99b15202..44116c3333 100644
--- a/src/corelib/kernel/qwineventnotifier.cpp
+++ b/src/corelib/kernel/qwineventnotifier.cpp
@@ -234,7 +234,7 @@ bool QWinEventNotifier::event(QEvent * e)
}
QObject::event(e); // will activate filters
if (e->type() == QEvent::WinEventAct) {
- emit activated(d->handleToEvent);
+ emit activated(d->handleToEvent, QPrivateSignal());
return true;
}
return false;
diff --git a/src/corelib/kernel/qwineventnotifier.h b/src/corelib/kernel/qwineventnotifier.h
index add4059595..d5e4d0f7e3 100644
--- a/src/corelib/kernel/qwineventnotifier.h
+++ b/src/corelib/kernel/qwineventnotifier.h
@@ -74,7 +74,11 @@ public Q_SLOTS:
void setEnabled(bool enable);
Q_SIGNALS:
- void activated(HANDLE hEvent);
+ void activated(HANDLE hEvent
+#if !defined(qdoc)
+ , QPrivateSignal
+#endif
+ );
protected:
bool event(QEvent * e);
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
index 7d4081f2c3..5eb9686f1d 100644
--- a/src/corelib/statemachine/qstate.cpp
+++ b/src/corelib/statemachine/qstate.cpp
@@ -279,7 +279,7 @@ void QState::assignProperty(QObject *object, const char *name,
#endif // QT_NO_PROPERTIES
/*!
- Returns this state's error state.
+ Returns this state's error state.
\sa QStateMachine::error()
*/
@@ -292,7 +292,7 @@ QAbstractState *QState::errorState() const
/*!
Sets this state's error state to be the given \a state. If the error state
is not set, or if it is set to 0, the state will inherit its parent's error
- state recursively. If no error state is set for the state itself or any of
+ state recursively. If no error state is set for the state itself or any of
its ancestors, an error will cause the machine to stop executing and an error
will be printed to the console.
*/
@@ -314,7 +314,7 @@ void QState::setErrorState(QAbstractState *state)
/*!
Adds the given \a transition. The transition has this state as the source.
- This state takes ownership of the transition.
+ This state takes ownership of the transition.
*/
void QState::addTransition(QAbstractTransition *transition)
{
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index 4d911cb4a2..c8d2f39525 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -141,8 +141,8 @@ QT_BEGIN_NAMESPACE
enter this state. The types of errors possible are described by the
\l{QStateMachine::}{Error} enum. After the error state is entered,
the type of the error can be retrieved with error(). The execution
- of the state graph will not stop when the error state is entered. If
- no error state applies to the erroneous state, the machine will stop
+ of the state graph will not stop when the error state is entered. If
+ no error state applies to the erroneous state, the machine will stop
executing and an error message will be printed to the console.
\sa QAbstractState, QAbstractTransition, QState, {The State Machine Framework}
@@ -1040,17 +1040,17 @@ QAbstractState *QStateMachinePrivate::findErrorState(QAbstractState *context)
if (errorState == 0)
errorState = findErrorState(context->parentState());
}
-
- return errorState;
+
+ return errorState;
}
void QStateMachinePrivate::setError(QStateMachine::Error errorCode, QAbstractState *currentContext)
{
Q_Q(QStateMachine);
-
+
error = errorCode;
switch (errorCode) {
- case QStateMachine::NoInitialStateError:
+ case QStateMachine::NoInitialStateError:
Q_ASSERT(currentContext != 0);
errorString = QStateMachine::tr("Missing initial state in compound state '%1'")
@@ -1074,23 +1074,23 @@ void QStateMachinePrivate::setError(QStateMachine::Error errorCode, QAbstractSta
errorString = QStateMachine::tr("Unknown error");
};
- pendingErrorStates.clear();
+ pendingErrorStates.clear();
pendingErrorStatesForDefaultEntry.clear();
QAbstractState *currentErrorState = findErrorState(currentContext);
// Avoid infinite loop if the error state itself has an error
if (currentContext == currentErrorState)
- currentErrorState = 0;
+ currentErrorState = 0;
Q_ASSERT(currentErrorState != rootState());
- if (currentErrorState != 0) {
+ if (currentErrorState != 0) {
QState *lca = findLCA(QList<QAbstractState*>() << currentErrorState << currentContext);
addStatesToEnter(currentErrorState, lca, pendingErrorStates, pendingErrorStatesForDefaultEntry);
addAncestorStatesToEnter(currentErrorState, lca, pendingErrorStates, pendingErrorStatesForDefaultEntry);
} else {
- qWarning("Unrecoverable error detected in running state machine: %s",
+ qWarning("Unrecoverable error detected in running state machine: %s",
qPrintable(errorString));
q->stop();
}
@@ -1099,7 +1099,7 @@ void QStateMachinePrivate::setError(QStateMachine::Error errorCode, QAbstractSta
#ifndef QT_NO_ANIMATION
QPair<QList<QAbstractAnimation*>, QList<QAbstractAnimation*> >
-QStateMachinePrivate::initializeAnimation(QAbstractAnimation *abstractAnimation,
+QStateMachinePrivate::initializeAnimation(QAbstractAnimation *abstractAnimation,
const QPropertyAssignment &prop)
{
QList<QAbstractAnimation*> handledAnimations;
@@ -1113,9 +1113,9 @@ QStateMachinePrivate::initializeAnimation(QAbstractAnimation *abstractAnimation,
handledAnimations << ret.first;
localResetEndValues << ret.second;
}
- } else {
+ } else {
QPropertyAnimation *animation = qobject_cast<QPropertyAnimation *>(abstractAnimation);
- if (animation != 0
+ if (animation != 0
&& prop.object == animation->targetObject()
&& prop.propertyName == animation->propertyName()) {
@@ -1894,7 +1894,7 @@ void QStateMachinePrivate::unregisterEventTransition(QEventTransition *transitio
}
void QStateMachinePrivate::handleFilteredEvent(QObject *watched, QEvent *event)
-{
+{
if (qobjectEvents.value(watched).contains(event->type())) {
postInternalEvent(new QStateMachine::WrappedEvent(watched, handler->cloneEvent(event)));
processEvents(DirectProcessing);
@@ -1980,24 +1980,24 @@ QStateMachine::~QStateMachine()
\value HighPriority The event has high priority.
*/
-/*! \enum QStateMachine::Error
+/*! \enum QStateMachine::Error
This enum type defines errors that can occur in the state machine at run time. When the state
- machine encounters an unrecoverable error at run time, it will set the error code returned
- by error(), the error message returned by errorString(), and enter an error state based on
+ machine encounters an unrecoverable error at run time, it will set the error code returned
+ by error(), the error message returned by errorString(), and enter an error state based on
the context of the error.
\value NoError No error has occurred.
\value NoInitialStateError The machine has entered a QState with children which does not have an
initial state set. The context of this error is the state which is missing an initial
state.
- \value NoDefaultStateInHistoryStateError The machine has entered a QHistoryState which does not have
+ \value NoDefaultStateInHistoryStateError The machine has entered a QHistoryState which does not have
a default state set. The context of this error is the QHistoryState which is missing a
default state.
- \value NoCommonAncestorForTransitionError The machine has selected a transition whose source
- and targets are not part of the same tree of states, and thus are not part of the same
- state machine. Commonly, this could mean that one of the states has not been given
- any parent or added to any machine. The context of this error is the source state of
+ \value NoCommonAncestorForTransitionError The machine has selected a transition whose source
+ and targets are not part of the same tree of states, and thus are not part of the same
+ state machine. Commonly, this could mean that one of the states has not been given
+ any parent or added to any machine. The context of this error is the source state of
the transition.
\sa setErrorState()
@@ -2043,9 +2043,9 @@ QState::RestorePolicy QStateMachine::globalRestorePolicy() const
}
/*!
- Sets the restore policy of the state machine to \a restorePolicy. The default
+ Sets the restore policy of the state machine to \a restorePolicy. The default
restore policy is QState::DontRestoreProperties.
-
+
\sa globalRestorePolicy()
*/
void QStateMachine::setGlobalRestorePolicy(QState::RestorePolicy restorePolicy)
@@ -2437,7 +2437,7 @@ void QStateMachine::onEntry(QEvent *event)
/*!
\reimp
- This function will call stop() to stop the state machine and
+ This function will call stop() to stop the state machine and
subsequently emit the stopped() signal.
*/
void QStateMachine::onExit(QEvent *event)
@@ -2468,7 +2468,7 @@ void QStateMachine::setAnimated(bool enabled)
/*!
Adds a default \a animation to be considered for any transition.
-*/
+*/
void QStateMachine::addDefaultAnimation(QAbstractAnimation *animation)
{
Q_D(QStateMachine);
@@ -2479,13 +2479,13 @@ void QStateMachine::addDefaultAnimation(QAbstractAnimation *animation)
Returns the list of default animations that will be considered for any transition.
*/
QList<QAbstractAnimation*> QStateMachine::defaultAnimations() const
-{
+{
Q_D(const QStateMachine);
return d->defaultAnimations;
}
/*!
- Removes \a animation from the list of default animations.
+ Removes \a animation from the list of default animations.
*/
void QStateMachine::removeDefaultAnimation(QAbstractAnimation *animation)
{
diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h
index cc1ffff553..d1789e9fcd 100644
--- a/src/corelib/statemachine/qstatemachine.h
+++ b/src/corelib/statemachine/qstatemachine.h
@@ -107,7 +107,7 @@ public:
};
enum Error {
- NoError,
+ NoError,
NoInitialStateError,
NoDefaultStateInHistoryStateError,
NoCommonAncestorForTransitionError
diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h
index 3e9c72b241..6072212350 100644
--- a/src/corelib/thread/qbasicatomic.h
+++ b/src/corelib/thread/qbasicatomic.h
@@ -105,8 +105,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
-
#if 0
// silence syncqt warnings
QT_END_NAMESPACE
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index 72bae48eba..465f2befbc 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -144,7 +144,7 @@ void QAdoptedThread::run()
*/
QThreadPrivate::QThreadPrivate(QThreadData *d)
- : QObjectPrivate(), running(false), finished(false), terminated(false),
+ : QObjectPrivate(), running(false), finished(false),
isInFinish(false), exited(false), returnCode(-1),
stackSize(0), priority(QThread::InheritPriority), data(d)
{
@@ -203,10 +203,9 @@ QThreadPrivate::~QThreadPrivate()
\section1 Managing threads
- QThread will notifiy you via a signal
- when the thread is started(), finished(), and terminated(), or
- you can use isFinished() and isRunning() to query the state of
- the thread.
+ QThread will notifiy you via a signal when the thread is
+ started() and finished(), or you can use isFinished() and
+ isRunning() to query the state of the thread.
You can stop the thread by calling exit() or quit(). In extreme
cases, you may want to forcibly terminate() an executing thread.
@@ -326,7 +325,7 @@ QThreadPrivate::~QThreadPrivate()
This signal is emitted from the associated thread when it starts executing,
before the run() function is called.
- \sa finished(), terminated()
+ \sa finished()
*/
/*!
@@ -341,17 +340,7 @@ QThreadPrivate::~QThreadPrivate()
\note If the associated thread was terminated using terminate(), it is undefined from
which thread this signal is emitted.
- \sa started(), terminated()
-*/
-
-/*!
- \fn void QThread::terminated()
-
- This signal is emitted when the thread is terminated.
-
- It is undefined from which thread this signal is emitted.
-
- \sa started(), finished()
+ \sa started()
*/
/*!
@@ -656,8 +645,8 @@ QThread::Priority QThread::priority() const
Terminates the execution of the thread. The thread may or may not
be terminated immediately, depending on the operating system's
- scheduling policies. Listen for the terminated() signal, or use
- QThread::wait() after terminate(), to be sure.
+ scheduling policies. Use QThread::wait() after terminate(), to be
+ sure.
When the thread is terminated, all threads waiting for the thread
to finish will be woken up.
diff --git a/src/corelib/thread/qthread.h b/src/corelib/thread/qthread.h
index 0fab71d5c1..058091baf4 100644
--- a/src/corelib/thread/qthread.h
+++ b/src/corelib/thread/qthread.h
@@ -113,7 +113,6 @@ public:
Q_SIGNALS:
void started();
void finished();
- void terminated();
protected:
virtual void run();
@@ -139,7 +138,7 @@ class Q_CORE_EXPORT QThread : public QObject
public:
static Qt::HANDLE currentThreadId() { return Qt::HANDLE(currentThread()); }
static QThread* currentThread();
-
+
protected:
QThread(QThreadPrivate &dd, QObject *parent = 0);
diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h
index 268891d5e8..ec89eed098 100644
--- a/src/corelib/thread/qthread_p.h
+++ b/src/corelib/thread/qthread_p.h
@@ -147,7 +147,6 @@ public:
bool running;
bool finished;
- bool terminated;
bool isInFinish; //when in QThreadPrivate::finish
bool exited;
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index 7fd89f4bca..2213b8f71a 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -346,16 +346,12 @@ void QThreadPrivate::finish(void *arg)
d->isInFinish = true;
d->priority = QThread::InheritPriority;
- bool terminated = d->terminated;
void *data = &d->data->tls;
locker.unlock();
- if (terminated)
- emit thr->terminated();
emit thr->finished();
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QThreadStorageData::finish((void **)data);
locker.relock();
- d->terminated = false;
QAbstractEventDispatcher *eventDispatcher = d->data->eventDispatcher;
if (eventDispatcher) {
@@ -523,7 +519,6 @@ void QThread::start(Priority priority)
d->running = true;
d->finished = false;
- d->terminated = false;
d->returnCode = 0;
d->exited = false;
@@ -631,8 +626,6 @@ void QThread::terminate()
if (code) {
qWarning("QThread::start: Thread termination error: %s",
qPrintable(qt_error_string((code))));
- } else {
- d->terminated = true;
}
#endif
}
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp
index b487efffad..56e58fbcc3 100644
--- a/src/corelib/thread/qthread_win.cpp
+++ b/src/corelib/thread/qthread_win.cpp
@@ -352,18 +352,13 @@ void QThreadPrivate::finish(void *arg, bool lockAnyway)
QMutexLocker locker(lockAnyway ? &d->mutex : 0);
d->isInFinish = true;
d->priority = QThread::InheritPriority;
- bool terminated = d->terminated;
void **tls_data = reinterpret_cast<void **>(&d->data->tls);
locker.unlock();
- if (terminated)
- emit thr->terminated();
emit thr->finished();
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QThreadStorageData::finish(tls_data);
locker.relock();
- d->terminated = false;
-
QAbstractEventDispatcher *eventDispatcher = d->data->eventDispatcher;
if (eventDispatcher) {
d->data->eventDispatcher = 0;
@@ -443,7 +438,6 @@ void QThread::start(Priority priority)
d->running = true;
d->finished = false;
- d->terminated = false;
d->exited = false;
d->returnCode = 0;
@@ -524,7 +518,6 @@ void QThread::terminate()
return;
}
TerminateThread(d->handle, 0);
- d->terminated = true;
QThreadPrivate::finish(this, false);
}
@@ -562,7 +555,7 @@ bool QThread::wait(unsigned long time)
if (ret && !d->finished) {
// thread was terminated by someone else
- d->terminated = true;
+
QThreadPrivate::finish(this, false);
}
@@ -583,7 +576,6 @@ void QThread::setTerminationEnabled(bool enabled)
QMutexLocker locker(&d->mutex);
d->terminationEnabled = enabled;
if (enabled && d->terminatePending) {
- d->terminated = true;
QThreadPrivate::finish(thr, false);
locker.unlock(); // don't leave the mutex locked!
_endthreadex(0);
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index a9d3095224..7d18e93dce 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -408,8 +408,6 @@ int QDate::daysInMonth() const
getDateFromJulianDay(jd, &y, &m, 0);
if (m == 2 && isLeapYear(y))
return 29;
- else if (m < 1 || m > 12)
- return 0;
else
return monthDays[m];
}
@@ -1150,9 +1148,10 @@ QDate QDate::fromString(const QString& s, Qt::DateFormat f)
break;
}
}
- }
- if (month < 1 || month > 12) {
- return QDate();
+ if (month == -1) {
+ // Month name matches neither English nor other localised name.
+ return QDate();
+ }
}
bool ok;
@@ -1805,7 +1804,7 @@ QTime fromStringImpl(const QString &s, Qt::DateFormat f, bool &isMidnight24)
if (s.size() == 5) {
// Do not need to specify seconds if using ISO format.
return QTime(hour, minute, 0, 0);
- } else if ((s.size() > 6 && s[5] == QLatin1Char(',')) || s[5] == QLatin1Char('.')) {
+ } else if ((s.size() > 6) && (s[5] == QLatin1Char(',') || s[5] == QLatin1Char('.'))) {
// Possibly specifying fraction of a minute.
// We only want 5 digits worth of fraction of minute. This follows the existing
@@ -2693,6 +2692,9 @@ QDateTime QDateTime::addYears(int nyears) const
QDateTime QDateTimePrivate::addMSecs(const QDateTime &dt, qint64 msecs)
{
+ if (!dt.isValid())
+ return QDateTime();
+
QDate utcDate;
QTime utcTime;
dt.d->getUTC(utcDate, utcTime);
@@ -2743,6 +2745,8 @@ void QDateTimePrivate::addMSecs(QDate &utcDate, QTime &utcTime, qint64 msecs)
later than the datetime of this object (or earlier if \a s is
negative).
+ If this datetime is invalid, an invalid datetime will be returned.
+
\sa addMSecs(), secsTo(), addDays(), addMonths(), addYears()
*/
@@ -2756,6 +2760,8 @@ QDateTime QDateTime::addSecs(qint64 s) const
later than the datetime of this object (or earlier if \a msecs is
negative).
+ If this datetime is invalid, an invalid datetime will be returned.
+
\sa addSecs(), msecsTo(), addDays(), addMonths(), addYears()
*/
QDateTime QDateTime::addMSecs(qint64 msecs) const
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 368cb444a3..97946b52c8 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -2262,7 +2262,7 @@ QString QLocalePrivate::dateTimeToString(const QString &format, const QDate *dat
switch (repeat) {
case 4:
- result.append(longLongToString(date->year()));
+ result.append(longLongToString(date->year(), -1, 10, 4, QLocalePrivate::ZeroPadded));
break;
case 2:
result.append(longLongToString(date->year() % 100, -1, 10, 2,
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index d0422175f5..6f3e577e55 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -625,7 +625,7 @@ public:
#ifndef QT_NO_QOBJECT
template <class X>
- inline QWeakPointer(X *ptr, bool) : d(ptr ? d->getAndRef(ptr) : 0), value(ptr)
+ inline QWeakPointer(X *ptr, bool) : d(ptr ? Data::getAndRef(ptr) : 0), value(ptr)
{ }
#endif
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 925ad17110..94733f77da 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -200,8 +200,8 @@ public:
typedef int size_type;
inline void push_back(const T &t) { append(t); }
inline void push_front(const T &t) { prepend(t); }
- void pop_back() { Q_ASSERT(!isEmpty()); erase(end()-1); }
- void pop_front() { Q_ASSERT(!isEmpty()); erase(begin()); }
+ void pop_back() { Q_ASSERT(!isEmpty()); erase(d->end() - 1); }
+ void pop_front() { Q_ASSERT(!isEmpty()); erase(d->begin()); }
inline bool empty() const
{ return d->size == 0; }
inline T& front() { return first(); }
@@ -366,11 +366,11 @@ inline void QVector<T>::insert(int i, int n, const T &t)
template <typename T>
inline void QVector<T>::remove(int i, int n)
{ Q_ASSERT_X(i >= 0 && n >= 0 && i + n <= d->size, "QVector<T>::remove", "index out of range");
- erase(begin() + i, begin() + i + n); }
+ erase(d->begin() + i, d->begin() + i + n); }
template <typename T>
inline void QVector<T>::remove(int i)
{ Q_ASSERT_X(i >= 0 && i < d->size, "QVector<T>::remove", "index out of range");
- erase(begin() + i, begin() + i + 1); }
+ erase(d->begin() + i, d->begin() + i + 1); }
template <typename T>
inline void QVector<T>::prepend(const T &t)
{ insert(begin(), 1, t); }
@@ -607,6 +607,8 @@ typename QVector<T>::iterator QVector<T>::erase(iterator abegin, iterator aend)
// FIXME we ara about to delete data maybe it is good time to shrink?
if (d->alloc) {
detach();
+ abegin = d->begin() + itemsUntouched;
+ aend = abegin + itemsToErase;
if (QTypeInfo<T>::isStatic) {
iterator moveBegin = abegin + itemsToErase;
iterator moveEnd = d->end();