summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--LICENSE.GPL3696
-rwxr-xr-xconfigure18
-rw-r--r--demos/boxes/qtbox.cpp14
-rw-r--r--demos/boxes/qtbox.h6
-rw-r--r--demos/sub-attaq/graphicsscene.cpp13
-rw-r--r--demos/sub-attaq/graphicsscene.h2
-rw-r--r--demos/sub-attaq/states.cpp25
-rw-r--r--demos/sub-attaq/states.h2
-rw-r--r--demos/sub-attaq/sub-attaq.pro18
-rw-r--r--demos/sub-attaq/textinformationitem.cpp (renamed from examples/effects/lighting/shadoweffect.cpp)42
-rw-r--r--demos/sub-attaq/textinformationitem.h (renamed from examples/effects/lighting/shadoweffect.h)29
-rw-r--r--doc/src/examples/diagramscene.qdoc7
-rw-r--r--doc/src/getting-started/installation.qdoc4
-rw-r--r--doc/src/network-programming/ssl.qdoc26
-rw-r--r--doc/src/snippets/code/src_corelib_io_qsettings.cpp2
-rw-r--r--doc/src/widgets-and-layouts/stylesheet.qdoc12
-rw-r--r--examples/animation/states/main.cpp4
-rw-r--r--examples/effects/lighting/lighting.cpp22
-rw-r--r--examples/effects/lighting/lighting.h2
-rw-r--r--examples/effects/lighting/lighting.pro4
-rw-r--r--examples/graphicsview/padnavigator/main.cpp2
-rw-r--r--examples/qws/dbscreen/dbscreen.cpp2
-rw-r--r--examples/qws/dbscreen/dbscreen.h21
-rw-r--r--examples/webkit/fancybrowser/mainwindow.cpp2
-rw-r--r--examples/webkit/googlechat/main.cpp4
-rw-r--r--examples/widgets/tablet/tabletcanvas.cpp4
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp4
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp15
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h3
-rw-r--r--src/activeqt/container/qaxwidget.cpp7
-rw-r--r--src/corelib/arch/arch.pri3
-rw-r--r--src/corelib/arch/qatomic_windows.h560
-rw-r--r--src/corelib/global/qglobal.h3
-rw-r--r--src/corelib/io/qiodevice.cpp7
-rw-r--r--src/corelib/io/qprocess.cpp5
-rw-r--r--src/corelib/io/qprocess_symbian.cpp2
-rw-r--r--src/corelib/io/qprocess_unix.cpp2
-rw-r--r--src/corelib/io/qtemporaryfile.cpp38
-rw-r--r--src/corelib/kernel/qabstractitemmodel.cpp2
-rw-r--r--src/corelib/kernel/qmetaobject.cpp11
-rw-r--r--src/corelib/kernel/qobject.cpp8
-rw-r--r--src/corelib/thread/qbasicatomic.h15
-rw-r--r--src/corelib/tools/qlist.h1
-rw-r--r--src/corelib/tools/qmargins.cpp167
-rw-r--r--src/corelib/tools/qmargins.h147
-rw-r--r--src/corelib/tools/tools.pri128
-rw-r--r--src/gui/effects/qgraphicseffect.cpp56
-rw-r--r--src/gui/effects/qgraphicseffect.h20
-rw-r--r--src/gui/effects/qgraphicseffect_p.h1
-rw-r--r--src/gui/embedded/directfb.pri39
-rw-r--r--src/gui/embedded/embedded.pri4
-rw-r--r--src/gui/embedded/qscreendriverfactory_qws.cpp9
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp80
-rw-r--r--src/gui/graphicsview/qgraphicsitem.h2
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h11
-rw-r--r--src/gui/graphicsview/qgraphicsproxywidget.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp149
-rw-r--r--src/gui/graphicsview/qgraphicsscene_p.h2
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp6
-rw-r--r--src/gui/image/qicon.cpp13
-rw-r--r--src/gui/image/qiconloader.cpp7
-rw-r--r--src/gui/image/qimage.cpp6
-rw-r--r--src/gui/image/qpnghandler.cpp8
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp8
-rw-r--r--src/gui/itemviews/qabstractitemview_p.h10
-rw-r--r--src/gui/itemviews/qheaderview.cpp4
-rw-r--r--src/gui/kernel/qapplication_x11.cpp111
-rw-r--r--src/gui/kernel/qwidget.cpp40
-rw-r--r--src/gui/kernel/qwidget.h4
-rw-r--r--src/gui/kernel/qwidget_p.h10
-rw-r--r--src/gui/painting/qcolor.cpp2
-rw-r--r--src/gui/painting/qdrawutil.cpp137
-rw-r--r--src/gui/painting/qdrawutil.h20
-rw-r--r--src/gui/styles/qcleanlooksstyle.cpp364
-rw-r--r--src/gui/styles/qstyle.cpp8
-rw-r--r--src/gui/styles/qwindowsvistastyle.cpp2
-rw-r--r--src/gui/text/qcssparser.cpp1
-rw-r--r--src/gui/widgets/qcalendarwidget.cpp9
-rw-r--r--src/multimedia/audio/qaudioformat.cpp24
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp41
-rw-r--r--src/network/access/qnetworkaccessbackend.cpp14
-rw-r--r--src/network/access/qnetworkaccesscachebackend.cpp1
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp3
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp36
-rw-r--r--src/network/access/qnetworkreplyimpl_p.h3
-rw-r--r--src/network/kernel/qnetworkproxy.cpp24
-rw-r--r--src/network/kernel/qnetworkproxy.h1
-rw-r--r--src/network/kernel/qnetworkproxy_p.h85
-rw-r--r--src/network/kernel/qnetworkproxy_win.cpp7
-rw-r--r--src/network/socket/qhttpsocketengine.cpp1
-rw-r--r--src/network/socket/qnativesocketengine.cpp17
-rw-r--r--src/network/ssl/qsslcertificate.cpp10
-rw-r--r--src/network/ssl/qsslerror.cpp15
-rw-r--r--src/network/ssl/qsslsocket.cpp8
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp2
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols_p.h1
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager.cpp36
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp52
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h19
-rw-r--r--src/opengl/qgl.cpp34
-rw-r--r--src/opengl/qgl_p.h41
-rw-r--r--src/opengl/qglextensions.cpp4
-rw-r--r--src/opengl/qglextensions_p.h162
-rw-r--r--src/opengl/qglframebufferobject.cpp56
-rw-r--r--src/opengl/qglpixmapfilter.cpp53
-rw-r--r--src/opengl/qglshaderprogram.cpp75
-rw-r--r--src/plugins/gfxdrivers/directfb/directfb.pro38
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp8
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h11
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp11
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbmouse.h11
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp108
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h26
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp112
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h8
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp46
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h16
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp134
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.h30
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp3
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp60
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h13
-rw-r--r--src/plugins/imageformats/gif/qgifhandler.cpp4
-rw-r--r--src/plugins/qpluginbase.pri2
-rw-r--r--src/script/api/qscriptengine.cpp4
-rw-r--r--src/script/api/qscriptengine_p.h10
-rw-r--r--src/script/api/qscriptstring.cpp10
-rw-r--r--src/script/api/qscriptstring.h1
-rw-r--r--src/script/api/qscriptstring_p.h2
-rw-r--r--src/script/bridge/qscriptactivationobject.cpp4
-rw-r--r--src/script/bridge/qscriptclassobject.cpp12
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp47
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp12
-rw-r--r--src/svg/qsvghandler.cpp410
-rw-r--r--src/testlib/qtestcase.cpp4
-rw-r--r--tests/auto/gestures/customgesturerecognizer.cpp208
-rw-r--r--tests/auto/gestures/customgesturerecognizer.h228
-rw-r--r--tests/auto/gestures/gestures.pro3
-rw-r--r--tests/auto/gestures/tst_gestures.cpp962
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp41
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp2/main2.cpp41
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp2/main3.cpp41
-rw-r--r--tests/auto/mediaobject/dummy/dummy.pro2
-rw-r--r--tests/auto/qabstractitemmodel/dynamictreemodel.cpp9
-rw-r--r--tests/auto/qabstractitemmodel/dynamictreemodel.h9
-rw-r--r--tests/auto/qabstractitemmodel/qabstractitemmodel.pro2
-rw-r--r--tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp2
-rw-r--r--tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp20
-rw-r--r--tests/auto/qatomicint/tst_qatomicint.cpp44
-rw-r--r--tests/auto/qatomicpointer/tst_qatomicpointer.cpp48
-rw-r--r--tests/auto/qgl/tst_qgl.cpp118
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp205
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp6
-rw-r--r--tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp8
-rw-r--r--tests/auto/qicon/tst_qicon.cpp3
-rw-r--r--tests/auto/qicon/tst_qicon.qrc14
-rw-r--r--tests/auto/qimagereader/images/qt.gifbin0 -> 26504 bytes
-rw-r--r--tests/auto/qimagereader/images/qt1.gifbin0 -> 7216 bytes
-rw-r--r--tests/auto/qimagereader/images/qt2.gifbin0 -> 5559 bytes
-rw-r--r--tests/auto/qimagereader/images/qt3.gifbin0 -> 4702 bytes
-rw-r--r--tests/auto/qimagereader/images/qt4.gifbin0 -> 4310 bytes
-rw-r--r--tests/auto/qimagereader/images/qt5.gifbin0 -> 4234 bytes
-rw-r--r--tests/auto/qimagereader/images/qt6.gifbin0 -> 4732 bytes
-rw-r--r--tests/auto/qimagereader/images/qt7.gifbin0 -> 5265 bytes
-rw-r--r--tests/auto/qimagereader/images/qt8.gifbin0 -> 6144 bytes
-rw-r--r--tests/auto/qimagereader/qimagereader.qrc13
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp13
-rw-r--r--tests/auto/qmargins/qmargins.pro3
-rw-r--r--tests/auto/qmargins/tst_qmargins.cpp108
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp6
-rw-r--r--tests/auto/qpainterpath/tst_qpainterpath.cpp5
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp29
-rw-r--r--tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp14
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp49
-rw-r--r--tests/auto/qsslcertificate/tst_qsslcertificate.cpp6
-rw-r--r--tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp82
-rw-r--r--tests/auto/qtreeview/tst_qtreeview.cpp30
-rw-r--r--tests/benchmarks/qgraphicsanchorlayout/qgraphicsanchorlayout.pro6
-rw-r--r--tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp197
-rw-r--r--tests/manual/qhttpnetworkconnection/main.cpp81
-rw-r--r--tests/manual/qhttpnetworkconnection/qhttpnetworkconnection.pro13
-rw-r--r--tests/manual/qtabletevent/device_information/main.cpp (renamed from tests/manual/qtabletevent/main.cpp)4
-rw-r--r--tests/manual/qtabletevent/device_information/qtabletevent.pro (renamed from tests/manual/qtabletevent/qtabletevent.pro)0
-rw-r--r--tests/manual/qtabletevent/device_information/tabletwidget.cpp (renamed from tests/manual/qtabletevent/tabletwidget.cpp)0
-rw-r--r--tests/manual/qtabletevent/device_information/tabletwidget.h (renamed from tests/manual/qtabletevent/tabletwidget.h)0
-rw-r--r--tests/manual/qtabletevent/event_compression/event_compression.pro7
-rw-r--r--tests/manual/qtabletevent/event_compression/main.cpp58
-rw-r--r--tests/manual/qtabletevent/event_compression/mousestatwidget.cpp99
-rw-r--r--tests/manual/qtabletevent/event_compression/mousestatwidget.h69
-rw-r--r--tools/assistant/tools/assistant/doc/assistant.qdocconf2
-rw-r--r--tools/configure/configureapp.cpp9
-rw-r--r--tools/qdoc3/test/classic.css38
192 files changed, 4326 insertions, 3867 deletions
diff --git a/LICENSE.GPL3 b/LICENSE.GPL3
deleted file mode 100644
index 265c4ea..0000000
--- a/LICENSE.GPL3
+++ /dev/null
@@ -1,696 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
-
- The Qt GUI Toolkit is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
- Contact: Nokia Corporation (qt-info@nokia.com)
-
- You may use, distribute and copy the Qt GUI Toolkit under the terms of
- GNU General Public License version 3, which is displayed below.
-
--------------------------------------------------------------------------
-
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- <program> Copyright (C) <year> <name of author>
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
-
--------------------------------------------------------------------------
-
-In addition, as a special exception, Nokia gives permission to link the
-code of its release of Qt with the OpenSSL project's "OpenSSL" library (or
-modified versions of it that use the same license as the "OpenSSL"
-library), and distribute the linked executables. You must comply with the
-GNU General Public License versions 2.0 or 3.0 in all respects for all of
-the code used other than the "OpenSSL" code. If you modify this file, you
-may extend this exception to your version of the file, but you are not
-obligated to do so. If you do not wish to do so, delete this exception
-statement from your version of this file.
diff --git a/configure b/configure
index 3f3e55a..87d1428 100755
--- a/configure
+++ b/configure
@@ -643,7 +643,7 @@ CFG_MULTIMEDIA=yes
CFG_SVG=yes
CFG_WEBKIT=auto # (yes|no|auto)
-CFG_GFX_AVAILABLE="linuxfb transformed qvfb vnc multiscreen"
+CFG_GFX_AVAILABLE="linuxfb transformed qvfb vnc multiscreen directfb"
CFG_GFX_ON="linuxfb multiscreen"
CFG_GFX_PLUGIN_AVAILABLE=
CFG_GFX_PLUGIN=
@@ -3842,16 +3842,22 @@ if [ "$Edition" = "NokiaInternalBuild" ]; then
elif [ "$Edition" = "OpenSource" ]; then
while true; do
echo "You are licensed to use this software under the terms of"
- echo "the GNU General Public License (GPL) versions 3."
- echo "You are also licensed to use this software under the terms of"
echo "the Lesser GNU General Public License (LGPL) versions 2.1."
+ if [ -e "$relpath/LICENSE.GPL3" ]; then
+ echo "You are also licensed to use this software under the terms of"
+ echo "the GNU General Public License (GPL) versions 3."
+ affix="either"
+ else
+ affix="the"
+ fi
echo
- affix="either"
if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
- echo "You have already accepted the terms of the $LicenseType license."
+ echo "You have already accepted the terms of the $LicenseType license."
acceptance=yes
else
- echo "Type '3' to view the GNU General Public License version 3."
+ if [ -e "$relpath/LICENSE.GPL3" ]; then
+ echo "Type '3' to view the GNU General Public License version 3."
+ fi
echo "Type 'L' to view the Lesser GNU General Public License version 2.1."
echo "Type 'yes' to accept this license offer."
echo "Type 'no' to decline this license offer."
diff --git a/demos/boxes/qtbox.cpp b/demos/boxes/qtbox.cpp
index 015bc95..54882fb 100644
--- a/demos/boxes/qtbox.cpp
+++ b/demos/boxes/qtbox.cpp
@@ -122,7 +122,7 @@ void ItemBase::duplicateSelectedItems(QGraphicsScene *scene)
selected = scene->selectedItems();
foreach (QGraphicsItem *item, selected) {
- ItemBase *itemBase = dynamic_cast<ItemBase *>(item);
+ ItemBase *itemBase = qgraphicsitem_cast<ItemBase *>(item);
if (itemBase)
scene->addItem(itemBase->createNew(itemBase->m_size, itemBase->pos().x() + itemBase->m_size, itemBase->pos().y()));
}
@@ -137,7 +137,7 @@ void ItemBase::deleteSelectedItems(QGraphicsScene *scene)
selected = scene->selectedItems();
foreach (QGraphicsItem *item, selected) {
- ItemBase *itemBase = dynamic_cast<ItemBase *>(item);
+ ItemBase *itemBase = qgraphicsitem_cast<ItemBase *>(item);
if (itemBase)
delete itemBase;
}
@@ -152,7 +152,7 @@ void ItemBase::growSelectedItems(QGraphicsScene *scene)
selected = scene->selectedItems();
foreach (QGraphicsItem *item, selected) {
- ItemBase *itemBase = dynamic_cast<ItemBase *>(item);
+ ItemBase *itemBase = qgraphicsitem_cast<ItemBase *>(item);
if (itemBase) {
itemBase->prepareGeometryChange();
itemBase->m_size *= 2;
@@ -171,7 +171,7 @@ void ItemBase::shrinkSelectedItems(QGraphicsScene *scene)
selected = scene->selectedItems();
foreach (QGraphicsItem *item, selected) {
- ItemBase *itemBase = dynamic_cast<ItemBase *>(item);
+ ItemBase *itemBase = qgraphicsitem_cast<ItemBase *>(item);
if (itemBase) {
itemBase->prepareGeometryChange();
itemBase->m_size /= 2;
@@ -257,6 +257,12 @@ void ItemBase::wheelEvent(QGraphicsSceneWheelEvent *event)
m_size = MIN_ITEM_SIZE;
}
+int ItemBase::type() const
+{
+ return Type;
+}
+
+
bool ItemBase::isInResizeArea(const QPointF &pos)
{
return (-pos.y() < pos.x() - m_size + 9);
diff --git a/demos/boxes/qtbox.h b/demos/boxes/qtbox.h
index 6f39b0d..9465911 100644
--- a/demos/boxes/qtbox.h
+++ b/demos/boxes/qtbox.h
@@ -47,10 +47,11 @@
#include <QtGui/qvector3d.h>
#include "glbuffers.h"
-class ItemBase : public QObject, public QGraphicsItem
+class ItemBase : public QGraphicsItem
{
- Q_OBJECT
public:
+ enum { Type = UserType + 1 };
+
ItemBase(int size, int x, int y);
virtual ~ItemBase();
virtual QRectF boundingRect() const;
@@ -64,6 +65,7 @@ protected:
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void keyPressEvent(QKeyEvent *event);
virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
+ virtual int type() const;
bool isInResizeArea(const QPointF &pos);
static void duplicateSelectedItems(QGraphicsScene *scene);
diff --git a/demos/sub-attaq/graphicsscene.cpp b/demos/sub-attaq/graphicsscene.cpp
index b4fd0c9..79de011 100644
--- a/demos/sub-attaq/graphicsscene.cpp
+++ b/demos/sub-attaq/graphicsscene.cpp
@@ -51,6 +51,7 @@
#include "animationmanager.h"
#include "qanimationstate.h"
#include "progressitem.h"
+#include "textinformationitem.h"
//Qt
#include <QtCore/QPropertyAnimation>
@@ -112,6 +113,8 @@ GraphicsScene::GraphicsScene(int x, int y, int width, int height, Mode mode)
//The item that display score and level
progressItem = new ProgressItem(backgroundItem);
+ textInformationItem = new TextInformationItem(backgroundItem);
+ textInformationItem->hide();
//We create the boat
boat = new Boat();
addItem(boat);
@@ -244,15 +247,15 @@ void GraphicsScene::setupScene(const QList<QAction *> &actions)
lettersFadingState->setAnimation(lettersGroupFading);
//if new game then we fade out the welcome screen and start playing
- lettersMovingState->addTransition(newAction, SIGNAL(triggered()),lettersFadingState);
- lettersFadingState->addTransition(lettersFadingState, SIGNAL(animationFinished()),gameState);
+ lettersMovingState->addTransition(newAction, SIGNAL(triggered()), lettersFadingState);
+ lettersFadingState->addTransition(lettersFadingState, SIGNAL(animationFinished()), gameState);
//New Game is triggered then player start playing
- gameState->addTransition(newAction, SIGNAL(triggered()),gameState);
+ gameState->addTransition(newAction, SIGNAL(triggered()), gameState);
//Wanna quit, then connect to CTRL+Q
- gameState->addTransition(quitAction, SIGNAL(triggered()),final);
- lettersMovingState->addTransition(quitAction, SIGNAL(triggered()),final);
+ gameState->addTransition(quitAction, SIGNAL(triggered()), final);
+ lettersMovingState->addTransition(quitAction, SIGNAL(triggered()), final);
//Welcome screen is the initial state
machine->setInitialState(lettersMovingState);
diff --git a/demos/sub-attaq/graphicsscene.h b/demos/sub-attaq/graphicsscene.h
index 073ad17..8fa62f7 100644
--- a/demos/sub-attaq/graphicsscene.h
+++ b/demos/sub-attaq/graphicsscene.h
@@ -54,6 +54,7 @@ class Torpedo;
class Bomb;
class PixmapItem;
class ProgressItem;
+class TextInformationItem;
QT_BEGIN_NAMESPACE
class QAction;
QT_END_NAMESPACE
@@ -108,6 +109,7 @@ private:
Mode mode;
PixmapItem *backgroundItem;
ProgressItem *progressItem;
+ TextInformationItem *textInformationItem;
QAction * newAction;
QAction * quitAction;
Boat *boat;
diff --git a/demos/sub-attaq/states.cpp b/demos/sub-attaq/states.cpp
index 75a2615..5c809cb 100644
--- a/demos/sub-attaq/states.cpp
+++ b/demos/sub-attaq/states.cpp
@@ -47,6 +47,7 @@
#include "torpedo.h"
#include "animationmanager.h"
#include "progressitem.h"
+#include "textinformationitem.h"
//Qt
#include <QtGui/QMessageBox>
@@ -226,8 +227,15 @@ void LostState::onEntry(QEvent *)
//We clear the scene
scene->clearScene();
- //we have only one view
- QMessageBox::information(scene->views().at(0),"You lose",message);
+ //We inform the player
+ scene->textInformationItem->setMessage(message);
+ scene->textInformationItem->show();
+}
+
+void LostState::onExit(QEvent *)
+{
+ //we hide the information
+ scene->textInformationItem->hide();
}
/** Win State */
@@ -242,7 +250,7 @@ void WinState::onEntry(QEvent *)
QString message;
if (scene->levelsData.size() - 1 != game->currentLevel) {
- message = QString("You win the level %1. Your score is %2.\nPress Space to continue after closing this dialog.").arg(game->currentLevel+1).arg(game->score);
+ message = QString("You win the level %1. Your score is %2.\nPress Space to continue.").arg(game->currentLevel+1).arg(game->score);
//We increment the level number
game->currentLevel++;
} else {
@@ -253,8 +261,15 @@ void WinState::onEntry(QEvent *)
game->score = 0;
}
- //we have only one view
- QMessageBox::information(scene->views().at(0),"You win",message);
+ //We inform the player
+ scene->textInformationItem->setMessage(message);
+ scene->textInformationItem->show();
+}
+
+void WinState::onExit(QEvent *)
+{
+ //we hide the information
+ scene->textInformationItem->hide();
}
/** UpdateScore State */
diff --git a/demos/sub-attaq/states.h b/demos/sub-attaq/states.h
index 7635c0c..3176571 100644
--- a/demos/sub-attaq/states.h
+++ b/demos/sub-attaq/states.h
@@ -113,6 +113,7 @@ public:
protected:
void onEntry(QEvent *);
+ void onExit(QEvent *);
private :
GraphicsScene *scene;
PlayState *game;
@@ -125,6 +126,7 @@ public:
protected:
void onEntry(QEvent *);
+ void onExit(QEvent *);
private :
GraphicsScene *scene;
PlayState *game;
diff --git a/demos/sub-attaq/sub-attaq.pro b/demos/sub-attaq/sub-attaq.pro
index ad1327d..ba2b54b 100644
--- a/demos/sub-attaq/sub-attaq.pro
+++ b/demos/sub-attaq/sub-attaq.pro
@@ -1,5 +1,4 @@
contains(QT_CONFIG, opengl):QT += opengl
-
HEADERS += boat.h \
bomb.h \
mainwindow.h \
@@ -13,7 +12,8 @@ HEADERS += boat.h \
submarine_p.h \
custompropertyanimation.h \
qanimationstate.h \
- progressitem.h
+ progressitem.h \
+ textinformationitem.h
SOURCES += boat.cpp \
bomb.cpp \
main.cpp \
@@ -26,12 +26,18 @@ SOURCES += boat.cpp \
states.cpp \
custompropertyanimation.cpp \
qanimationstate.cpp \
- progressitem.cpp
+ progressitem.cpp \
+ textinformationitem.cpp
RESOURCES += subattaq.qrc
# install
target.path = $$[QT_INSTALL_DEMOS]/animation/sub-attaq
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS sub-attaq.pro pics
+sources.files = $$SOURCES \
+ $$HEADERS \
+ $$RESOURCES \
+ $$FORMS \
+ sub-attaq.pro \
+ pics
sources.path = $$[QT_INSTALL_DEMOS]/animation/sub-attaq
-INSTALLS += target sources
-
+INSTALLS += target \
+ sources
diff --git a/examples/effects/lighting/shadoweffect.cpp b/demos/sub-attaq/textinformationitem.cpp
index 16e52fb..759aa56 100644
--- a/examples/effects/lighting/shadoweffect.cpp
+++ b/demos/sub-attaq/textinformationitem.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the examples of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -38,39 +38,17 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+#include "textinformationitem.h"
+#include "pixmapitem.h"
-#include "shadoweffect.h"
-
-#include <math.h>
-
-ShadowEffect::ShadowEffect(QGraphicsItem *item, QGraphicsItem *source)
- : QGraphicsDropShadowEffect()
- , item(item), m_lightSource(source)
-{
- setBlurRadius(8);
- m_color = color();
-}
-
-void ShadowEffect::adjustForItem()
+TextInformationItem::TextInformationItem (QGraphicsItem * parent)
+ : QGraphicsTextItem(parent)
{
- QPointF delta = item->pos() - m_lightSource->pos();
- setOffset(delta.toPoint() / 30);
-
- qreal dx = delta.x();
- qreal dy = delta.y();
- qreal dd = sqrt(dx * dx + dy * dy);
- m_color.setAlphaF(qBound(0.4, 1 - dd / 200.0, 0.7));
- setColor(m_color);
+ setFont(QFont("Comic Sans MS", 25));
}
-
-QRectF ShadowEffect::boundingRectFor(const QRectF &rect) const
-{
- const_cast<ShadowEffect *>(this)->adjustForItem();
- return QGraphicsDropShadowEffect::boundingRectFor(rect);
-}
-
-void ShadowEffect::draw(QPainter *painter, QGraphicsEffectSource *source)
+#include <QDebug>
+void TextInformationItem::setMessage(const QString& text)
{
- adjustForItem();
- QGraphicsDropShadowEffect::draw(painter, source);
+ setHtml(text);
+ setPos(parentItem()->boundingRect().center().x() - boundingRect().size().width()/2 , parentItem()->boundingRect().center().y());
}
diff --git a/examples/effects/lighting/shadoweffect.h b/demos/sub-attaq/textinformationitem.h
index 64314e5..aa7f0be 100644
--- a/examples/effects/lighting/shadoweffect.h
+++ b/demos/sub-attaq/textinformationitem.h
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the examples of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -39,28 +39,17 @@
**
****************************************************************************/
-#ifndef SHADOWEFFECT_H
-#define SHADOWEFFECT_H
+#ifndef TEXTINFORMATIONITEM_H
+#define TEXTINFORMATIONITEM_H
-#include <QGraphicsEffect>
-#include <QGraphicsItem>
+//Qt
+#include <QtGui/QGraphicsTextItem>
-class ShadowEffect: public QGraphicsDropShadowEffect
+class TextInformationItem : public QGraphicsTextItem
{
public:
- ShadowEffect(QGraphicsItem *item, QGraphicsItem *source);
-
- QRectF boundingRectFor(const QRectF &rect) const;
-
- void draw(QPainter *painter, QGraphicsEffectSource *source);
-
-private:
- void adjustForItem();
-
-private:
- QColor m_color;
- QGraphicsItem *item;
- QGraphicsItem *m_lightSource;
+ TextInformationItem(QGraphicsItem * parent = 0);
+ void setMessage(const QString& text);
};
-#endif // SHADOWEFFECT_H
+#endif // TEXTINFORMATIONITEM_H
diff --git a/doc/src/examples/diagramscene.qdoc b/doc/src/examples/diagramscene.qdoc
index 9f5d785..2011aa9 100644
--- a/doc/src/examples/diagramscene.qdoc
+++ b/doc/src/examples/diagramscene.qdoc
@@ -704,7 +704,7 @@
We use \c itemChange() and \c focusOutEvent() to notify the
\c DiagramScene when the text item loses focus and gets selected.
- Vi reimplement the functions that handle mouse events to make it
+ We reimplement the functions that handle mouse events to make it
possible to alter the mouse behavior of QGraphicsTextItem.
\section1 DiagramTextItem Implementation
@@ -729,7 +729,8 @@
\snippet examples/graphicsview/diagramscene/diagramtextitem.cpp 2
\c DiagramScene uses the signal emitted when the text item looses
- remove the item if it is empty, i.e., it contains no text.
+ focus to remove the item if it is empty, i.e., it contains no
+ text.
This is the implementation of \c mouseDoubleClickEvent():
@@ -838,7 +839,7 @@
\snippet examples/graphicsview/diagramscene/arrow.cpp 7
- If the line is selected we draw to dotted lines that are
+ If the line is selected, we draw two dotted lines that are
parallel with the line of the arrow. We do not use the default
implementation, which uses \l{QGraphicsItem::}{boundingRect()}
because the QRect bounding rectangle is considerably larger than
diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc
index 3619243..4307e0e 100644
--- a/doc/src/getting-started/installation.qdoc
+++ b/doc/src/getting-started/installation.qdoc
@@ -652,7 +652,9 @@ If you are using pre-built binaries, follow the instructions
\section1 OpenSSL (version 0.9.7 or later)
Support for \l{SSL}{Secure Sockets Layer (SSL)} communication is provided by the
- \l{OpenSSL Toolkit}, which must be obtained separately.
+ \l{OpenSSL Toolkit}, which must be obtained separately. More information about
+ enabling SSL support can be found in the \l{Secure Sockets Layer (SSL) Classes}
+ document.
\section1 Platform-Specific Requirements
diff --git a/doc/src/network-programming/ssl.qdoc b/doc/src/network-programming/ssl.qdoc
index fa37cb9..8117823 100644
--- a/doc/src/network-programming/ssl.qdoc
+++ b/doc/src/network-programming/ssl.qdoc
@@ -54,6 +54,32 @@
See the \l{General Qt Requirements} page for information about the
versions of OpenSSL that are known to work with Qt.
+ \section1 Enabling and Disabling SSL Support
+
+ When building Qt from source, the configuration system checks for the presence
+ of the \c{openssl/opensslv.h} header provided by source or developer packages
+ of OpenSSL.
+
+ By default, an SSL-enabled Qt library dynamically loads any installed OpenSSL
+ library at run-time. However, it is possible to link against the library at
+ compile-time by configuring Qt with the \c{-openssl-linked} option.
+
+ When building a version of Qt linked against OpenSSL, the build system will
+ attempt to link with libssl and libcrypt libraries located in the default
+ location on the developer's system. This location is configurable:
+ set the \c OPENSSL_LIBS environment variable to contain the linker options
+ required to link Qt against the installed library. For example, on a Unix/Linux
+ system:
+
+ \code
+ ./configure -openssl-linked OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto'
+ \endcode
+
+ To disable SSL support in a Qt build, configure Qt with the \c{-no-openssl}
+ option.
+
+ \section1 Licensing Information
+
\note Due to import and export restrictions in some parts of the world, we
are unable to supply the OpenSSL Toolkit with Qt packages. Developers wishing
to use SSL communication in their deployed applications should either ensure
diff --git a/doc/src/snippets/code/src_corelib_io_qsettings.cpp b/doc/src/snippets/code/src_corelib_io_qsettings.cpp
index 12a204b..c380d19 100644
--- a/doc/src/snippets/code/src_corelib_io_qsettings.cpp
+++ b/doc/src/snippets/code/src_corelib_io_qsettings.cpp
@@ -309,7 +309,7 @@ int main(int argc, char *argv[])
const QSettings::Format XmlFormat =
QSettings::registerFormat("xml", readXmlFile, writeXmlFile);
- QSettings settings(XmlFormat, QSettings::UserSettings, "MySoft",
+ QSettings settings(XmlFormat, QSettings::UserScope, "MySoft",
"Star Runner");
...
diff --git a/doc/src/widgets-and-layouts/stylesheet.qdoc b/doc/src/widgets-and-layouts/stylesheet.qdoc
index 6355850..354050d 100644
--- a/doc/src/widgets-and-layouts/stylesheet.qdoc
+++ b/doc/src/widgets-and-layouts/stylesheet.qdoc
@@ -2067,6 +2067,9 @@
QMenuBar, QPushButton, QRadioButton, QSizeGrip, QSpinBox,
QSplitter, QStatusBar, QTextEdit, and QToolTip.
+ The value is relative to the contents rect in the \l{The
+ Box Model}{box model}.
+
Example:
\snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 63
@@ -2084,6 +2087,9 @@
QMenuBar, QPushButton, QRadioButton, QSizeGrip, QSpinBox,
QSplitter, QStatusBar, QTextEdit, and QToolTip.
+ The value is relative to the contents rect in the \l{The
+ Box Model}{box model}.
+
Example:
\snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 64
@@ -2121,6 +2127,9 @@
If this property is not specified, the minimum height is
derived based on the widget's contents and the style.
+ The value is relative to the contents rect in the \l{The
+ Box Model}{box model}.
+
Example:
\snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 66
@@ -2141,6 +2150,9 @@
If this property is not specified, the minimum width is
derived based on the widget's contents and the style.
+ The value is relative to the contents rect in the \l{The
+ Box Model}{box model}.
+
Example:
\snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 67
diff --git a/examples/animation/states/main.cpp b/examples/animation/states/main.cpp
index a78548c..9644049 100644
--- a/examples/animation/states/main.cpp
+++ b/examples/animation/states/main.cpp
@@ -179,8 +179,8 @@ int main(int argc, char *argv[])
// State 3
state3->assignProperty(button, "text", "Switch to state 1");
- state3->assignProperty(p1, "geometry", QRectF(5, 5, 64, 64));
- state3->assignProperty(p2, "geometry", QRectF(5, 5 + 64 + 5, 64, 64));
+ state3->assignProperty(p1, "geometry", QRectF(0, 5, 64, 64));
+ state3->assignProperty(p2, "geometry", QRectF(0, 5 + 64 + 5, 64, 64));
state3->assignProperty(p3, "geometry", QRectF(5, 5 + (64 + 5) + 64, 64, 64));
state3->assignProperty(p4, "geometry", QRectF(5 + 64 + 5, 5, 64, 64));
state3->assignProperty(p5, "geometry", QRectF(5 + 64 + 5, 5 + 64 + 5, 64, 64));
diff --git a/examples/effects/lighting/lighting.cpp b/examples/effects/lighting/lighting.cpp
index 2294b36..e309e2e 100644
--- a/examples/effects/lighting/lighting.cpp
+++ b/examples/effects/lighting/lighting.cpp
@@ -43,8 +43,6 @@
#include <QtGui>
-#include "shadoweffect.h"
-
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
@@ -98,7 +96,7 @@ void Lighting::setupScene()
item->setPen(QPen(Qt::black));
item->setBrush(QBrush(Qt::white));
- item->setGraphicsEffect(new ShadowEffect(item, m_lightSource));
+ item->setGraphicsEffect(new QGraphicsDropShadowEffect);
item->setZValue(1);
item->setPos(i * 80, j * 80);
m_scene.addItem(item);
@@ -114,6 +112,24 @@ void Lighting::animate()
qreal xs = 200 * sin(angle) - 40 + 25;
qreal ys = 200 * cos(angle) - 40 + 25;
m_lightSource->setPos(xs, ys);
+
+ for (int i = 0; i < m_items.size(); ++i) {
+ QGraphicsItem *item = m_items.at(i);
+ Q_ASSERT(item);
+ QGraphicsDropShadowEffect *effect = static_cast<QGraphicsDropShadowEffect *>(item->graphicsEffect());
+ Q_ASSERT(effect);
+
+ QPointF delta(item->x() - xs, item->y() - ys);
+ effect->setOffset(delta.toPoint() / 30);
+
+ qreal dx = delta.x();
+ qreal dy = delta.y();
+ qreal dd = sqrt(dx * dx + dy * dy);
+ QColor color = effect->color();
+ color.setAlphaF(qBound(0.4, 1 - dd / 200.0, 0.7));
+ effect->setColor(color);
+ }
+
m_scene.update();
}
diff --git a/examples/effects/lighting/lighting.h b/examples/effects/lighting/lighting.h
index 3e12fdf..eef5cae 100644
--- a/examples/effects/lighting/lighting.h
+++ b/examples/effects/lighting/lighting.h
@@ -45,8 +45,6 @@
#include <QGraphicsEffect>
#include <QGraphicsView>
-#include "shadoweffect.h"
-
class Lighting: public QGraphicsView
{
Q_OBJECT
diff --git a/examples/effects/lighting/lighting.pro b/examples/effects/lighting/lighting.pro
index ea9d5f6..432d1b5 100644
--- a/examples/effects/lighting/lighting.pro
+++ b/examples/effects/lighting/lighting.pro
@@ -1,5 +1,5 @@
-SOURCES += main.cpp lighting.cpp shadoweffect.cpp
-HEADERS += lighting.h shadoweffect.h
+SOURCES += main.cpp lighting.cpp
+HEADERS += lighting.h
# install
target.path = $$[QT_INSTALL_EXAMPLES]/effects/lighting
diff --git a/examples/graphicsview/padnavigator/main.cpp b/examples/graphicsview/padnavigator/main.cpp
index a984eab..30e1dc3 100644
--- a/examples/graphicsview/padnavigator/main.cpp
+++ b/examples/graphicsview/padnavigator/main.cpp
@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
Panel panel(3, 3);
panel.setFocus();
- panel.showFullScreen();
+ panel.show();
return app.exec();
}
diff --git a/examples/qws/dbscreen/dbscreen.cpp b/examples/qws/dbscreen/dbscreen.cpp
index aa33a97..3d3b15b 100644
--- a/examples/qws/dbscreen/dbscreen.cpp
+++ b/examples/qws/dbscreen/dbscreen.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
diff --git a/examples/qws/dbscreen/dbscreen.h b/examples/qws/dbscreen/dbscreen.h
index a3c392e..b177cfc 100644
--- a/examples/qws/dbscreen/dbscreen.h
+++ b/examples/qws/dbscreen/dbscreen.h
@@ -1,11 +1,11 @@
- /****************************************************************************
- **
- ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
- **
- ** This file is part of the examples of the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:LGPL$
+**
+** This file is part of the examples 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
@@ -36,11 +36,8 @@
**
**
** $QT_END_LICENSE$
- **
- ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
- ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- **
- ****************************************************************************/
+**
+****************************************************************************/
#ifndef DBSCREEN_H
#define DBSCREEN_H
diff --git a/examples/webkit/fancybrowser/mainwindow.cpp b/examples/webkit/fancybrowser/mainwindow.cpp
index ecca36b..06b1e30 100644
--- a/examples/webkit/fancybrowser/mainwindow.cpp
+++ b/examples/webkit/fancybrowser/mainwindow.cpp
@@ -56,6 +56,8 @@ MainWindow::MainWindow()
file.close();
//! [1]
+ QNetworkProxyFactory::setUseSystemConfigurationEnabled(true);
+
//! [2]
view = new QWebView(this);
view->load(QUrl("http://www.google.com/ncr"));
diff --git a/examples/webkit/googlechat/main.cpp b/examples/webkit/googlechat/main.cpp
index 31937ee..09d94ef 100644
--- a/examples/webkit/googlechat/main.cpp
+++ b/examples/webkit/googlechat/main.cpp
@@ -40,11 +40,15 @@
****************************************************************************/
#include <QtGui>
+#include <QNetworkProxyFactory>
#include "googlechat.h"
int main(int argc, char * argv[])
{
QApplication app(argc, argv);
+
+ QNetworkProxyFactory::setUseSystemConfigurationEnabled(true);
+
GoogleChat *chat = new GoogleChat;
chat->show();
return app.exec();
diff --git a/examples/widgets/tablet/tabletcanvas.cpp b/examples/widgets/tablet/tabletcanvas.cpp
index abb667c..612a635 100644
--- a/examples/widgets/tablet/tabletcanvas.cpp
+++ b/examples/widgets/tablet/tabletcanvas.cpp
@@ -98,8 +98,10 @@ void TabletCanvas::tabletEvent(QTabletEvent *event)
switch (event->type()) {
case QEvent::TabletPress:
- if (!deviceDown)
+ if (!deviceDown) {
deviceDown = true;
+ polyLine[0] = polyLine[1] = polyLine[2] = event->pos();
+ }
break;
case QEvent::TabletRelease:
if (deviceDown)
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp
index 8371229..4a33e67 100644
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp
@@ -684,6 +684,10 @@ void JIT::emit_op_catch(Instruction* currentInstruction)
killLastResultRegister(); // FIXME: Implicitly treat op_catch as a labeled statement, and remove this line of code.
peek(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof (void*));
emitPutVirtualRegister(currentInstruction[1].u.operand);
+#ifdef QT_BUILD_SCRIPT_LIB
+ JITStubCall stubCall(this, JITStubs::cti_op_debug_catch);
+ stubCall.call();
+#endif
}
void JIT::emit_op_jmp_scopes(Instruction* currentInstruction)
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp
index 2563848..f0d3b84 100644
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp
@@ -2713,15 +2713,22 @@ DEFINE_STUB_FUNCTION(void, op_debug)
int debugHookID = stackFrame.args[0].int32();
int firstLine = stackFrame.args[1].int32();
int lastLine = stackFrame.args[2].int32();
-#ifdef QT_BUILD_SCRIPT_LIB
int column = stackFrame.args[3].int32();
-#else
- int column = -1;
-#endif
stackFrame.globalData->interpreter->debug(callFrame, static_cast<DebugHookID>(debugHookID), firstLine, lastLine, column);
}
+#ifdef QT_BUILD_SCRIPT_LIB
+DEFINE_STUB_FUNCTION(void, op_debug_catch)
+{
+ STUB_INIT_STACK_FRAME(stackFrame);
+ CallFrame* callFrame = stackFrame.callFrame;
+ if (JSC::Debugger* debugger = callFrame->lexicalGlobalObject()->debugger() ) {
+ debugger->exceptionCatch(DebuggerCallFrame(callFrame), callFrame->codeBlock()->ownerNode()->sourceID());
+ }
+}
+#endif
+
DEFINE_STUB_FUNCTION(EncodedJSValue, vm_throw)
{
STUB_INIT_STACK_FRAME(stackFrame);
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h
index 0493189..60bf64a 100644
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h
+++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h
@@ -221,6 +221,9 @@ namespace JITStubs { extern "C" {
void JIT_STUB cti_op_create_arguments(STUB_ARGS_DECLARATION);
void JIT_STUB cti_op_create_arguments_no_params(STUB_ARGS_DECLARATION);
void JIT_STUB cti_op_debug(STUB_ARGS_DECLARATION);
+#ifdef QT_BUILD_SCRIPT_LIB
+ void JIT_STUB cti_op_debug_catch(STUB_ARGS_DECLARATION);
+#endif
void JIT_STUB cti_op_end(STUB_ARGS_DECLARATION);
void JIT_STUB cti_op_jmp_scopes(STUB_ARGS_DECLARATION);
void JIT_STUB cti_op_pop_scope(STUB_ARGS_DECLARATION);
diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp
index 621c836..94f85a5 100644
--- a/src/activeqt/container/qaxwidget.cpp
+++ b/src/activeqt/container/qaxwidget.cpp
@@ -1437,6 +1437,9 @@ extern Q_GUI_EXPORT bool qt_win_ignoreNextMouseReleaseEvent;
HRESULT WINAPI QAxClientSite::EnableModeless(BOOL fEnable)
{
+#if !defined(Q_OS_WINCE)
+ LockWindowUpdate(host->window()->winId());
+#endif
EnableWindow(host->window()->winId(), fEnable);
if (!fEnable) {
@@ -1447,7 +1450,9 @@ HRESULT WINAPI QAxClientSite::EnableModeless(BOOL fEnable)
QApplicationPrivate::leaveModal(host);
}
qt_win_ignoreNextMouseReleaseEvent = false;
-
+#if !defined(Q_OS_WINCE)
+ LockWindowUpdate(0);
+#endif
return S_OK;
}
diff --git a/src/corelib/arch/arch.pri b/src/corelib/arch/arch.pri
index a25027b..57bc80a 100644
--- a/src/corelib/arch/arch.pri
+++ b/src/corelib/arch/arch.pri
@@ -1,6 +1,9 @@
win32:HEADERS += arch/qatomic_windows.h \
arch/qatomic_generic.h
+win32-g++*:HEADERS += arch/qatomic_i386.h \
+ arch/qatomic_x86_64.h
+
mac:HEADERS += arch/qatomic_macosx.h \
arch/qatomic_generic.h
diff --git a/src/corelib/arch/qatomic_windows.h b/src/corelib/arch/qatomic_windows.h
index a826bd3..9b7ff5d 100644
--- a/src/corelib/arch/qatomic_windows.h
+++ b/src/corelib/arch/qatomic_windows.h
@@ -42,6 +42,197 @@
#ifndef QATOMIC_WINDOWS_H
#define QATOMIC_WINDOWS_H
+#ifndef Q_CC_MSVC
+
+// Mingw and other GCC platforms get inline assembly
+
+# ifdef __i386__
+# include "QtCore/qatomic_i386.h"
+# else
+# include "QtCore/qatomic_x86_64.h"
+# endif
+
+#else // Q_CC_MSVC
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef Q_OS_WINCE
+
+// use compiler intrinsics for all atomic functions
+# define QT_INTERLOCKED_PREFIX _
+# define QT_INTERLOCKED_PROTOTYPE __cdecl
+# define QT_INTERLOCKED_DECLARE_PROTOTYPES
+# define QT_INTERLOCKED_INTRINSIC
+
+#else // Q_OS_WINCE
+
+# if _WIN32_WCE < 0x600 && defined(_X86_)
+// For X86 Windows CE, include winbase.h to catch inline functions which
+// override the regular definitions inside of coredll.dll.
+// Though one could use the original version of Increment/Decrement, others are
+// not exported at all.
+# include <winbase.h>
+
+// It's safer to remove the volatile and let the compiler add it as needed.
+# define QT_INTERLOCKED_NO_VOLATILE
+
+# else // _WIN32_WCE >= 0x600 || !_X86_
+
+# define QT_INTERLOCKED_PROTOTYPE __cdecl
+# define QT_INTERLOCKED_DECLARE_PROTOTYPES
+
+# if _WIN32_WCE >= 0x600
+# if defined(_X86_)
+# define QT_INTERLOCKED_PREFIX _
+# define QT_INTERLOCKED_INTRINSIC
+# endif
+# else
+# define QT_INTERLOCKED_NO_VOLATILE
+# endif
+
+# endif // _WIN32_WCE >= 0x600 || !_X86_
+
+#endif // Q_OS_WINCE
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Prototype declaration
+
+#define QT_INTERLOCKED_CONCAT_I(prefix, suffix) \
+ prefix ## suffix
+#define QT_INTERLOCKED_CONCAT(prefix, suffix) \
+ QT_INTERLOCKED_CONCAT_I(prefix, suffix)
+
+// MSVC intrinsics prefix function names with an underscore
+#define QT_INTERLOCKED_FUNCTION(name) \
+ QT_INTERLOCKED_CONCAT(QT_INTERLOCKED_PREFIX, name)
+
+#ifdef QT_INTERLOCKED_NO_VOLATILE
+# define QT_INTERLOCKED_VOLATILE
+# define QT_INTERLOCKED_REMOVE_VOLATILE(a) qt_interlocked_remove_volatile(a)
+#else
+# define QT_INTERLOCKED_VOLATILE volatile
+# define QT_INTERLOCKED_REMOVE_VOLATILE(a) a
+#endif
+
+#ifndef QT_INTERLOCKED_PREFIX
+#define QT_INTERLOCKED_PREFIX
+#endif
+
+#ifndef QT_INTERLOCKED_PROTOTYPE
+#define QT_INTERLOCKED_PROTOTYPE
+#endif
+
+#ifdef QT_INTERLOCKED_DECLARE_PROTOTYPES
+#undef QT_INTERLOCKED_DECLARE_PROTOTYPES
+
+extern "C" {
+
+ long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedIncrement )(long QT_INTERLOCKED_VOLATILE *);
+ long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedDecrement )(long QT_INTERLOCKED_VOLATILE *);
+ long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedCompareExchange )(long QT_INTERLOCKED_VOLATILE *, long, long);
+ long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedExchange )(long QT_INTERLOCKED_VOLATILE *, long);
+ long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedExchangeAdd )(long QT_INTERLOCKED_VOLATILE *, long);
+
+# if !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86)
+ void * QT_INTERLOCKED_FUNCTION( InterlockedCompareExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *, void *);
+ void * QT_INTERLOCKED_FUNCTION( InterlockedExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *);
+ __int64 QT_INTERLOCKED_FUNCTION( InterlockedExchangeAdd64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64);
+# endif
+
+}
+
+#endif // QT_INTERLOCKED_DECLARE_PROTOTYPES
+
+#undef QT_INTERLOCKED_PROTOTYPE
+#undef QT_INTERLOCKED_VOLATILE
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifdef QT_INTERLOCKED_INTRINSIC
+#undef QT_INTERLOCKED_INTRINSIC
+
+# pragma intrinsic (_InterlockedIncrement)
+# pragma intrinsic (_InterlockedDecrement)
+# pragma intrinsic (_InterlockedExchange)
+# pragma intrinsic (_InterlockedCompareExchange)
+# pragma intrinsic (_InterlockedExchangeAdd)
+
+# ifndef _M_IX86
+# pragma intrinsic (_InterlockedCompareExchangePointer)
+# pragma intrinsic (_InterlockedExchangePointer)
+# pragma intrinsic (_InterlockedExchangeAdd64)
+# endif
+
+#endif // QT_INTERLOCKED_INTRINSIC
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Interlocked* replacement macros
+
+#define QT_INTERLOCKED_INCREMENT(value) \
+ QT_INTERLOCKED_FUNCTION(InterlockedIncrement)( \
+ QT_INTERLOCKED_REMOVE_VOLATILE( value ) )
+
+#define QT_INTERLOCKED_DECREMENT(value) \
+ QT_INTERLOCKED_FUNCTION(InterlockedDecrement)( \
+ QT_INTERLOCKED_REMOVE_VOLATILE( value ) )
+
+#define QT_INTERLOCKED_COMPARE_EXCHANGE(value, newValue, expectedValue) \
+ QT_INTERLOCKED_FUNCTION(InterlockedCompareExchange)( \
+ QT_INTERLOCKED_REMOVE_VOLATILE( value ), \
+ newValue, \
+ expectedValue )
+
+#define QT_INTERLOCKED_EXCHANGE(value, newValue) \
+ QT_INTERLOCKED_FUNCTION(InterlockedExchange)( \
+ QT_INTERLOCKED_REMOVE_VOLATILE( value ), \
+ newValue )
+
+#define QT_INTERLOCKED_EXCHANGE_ADD(value, valueToAdd) \
+ QT_INTERLOCKED_FUNCTION(InterlockedExchangeAdd)( \
+ QT_INTERLOCKED_REMOVE_VOLATILE( value ), \
+ valueToAdd )
+
+#if defined(Q_OS_WINCE) || defined(__i386__) || defined(_M_IX86)
+
+# define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \
+ reinterpret_cast<void *>( \
+ QT_INTERLOCKED_FUNCTION(InterlockedCompareExchange)( \
+ QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \
+ (long)( newValue ), \
+ (long)( expectedValue ) ))
+
+# define QT_INTERLOCKED_EXCHANGE_POINTER(value, newValue) \
+ QT_INTERLOCKED_FUNCTION(InterlockedExchange)( \
+ QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \
+ (quintptr)( newValue ) )
+
+# define QT_INTERLOCKED_EXCHANGE_ADD_POINTER(value, valueToAdd) \
+ QT_INTERLOCKED_FUNCTION(InterlockedExchangeAdd)( \
+ QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \
+ valueToAdd )
+
+#else // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86)
+
+# define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \
+ QT_INTERLOCKED_FUNCTION(InterlockedCompareExchangePointer)( \
+ QT_INTERLOCKED_REMOVE_VOLATILE( value ), \
+ newValue, \
+ expectedValue )
+
+# define QT_INTERLOCKED_EXCHANGE_POINTER(value, newValue) \
+ QT_INTERLOCKED_FUNCTION(InterlockedExchangePointer)( \
+ QT_INTERLOCKED_REMOVE_VOLATILE( value ), \
+ newValue )
+
+# define QT_INTERLOCKED_EXCHANGE_ADD_POINTER(value, valueToAdd) \
+ QT_INTERLOCKED_FUNCTION(InterlockedExchangeAdd64)( \
+ QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \
+ valueToAdd )
+
+#endif // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86)
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -107,369 +298,68 @@ template <typename T>
Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree()
{ return true; }
-#if defined(Q_CC_MSVC) || defined(Q_CC_MWERKS)
-
-// MSVC++ 6.0 doesn't generate correct code when optimizations are turned on!
-#if _MSC_VER < 1300 && defined (_M_IX86)
-
-inline bool QBasicAtomicInt::ref()
-{
- volatile int *pointer = &_q_value;
- unsigned char retVal;
- __asm {
- mov ECX,pointer
- lock inc DWORD ptr[ECX]
- setne retVal
- }
- return retVal != 0;
-}
-
-inline bool QBasicAtomicInt::deref()
-{
- volatile int *pointer = &_q_value;
- unsigned char retVal;
- __asm {
- mov ECX,pointer
- lock dec DWORD ptr[ECX]
- setne retVal
- }
- return retVal != 0;
-}
-
-inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue)
-{
- volatile int *pointer = &_q_value;
- __asm {
- mov EDX,pointer
- mov EAX,expectedValue
- mov ECX,newValue
- lock cmpxchg dword ptr[EDX],ECX
- mov newValue,EAX
- }
- return newValue == expectedValue;
-}
-
-
-inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue)
-{
- volatile int *pointer = &_q_value;
- __asm {
- mov EDX,pointer
- mov ECX,newValue
- lock xchg dword ptr[EDX],ECX
- mov newValue,ECX
- }
- return newValue;
-}
-
-
-inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd)
-{
- volatile int *pointer = &_q_value;
- __asm {
- mov EDX,pointer
- mov ECX,valueToAdd
- lock xadd dword ptr[EDX],ECX
- mov valueToAdd,ECX
- }
- return valueToAdd;
-}
+////////////////////////////////////////////////////////////////////////////////////////////////////
-template <typename T>
-Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue)
-{
- volatile void *pointer = &_q_value;
- __asm {
- mov EDX,pointer
- mov EAX,expectedValue
- mov ECX,newValue
- lock cmpxchg dword ptr[EDX],ECX
- mov newValue,EAX
- }
- return newValue == expectedValue;
-}
-
-template <typename T>
-Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue)
-{
- volatile void *pointer = &_q_value;
- __asm {
- mov EDX,pointer
- mov ECX,newValue
- lock xchg dword ptr[EDX],ECX
- mov newValue,ECX
- }
- return reinterpret_cast<T *>(newValue);
-}
-
-template <typename T>
-Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd)
+#ifdef QT_INTERLOCKED_NO_VOLATILE
+template <class T>
+Q_INLINE_TEMPLATE T *qt_interlocked_remove_volatile(T volatile *t)
{
- volatile void *pointer = &_q_value;
- valueToAdd *= sizeof(T);
- __asm {
- mov EDX,pointer
- mov ECX,valueToAdd
- lock xadd dword ptr[EDX],ECX
- mov pointer,ECX
- }
- return reinterpret_cast<T *>(const_cast<void *>(pointer));
+ return const_cast<T *>(t);
}
+#endif // !QT_INTERLOCKED_NO_VOLATILE
-#else
-
-#if !defined(Q_OS_WINCE) && !defined(Q_CC_MWERKS)
-// use compiler intrinsics for all atomic functions
-//those functions need to be define in the global namespace
-QT_END_NAMESPACE
-
-extern "C" {
- long __cdecl _InterlockedIncrement(volatile long *);
- long __cdecl _InterlockedDecrement(volatile long *);
- long __cdecl _InterlockedExchange(volatile long *, long);
- long __cdecl _InterlockedCompareExchange(volatile long *, long, long);
- long __cdecl _InterlockedExchangeAdd(volatile long *, long);
-}
-# pragma intrinsic (_InterlockedIncrement)
-# pragma intrinsic (_InterlockedDecrement)
-# pragma intrinsic (_InterlockedExchange)
-# pragma intrinsic (_InterlockedCompareExchange)
-# pragma intrinsic (_InterlockedExchangeAdd)
-
-# ifndef _M_IX86
-extern "C" {
- void *_InterlockedCompareExchangePointer(void * volatile *, void *, void *);
- void *_InterlockedExchangePointer(void * volatile *, void *);
- __int64 _InterlockedExchangeAdd64(__int64 volatile * Addend, __int64 Value);
-}
-# pragma intrinsic (_InterlockedCompareExchangePointer)
-# pragma intrinsic (_InterlockedExchangePointer)
-# pragma intrinsic (_InterlockedExchangeAdd64)
-# define _InterlockedExchangeAddPointer(a,b) \
- _InterlockedExchangeAdd64(reinterpret_cast<volatile __int64 *>(a), __int64(b))
-# else
-# define _InterlockedCompareExchangePointer(a,b,c) \
- _InterlockedCompareExchange(reinterpret_cast<volatile long *>(a), long(b), long(c))
-# define _InterlockedExchangePointer(a, b) \
- _InterlockedExchange(reinterpret_cast<volatile long *>(a), long(b))
-# define _InterlockedExchangeAddPointer(a,b) \
- _InterlockedExchangeAdd(reinterpret_cast<volatile long *>(a), long(b))
-# endif
-
-QT_BEGIN_NAMESPACE
+////////////////////////////////////////////////////////////////////////////////////////////////////
inline bool QBasicAtomicInt::ref()
{
- return _InterlockedIncrement(reinterpret_cast<volatile long *>(&_q_value)) != 0;
+ return QT_INTERLOCKED_INCREMENT(&_q_value) != 0;
}
inline bool QBasicAtomicInt::deref()
{
- return _InterlockedDecrement(reinterpret_cast<volatile long *>(&_q_value)) != 0;
+ return QT_INTERLOCKED_DECREMENT(&_q_value) != 0;
}
inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue)
{
- return _InterlockedCompareExchange(reinterpret_cast<volatile long *>(&_q_value), newValue, expectedValue) == expectedValue;
+ return QT_INTERLOCKED_COMPARE_EXCHANGE(&_q_value, newValue, expectedValue)
+ == expectedValue;
}
inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue)
{
- return _InterlockedExchange(reinterpret_cast<volatile long *>(&_q_value), newValue);
+ return QT_INTERLOCKED_EXCHANGE(&_q_value, newValue);
}
inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd)
{
- return _InterlockedExchangeAdd(reinterpret_cast<volatile long *>(&_q_value), valueToAdd);
+ return QT_INTERLOCKED_EXCHANGE_ADD(&_q_value, valueToAdd);
}
-#if defined(Q_CC_MSVC)
-#pragma warning( push )
-#pragma warning( disable : 4311 ) // ignoring the warning from /Wp64
-#endif
+////////////////////////////////////////////////////////////////////////////////////////////////////
template <typename T>
Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue)
{
- return (_InterlockedCompareExchangePointer(reinterpret_cast<void * volatile *>(&_q_value),
- newValue, expectedValue) ==
-#ifndef _M_IX86
- (void *)
-#else
- (long)
-#endif
- (expectedValue));
-}
-
-#if defined(Q_CC_MSVC)
-#pragma warning( pop )
-#endif
-
-template <typename T>
-Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue)
-{
- return reinterpret_cast<T *>(_InterlockedExchangePointer(reinterpret_cast<void * volatile *>(&_q_value), newValue));
+ return QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(&_q_value, newValue, expectedValue)
+ == expectedValue;
}
template <typename T>
-Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd)
-{
- return reinterpret_cast<T *>(_InterlockedExchangeAddPointer(reinterpret_cast<void * volatile *>(&_q_value), valueToAdd * sizeof(T)));
-}
-
-#else // Q_OS_WINCE
-
-#if (_WIN32_WCE < 0x600 && defined(_X86_)) || defined(Q_CC_MWERKS)
-// For X86 Windows CE build we need to include winbase.h to be able
-// to catch the inline functions which overwrite the regular
-// definitions inside of coredll.dll. Though one could use the
-// original version of Increment/Decrement, the others are not
-// exported at all.
-#include <winbase.h>
-#else
-#if _WIN32_WCE >= 0x600 || defined(Q_CC_MWERKS)
-#define Q_ARGUMENT_TYPE volatile
-# if defined(_X86_)
-# define InterlockedIncrement _InterlockedIncrement
-# define InterlockedDecrement _InterlockedDecrement
-# define InterlockedExchange _InterlockedExchange
-# define InterlockedCompareExchange _InterlockedCompareExchange
-# define InterlockedExchangeAdd _InterlockedExchangeAdd
-# endif
-#else
-#define Q_ARGUMENT_TYPE
-#endif
-
-QT_END_NAMESPACE
-
-extern "C" {
-long __cdecl InterlockedIncrement(long Q_ARGUMENT_TYPE * lpAddend);
-long __cdecl InterlockedDecrement(long Q_ARGUMENT_TYPE * lpAddend);
-long __cdecl InterlockedExchange(long Q_ARGUMENT_TYPE * Target, long Value);
-long __cdecl InterlockedCompareExchange(long Q_ARGUMENT_TYPE * Destination, long Exchange, long Comperand);
-long __cdecl InterlockedExchangeAdd(long Q_ARGUMENT_TYPE * Addend, long Value);
-}
-
-#if _WIN32_WCE >= 0x600 && defined(_X86_)
-# pragma intrinsic (_InterlockedIncrement)
-# pragma intrinsic (_InterlockedDecrement)
-# pragma intrinsic (_InterlockedExchange)
-# pragma intrinsic (_InterlockedCompareExchange)
-# pragma intrinsic (_InterlockedExchangeAdd)
-#endif
-
-QT_BEGIN_NAMESPACE
-
-#endif
-
-
-inline bool QBasicAtomicInt::ref()
-{
- return InterlockedIncrement((long*)(&_q_value)) != 0;
-}
-
-inline bool QBasicAtomicInt::deref()
-{
- return InterlockedDecrement((long*)(&_q_value)) != 0;
-}
-
-inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue)
-{
- return InterlockedCompareExchange((long*)(&_q_value), newValue, expectedValue) == expectedValue;
-}
-
-inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue)
-{
- return InterlockedExchange((long*)(&_q_value), newValue);
-}
-
-inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd)
-{
- return InterlockedExchangeAdd((long*)(&_q_value), valueToAdd);
-}
-
-template <typename T>
-Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue)
-{
- return (InterlockedCompareExchange((long*)(&_q_value),
- (long)newValue, (long)expectedValue) ==
- (long)(expectedValue));
-}
-
-template <typename T>
-Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue)
+Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T* newValue)
{
- return reinterpret_cast<T *>(InterlockedExchange((long*)(&_q_value), (long)newValue));
+ return reinterpret_cast<T *>(
+ QT_INTERLOCKED_EXCHANGE_POINTER(&_q_value, newValue));
}
template <typename T>
Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd)
{
- return reinterpret_cast<T *>(InterlockedExchangeAdd((long*)(&_q_value), valueToAdd * sizeof(T)));
-}
-
-#endif //Q_OS_WINCE
-
-#endif // _MSC_VER ...
-
-#else
-
-// __INTERLOCKED_DECLARED is defined in MinGW's winbase.h. Simply, preferrably we use
-// MinGW's definition, such that we pick up variations in the headers.
-#ifndef __INTERLOCKED_DECLARED
-#define __INTERLOCKED_DECLARED
-QT_END_NAMESPACE
-
-extern "C" {
- __declspec(dllimport) long __stdcall InterlockedCompareExchange(long *, long, long);
- __declspec(dllimport) long __stdcall InterlockedIncrement(long *);
- __declspec(dllimport) long __stdcall InterlockedDecrement(long *);
- __declspec(dllimport) long __stdcall InterlockedExchange(long *, long);
- __declspec(dllimport) long __stdcall InterlockedExchangeAdd(long *, long);
-}
-
-QT_BEGIN_NAMESPACE
-#endif
-
-inline bool QBasicAtomicInt::ref()
-{
- return InterlockedIncrement(reinterpret_cast<long *>(const_cast<int *>(&_q_value))) != 0;
-}
-
-inline bool QBasicAtomicInt::deref()
-{
- return InterlockedDecrement(reinterpret_cast<long *>(const_cast<int *>(&_q_value))) != 0;
+ return reinterpret_cast<T *>(
+ QT_INTERLOCKED_EXCHANGE_ADD_POINTER(&_q_value, valueToAdd * sizeof(T)));
}
-inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue)
-{
- return InterlockedCompareExchange(reinterpret_cast<long *>(const_cast<int *>(&_q_value)), newValue, expectedValue) == expectedValue;
-}
-
-inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue)
-{ return InterlockedExchange(reinterpret_cast<long *>(const_cast<int *>(&_q_value)), newValue); }
-
-inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd)
-{
- return InterlockedExchangeAdd(reinterpret_cast<long *>(const_cast<int *>(&_q_value)), valueToAdd);
-}
-
-template <typename T>
-Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T* newValue)
-{ return InterlockedCompareExchange(reinterpret_cast<long *>(const_cast<T **>(&_q_value)),
- reinterpret_cast<long>(newValue),
- reinterpret_cast<long>(expectedValue)) == reinterpret_cast<long>(expectedValue); }
-
-template <typename T>
-Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T* newValue)
-{ return reinterpret_cast<T *>(InterlockedExchange(reinterpret_cast<long *>(const_cast<T **>(&_q_value)),
- reinterpret_cast<long>(newValue))); }
-
-template <typename T>
-Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd)
-{ return reinterpret_cast<T *>(InterlockedExchangeAdd(reinterpret_cast<long *>(const_cast<T **>(&_q_value)), valueToAdd * sizeof(T))); }
-
-#endif // Q_CC_GNU
+////////////////////////////////////////////////////////////////////////////////////////////////////
inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue)
{
@@ -516,6 +406,8 @@ inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd)
return fetchAndAddOrdered(valueToAdd);
}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
template <typename T>
Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue)
{
@@ -570,8 +462,30 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueTo
return fetchAndAddOrdered(valueToAdd);
}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Cleanup
+
+#undef QT_INTERLOCKED_CONCAT_I
+#undef QT_INTERLOCKED_CONCAT
+#undef QT_INTERLOCKED_FUNCTION
+#undef QT_INTERLOCKED_PREFIX
+
+#undef QT_INTERLOCKED_NO_VOLATILE
+#undef QT_INTERLOCKED_REMOVE_VOLATILE
+
+#undef QT_INTERLOCKED_INCREMENT
+#undef QT_INTERLOCKED_DECREMENT
+#undef QT_INTERLOCKED_COMPARE_EXCHANGE
+#undef QT_INTERLOCKED_EXCHANGE
+#undef QT_INTERLOCKED_EXCHANGE_ADD
+#undef QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER
+#undef QT_INTERLOCKED_EXCHANGE_POINTER
+#undef QT_INTERLOCKED_EXCHANGE_ADD_POINTER
+
QT_END_NAMESPACE
QT_END_HEADER
+#endif // Q_CC_MSVC
+
#endif // QATOMIC_WINDOWS_H
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index c34fc31..765665c 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1364,6 +1364,9 @@ inline void qt_noop() {}
#ifdef QT_BOOTSTRAPPED
# define QT_NO_EXCEPTIONS
#endif
+#if defined(Q_CC_GNU) && !defined (__EXCEPTIONS)
+# define QT_NO_EXCEPTIONS
+#endif
#ifdef QT_NO_EXCEPTIONS
# define QT_TRY if (true)
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index 75f8e54..ac9f532 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -122,7 +122,12 @@ void debugBinaryString(const char *data, qint64 maxlen)
*/
QIODevicePrivate::QIODevicePrivate()
: openMode(QIODevice::NotOpen), buffer(QIODEVICE_BUFFERSIZE),
- pos(0), devicePos(0), accessMode(Unset)
+ pos(0), devicePos(0)
+ , baseReadLineDataCalled(false)
+ , accessMode(Unset)
+#ifdef QT_NO_QOBJECT
+ , q_ptr(0)
+#endif
{
}
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index f7049d3..5b6830c 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -411,6 +411,11 @@ void QProcessPrivate::Channel::clear()
process = 0;
}
+/*! \fn bool QProcessPrivate::startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid)
+
+\internal
+ */
+
/*!
\class QProcess
diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp
index e558387..d41321b 100644
--- a/src/corelib/io/qprocess_symbian.cpp
+++ b/src/corelib/io/qprocess_symbian.cpp
@@ -1009,8 +1009,6 @@ void QProcessPrivate::_q_notified()
// Nothing to do in Symbian
}
-/*! \internal
- */
bool QProcessPrivate::startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid)
{
QPROCESS_DEBUG_PRINT("QProcessPrivate::startDetached()");
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index baf90c4..d45ff03 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -1163,8 +1163,6 @@ void QProcessPrivate::_q_notified()
{
}
-/*! \internal
- */
bool QProcessPrivate::startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid)
{
processManager()->start();
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp
index 48f34d6..fa3ed09 100644
--- a/src/corelib/io/qtemporaryfile.cpp
+++ b/src/corelib/io/qtemporaryfile.cpp
@@ -292,14 +292,20 @@ class QTemporaryFileEngine : public QFSFileEngine
Q_DECLARE_PRIVATE(QFSFileEngine)
public:
QTemporaryFileEngine(const QString &file, bool fileIsTemplate = true)
- : QFSFileEngine(file), filePathIsTemplate(fileIsTemplate)
+ : QFSFileEngine(), filePathIsTemplate(fileIsTemplate)
{
+ Q_D(QFSFileEngine);
+ d->filePath = file;
+
+ if (!filePathIsTemplate)
+ QFSFileEngine::setFileName(file);
}
~QTemporaryFileEngine();
bool isReallyOpen();
void setFileName(const QString &file);
+ void setFileTemplate(const QString &fileTemplate);
bool open(QIODevice::OpenMode flags);
bool remove();
@@ -336,6 +342,13 @@ void QTemporaryFileEngine::setFileName(const QString &file)
QFSFileEngine::setFileName(file);
}
+void QTemporaryFileEngine::setFileTemplate(const QString &fileTemplate)
+{
+ Q_D(QFSFileEngine);
+ if (filePathIsTemplate)
+ d->filePath = fileTemplate;
+}
+
bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode)
{
Q_D(QFSFileEngine);
@@ -382,12 +395,19 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode)
return false;
}
+ QString template_ = d->filePath;
d->filePath = QString::fromLocal8Bit(filename);
- filePathIsTemplate = false;
d->nativeInitFileName();
- d->closeFileHandle = true;
delete [] filename;
- return QFSFileEngine::open(openMode);
+
+ if (QFSFileEngine::open(openMode)) {
+ filePathIsTemplate = false;
+ return true;
+ }
+
+ d->filePath = template_;
+ d->nativeFilePath.clear();
+ return false;
#endif
}
@@ -533,7 +553,8 @@ QTemporaryFile::QTemporaryFile()
QTemporaryFile::QTemporaryFile(const QString &templateName)
: QFile(*new QTemporaryFilePrivate, 0)
{
- setFileTemplate(templateName);
+ Q_D(QTemporaryFile);
+ d->templateName = templateName;
}
/*!
@@ -567,7 +588,8 @@ QTemporaryFile::QTemporaryFile(QObject *parent)
QTemporaryFile::QTemporaryFile(const QString &templateName, QObject *parent)
: QFile(*new QTemporaryFilePrivate, parent)
{
- setFileTemplate(templateName);
+ Q_D(QTemporaryFile);
+ d->templateName = templateName;
}
#endif
@@ -671,10 +693,10 @@ QString QTemporaryFile::fileTemplate() const
*/
void QTemporaryFile::setFileTemplate(const QString &name)
{
- Q_ASSERT(!isOpen());
Q_D(QTemporaryFile);
- fileEngine()->setFileName(name);
d->templateName = name;
+ if (d->fileEngine)
+ static_cast<QTemporaryFileEngine*>(d->fileEngine)->setFileTemplate(name);
}
/*!
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp
index 0a6c628..ec8fb76 100644
--- a/src/corelib/kernel/qabstractitemmodel.cpp
+++ b/src/corelib/kernel/qabstractitemmodel.cpp
@@ -601,7 +601,6 @@ void QAbstractItemModelPrivate::rowsInserted(const QModelIndex &parent,
void QAbstractItemModelPrivate::itemsAboutToBeMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation)
{
- Q_Q(QAbstractItemModel);
QVector<QPersistentModelIndexData *> persistent_moved_explicitly;
QVector<QPersistentModelIndexData *> persistent_moved_in_source;
QVector<QPersistentModelIndexData *> persistent_moved_in_destination;
@@ -2469,7 +2468,6 @@ void QAbstractItemModel::endRemoveRows()
*/
bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int start, int end, const QModelIndex &destinationParent, int destinationStart, Qt::Orientation orientation)
{
- Q_Q(QAbstractItemModel);
// Don't move the range within itself.
if ( ( destinationParent == srcParent )
&& ( destinationStart >= start )
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 30f1cc8..c311465 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -943,7 +943,7 @@ QByteArray QMetaObject::normalizedType(const char *type)
if (!type || !*type)
return result;
- QVarLengthArray<char> stackbuf((int)strlen(type));
+ QVarLengthArray<char> stackbuf(int(strlen(type)) + 1);
qRemoveWhitespace(type, stackbuf.data());
int templdepth = 0;
qNormalizeType(stackbuf.data(), templdepth, result);
@@ -968,10 +968,9 @@ QByteArray QMetaObject::normalizedSignature(const char *method)
if (!method || !*method)
return result;
int len = int(strlen(method));
- char stackbuf[64];
- char *buf = (len >= 64 ? new char[len+1] : stackbuf);
- qRemoveWhitespace(method, buf);
- char *d = buf;
+ QVarLengthArray<char> stackbuf(len + 1);
+ char *d = stackbuf.data();
+ qRemoveWhitespace(method, d);
result.reserve(len);
@@ -987,8 +986,6 @@ QByteArray QMetaObject::normalizedSignature(const char *method)
result += *d++;
}
- if (buf != stackbuf)
- delete [] buf;
return result;
}
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 4d9d3b2..c0c97b8 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -3364,10 +3364,10 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
&& (currentThreadData != sender->d_func()->threadData
|| receiver->d_func()->threadData != sender->d_func()->threadData))
|| (c->connectionType == Qt::QueuedConnection)) {
- queued_activate(sender, signal_absolute_index, c, argv);
+ queued_activate(sender, signal_absolute_index, c, argv ? argv : empty_argv);
continue;
} else if (c->connectionType == Qt::BlockingQueuedConnection) {
- blocking_activate(sender, signal_absolute_index, c, argv);
+ blocking_activate(sender, signal_absolute_index, c, argv ? argv : empty_argv);
continue;
}
@@ -3442,7 +3442,7 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
void QMetaObject::activate(QObject *sender, int signal_index, void **argv)
{
const QMetaObject *mo = sender->metaObject();
- while (mo && mo->methodOffset() > signal_index)
+ while (mo->methodOffset() > signal_index)
mo = mo->superClass();
activate(sender, mo, signal_index - mo->methodOffset(), argv);
}
@@ -3706,7 +3706,7 @@ void QObject::dumpObjectInfo()
const QMetaObject *mo = metaObject();
int signalOffset, methodOffset;
computeOffsets(mo, &signalOffset, &methodOffset);
- while (mo && signalOffset > signal_index) {
+ while (signalOffset > signal_index) {
mo = mo->superClass();
offsetToNextMetaObject = signalOffset;
computeOffsets(mo, &signalOffset, &methodOffset);
diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h
index e96b4d2..629fb3d 100644
--- a/src/corelib/thread/qbasicatomic.h
+++ b/src/corelib/thread/qbasicatomic.h
@@ -56,7 +56,13 @@ public:
#ifdef QT_ARCH_PARISC
int _q_lock[4];
#endif
+#if defined(QT_ARCH_WINDOWS) || defined(QT_ARCH_WINDOWSCE)
+ union { // needed for Q_BASIC_ATOMIC_INITIALIZER
+ volatile long _q_value;
+ };
+#else
volatile int _q_value;
+#endif
// Non-atomic API
inline bool operator==(int value) const
@@ -128,7 +134,14 @@ public:
#ifdef QT_ARCH_PARISC
int _q_lock[4];
#endif
+#if defined(QT_ARCH_WINDOWS) || defined(QT_ARCH_WINDOWSCE)
+ union {
+ T * volatile _q_value;
+ long volatile _q_value_integral;
+ };
+#else
T * volatile _q_value;
+#endif
// Non-atomic API
inline bool operator==(T *value) const
@@ -194,6 +207,8 @@ public:
#ifdef QT_ARCH_PARISC
# define Q_BASIC_ATOMIC_INITIALIZER(a) {{-1,-1,-1,-1},(a)}
+#elif defined(QT_ARCH_WINDOWS) || defined(QT_ARCH_WINDOWSCE)
+# define Q_BASIC_ATOMIC_INITIALIZER(a) { {(a)} }
#else
# define Q_BASIC_ATOMIC_INITIALIZER(a) { (a) }
#endif
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index ba8ae56..c2bdbee 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -52,6 +52,7 @@
#endif
#include <new>
+#include <string.h>
QT_BEGIN_HEADER
diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp
new file mode 100644
index 0000000..747ea5e
--- /dev/null
+++ b/src/corelib/tools/qmargins.cpp
@@ -0,0 +1,167 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore module 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 "qmargins.h"
+#include "qdatastream.h"
+#include "qdebug.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QMargins
+ \ingroup painting
+
+ \brief The QMargins class defines the four margins of a rectangle.
+
+ QMargin defines a set of four margins; left, top, right and bottom,
+ that describe the size of the borders surrounding a rectangle.
+
+ The isNull() function returns true only if all margins are set to zero.
+
+ QMargin objects can be streamed as well as compared.
+
+*/
+
+
+/*****************************************************************************
+ QMargins member functions
+ *****************************************************************************/
+
+/*!
+ \fn QMargins::QMargins()
+
+ Constructs a margins object with all margins set to 0.
+
+ \sa isNull()
+*/
+
+/*!
+ \fn QMargins::QMargins(int left, int top, int right, int bottom)
+
+ Constructs margins with the given \a left, \a top, \a right, \a bottom
+
+ \sa setLeft(), setRight(), setTop(), setBottom()
+*/
+
+/*!
+ \fn bool QMargins::isNull() const
+
+ Returns true if all margins are is 0; otherwise returns
+ false.
+*/
+
+
+/*!
+ \fn int QMargins::left() const
+
+ Returns the left margin.
+
+ \sa setLeft()
+*/
+
+/*!
+ \fn int QMargins::top() const
+
+ Returns the top margin.
+
+ \sa setTop()
+*/
+
+/*!
+ \fn int QMargins::right() const
+
+ Returns the right margin.
+*/
+
+/*!
+ \fn int QMargins::bottom() const
+
+ Returns the bottom margin.
+*/
+
+
+/*!
+ \fn void QMargins::setLeft(int left)
+
+ Sets the left margin to \a left.
+*/
+
+/*!
+ \fn void QMargins::setTop(int Top)
+
+ Sets the Top margin to \a Top.
+*/
+
+/*!
+ \fn void QMargins::setRight(int right)
+
+ Sets the right margin to \a right.
+*/
+
+/*!
+ \fn void QMargins::setBottom(int bottom)
+
+ Sets the bottom margin to \a bottom.
+*/
+
+/*!
+ \fn bool operator==(const QMargins &m1, const QMargins &m2)
+ \relates QMargins
+
+ Returns true if \a m1 and \a m2 are equal; otherwise returns false.
+*/
+
+/*!
+ \fn bool operator!=(const QMargins &m1, const QMargins &m2)
+ \relates QMargins
+
+ Returns true if \a m1 and \a m2 are different; otherwise returns false.
+*/
+
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QMargins &m) {
+ dbg.nospace() << "QMargins(" << m.left() << ", "
+ << m.top() << ", " << m.right() << ", " << m.bottom() << ')';
+ return dbg.space();
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/corelib/tools/qmargins.h b/src/corelib/tools/qmargins.h
new file mode 100644
index 0000000..549c634
--- /dev/null
+++ b/src/corelib/tools/qmargins.h
@@ -0,0 +1,147 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore module 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$
+**
+****************************************************************************/
+
+#ifndef QMARGINS_H
+#define QMARGINS_H
+
+#include <QtCore/qnamespace.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Core)
+
+class QMargins
+{
+public:
+ QMargins();
+ QMargins(int left, int top, int right, int bottom);
+
+ bool isNull() const;
+
+ int left() const;
+ int top() const;
+ int right() const;
+ int bottom() const;
+
+ void setLeft(int left);
+ void setTop(int top);
+ void setRight(int right);
+ void setBottom(int bottom);
+
+private:
+ int m_left;
+ int m_top;
+ int m_right;
+ int m_bottom;
+
+ friend inline bool operator==(const QMargins &, const QMargins &);
+ friend inline bool operator!=(const QMargins &, const QMargins &);
+};
+
+Q_DECLARE_TYPEINFO(QMargins, Q_MOVABLE_TYPE);
+
+/*****************************************************************************
+ QMargins inline functions
+ *****************************************************************************/
+
+inline QMargins::QMargins()
+{ m_top = m_bottom = m_left = m_right = 0; }
+
+inline QMargins::QMargins(int left, int top, int right, int bottom)
+{ m_left = left; m_top = top; m_right = right; m_bottom = bottom; }
+
+inline bool QMargins::isNull() const
+{ return m_left==0 && m_top==0 && m_right==0 && m_bottom==0; }
+
+inline int QMargins::left() const
+{ return m_left; }
+
+inline int QMargins::top() const
+{ return m_top; }
+
+inline int QMargins::right() const
+{ return m_right; }
+
+inline int QMargins::bottom() const
+{ return m_bottom; }
+
+
+inline void QMargins::setLeft(int left)
+{ m_left = left; }
+
+inline void QMargins::setTop(int top)
+{ m_top = top; }
+
+inline void QMargins::setRight(int right)
+{ m_right = right; }
+
+inline void QMargins::setBottom(int bottom)
+{ m_bottom = bottom; }
+
+inline bool operator==(const QMargins &m1, const QMargins &m2)
+{
+ return
+ m1.m_left == m2.m_left &&
+ m1.m_top == m2.m_top &&
+ m1.m_right == m2.m_right &&
+ m1.m_bottom == m2.m_bottom;
+}
+
+inline bool operator!=(const QMargins &m1, const QMargins &m2)
+{
+ return
+ m1.m_left != m2.m_left ||
+ m1.m_top != m2.m_top ||
+ m1.m_right != m2.m_right ||
+ m1.m_bottom != m2.m_bottom;
+}
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_CORE_EXPORT QDebug operator<<(QDebug, const QMargins &);
+#endif
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QMARGINS_H
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index 464c60f..007b763 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -1,77 +1,79 @@
# Qt tools module
HEADERS += \
- tools/qalgorithms.h \
- tools/qbitarray.h \
- tools/qbytearray.h \
- tools/qbytearraymatcher.h \
+ tools/qalgorithms.h \
+ tools/qbitarray.h \
+ tools/qbytearray.h \
+ tools/qbytearraymatcher.h \
tools/qbytedata_p.h \
- tools/qcache.h \
- tools/qchar.h \
- tools/qcontainerfwd.h \
- tools/qcryptographichash.h \
- tools/qdatetime.h \
- tools/qdatetime_p.h \
+ tools/qcache.h \
+ tools/qchar.h \
+ tools/qcontainerfwd.h \
+ tools/qcryptographichash.h \
+ tools/qdatetime.h \
+ tools/qdatetime_p.h \
tools/qeasingcurve.h \
- tools/qhash.h \
+ tools/qhash.h \
tools/qline.h \
- tools/qlinkedlist.h \
- tools/qlist.h \
- tools/qlocale.h \
- tools/qlocale_p.h \
- tools/qlocale_data_p.h \
- tools/qmap.h \
+ tools/qlinkedlist.h \
+ tools/qlist.h \
+ tools/qlocale.h \
+ tools/qlocale_p.h \
+ tools/qlocale_data_p.h \
+ tools/qmap.h \
+ tools/qmargins.h \
tools/qcontiguouscache.h \
tools/qpodlist_p.h \
tools/qpoint.h \
- tools/qqueue.h \
+ tools/qqueue.h \
tools/qrect.h \
- tools/qregexp.h \
- tools/qringbuffer_p.h \
- tools/qshareddata.h \
+ tools/qregexp.h \
+ tools/qringbuffer_p.h \
+ tools/qshareddata.h \
tools/qsharedpointer.h \
tools/qsharedpointer_impl.h \
- tools/qset.h \
+ tools/qset.h \
tools/qsize.h \
- tools/qstack.h \
- tools/qstring.h \
- tools/qstringbuilder.h \
- tools/qstringlist.h \
- tools/qstringmatcher.h \
- tools/qtextboundaryfinder.h \
- tools/qtimeline.h \
- tools/qunicodetables_p.h \
- tools/qvarlengtharray.h \
- tools/qvector.h \
+ tools/qstack.h \
+ tools/qstring.h \
+ tools/qstringbuilder.h \
+ tools/qstringlist.h \
+ tools/qstringmatcher.h \
+ tools/qtextboundaryfinder.h \
+ tools/qtimeline.h \
+ tools/qunicodetables_p.h \
+ tools/qvarlengtharray.h \
+ tools/qvector.h \
tools/qscopedpointer.h
SOURCES += \
- tools/qbitarray.cpp \
- tools/qbytearray.cpp \
- tools/qbytearraymatcher.cpp \
- tools/qcryptographichash.cpp \
- tools/qdatetime.cpp \
+ tools/qbitarray.cpp \
+ tools/qbytearray.cpp \
+ tools/qbytearraymatcher.cpp \
+ tools/qcryptographichash.cpp \
+ tools/qdatetime.cpp \
tools/qeasingcurve.cpp \
- tools/qhash.cpp \
+ tools/qhash.cpp \
tools/qline.cpp \
- tools/qlinkedlist.cpp \
- tools/qlist.cpp \
- tools/qlocale.cpp \
+ tools/qlinkedlist.cpp \
+ tools/qlist.cpp \
+ tools/qlocale.cpp \
tools/qpoint.cpp \
- tools/qmap.cpp \
- tools/qcontiguouscache.cpp \
+ tools/qmap.cpp \
+ tools/qmargins.cpp \
+ tools/qcontiguouscache.cpp \
tools/qrect.cpp \
- tools/qregexp.cpp \
- tools/qshareddata.cpp \
- tools/qsharedpointer.cpp \
+ tools/qregexp.cpp \
+ tools/qshareddata.cpp \
+ tools/qsharedpointer.cpp \
tools/qsize.cpp \
- tools/qstring.cpp \
- tools/qstringbuilder.cpp \
- tools/qstringlist.cpp \
- tools/qtextboundaryfinder.cpp \
- tools/qtimeline.cpp \
- tools/qvector.cpp \
+ tools/qstring.cpp \
+ tools/qstringbuilder.cpp \
+ tools/qstringlist.cpp \
+ tools/qtextboundaryfinder.cpp \
+ tools/qtimeline.cpp \
+ tools/qvector.cpp \
tools/qvsnprintf.cpp
symbian:SOURCES+=tools/qlocale_symbian.cpp
@@ -81,17 +83,17 @@ contains(QT_CONFIG, zlib) {
wince*: DEFINES += NO_ERRNO_H
INCLUDEPATH += ../3rdparty/zlib
SOURCES+= \
- ../3rdparty/zlib/adler32.c \
- ../3rdparty/zlib/compress.c \
- ../3rdparty/zlib/crc32.c \
- ../3rdparty/zlib/deflate.c \
- ../3rdparty/zlib/gzio.c \
- ../3rdparty/zlib/inffast.c \
- ../3rdparty/zlib/inflate.c \
- ../3rdparty/zlib/inftrees.c \
- ../3rdparty/zlib/trees.c \
- ../3rdparty/zlib/uncompr.c \
- ../3rdparty/zlib/zutil.c
+ ../3rdparty/zlib/adler32.c \
+ ../3rdparty/zlib/compress.c \
+ ../3rdparty/zlib/crc32.c \
+ ../3rdparty/zlib/deflate.c \
+ ../3rdparty/zlib/gzio.c \
+ ../3rdparty/zlib/inffast.c \
+ ../3rdparty/zlib/inflate.c \
+ ../3rdparty/zlib/inftrees.c \
+ ../3rdparty/zlib/trees.c \
+ ../3rdparty/zlib/uncompr.c \
+ ../3rdparty/zlib/zutil.c
} else:!contains(QT_CONFIG, no-zlib) {
unix:LIBS_PRIVATE += -lz
# win32:LIBS += libz.lib
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp
index ccbf7fc..f60e80e 100644
--- a/src/gui/effects/qgraphicseffect.cpp
+++ b/src/gui/effects/qgraphicseffect.cpp
@@ -335,7 +335,7 @@ void QGraphicsEffect::setEnabled(bool enable)
d->isEnabled = enable;
if (d->source)
- d->source->update();
+ d->source->d_func()->effectBoundingRectChanged();
emit enabledChanged(enable);
}
@@ -349,6 +349,22 @@ void QGraphicsEffect::setEnabled(bool enable)
*/
/*!
+ Schedules a redraw of the source. Call this function whenever the source
+ needs to be redrawn.
+
+ This convenience function is equivalent to calling
+ QGraphicsEffectSource::update().
+
+ \sa updateBoundingRect(), QGraphicsEffectSource::update()
+*/
+void QGraphicsEffect::update()
+{
+ Q_D(QGraphicsEffect);
+ if (d->source)
+ d->source->update();
+}
+
+/*!
Returns a pointer to the source, which provides extra context information
that can be useful for the effect.
@@ -366,13 +382,15 @@ QGraphicsEffectSource *QGraphicsEffect::source() const
function whenever you change any parameters that will cause the virtual
boundingRectFor() function to return a different value.
+ This function will call update() if this is necessary.
+
\sa boundingRectFor(), boundingRect()
*/
void QGraphicsEffect::updateBoundingRect()
{
Q_D(QGraphicsEffect);
if (d->source)
- d->source->update();
+ d->source->d_func()->effectBoundingRectChanged();
}
/*!
@@ -523,6 +541,7 @@ void QGraphicsColorizeEffect::setColor(const QColor &color)
return;
d->filter->setColor(color);
+ update();
emit colorChanged(color);
}
@@ -610,6 +629,7 @@ void QGraphicsPixelizeEffect::setPixelSize(int size)
return;
d->pixelSize = size;
+ update();
emit pixelSizeChanged(size);
}
@@ -820,7 +840,7 @@ QGraphicsDropShadowEffect::~QGraphicsDropShadowEffect()
By default, the offset is 8 pixels towards the lower right.
- \sa blurRadius(), color()
+ \sa xOffset(), yOffset(), blurRadius(), color()
*/
QPointF QGraphicsDropShadowEffect::offset() const
{
@@ -840,6 +860,24 @@ void QGraphicsDropShadowEffect::setOffset(const QPointF &offset)
}
/*!
+ \property QGraphicsDropShadowEffect::xOffset
+ \brief the horizontal shadow offset in pixels.
+
+ By default, the horizontal shadow offset is 8 pixels.
+
+ \sa yOffset(), offset()
+*/
+
+/*!
+ \property QGraphicsDropShadowEffect::yOffset
+ \brief the vertical shadow offset in pixels.
+
+ By default, the vertical shadow offset is 8 pixels.
+
+ \sa xOffset(), offset()
+*/
+
+/*!
\fn void QGraphicsDropShadowEffect::offsetChanged(const QPointF &offset)
This signal is emitted whenever the effect's shadow offset changes.
@@ -903,6 +941,7 @@ void QGraphicsDropShadowEffect::setColor(const QColor &color)
return;
d->filter->setColor(color);
+ update();
emit colorChanged(color);
}
@@ -1012,6 +1051,7 @@ void QGraphicsOpacityEffect::setOpacity(qreal opacity)
d->isFullyOpaque = 0;
else
d->isFullyOpaque = qFuzzyIsNull(d->opacity - 1);
+ update();
emit opacityChanged(opacity);
}
@@ -1050,6 +1090,7 @@ void QGraphicsOpacityEffect::setOpacityMask(const QBrush &mask)
d->opacityMask = mask;
d->hasOpacityMask = (mask.style() != Qt::NoBrush);
+ update();
emit opacityMaskChanged(mask);
}
@@ -1088,19 +1129,20 @@ void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *sour
const QPixmap pixmap = source->pixmap(Qt::LogicalCoordinates, &offset);
painter->drawPixmap(offset, pixmap);
} else {
- QRectF srcBrect = source->boundingRect();
- QPixmap pixmap(srcBrect.size().toSize());
+ QRect srcBrect = source->boundingRect().toAlignedRect();
+ offset = srcBrect.topLeft();
+ QPixmap pixmap(srcBrect.size());
pixmap.fill(Qt::transparent);
QPainter pixmapPainter(&pixmap);
pixmapPainter.setRenderHints(painter->renderHints());
- pixmapPainter.translate(-srcBrect.topLeft());
+ pixmapPainter.translate(-offset);
source->draw(&pixmapPainter);
pixmapPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
pixmapPainter.fillRect(srcBrect, d->opacityMask);
pixmapPainter.end();
- painter->drawPixmap(srcBrect.topLeft(), pixmap);
+ painter->drawPixmap(offset, pixmap);
}
} else {
// Draw pixmap in device coordinates to avoid pixmap scaling;
diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h
index 8e5384c..aee7834 100644
--- a/src/gui/effects/qgraphicseffect.h
+++ b/src/gui/effects/qgraphicseffect.h
@@ -118,7 +118,7 @@ public:
public Q_SLOTS:
void setEnabled(bool enable);
- // ### add update() slot
+ void update();
Q_SIGNALS:
void enabledChanged(bool enabled);
@@ -237,6 +237,8 @@ class Q_GUI_EXPORT QGraphicsDropShadowEffect: public QGraphicsEffect
{
Q_OBJECT
Q_PROPERTY(QPointF offset READ offset WRITE setOffset NOTIFY offsetChanged)
+ Q_PROPERTY(qreal xOffset READ xOffset WRITE setXOffset NOTIFY offsetChanged)
+ Q_PROPERTY(qreal yOffset READ yOffset WRITE setYOffset NOTIFY offsetChanged)
Q_PROPERTY(int blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged)
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
public:
@@ -245,15 +247,31 @@ public:
QRectF boundingRectFor(const QRectF &rect) const;
QPointF offset() const;
+
+ inline qreal xOffset() const
+ { return offset().x(); }
+
+ inline qreal yOffset() const
+ { return offset().y(); }
+
int blurRadius() const;
QColor color() const;
public Q_SLOTS:
void setOffset(const QPointF &ofs);
+
inline void setOffset(qreal dx, qreal dy)
{ setOffset(QPointF(dx, dy)); }
+
inline void setOffset(qreal d)
{ setOffset(QPointF(d, d)); }
+
+ inline void setXOffset(qreal dx)
+ { setOffset(QPointF(dx, yOffset())); }
+
+ inline void setYOffset(qreal dy)
+ { setOffset(QPointF(xOffset(), dy)); }
+
void setBlurRadius(int blurRadius);
void setColor(const QColor &color);
diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h
index bfabfc0..24b605f 100644
--- a/src/gui/effects/qgraphicseffect_p.h
+++ b/src/gui/effects/qgraphicseffect_p.h
@@ -76,6 +76,7 @@ public:
virtual void update() = 0;
virtual bool isPixmap() const = 0;
virtual QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset = 0) const = 0;
+ virtual void effectBoundingRectChanged() = 0;
friend class QGraphicsScenePrivate;
friend class QGraphicsItem;
friend class QGraphicsItemPrivate;
diff --git a/src/gui/embedded/directfb.pri b/src/gui/embedded/directfb.pri
new file mode 100644
index 0000000..7dae9d5
--- /dev/null
+++ b/src/gui/embedded/directfb.pri
@@ -0,0 +1,39 @@
+# These defines might be necessary if your DirectFB driver doesn't
+# support all of the DirectFB API.
+#
+#DEFINES += QT_NO_DIRECTFB_SUBSURFACE
+#DEFINES += QT_DIRECTFB_WINDOW_AS_CURSOR
+#DEFINES += QT_NO_DIRECTFB_IMAGEPROVIDER
+#DEFINES += QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
+#DEFINES += QT_DIRECTFB_IMAGECACHE
+#DEFINES += QT_NO_DIRECTFB_WM
+#DEFINES += QT_NO_DIRECTFB_LAYER
+#DEFINES += QT_NO_DIRECTFB_PALETTE
+#DEFINES += QT_NO_DIRECTFB_PREALLOCATED
+#DEFINES += QT_NO_DIRECTFB_MOUSE
+#DEFINES += QT_NO_DIRECTFB_KEYBOARD
+#DEFINES += QT_DIRECTFB_TIMING
+#DEFINES += QT_NO_DIRECTFB_OPAQUE_DETECTION
+#DIRECTFB_DRAWINGOPERATIONS=DRAW_RECTS|DRAW_LINES|DRAW_IMAGE|DRAW_PIXMAP|DRAW_TILED_PIXMAP|STROKE_PATH|DRAW_PATH|DRAW_POINTS|DRAW_ELLIPSE|DRAW_POLYGON|DRAW_TEXT|FILL_PATH|FILL_RECT|DRAW_COLORSPANS
+#DEFINES += \"QT_DIRECTFB_WARN_ON_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\"
+#DEFINES += \"QT_DIRECTFB_DISABLE_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\"
+
+HEADERS += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h
+
+SOURCES += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp \
+ $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
+
+
+QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB
+LIBS += $$QT_LIBS_DIRECTFB
diff --git a/src/gui/embedded/embedded.pri b/src/gui/embedded/embedded.pri
index 255a504..eb13d8d 100644
--- a/src/gui/embedded/embedded.pri
+++ b/src/gui/embedded/embedded.pri
@@ -139,6 +139,10 @@ embedded {
SOURCES += embedded/qscreentransformed_qws.cpp
}
+ contains( gfx-drivers, directfb ) {
+ INCLUDEPATH += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb
+ include($$PWD/directfb.pri)
+ }
#
# Keyboard drivers
#
diff --git a/src/gui/embedded/qscreendriverfactory_qws.cpp b/src/gui/embedded/qscreendriverfactory_qws.cpp
index 21058af..99ee8f2 100644
--- a/src/gui/embedded/qscreendriverfactory_qws.cpp
+++ b/src/gui/embedded/qscreendriverfactory_qws.cpp
@@ -51,7 +51,9 @@
#include <stdlib.h>
#include "private/qfactoryloader_p.h"
#include "qscreendriverplugin_qws.h"
-
+#ifndef QT_NO_QWS_DIRECTFB
+#include "qdirectfbscreen.h"
+#endif
#ifndef QT_NO_QWS_VNC
#include "qscreenvnc_qws.h"
#endif
@@ -118,6 +120,10 @@ QScreen *QScreenDriverFactory::create(const QString& key, int displayId)
if (driver == QLatin1String("linuxfb") || driver.isEmpty())
return new QLinuxFbScreen(displayId);
#endif
+#ifndef QT_NO_QWS_DIRECTFB
+ if (driver == QLatin1String("directfb") || driver.isEmpty())
+ return new QDirectFBScreen(displayId);
+#endif
#ifndef QT_NO_QWS_TRANSFORMED
if (driver == QLatin1String("transformed"))
return new QTransformedScreen(displayId);
@@ -130,7 +136,6 @@ QScreen *QScreenDriverFactory::create(const QString& key, int displayId)
if (driver == QLatin1String("multi"))
return new QMultiScreen(displayId);
#endif
-
#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
#ifndef QT_NO_LIBRARY
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 86c589d..4c7765d 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -198,20 +198,19 @@
\o hoverEnterEvent(), hoverMoveEvent(), and hoverLeaveEvent() handles
hover enter, move and leave events
\o inputMethodEvent() handles input events, for accessibility support
- \o keyPressEvent() and keyReleaseEvent handle key press and release events
+ \o keyPressEvent() and keyReleaseEvent() handle key press and release events
\o mousePressEvent(), mouseMoveEvent(), mouseReleaseEvent(), and
mouseDoubleClickEvent() handles mouse press, move, release, click and
doubleclick events
\endlist
- You can filter events for any other item by installing event
- filters. This functionaly is separate from from Qt's regular
- event filters (see QObject::installEventFilter()), which only
- work on subclasses of QObject. After installing your item as an
- event filter for another item by calling
- installSceneEventFilter(), the filtered events will be received
- by the virtual function sceneEventFilter(). You can remove item
- event filters by calling removeSceneEventFilter().
+ You can filter events for any other item by installing event filters. This
+ functionality is separate from Qt's regular event filters (see
+ QObject::installEventFilter()), which only work on subclasses of QObject. After
+ installing your item as an event filter for another item by calling
+ installSceneEventFilter(), the filtered events will be received by the virtual
+ function sceneEventFilter(). You can remove item event filters by calling
+ removeSceneEventFilter().
\section1 Custom Data
@@ -414,11 +413,11 @@
(same as transform()), and QGraphicsItem ignores the return value for this
notification (i.e., a read-only notification).
- \value ItemSelectedChange The item's selected state changes. If the item
- is presently selected, it will become unselected, and vice verca. The
- value argument is the new selected state (i.e., true or false). Do not
- call setSelected() in itemChange() as this notification is delivered();
- instead, you can return the new selected state from itemChange().
+ \value ItemSelectedChange The item's selected state changes. If the item is
+ presently selected, it will become unselected, and vice verca. The value
+ argument is the new selected state (i.e., true or false). Do not call
+ setSelected() in itemChange() as this notification is delivered; instead, you
+ can return the new selected state from itemChange().
\value ItemSelectedHasChanged The item's selected state has changed. The
value argument is the new selected state (i.e., true or false). Do not
@@ -1007,6 +1006,9 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent)
setEnabledHelper(parent->isEnabled(), /* explicit = */ false, /* update = */ !implicitUpdate);
}
+ // Auto-activate if visible and the parent is active.
+ if (q->isVisible() && parent->isActive())
+ q->setActive(true);
} else {
// Inherit ancestor flags from the new parent.
updateAncestorFlag(QGraphicsItem::GraphicsItemFlag(-2));
@@ -1941,6 +1943,17 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo
child->d_ptr->setVisibleHelper(newVisible, false, updateChildren);
}
+ // Update activation
+ if (scene && q->isPanel()) {
+ if (newVisible) {
+ if (parent && parent->isActive())
+ q->setActive(true);
+ } else {
+ if (q->isActive())
+ scene->setActivePanel(parent);
+ }
+ }
+
// Enable subfocus
if (newVisible && isWidget) {
QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(q_ptr);
@@ -2669,6 +2682,37 @@ bool QGraphicsItem::isActive() const
}
/*!
+ \since 4.6
+
+ If \a active is true, and the scene is active, this item's panel will be
+ activated. Otherwise, the panel is deactivated.
+
+ If the item is not part of an active scene, \a active will decide what
+ happens to the panel when the scene becomes active or the item is added to
+ the scene. If true, the item's panel will be activated when the item is
+ either added to the scene or the scene is activated. Otherwise, the item
+ will stay inactive independent of the scene's activated state.
+
+ \sa isPanel(), QGraphicsScene::setActivePanel(), QGraphicsScene::isActive()
+*/
+void QGraphicsItem::setActive(bool active)
+{
+ d_ptr->explicitActivate = 1;
+ d_ptr->wantsActive = active;
+ if (d_ptr->scene) {
+ if (active) {
+ // Activate this item.
+ d_ptr->scene->setActivePanel(this);
+ } else {
+ // Deactivate this item, and reactivate the last active item
+ // (if any).
+ QGraphicsItem *lastActive = d_ptr->scene->d_func()->lastActivePanel;
+ d_ptr->scene->setActivePanel(lastActive != this ? lastActive : 0);
+ }
+ }
+}
+
+/*!
Returns true if this item is active, and it or its \l{focusProxy()}{focus
proxy} has keyboard input focus; otherwise, returns false.
@@ -6099,8 +6143,10 @@ bool QGraphicsItem::sceneEvent(QEvent *event)
if (d_ptr->scene) {
for (int i = 0; i < d_ptr->children.size(); ++i) {
QGraphicsItem *child = d_ptr->children.at(i);
- if (!(child->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorHandlesChildEvents))
- d_ptr->scene->sendEvent(child, event);
+ if (child->isVisible() && !child->isPanel()) {
+ if (!(child->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorHandlesChildEvents))
+ d_ptr->scene->sendEvent(child, event);
+ }
}
}
break;
@@ -6945,7 +6991,7 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent
\property QGraphicsObject::id
\brief the id of of the item
- \sa QGraphicsItem::opacity(), QGraphicsItem::setOpacity()
+ \sa QObject::objectName(), QObject::setObjectName()
*/
/*!
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h
index 04fe0cb..df25e6a 100644
--- a/src/gui/graphicsview/qgraphicsitem.h
+++ b/src/gui/graphicsview/qgraphicsitem.h
@@ -235,6 +235,8 @@ public:
void setHandlesChildEvents(bool enabled);
bool isActive() const;
+ void setActive(bool active);
+
bool hasFocus() const;
void setFocus(Qt::FocusReason focusReason = Qt::OtherFocusReason);
void clearFocus();
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index 2bc876c..49361cf 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -171,6 +171,8 @@ public:
notifyBoundingRectChanged(0),
notifyInvalidated(0),
mouseSetsFocus(1),
+ explicitActivate(0),
+ wantsActive(0),
globalStackingOrder(-1),
q_ptr(0)
{
@@ -461,7 +463,7 @@ public:
quint32 needSortChildren : 1;
quint32 allChildrenDirty : 1;
- // New 32 bits
+ // Packed 32 bits
quint32 fullUpdatePending : 1;
quint32 flags : 16;
quint32 dirtyChildrenBoundingRect : 1;
@@ -480,6 +482,10 @@ public:
quint32 notifyInvalidated : 1;
quint32 mouseSetsFocus : 1;
+ // New 32 bits
+ quint32 explicitActivate : 1;
+ quint32 wantsActive : 1;
+
// Optional stacking order
int globalStackingOrder;
QGraphicsItem *q_ptr;
@@ -566,6 +572,9 @@ public:
inline void update()
{ item->update(); }
+ inline void effectBoundingRectChanged()
+ { item->prepareGeometryChange(); }
+
inline bool isPixmap() const
{
return (item->type() == QGraphicsPixmapItem::Type);
diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp
index 447fc50..c710c55 100644
--- a/src/gui/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp
@@ -390,7 +390,7 @@ QWidget *QGraphicsProxyWidgetPrivate::findFocusChild(QWidget *child, bool next)
if (child->isEnabled()
&& child->isVisibleTo(widget)
&& (child->focusPolicy() & Qt::TabFocus)) {
- return child;
+ return child;
}
child = next ? child->d_func()->focus_next : child->d_func()->focus_prev;
} while (child != oldChild && !(next && child == widget) && !(!next && child == widget->d_func()->focus_prev));
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index ac30668..2ac1dca 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -291,6 +291,7 @@ QGraphicsScenePrivate::QGraphicsScenePrivate()
activePanel(0),
lastActivePanel(0),
activationRefCount(0),
+ childExplicitActivation(0),
lastMouseGrabberItem(0),
lastMouseGrabberItemHasImplicitMouseGrab(false),
dragDropItem(0),
@@ -571,6 +572,66 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
/*!
\internal
*/
+void QGraphicsScenePrivate::setActivePanelHelper(QGraphicsItem *item, bool duringActivationEvent)
+{
+ Q_Q(QGraphicsScene);
+ if (item && item->scene() != q) {
+ qWarning("QGraphicsScene::setActivePanel: item %p must be part of this scene",
+ item);
+ return;
+ }
+
+ // Find the item's panel.
+ QGraphicsItem *panel = item ? item->panel() : 0;
+ lastActivePanel = panel ? activePanel : 0;
+ if (panel == activePanel || (!q->isActive() && !duringActivationEvent))
+ return;
+
+ // Deactivate the last active panel.
+ if (activePanel) {
+ if (QGraphicsItem *fi = activePanel->focusItem()) {
+ // Remove focus from the current focus item.
+ if (fi == q->focusItem())
+ q->setFocusItem(0, Qt::ActiveWindowFocusReason);
+ }
+
+ QEvent event(QEvent::WindowDeactivate);
+ q->sendEvent(activePanel, &event);
+ } else if (panel && !duringActivationEvent) {
+ // Deactivate the scene if changing activation to a panel.
+ QEvent event(QEvent::WindowDeactivate);
+ foreach (QGraphicsItem *item, q->items()) {
+ if (item->isVisible() && !item->isPanel() && !item->parentItem())
+ q->sendEvent(item, &event);
+ }
+ }
+
+ // Update activate state.
+ activePanel = panel;
+ QEvent event(QEvent::ActivationChange);
+ QApplication::sendEvent(q, &event);
+
+ // Activate
+ if (panel) {
+ QEvent event(QEvent::WindowActivate);
+ q->sendEvent(panel, &event);
+
+ // Set focus on the panel's focus item.
+ if (QGraphicsItem *focusItem = panel->focusItem())
+ focusItem->setFocus(Qt::ActiveWindowFocusReason);
+ } else if (q->isActive()) {
+ // Activate the scene
+ QEvent event(QEvent::WindowActivate);
+ foreach (QGraphicsItem *item, q->items()) {
+ if (item->isVisible() && !item->isPanel() && !item->parentItem())
+ q->sendEvent(item, &event);
+ }
+ }
+}
+
+/*!
+ \internal
+*/
void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
Qt::FocusReason focusReason)
{
@@ -2351,9 +2412,29 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
// Deliver post-change notification
item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant);
- // Auto-activate the first inactive panel if the scene is active.
- if (isActive() && !d->activePanel && item->isPanel())
- setActivePanel(item);
+ // Update explicit activation
+ bool autoActivate = true;
+ if (!d->childExplicitActivation && item->d_ptr->explicitActivate)
+ d->childExplicitActivation = item->d_ptr->wantsActive ? 1 : 2;
+ if (d->childExplicitActivation && item->isPanel()) {
+ if (d->childExplicitActivation == 1)
+ setActivePanel(item);
+ else
+ autoActivate = false;
+ d->childExplicitActivation = 0;
+ } else if (!item->d_ptr->parent) {
+ d->childExplicitActivation = 0;
+ }
+
+ // Auto-activate this item's panel if nothing else has been activated
+ if (autoActivate) {
+ if (!d->lastActivePanel && !d->activePanel && item->isPanel()) {
+ if (isActive())
+ setActivePanel(item);
+ else
+ d->lastActivePanel = item;
+ }
+ }
// Ensure that newly added items that have subfocus set, gain
// focus automatically if there isn't a focus item already.
@@ -3129,11 +3210,11 @@ bool QGraphicsScene::event(QEvent *event)
if (!d->activationRefCount++) {
if (d->lastActivePanel) {
// Activate the last panel.
- setActivePanel(d->lastActivePanel);
+ d->setActivePanelHelper(d->lastActivePanel, true);
} else if (d->tabFocusFirst && d->tabFocusFirst->isPanel()) {
// Activate the panel of the first item in the tab focus
// chain.
- setActivePanel(d->tabFocusFirst);
+ d->setActivePanelHelper(d->tabFocusFirst, true);
} else {
// Activate all toplevel items.
QEvent event(QEvent::WindowActivate);
@@ -3150,7 +3231,7 @@ bool QGraphicsScene::event(QEvent *event)
// Deactivate the active panel (but keep it so we can
// reactivate it later).
QGraphicsItem *lastActivePanel = d->activePanel;
- setActivePanel(0);
+ d->setActivePanelHelper(0, true);
d->lastActivePanel = lastActivePanel;
} else {
// Activate all toplevel items.
@@ -5095,63 +5176,15 @@ QGraphicsItem *QGraphicsScene::activePanel() const
can also pass 0 for \a item, in which case QGraphicsScene will
deactivate any currently active panel.
+ If the scene is currently inactive, \a item remains inactive until the
+ scene becomes active (or, ir \a item is 0, no item will be activated).
+
\sa activePanel(), isActive(), QGraphicsItem::isActive()
*/
void QGraphicsScene::setActivePanel(QGraphicsItem *item)
{
Q_D(QGraphicsScene);
- if (item && item->scene() != this) {
- qWarning("QGraphicsScene::setActivePanel: item %p must be part of this scene",
- item);
- return;
- }
-
- // Find the item's panel.
- QGraphicsItem *panel = item ? item->panel() : 0;
- d->lastActivePanel = panel ? d->activePanel : 0;
- if (panel == d->activePanel)
- return;
-
- // Deactivate the last active panel.
- if (d->activePanel) {
- if (QGraphicsItem *fi = d->activePanel->focusItem()) {
- // Remove focus from the current focus item.
- if (fi == focusItem())
- setFocusItem(0, Qt::ActiveWindowFocusReason);
- }
-
- QEvent event(QEvent::WindowDeactivate);
- sendEvent(d->activePanel, &event);
- } else if (panel) {
- // Deactivate the scene if changing activation to a panel.
- QEvent event(QEvent::WindowDeactivate);
- foreach (QGraphicsItem *item, items()) {
- if (item->isVisible() && !item->isPanel() && !item->parentItem())
- sendEvent(item, &event);
- }
- }
-
- // Update activate state.
- d->activePanel = panel;
- QEvent event(QEvent::ActivationChange);
- QApplication::sendEvent(this, &event);
-
- // Activate
- if (panel) {
- QEvent event(QEvent::WindowActivate);
- sendEvent(panel, &event);
-
- // Set focus on the panel's focus item.
- if (QGraphicsItem *focusItem = panel->focusItem())
- focusItem->setFocus(Qt::ActiveWindowFocusReason);
- } else if (isActive()) {
- // Activate the scene
- QEvent event(QEvent::WindowActivate);
- foreach (QGraphicsItem *item, items()) {
- if (item->isVisible() && !item->isPanel() && !item->parentItem())
- sendEvent(item, &event);
- }
- }
+ d->setActivePanelHelper(item, false);
}
/*!
diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h
index c1b78ff..1f66eb4 100644
--- a/src/gui/graphicsview/qgraphicsscene_p.h
+++ b/src/gui/graphicsview/qgraphicsscene_p.h
@@ -132,6 +132,8 @@ public:
QGraphicsItem *activePanel;
QGraphicsItem *lastActivePanel;
int activationRefCount;
+ int childExplicitActivation;
+ void setActivePanelHelper(QGraphicsItem *item, bool duringActivationEvent);
void setFocusItemHelper(QGraphicsItem *item, Qt::FocusReason focusReason);
QList<QGraphicsWidget *> popupWidgets;
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index 9972223..afabf49 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -1665,11 +1665,7 @@ void QGraphicsWidget::setWindowFlags(Qt::WindowFlags wFlags)
*/
bool QGraphicsWidget::isActiveWindow() const
{
- Q_D(const QGraphicsWidget);
- if (!d->scene)
- return false;
- const QGraphicsWidget *w = window();
- return (!w && d->scene->isActive()) || (w && d->scene->activeWindow() == w);
+ return isActive();
}
/*!
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index a4ea6af..e23677f 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -888,10 +888,9 @@ void QIcon::setThemeSearchPaths(const QStringList &paths)
On X11, the search path will use the XDG_DATA_DIRS environment
variable if available.
- On Windows the search path defaults to [Application Directory]/icons
-
- On Mac the default search path will search in the
- [Contents/Resources/icons] part of the application bundle.
+ By default all platforms will have the resource directory
+ ":\icons" as their fallback. You can use "rcc -project"
+ to generate a resource file from your icon theme.
\sa setThemeSearchPaths(), fromTheme(), setThemeName()
*/
@@ -906,7 +905,7 @@ QStringList QIcon::themeSearchPaths()
Sets the current icon theme to \a name.
The \a name should correspond to a directory name in the
- current themeSearchPath() containing an index.theme
+ themeSearchPath() containing an index.theme
file describing it's contents.
\sa themeSearchPaths(), themeName()
@@ -939,10 +938,6 @@ QString QIcon::themeName()
icon theme. If no such icon is found in the current theme
\a fallback is return instead.
- To use an icon theme on Windows or Mac, you will need to
- bundle a compliant theme with your application and make sure
- it is located in your themeSarchPaths.
-
The lastest version of the freedesktop icon specification and naming
spesification can be obtained here:
http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 279703c..cb1cc61 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -187,14 +187,17 @@ QStringList QIconLoader::themeSearchPaths() const
QDir homeDir(QDir::homePath() + QLatin1String("/.icons"));
if (homeDir.exists())
m_iconDirs.prepend(homeDir.path());
-
-#elif defined(Q_WS_WIN)
+#endif
+
+#if defined(Q_WS_WIN)
m_iconDirs.append(qApp->applicationDirPath() +
QLatin1String("/icons"));
#elif defined(Q_WS_MAC)
m_iconDirs.append(qApp->applicationDirPath() +
QLatin1String("/../Resources/icons"));
#endif
+ // Allways add resource directory as search path
+ m_iconDirs.append(QLatin1String(":/icons"));
}
return m_iconDirs;
}
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 2b82f49..89af452 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -2892,6 +2892,12 @@ static void convert_Indexed8_to_X32(QImageData *dest, const QImageData *src, Qt:
Q_ASSERT(src->height == dest->height);
QVector<QRgb> colorTable = fix_color_table(src->colortable, dest->format);
+ if (colorTable.size() == 0) {
+ colorTable.resize(256);
+ for (int i=0; i<256; ++i)
+ colorTable[i] = qRgb(i, i, i);
+
+ }
int w = src->width;
const uchar *src_data = src->data;
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 3f3a55c..c4733cf 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -205,7 +205,11 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, float scre
image.setColor(i, qRgba(c,c,c,0xff));
}
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
+#if PNG_LIBPNG_VER_MAJOR < 1 || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR < 4)
const int g = info_ptr->trans_values.gray;
+#else
+ const int g = info_ptr->trans_color.gray;
+#endif
if (g < ncols) {
image.setColor(g, 0);
}
@@ -234,7 +238,11 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, float scre
info_ptr->palette[i].red,
info_ptr->palette[i].green,
info_ptr->palette[i].blue,
+#if PNG_LIBPNG_VER_MAJOR < 1 || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR < 4)
info_ptr->trans[i]
+#else
+ info_ptr->trans_alpha[i]
+#endif
)
);
i++;
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 07c5454..ea98cb2 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -956,6 +956,7 @@ QModelIndex QAbstractItemView::currentIndex() const
void QAbstractItemView::reset()
{
Q_D(QAbstractItemView);
+ d->delayedReset.stop(); //make sure we stop the timer
QList<QEditorInfo>::const_iterator it = d->editors.constBegin();
for (; it != d->editors.constEnd(); ++it)
d->releaseEditor(it->editor);
@@ -2208,7 +2209,9 @@ void QAbstractItemView::timerEvent(QTimerEvent *event)
Q_D(QAbstractItemView);
if (event->timerId() == d->fetchMoreTimer.timerId())
d->fetchMore();
- if (event->timerId() == d->autoScrollTimer.timerId())
+ else if (event->timerId() == d->delayedReset.timerId())
+ reset();
+ else if (event->timerId() == d->autoScrollTimer.timerId())
doAutoScroll();
else if (event->timerId() == d->updateTimer.timerId())
d->updateDirtyRegion();
@@ -3132,9 +3135,8 @@ void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &, int, int)
*/
void QAbstractItemViewPrivate::_q_modelDestroyed()
{
- Q_Q(QAbstractItemView);
model = QAbstractItemModelPrivate::staticEmptyModel();
- QMetaObject::invokeMethod(q, "reset", Qt::QueuedConnection);
+ doDelayedReset();
}
/*!
diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h
index 4517941..434d644 100644
--- a/src/gui/itemviews/qabstractitemview_p.h
+++ b/src/gui/itemviews/qabstractitemview_p.h
@@ -328,6 +328,15 @@ public:
QStyleOptionViewItemV4 viewOptionsV4() const;
+ void doDelayedReset()
+ {
+ //we delay the reset of the timer because some views (QTableView)
+ //with headers can't handle the fact that the model has been destroyed
+ //all _q_modelDestroyed slots must have been called
+ if (!delayedReset.isActive())
+ delayedReset.start(0, q_func());
+ }
+
QAbstractItemModel *model;
QPointer<QAbstractItemDelegate> itemDelegate;
QMap<int, QPointer<QAbstractItemDelegate> > rowDelegates;
@@ -389,6 +398,7 @@ public:
QBasicTimer updateTimer;
QBasicTimer delayedEditing;
QBasicTimer delayedAutoScroll; //used when an item is clicked
+ QBasicTimer delayedReset;
QAbstractItemView::ScrollMode verticalScrollMode;
QAbstractItemView::ScrollMode horizontalScrollMode;
diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp
index a1c3e4e..4dbd6dc 100644
--- a/src/gui/itemviews/qheaderview.cpp
+++ b/src/gui/itemviews/qheaderview.cpp
@@ -1047,7 +1047,9 @@ int QHeaderView::visualIndex(int logicalIndex) const
/*!
Returns the logicalIndex for the section at the given \a visualIndex
- position, or -1 otherwise.
+ position, or -1 if visualIndex < 0 or visualIndex >= QHeaderView::count().
+
+ Note that the visualIndex is not affected by hidden sections.
\sa visualIndex(), sectionPosition()
*/
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 69dba40..0056b9e 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -4510,7 +4510,9 @@ void fetchWacomToolId(int &deviceType, qint64 &serialId)
struct qt_tablet_motion_data
{
- Time timestamp;
+ bool filterByWidget;
+ const QWidget *widget;
+ const QWidget *etWidget;
int tabletMotionType;
bool error; // found a reason to stop searching
};
@@ -4533,15 +4535,20 @@ static Bool qt_tabletMotion_scanner(Display *, XEvent *event, XPointer arg)
qt_tablet_motion_data *data = (qt_tablet_motion_data *) arg;
if (data->error)
return false;
-
if (event->type == data->tabletMotionType) {
- if (data->timestamp > 0) {
- if ((reinterpret_cast<const XDeviceMotionEvent*>(event))->time > data->timestamp) {
- data->error = true;
- return false;
+ const XDeviceMotionEvent *const motion = reinterpret_cast<const XDeviceMotionEvent*>(event);
+ if (data->filterByWidget) {
+ const QPoint curr(motion->x, motion->y);
+ const QWidget *w = data->etWidget;
+ const QWidget *const child = w->childAt(curr);
+ if (child) {
+ w = child;
}
+ if (w == data->widget)
+ return true;
+ } else {
+ return true;
}
- return true;
}
data->error = event->type != MotionNotify; // we stop compression when another event gets in between.
@@ -4574,57 +4581,17 @@ bool QETWidget::translateXinputEvent(const XEvent *ev, QTabletDeviceData *tablet
qreal rotation = 0;
int deviceType = QTabletEvent::NoDevice;
int pointerType = QTabletEvent::UnknownPointer;
- XEvent mouseMotionEvent;
- XEvent dummy;
const XDeviceMotionEvent *motion = 0;
XDeviceButtonEvent *button = 0;
const XProximityNotifyEvent *proximity = 0;
QEvent::Type t;
Qt::KeyboardModifiers modifiers = 0;
- bool reinsertMouseEvent = false;
- XEvent mouseMotionEventSave;
#if !defined (Q_OS_IRIX)
XID device_id;
#endif
if (ev->type == tablet->xinput_motion) {
motion = reinterpret_cast<const XDeviceMotionEvent*>(ev);
-
- // Do event compression. Skip over tablet+mouse move events if there are newer ones.
- qt_tablet_motion_data tabletMotionData;
- tabletMotionData.tabletMotionType = tablet->xinput_motion;
- while (true) {
- // Find first mouse event since we expect them in pairs inside Qt
- tabletMotionData.error =false;
- tabletMotionData.timestamp = 0;
- if (XCheckIfEvent(X11->display, &mouseMotionEvent, &qt_mouseMotion_scanner, (XPointer) &tabletMotionData)) {
- mouseMotionEventSave = mouseMotionEvent;
- reinsertMouseEvent = true;
- } else {
- break;
- }
-
- // Now discard any duplicate tablet events.
- tabletMotionData.error = false;
- tabletMotionData.timestamp = mouseMotionEvent.xmotion.time;
- while (XCheckIfEvent(X11->display, &dummy, &qt_tabletMotion_scanner, (XPointer) &tabletMotionData)) {
- motion = reinterpret_cast<const XDeviceMotionEvent*>(&dummy);
- }
-
- // now check if there are more recent tablet motion events since we'll compress the current one with
- // newer ones in that case
- tabletMotionData.error = false;
- tabletMotionData.timestamp = 0;
- if (! XCheckIfEvent(X11->display, &dummy, &qt_tabletMotion_scanner, (XPointer) &tabletMotionData)) {
- break; // done with compression
- }
- motion = reinterpret_cast<const XDeviceMotionEvent*>(&dummy);
- }
-
- if (reinsertMouseEvent) {
- XPutBackEvent(X11->display, &mouseMotionEventSave);
- }
-
t = QEvent::TabletMove;
global = QPoint(motion->x_root, motion->y_root);
curr = QPoint(motion->x, motion->y);
@@ -4777,11 +4744,14 @@ bool QETWidget::translateXinputEvent(const XEvent *ev, QTabletDeviceData *tablet
}
#endif
- QWidget *child = w->childAt(curr);
- if (child) {
- w = child;
- curr = w->mapFromGlobal(global);
+ if (tablet->widgetToGetPress) {
+ w = tablet->widgetToGetPress;
+ } else {
+ QWidget *child = w->childAt(curr);
+ if (child)
+ w = child;
}
+ curr = w->mapFromGlobal(global);
if (t == QEvent::TabletPress) {
tablet->widgetToGetPress = w;
@@ -4795,10 +4765,45 @@ bool QETWidget::translateXinputEvent(const XEvent *ev, QTabletDeviceData *tablet
deviceType, pointerType,
qreal(pressure / qreal(tablet->maxPressure - tablet->minPressure)),
xTilt, yTilt, tangentialPressure, rotation, z, modifiers, uid);
- if (proximity)
+ if (proximity) {
QApplication::sendSpontaneousEvent(qApp, &e);
- else
+ } else {
QApplication::sendSpontaneousEvent(w, &e);
+ const bool accepted = e.isAccepted();
+ if (!accepted && ev->type == tablet->xinput_motion) {
+ // If the widget does not accept tablet events, we drop the next ones from the event queue
+ // for this widget so it is not overloaded with the numerous tablet events.
+ qt_tablet_motion_data tabletMotionData;
+ tabletMotionData.tabletMotionType = tablet->xinput_motion;
+ tabletMotionData.widget = w;
+ tabletMotionData.etWidget = this;
+ // if nothing is pressed, the events are filtered by position
+ tabletMotionData.filterByWidget = (tablet->widgetToGetPress == 0);
+
+ bool reinsertMouseEvent = false;
+ XEvent mouseMotionEvent;
+ while (true) {
+ // Find first mouse event since we expect them in pairs inside Qt
+ tabletMotionData.error =false;
+ if (XCheckIfEvent(X11->display, &mouseMotionEvent, &qt_mouseMotion_scanner, (XPointer) &tabletMotionData)) {
+ reinsertMouseEvent = true;
+ } else {
+ break;
+ }
+
+ // Now discard any duplicate tablet events.
+ tabletMotionData.error = false;
+ XEvent dummy;
+ while (XCheckIfEvent(X11->display, &dummy, &qt_tabletMotion_scanner, (XPointer) &tabletMotionData)) {
+ // just discard the event
+ }
+ }
+
+ if (reinsertMouseEvent) {
+ XPutBackEvent(X11->display, &mouseMotionEvent);
+ }
+ }
+ }
return true;
}
#endif
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index ab809df..863c43e 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -919,7 +919,7 @@ void QWidget::setAutoFillBackground(bool enabled)
any amount of widgets there might be physical restrictions to amount of
softkeys that can be used by the device.
- \o Series60: For series60 menu button is automatically mapped to left
+ \e Series60: For series60 menu button is automatically mapped to left
soft key if there is QMainWindow with QMenuBar in widgets parent hierarchy.
\sa softKeys()
@@ -5962,6 +5962,8 @@ bool QWidget::hasFocus() const
isActiveWindow() active window\endlink. The \a reason argument will
be passed into any focus event sent from this function, it is used
to give an explanation of what caused the widget to get focus.
+ If the window is not active, the widget will be given the focus when
+ the window becomes active.
First, a focus out event is sent to the focus widget (if any) to
tell it that it is about to lose the focus. Then a focus in event
@@ -6748,7 +6750,27 @@ void QWidget::setContentsMargins(int left, int top, int right, int bottom)
QApplication::sendEvent(this, &e);
}
-/*! Returns the widget's contents margins for \a left, \a top, \a
+/*!
+ \overload
+ \since 4.6
+
+ Sets the margins around the contents of the widget to have the
+ sizes determined by \a margins. The margins are
+ used by the layout system, and may be used by subclasses to
+ specify the area to draw in (e.g. excluding the frame).
+
+ Changing the margins will trigger a resizeEvent().
+
+ \sa contentsRect(), getContentsMargins()
+*/
+void QWidget::setContentsMargins(const QMargins &margins)
+{
+ setContentsMargins(margins.left(), margins.top(),
+ margins.right(), margins.bottom());
+}
+
+/*!
+ Returns the widget's contents margins for \a left, \a top, \a
right, and \a bottom.
\sa setContentsMargins(), contentsRect()
@@ -6767,6 +6789,20 @@ void QWidget::getContentsMargins(int *left, int *top, int *right, int *bottom) c
}
/*!
+ \since 4.6
+
+ Returns the widget's contents margins.
+
+ \sa getContentsMargins(), setContentsMargins(), contentsRect()
+ */
+QMargins QWidget::contentsMargins() const
+{
+ Q_D(const QWidget);
+ return QMargins(d->leftmargin, d->topmargin, d->rightmargin, d->bottommargin);
+}
+
+
+/*!
Returns the area inside the widget's margins.
\sa setContentsMargins(), getContentsMargins()
diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h
index 38650f0..f398dbd 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -44,6 +44,7 @@
#include <QtGui/qwindowdefs.h>
#include <QtCore/qobject.h>
+#include <QtCore/qmargins.h>
#include <QtGui/qpaintdevice.h>
#include <QtGui/qpalette.h>
#include <QtGui/qfont.h>
@@ -527,7 +528,10 @@ public:
QRegion visibleRegion() const;
void setContentsMargins(int left, int top, int right, int bottom);
+ void setContentsMargins(const QMargins &margins);
void getContentsMargins(int *left, int *top, int *right, int *bottom) const;
+ QMargins contentsMargins() const;
+
QRect contentsRect() const;
public:
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index ff0c453..f69c3a7 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -727,6 +727,16 @@ public:
inline bool isPixmap() const
{ return false; }
+ inline void effectBoundingRectChanged()
+ {
+ // ### This function should take a rect parameter; then we can avoid
+ // updating too much on the parent widget.
+ if (QWidget *parent = m_widget->parentWidget())
+ parent->update();
+ else
+ m_widget->update();
+ }
+
inline const QStyleOption *styleOption() const
{ return 0; }
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 422d5a3..173c870 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -298,7 +298,7 @@ QT_BEGIN_NAMESPACE
/*!
\enum QColor::Spec
- The type of color specified, either RGB, HSV or CMYK.
+ The type of color specified, either RGB, HSV, CMYK or HSL.
\value Rgb
\value Hsv
diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp
index 59a5063..2220206 100644
--- a/src/gui/painting/qdrawutil.cpp
+++ b/src/gui/painting/qdrawutil.cpp
@@ -1038,27 +1038,6 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs,
#endif
/*!
- \class QMargins
- \since 4.6
-
- Holds the borders used to split a pixmap into nine segments in order to
- draw it, similar to \l{http://www.w3.org/TR/css3-background/}
- {CSS3 border-images}.
-
- \sa Qt::TileRule, QTileRules
-*/
-
-/*! \fn QMargins::QMargins(int margin)
- Constructs a QMargins with the top, left, bottom, and
- right margins set to \a margin.
-*/
-
-/*! \fn QMargins::QMargins(int topMargin, int leftMargin, int bottomMargin, int rightMargin)
- Constructs a QMargins with the given \a topMargin, \a leftMargin,
- \a bottomMargin, and \a rightMargin.
- */
-
-/*!
\class QTileRules
\since 4.6
@@ -1195,79 +1174,79 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin
// source center
const int sourceTop = sourceRect.top();
const int sourceLeft = sourceRect.left();
- const int sourceCenterTop = sourceTop + sourceMargins.top;
- const int sourceCenterLeft = sourceLeft + sourceMargins.left;
- const int sourceCenterBottom = sourceRect.bottom() - sourceMargins.bottom + 1;
- const int sourceCenterRight = sourceRect.right() - sourceMargins.right + 1;
- const int sourceCenterWidth = sourceCenterRight - sourceMargins.left;
- const int sourceCenterHeight = sourceCenterBottom - sourceMargins.top;
+ const int sourceCenterTop = sourceTop + sourceMargins.top();
+ const int sourceCenterLeft = sourceLeft + sourceMargins.left();
+ const int sourceCenterBottom = sourceRect.bottom() - sourceMargins.bottom() + 1;
+ const int sourceCenterRight = sourceRect.right() - sourceMargins.right() + 1;
+ const int sourceCenterWidth = sourceCenterRight - sourceMargins.left();
+ const int sourceCenterHeight = sourceCenterBottom - sourceMargins.top();
// target center
const int targetTop = targetRect.top();
const int targetLeft = targetRect.left();
- const int targetCenterTop = targetTop + targetMargins.top;
- const int targetCenterLeft = targetLeft + targetMargins.left;
- const int targetCenterBottom = targetRect.bottom() - targetMargins.bottom + 1;
- const int targetCenterRight = targetRect.right() - targetMargins.right + 1;
+ const int targetCenterTop = targetTop + targetMargins.top();
+ const int targetCenterLeft = targetLeft + targetMargins.left();
+ const int targetCenterBottom = targetRect.bottom() - targetMargins.bottom() + 1;
+ const int targetCenterRight = targetRect.right() - targetMargins.right() + 1;
const int targetCenterWidth = targetCenterRight - targetCenterLeft;
const int targetCenterHeight = targetCenterBottom - targetCenterTop;
// corners
- if (targetMargins.top > 0 && targetMargins.left > 0 && sourceMargins.top > 0 && sourceMargins.left > 0) { // top left
- const QRect targetTopLeftRect(targetLeft, targetTop, targetMargins.left, targetMargins.top);
- const QRect sourceTopLeftRect(sourceLeft, sourceTop, sourceMargins.left, sourceMargins.top);
+ if (targetMargins.top() > 0 && targetMargins.left() > 0 && sourceMargins.top() > 0 && sourceMargins.left() > 0) { // top left
+ const QRect targetTopLeftRect(targetLeft, targetTop, targetMargins.left(), targetMargins.top());
+ const QRect sourceTopLeftRect(sourceLeft, sourceTop, sourceMargins.left(), sourceMargins.top());
qDrawPixmap(painter, targetTopLeftRect, pixmap, sourceTopLeftRect);
}
- if (targetMargins.top > 0 && targetMargins.right > 0 && sourceMargins.top > 0 && sourceMargins.right > 0) { // top right
- const QRect targetTopRightRect(targetCenterRight, targetTop, targetMargins.right, targetMargins.top);
- const QRect sourceTopRightRect(sourceCenterRight, sourceTop, sourceMargins.right, sourceMargins.top);
+ if (targetMargins.top() > 0 && targetMargins.right() > 0 && sourceMargins.top() > 0 && sourceMargins.right() > 0) { // top right
+ const QRect targetTopRightRect(targetCenterRight, targetTop, targetMargins.right(), targetMargins.top());
+ const QRect sourceTopRightRect(sourceCenterRight, sourceTop, sourceMargins.right(), sourceMargins.top());
qDrawPixmap(painter, targetTopRightRect, pixmap, sourceTopRightRect);
}
- if (targetMargins.bottom > 0 && targetMargins.left > 0 && sourceMargins.bottom > 0 && sourceMargins.left > 0) { // bottom left
- const QRect targetBottomLeftRect(targetLeft, targetCenterBottom, targetMargins.left, targetMargins.bottom);
- const QRect sourceBottomLeftRect(sourceLeft, sourceCenterBottom, sourceMargins.left, sourceMargins.bottom);
+ if (targetMargins.bottom() > 0 && targetMargins.left() > 0 && sourceMargins.bottom() > 0 && sourceMargins.left() > 0) { // bottom left
+ const QRect targetBottomLeftRect(targetLeft, targetCenterBottom, targetMargins.left(), targetMargins.bottom());
+ const QRect sourceBottomLeftRect(sourceLeft, sourceCenterBottom, sourceMargins.left(), sourceMargins.bottom());
qDrawPixmap(painter, targetBottomLeftRect, pixmap, sourceBottomLeftRect);
}
- if (targetMargins.bottom > 0 && targetMargins.right > 0 && sourceMargins.bottom > 0 && sourceMargins.right > 0) { // bottom right
- const QRect targetBottomRightRect(targetCenterRight, targetCenterBottom, targetMargins.right, targetMargins.bottom);
- const QRect sourceBottomRightRect(sourceCenterRight, sourceCenterBottom, sourceMargins.right, sourceMargins.bottom);
+ if (targetMargins.bottom() > 0 && targetMargins.right() > 0 && sourceMargins.bottom() > 0 && sourceMargins.right() > 0) { // bottom right
+ const QRect targetBottomRightRect(targetCenterRight, targetCenterBottom, targetMargins.right(), targetMargins.bottom());
+ const QRect sourceBottomRightRect(sourceCenterRight, sourceCenterBottom, sourceMargins.right(), sourceMargins.bottom());
qDrawPixmap(painter, targetBottomRightRect, pixmap, sourceBottomRightRect);
}
// horizontal edges
switch (rules.horizontal) {
case Qt::Stretch:
- if (targetMargins.top > 0 && sourceMargins.top > 0) { // top
- const QRect targetTopRect(targetCenterLeft, targetTop, targetCenterWidth, targetMargins.top);
- const QRect sourceTopRect(sourceCenterLeft, sourceTop, sourceCenterWidth, sourceMargins.top);
+ if (targetMargins.top() > 0 && sourceMargins.top() > 0) { // top
+ const QRect targetTopRect(targetCenterLeft, targetTop, targetCenterWidth, targetMargins.top());
+ const QRect sourceTopRect(sourceCenterLeft, sourceTop, sourceCenterWidth, sourceMargins.top());
qDrawPixmap(painter, targetTopRect, pixmap, sourceTopRect);
}
- if (targetMargins.bottom > 0 && sourceMargins.bottom > 0) { // bottom
- const QRect targetBottomRect(targetCenterLeft, targetCenterBottom, targetCenterWidth, targetMargins.bottom);
- const QRect sourceBottomRect(sourceCenterLeft, sourceCenterBottom, sourceCenterWidth, sourceMargins.bottom);
+ if (targetMargins.bottom() > 0 && sourceMargins.bottom() > 0) { // bottom
+ const QRect targetBottomRect(targetCenterLeft, targetCenterBottom, targetCenterWidth, targetMargins.bottom());
+ const QRect sourceBottomRect(sourceCenterLeft, sourceCenterBottom, sourceCenterWidth, sourceMargins.bottom());
qDrawPixmap(painter, targetBottomRect, pixmap, sourceBottomRect);
}
break;
case Qt::Repeat:
- if (targetMargins.top > 0 && sourceMargins.top > 0) { // top
- const QRect targetTopRect(targetCenterLeft, targetTop, targetCenterWidth, targetMargins.top);
- const QRect sourceTopRect(sourceCenterLeft, sourceTop, sourceCenterWidth, sourceMargins.top);
+ if (targetMargins.top() > 0 && sourceMargins.top() > 0) { // top
+ const QRect targetTopRect(targetCenterLeft, targetTop, targetCenterWidth, targetMargins.top());
+ const QRect sourceTopRect(sourceCenterLeft, sourceTop, sourceCenterWidth, sourceMargins.top());
qDrawHorizontallyRepeatedPixmap(painter, targetTopRect, pixmap, sourceTopRect);
}
- if (targetMargins.bottom > 0 && sourceMargins.bottom > 0) { // bottom
- const QRect targetBottomRect(targetCenterLeft, targetCenterBottom, targetCenterWidth, targetMargins.bottom);
- const QRect sourceBottomRect(sourceCenterLeft, sourceCenterBottom, sourceCenterWidth, sourceMargins.bottom);
+ if (targetMargins.bottom() > 0 && sourceMargins.bottom() > 0) { // bottom
+ const QRect targetBottomRect(targetCenterLeft, targetCenterBottom, targetCenterWidth, targetMargins.bottom());
+ const QRect sourceBottomRect(sourceCenterLeft, sourceCenterBottom, sourceCenterWidth, sourceMargins.bottom());
qDrawHorizontallyRepeatedPixmap(painter, targetBottomRect, pixmap, sourceBottomRect);
}
break;
case Qt::Round:
- if (targetMargins.top > 0 && sourceMargins.top > 0) { // top
- const QRect targetTopRect(targetCenterLeft, targetTop, targetCenterWidth, targetMargins.top);
- const QRect sourceTopRect(sourceCenterLeft, sourceTop, sourceCenterWidth, sourceMargins.top);
+ if (targetMargins.top() > 0 && sourceMargins.top() > 0) { // top
+ const QRect targetTopRect(targetCenterLeft, targetTop, targetCenterWidth, targetMargins.top());
+ const QRect sourceTopRect(sourceCenterLeft, sourceTop, sourceCenterWidth, sourceMargins.top());
qDrawHorizontallyRoundedPixmap(painter, targetTopRect, pixmap, sourceTopRect);
}
- if (targetMargins.bottom > 0 && sourceMargins.bottom > 0) { // bottom
- const QRect targetBottomRect(targetCenterLeft, targetCenterBottom, targetCenterWidth, targetMargins.bottom);
- const QRect sourceBottomRect(sourceCenterLeft, sourceCenterBottom, sourceCenterWidth, sourceMargins.bottom);
+ if (targetMargins.bottom() > 0 && sourceMargins.bottom() > 0) { // bottom
+ const QRect targetBottomRect(targetCenterLeft, targetCenterBottom, targetCenterWidth, targetMargins.bottom());
+ const QRect sourceBottomRect(sourceCenterLeft, sourceCenterBottom, sourceCenterWidth, sourceMargins.bottom());
qDrawHorizontallyRoundedPixmap(painter, targetBottomRect, pixmap, sourceBottomRect);
}
break;
@@ -1276,38 +1255,38 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin
// vertical edges
switch (rules.vertical) {
case Qt::Stretch:
- if (targetMargins.left > 0 && sourceMargins.left > 0) { // left
- const QRect targetLeftRect(targetLeft, targetCenterTop, targetMargins.left, targetCenterHeight);
- const QRect sourceLeftRect(sourceLeft, sourceCenterTop, sourceMargins.left, sourceCenterHeight);
+ if (targetMargins.left() > 0 && sourceMargins.left() > 0) { // left
+ const QRect targetLeftRect(targetLeft, targetCenterTop, targetMargins.left(), targetCenterHeight);
+ const QRect sourceLeftRect(sourceLeft, sourceCenterTop, sourceMargins.left(), sourceCenterHeight);
qDrawPixmap(painter, targetLeftRect, pixmap, sourceLeftRect);
}
- if (targetMargins.right > 0 && sourceMargins.right > 0) { // right
- const QRect targetRightRect(targetCenterRight, targetCenterTop, targetMargins.right, targetCenterHeight);
- const QRect sourceRightRect(sourceCenterRight, sourceCenterTop, sourceMargins.right, sourceCenterHeight);
+ if (targetMargins.right() > 0 && sourceMargins.right() > 0) { // right
+ const QRect targetRightRect(targetCenterRight, targetCenterTop, targetMargins.right(), targetCenterHeight);
+ const QRect sourceRightRect(sourceCenterRight, sourceCenterTop, sourceMargins.right(), sourceCenterHeight);
qDrawPixmap(painter, targetRightRect, pixmap, sourceRightRect);
}
break;
case Qt::Repeat:
- if (targetMargins.left > 0 && sourceMargins.left > 0) { // left
- const QRect targetLeftRect(targetLeft, targetCenterTop, targetMargins.left, targetCenterHeight);
- const QRect sourceLeftRect(sourceLeft, sourceCenterTop, sourceMargins.left, sourceCenterHeight);
+ if (targetMargins.left() > 0 && sourceMargins.left() > 0) { // left
+ const QRect targetLeftRect(targetLeft, targetCenterTop, targetMargins.left(), targetCenterHeight);
+ const QRect sourceLeftRect(sourceLeft, sourceCenterTop, sourceMargins.left(), sourceCenterHeight);
qDrawVerticallyRepeatedPixmap(painter, targetLeftRect, pixmap, sourceLeftRect);
}
- if (targetMargins.right > 0 && sourceMargins.right > 0) { // right
- const QRect targetRightRect(targetCenterRight, targetCenterTop, targetMargins.right, targetCenterHeight);
- const QRect sourceRightRect(sourceCenterRight, sourceCenterTop, sourceMargins.right, sourceCenterHeight);
+ if (targetMargins.right() > 0 && sourceMargins.right() > 0) { // right
+ const QRect targetRightRect(targetCenterRight, targetCenterTop, targetMargins.right(), targetCenterHeight);
+ const QRect sourceRightRect(sourceCenterRight, sourceCenterTop, sourceMargins.right(), sourceCenterHeight);
qDrawVerticallyRepeatedPixmap(painter, targetRightRect, pixmap, sourceRightRect);
}
break;
case Qt::Round:
- if (targetMargins.left > 0 && sourceMargins.left > 0) { // left
- const QRect targetLeftRect(targetLeft, targetCenterTop, targetMargins.left, targetCenterHeight);
- const QRect sourceLeftRect(sourceLeft, sourceCenterTop, sourceMargins.left, sourceCenterHeight);
+ if (targetMargins.left() > 0 && sourceMargins.left() > 0) { // left
+ const QRect targetLeftRect(targetLeft, targetCenterTop, targetMargins.left(), targetCenterHeight);
+ const QRect sourceLeftRect(sourceLeft, sourceCenterTop, sourceMargins.left(), sourceCenterHeight);
qDrawVerticallyRoundedPixmap(painter, targetLeftRect, pixmap, sourceLeftRect);
}
- if (targetMargins.right > 0 && sourceMargins.right > 0) { // right
- const QRect targetRightRect(targetCenterRight, targetCenterTop, targetMargins.right, targetCenterHeight);
- const QRect sourceRightRect(sourceCenterRight, sourceCenterTop, sourceMargins.right, sourceCenterHeight);
+ if (targetMargins.right() > 0 && sourceMargins.right() > 0) { // right
+ const QRect targetRightRect(targetCenterRight, targetCenterTop, targetMargins.right(), targetCenterHeight);
+ const QRect sourceRightRect(sourceCenterRight, sourceCenterTop, sourceMargins.right(), sourceCenterHeight);
qDrawVerticallyRoundedPixmap(painter, targetRightRect, pixmap, sourceRightRect);
}
break;
diff --git a/src/gui/painting/qdrawutil.h b/src/gui/painting/qdrawutil.h
index 4135c19..38ef30e 100644
--- a/src/gui/painting/qdrawutil.h
+++ b/src/gui/painting/qdrawutil.h
@@ -44,8 +44,8 @@
#include <QtCore/qnamespace.h>
#include <QtCore/qstring.h> // char*->QString conversion
+#include <QtCore/qmargins.h>
#include <QtGui/qpixmap.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -133,24 +133,6 @@ Q_GUI_EXPORT QT3_SUPPORT void qDrawArrow(QPainter *p, Qt::ArrowType type, Qt::GU
const QPalette &pal, bool enabled);
#endif
-struct QMargins
-{
- inline QMargins(int margin = 0)
- : top(margin),
- left(margin),
- bottom(margin),
- right(margin) {}
- inline QMargins(int topMargin, int leftMargin, int bottomMargin, int rightMargin)
- : top(topMargin),
- left(leftMargin),
- bottom(bottomMargin),
- right(rightMargin) {}
- int top;
- int left;
- int bottom;
- int right;
-};
-
struct QTileRules
{
inline QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule = Qt::Stretch)
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp
index 6d957ca..20f1d26 100644
--- a/src/gui/styles/qcleanlooksstyle.cpp
+++ b/src/gui/styles/qcleanlooksstyle.cpp
@@ -561,14 +561,20 @@ static void qt_cleanlooks_draw_mdibutton(QPainter *painter, const QStyleOptionTi
QColor mdiButtonBorderColor(active ? option->palette.highlight().color().darker(180): dark.darker(110));
painter->setPen(QPen(mdiButtonBorderColor, 1));
- painter->drawLine(tmp.left() + 2, tmp.top(), tmp.right() - 2, tmp.top());
- painter->drawLine(tmp.left() + 2, tmp.bottom(), tmp.right() - 2, tmp.bottom());
- painter->drawLine(tmp.left(), tmp.top() + 2, tmp.left(), tmp.bottom() - 2);
- painter->drawLine(tmp.right(), tmp.top() + 2, tmp.right(), tmp.bottom() - 2);
- painter->drawPoint(tmp.left() + 1, tmp.top() + 1);
- painter->drawPoint(tmp.right() - 1, tmp.top() + 1);
- painter->drawPoint(tmp.left() + 1, tmp.bottom() - 1);
- painter->drawPoint(tmp.right() - 1, tmp.bottom() - 1);
+ const QLine lines[4] = {
+ QLine(tmp.left() + 2, tmp.top(), tmp.right() - 2, tmp.top()),
+ QLine(tmp.left() + 2, tmp.bottom(), tmp.right() - 2, tmp.bottom()),
+ QLine(tmp.left(), tmp.top() + 2, tmp.left(), tmp.bottom() - 2),
+ QLine(tmp.right(), tmp.top() + 2, tmp.right(), tmp.bottom() - 2)
+ };
+ painter->drawLines(lines, 4);
+ const QPoint points[4] = {
+ QPoint(tmp.left() + 1, tmp.top() + 1),
+ QPoint(tmp.right() - 1, tmp.top() + 1),
+ QPoint(tmp.left() + 1, tmp.bottom() - 1),
+ QPoint(tmp.right() - 1, tmp.bottom() - 1)
+ };
+ painter->drawPoints(points, 4);
painter->setPen(titleBarHighlight);
painter->drawLine(tmp.left() + 2, tmp.top() + 1, tmp.right() - 2, tmp.top() + 1);
@@ -900,14 +906,17 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
QRect r = rect.adjusted(0, 1, 0, -1);
painter->setPen(buttonShadowAlpha);
painter->drawLine(QPoint(r.left() + 2, r.top() - 1), QPoint(r.right() - 2, r.top() - 1));
- painter->drawPoint(r.right() - 1, r.top());
- painter->drawPoint(r.right(), r.top() + 1);
- painter->drawPoint(r.right() - 1, r.bottom());
- painter->drawPoint(r.right(), r.bottom() - 1);
- painter->drawPoint(r.left() + 1, r.top() );
- painter->drawPoint(r.left(), r.top() + 1);
- painter->drawPoint(r.left() + 1, r.bottom() );
- painter->drawPoint(r.left(), r.bottom() - 1);
+ const QPoint points[8] = {
+ QPoint(r.right() - 1, r.top()),
+ QPoint(r.right(), r.top() + 1),
+ QPoint(r.right() - 1, r.bottom()),
+ QPoint(r.right(), r.bottom() - 1),
+ QPoint(r.left() + 1, r.top() ),
+ QPoint(r.left(), r.top() + 1),
+ QPoint(r.left() + 1, r.bottom() ),
+ QPoint(r.left(), r.bottom() - 1)
+ };
+ painter->drawPoints(points, 8);
painter->setPen(QPen(option->palette.background().color(), 1));
painter->drawLine(QPoint(r.left() + 2, r.top() + 1), QPoint(r.right() - 2, r.top() + 1));
@@ -939,10 +948,13 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
painter->drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2));
painter->drawLine(QPoint(r.right(), r.top() + 2), QPoint(r.right(), r.bottom() - 2));
painter->drawLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right() - 2, r.bottom()));
- painter->drawPoint(QPoint(r.right() - 1, r.bottom() - 1));
- painter->drawPoint(QPoint(r.right() - 1, r.top() + 1));
- painter->drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
- painter->drawPoint(QPoint(r.left() + 1, r.top() + 1));
+ const QPoint points2[4] = {
+ QPoint(r.right() - 1, r.bottom() - 1),
+ QPoint(r.right() - 1, r.top() + 1),
+ QPoint(r.left() + 1, r.bottom() - 1),
+ QPoint(r.left() + 1, r.top() + 1)
+ };
+ painter->drawPoints(points2, 4);
painter->drawLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - 2, r.top()));
painter->setPen(oldPen);
}
@@ -1040,10 +1052,13 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
painter->setBrush(QBrush(dark.darker(120), Qt::Dense4Pattern));
painter->setBrushOrigin(rect.topLeft());
painter->setPen(Qt::NoPen);
- painter->drawRect(rect.left(), rect.top(), rect.width(), 1); // Top
- painter->drawRect(rect.left(), rect.bottom(), rect.width(), 1); // Bottom
- painter->drawRect(rect.left(), rect.top(), 1, rect.height()); // Left
- painter->drawRect(rect.right(), rect.top(), 1, rect.height()); // Right
+ const QRect rects[4] = {
+ QRect(rect.left(), rect.top(), rect.width(), 1), // Top
+ QRect(rect.left(), rect.bottom(), rect.width(), 1), // Bottom
+ QRect(rect.left(), rect.top(), 1, rect.height()), // Left
+ QRect(rect.right(), rect.top(), 1, rect.height()) // Right
+ };
+ painter->drawRects(rects, 4);
painter->restore();
}
break;
@@ -1065,18 +1080,24 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
if (isDefault) {
r = option->rect.adjusted(0, 1, 0, -1);
painter->setPen(QPen(Qt::black, 0));
- painter->drawLine(QPoint(r.left() + 2, r.top()),
- QPoint(r.right() - 2, r.top()));
- painter->drawLine(QPoint(r.left(), r.top() + 2),
- QPoint(r.left(), r.bottom() - 2));
- painter->drawLine(QPoint(r.right(), r.top() + 2),
- QPoint(r.right(), r.bottom() - 2));
- painter->drawLine(QPoint(r.left() + 2, r.bottom()),
- QPoint(r.right() - 2, r.bottom()));
- painter->drawPoint(QPoint(r.right() - 1, r.bottom() - 1));
- painter->drawPoint(QPoint(r.right() - 1, r.top() + 1));
- painter->drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
- painter->drawPoint(QPoint(r.left() + 1, r.top() + 1));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left() + 2, r.top()),
+ QPoint(r.right() - 2, r.top())),
+ QLine(QPoint(r.left(), r.top() + 2),
+ QPoint(r.left(), r.bottom() - 2)),
+ QLine(QPoint(r.right(), r.top() + 2),
+ QPoint(r.right(), r.bottom() - 2)),
+ QLine(QPoint(r.left() + 2, r.bottom()),
+ QPoint(r.right() - 2, r.bottom()))
+ };
+ painter->drawLines(lines, 4);
+ const QPoint points[4] = {
+ QPoint(r.right() - 1, r.bottom() - 1),
+ QPoint(r.right() - 1, r.top() + 1),
+ QPoint(r.left() + 1, r.bottom() - 1),
+ QPoint(r.left() + 1, r.top() + 1)
+ };
+ painter->drawPoints(points, 4);
painter->setPen(oldPen);
}
return;
@@ -1140,10 +1161,13 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
QPoint(r.right(), r.bottom() - 2));
p->drawLine(QPoint(r.left() + 2, r.bottom()),
QPoint(r.right() - 2, r.bottom()));
- p->drawPoint(QPoint(r.right() - 1, r.bottom() - 1));
- p->drawPoint(QPoint(r.right() - 1, r.top() + 1));
- p->drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
- p->drawPoint(QPoint(r.left() + 1, r.top() + 1));
+ const QPoint points[4] = {
+ QPoint(r.right() - 1, r.bottom() - 1),
+ QPoint(r.right() - 1, r.top() + 1),
+ QPoint(r.left() + 1, r.bottom() - 1),
+ QPoint(r.left() + 1, r.top() + 1)
+ };
+ p->drawPoints(points, 4);
if (!isDefault && !hasFocus && isEnabled)
p->setPen(QPen(darkOutline.darker(110), 0));
@@ -1163,14 +1187,17 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
topShadow.setAlpha(60);
p->setPen(topShadow);
- p->drawPoint(QPoint(r.right(), r.top() + 1));
- p->drawPoint(QPoint(r.right() - 1, r.top() ));
- p->drawPoint(QPoint(r.right(), r.bottom() - 1));
- p->drawPoint(QPoint(r.right() - 1, r.bottom() ));
- p->drawPoint(QPoint(r.left() + 1, r.bottom()));
- p->drawPoint(QPoint(r.left(), r.bottom() - 1));
- p->drawPoint(QPoint(r.left() + 1, r.top()));
- p->drawPoint(QPoint(r.left(), r.top() + 1));
+ const QPoint points2[8] = {
+ QPoint(r.right(), r.top() + 1),
+ QPoint(r.right() - 1, r.top() ),
+ QPoint(r.right(), r.bottom() - 1),
+ QPoint(r.right() - 1, r.bottom() ),
+ QPoint(r.left() + 1, r.bottom()),
+ QPoint(r.left(), r.bottom() - 1),
+ QPoint(r.left() + 1, r.top()),
+ QPoint(r.left(), r.top() + 1)
+ };
+ p->drawPoints(points2, 8);
topShadow.setAlpha(30);
p->setPen(topShadow);
@@ -1183,18 +1210,24 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
if (isDefault) {
r.adjust(-1, -1, 1, 1);
p->setPen(buttonShadowAlpha.darker(120));
- p->drawLine(r.topLeft() + QPoint(3, 0), r.topRight() - QPoint(3, 0));
- p->drawLine(r.bottomLeft() + QPoint(3, 0), r.bottomRight() - QPoint(3, 0));
- p->drawLine(r.topLeft() + QPoint(0, 3), r.bottomLeft() - QPoint(0, 3));
- p->drawLine(r.topRight() + QPoint(0, 3), r.bottomRight() - QPoint(0, 3));
- p->drawPoint(r.topRight() + QPoint(-2, 1));
- p->drawPoint(r.topRight() + QPoint(-1, 2));
- p->drawPoint(r.bottomRight() + QPoint(-1, -2));
- p->drawPoint(r.bottomRight() + QPoint(-2, -1));
- p->drawPoint(r.topLeft() + QPoint(1, 2));
- p->drawPoint(r.topLeft() + QPoint(2, 1));
- p->drawPoint(r.bottomLeft() + QPoint(1, -2));
- p->drawPoint(r.bottomLeft() + QPoint(2, -1));
+ const QLine lines[4] = {
+ QLine(r.topLeft() + QPoint(3, 0), r.topRight() - QPoint(3, 0)),
+ QLine(r.bottomLeft() + QPoint(3, 0), r.bottomRight() - QPoint(3, 0)),
+ QLine(r.topLeft() + QPoint(0, 3), r.bottomLeft() - QPoint(0, 3)),
+ QLine(r.topRight() + QPoint(0, 3), r.bottomRight() - QPoint(0, 3))
+ };
+ p->drawLines(lines, 4);
+ const QPoint points3[8] = {
+ r.topRight() + QPoint(-2, 1),
+ r.topRight() + QPoint(-1, 2),
+ r.bottomRight() + QPoint(-1, -2),
+ r.bottomRight() + QPoint(-2, -1),
+ r.topLeft() + QPoint(1, 2),
+ r.topLeft() + QPoint(2, 1),
+ r.bottomLeft() + QPoint(1, -2),
+ r.bottomLeft() + QPoint(2, -1)
+ };
+ p->drawPoints(points3, 8);
}
painter->setPen(oldPen);
painter->setBrush(oldBrush);
@@ -1307,12 +1340,15 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
painter->drawLine(innerBottomLine);
painter->setPen(alphaCornerColor);
- painter->drawPoint(leftBottomInnerCorner1);
- painter->drawPoint(leftBottomInnerCorner2);
- painter->drawPoint(rightBottomInnerCorner1);
- painter->drawPoint(rightBottomInnerCorner2);
- painter->drawPoint(leftTopInnerCorner1);
- painter->drawPoint(leftTopInnerCorner2);
+ const QPoint points[6] = {
+ leftBottomInnerCorner1,
+ leftBottomInnerCorner2,
+ rightBottomInnerCorner1,
+ rightBottomInnerCorner2,
+ leftTopInnerCorner1,
+ leftTopInnerCorner2
+ };
+ painter->drawPoints(points, 6);
}
#endif // QT_NO_TABWIDGET
painter->restore();
@@ -1670,19 +1706,25 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
painter->fillRect(rect, option->palette.base());
QColor borderColor = dark.lighter(110);
painter->setPen(QPen(borderColor, 0));
- painter->drawLine(QPoint(rect.left() + 1, rect.top()), QPoint(rect.right() - 1, rect.top()));
- painter->drawLine(QPoint(rect.left() + 1, rect.bottom()), QPoint(rect.right() - 1, rect.bottom()));
- painter->drawLine(QPoint(rect.left(), rect.top() + 1), QPoint(rect.left(), rect.bottom() - 1));
- painter->drawLine(QPoint(rect.right(), rect.top() + 1), QPoint(rect.right(), rect.bottom() - 1));
+ const QLine lines[4] = {
+ QLine(QPoint(rect.left() + 1, rect.top()), QPoint(rect.right() - 1, rect.top())),
+ QLine(QPoint(rect.left() + 1, rect.bottom()), QPoint(rect.right() - 1, rect.bottom())),
+ QLine(QPoint(rect.left(), rect.top() + 1), QPoint(rect.left(), rect.bottom() - 1)),
+ QLine(QPoint(rect.right(), rect.top() + 1), QPoint(rect.right(), rect.bottom() - 1))
+ };
+ painter->drawLines(lines, 4);
QColor alphaCorner = mergedColors(borderColor, option->palette.background().color());
QColor innerShadow = mergedColors(borderColor, option->palette.base().color());
//corner smoothing
painter->setPen(alphaCorner);
- painter->drawPoint(rect.topRight());
- painter->drawPoint(rect.topLeft());
- painter->drawPoint(rect.bottomRight());
- painter->drawPoint(rect.bottomLeft());
+ const QPoint points[4] = {
+ rect.topRight(),
+ rect.topLeft(),
+ rect.bottomRight(),
+ rect.bottomLeft()
+ };
+ painter->drawPoints(points, 4);
//inner shadow
painter->setPen(innerShadow);
@@ -1807,10 +1849,13 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
option->palette.highlight());
painter->setPen(QPen(highlightOutline, 0));
- painter->drawLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom()));
- painter->drawLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom()));
- painter->drawLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom()));
- painter->drawLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom())),
+ QLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom())),
+ QLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom())),
+ QLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()))
+ };
+ painter->drawLines(lines, 4);
//draw text
QPalette::ColorRole textRole = dis ? QPalette::Text : QPalette::HighlightedText;
@@ -1864,10 +1909,13 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
highlight);
r = r.adjusted(-1, 0, 1, 0);
painter->setPen(QPen(highlightOutline, 0));
- painter->drawLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom() - 1));
- painter->drawLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom() - 1));
- painter->drawLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom()));
- painter->drawLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom() - 1)),
+ QLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom() - 1)),
+ QLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom())),
+ QLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()))
+ };
+ painter->drawLines(lines, 4);
} else {
painter->fillRect(option->rect, menuBackground);
}
@@ -2447,14 +2495,17 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
cachePainter.setPen(topShadow);
// antialias corners
- cachePainter.drawPoint(QPoint(r.right(), r.top() + 1));
- cachePainter.drawPoint(QPoint(r.right() - 1, r.top() ));
- cachePainter.drawPoint(QPoint(r.right(), r.bottom() - 1));
- cachePainter.drawPoint(QPoint(r.right() - 1, r.bottom() ));
- cachePainter.drawPoint(QPoint(r.left() + 1, r.bottom()));
- cachePainter.drawPoint(QPoint(r.left(), r.bottom() - 1));
- cachePainter.drawPoint(QPoint(r.left() + 1, r.top()));
- cachePainter.drawPoint(QPoint(r.left(), r.top() + 1));
+ const QPoint points[8] = {
+ QPoint(r.right(), r.top() + 1),
+ QPoint(r.right() - 1, r.top() ),
+ QPoint(r.right(), r.bottom() - 1),
+ QPoint(r.right() - 1, r.bottom() ),
+ QPoint(r.left() + 1, r.bottom()),
+ QPoint(r.left(), r.bottom() - 1),
+ QPoint(r.left() + 1, r.top()),
+ QPoint(r.left(), r.top() + 1)
+ };
+ cachePainter.drawPoints(points, 8);
// draw frame
topShadow.setAlpha(30);
@@ -2482,10 +2533,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
cachePainter.setPen(QPen(darkOutline, 1));
// top and bottom lines
- cachePainter.drawLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- 2, r.bottom()));
- cachePainter.drawLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - 2, r.top()));
- cachePainter.drawLine(QPoint(r.right(), r.top() + 2), QPoint(r.right(), r.bottom() - 2));
- cachePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- 2, r.bottom())),
+ QLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - 2, r.top())),
+ QLine(QPoint(r.right(), r.top() + 2), QPoint(r.right(), r.bottom() - 2)),
+ QLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2))
+ };
+ cachePainter.drawLines(lines, 4);
}
// gradients
@@ -2519,10 +2573,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
if (spinBox->frame) {
// rounded corners
- cachePainter.drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
- cachePainter.drawPoint(QPoint(r.left() + 1, r.top() + 1));
- cachePainter.drawPoint(QPoint(r.right() - 1, r.bottom() - 1));
- cachePainter.drawPoint(QPoint(r.right() - 1, r.top() + 1));
+ const QPoint points[4] = {
+ QPoint(r.left() + 1, r.bottom() - 1),
+ QPoint(r.left() + 1, r.top() + 1),
+ QPoint(r.right() - 1, r.bottom() - 1),
+ QPoint(r.right() - 1, r.top() + 1)
+ };
+ cachePainter.drawPoints(points, 4);
if (option->state & State_HasFocus) {
QColor darkoutline = option->palette.highlight().color().darker(150);
@@ -2531,10 +2588,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
if (spinBox->direction == Qt::LeftToRight) {
cachePainter.drawRect(rect.adjusted(1, 2, -3 -downRect.width(), -3));
cachePainter.setPen(QPen(darkoutline, 0));
- cachePainter.drawLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- downRect.width() - 1, r.bottom()));
- cachePainter.drawLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - downRect.width() - 1, r.top()));
- cachePainter.drawLine(QPoint(r.right() - downRect.width() - 1, r.top() + 1), QPoint(r.right()- downRect.width() - 1, r.bottom() - 1));
- cachePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- downRect.width() - 1, r.bottom())),
+ QLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - downRect.width() - 1, r.top())),
+ QLine(QPoint(r.right() - downRect.width() - 1, r.top() + 1), QPoint(r.right()- downRect.width() - 1, r.bottom() - 1)),
+ QLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2))
+ };
+ cachePainter.drawLines(lines, 4);
cachePainter.drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
cachePainter.drawPoint(QPoint(r.left() + 1, r.top() + 1));
cachePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2));
@@ -2679,18 +2739,24 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
// top outline
painter->drawLine(fullRect.left() + 5, fullRect.top(), fullRect.right() - 5, fullRect.top());
painter->drawLine(fullRect.left(), fullRect.top() + 4, fullRect.left(), fullRect.bottom());
- painter->drawPoint(fullRect.left() + 4, fullRect.top() + 1);
- painter->drawPoint(fullRect.left() + 3, fullRect.top() + 1);
- painter->drawPoint(fullRect.left() + 2, fullRect.top() + 2);
- painter->drawPoint(fullRect.left() + 1, fullRect.top() + 3);
- painter->drawPoint(fullRect.left() + 1, fullRect.top() + 4);
+ const QPoint points[5] = {
+ QPoint(fullRect.left() + 4, fullRect.top() + 1),
+ QPoint(fullRect.left() + 3, fullRect.top() + 1),
+ QPoint(fullRect.left() + 2, fullRect.top() + 2),
+ QPoint(fullRect.left() + 1, fullRect.top() + 3),
+ QPoint(fullRect.left() + 1, fullRect.top() + 4)
+ };
+ painter->drawPoints(points, 5);
painter->drawLine(fullRect.right(), fullRect.top() + 4, fullRect.right(), fullRect.bottom());
- painter->drawPoint(fullRect.right() - 3, fullRect.top() + 1);
- painter->drawPoint(fullRect.right() - 4, fullRect.top() + 1);
- painter->drawPoint(fullRect.right() - 2, fullRect.top() + 2);
- painter->drawPoint(fullRect.right() - 1, fullRect.top() + 3);
- painter->drawPoint(fullRect.right() - 1, fullRect.top() + 4);
+ const QPoint points2[5] = {
+ QPoint(fullRect.right() - 3, fullRect.top() + 1),
+ QPoint(fullRect.right() - 4, fullRect.top() + 1),
+ QPoint(fullRect.right() - 2, fullRect.top() + 2),
+ QPoint(fullRect.right() - 1, fullRect.top() + 3),
+ QPoint(fullRect.right() - 1, fullRect.top() + 4)
+ };
+ painter->drawPoints(points2, 5);
// draw bottomline
painter->drawLine(fullRect.right(), fullRect.bottom(), fullRect.left(), fullRect.bottom());
@@ -2749,10 +2815,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
painter->drawLine(maxButtonIconRect.left() + 1, maxButtonIconRect.top() + 1,
maxButtonIconRect.right() - 1, maxButtonIconRect.top() + 1);
painter->setPen(textAlphaColor);
- painter->drawPoint(maxButtonIconRect.topLeft());
- painter->drawPoint(maxButtonIconRect.topRight());
- painter->drawPoint(maxButtonIconRect.bottomLeft());
- painter->drawPoint(maxButtonIconRect.bottomRight());
+ const QPoint points[4] = {
+ maxButtonIconRect.topLeft(),
+ maxButtonIconRect.topRight(),
+ maxButtonIconRect.bottomLeft(),
+ maxButtonIconRect.bottomRight()
+ };
+ painter->drawPoints(points, 4);
}
}
@@ -2765,18 +2834,24 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
qt_cleanlooks_draw_mdibutton(painter, titleBar, closeButtonRect, hover, sunken);
QRect closeIconRect = closeButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin);
painter->setPen(textAlphaColor);
- painter->drawLine(closeIconRect.left() + 1, closeIconRect.top(),
- closeIconRect.right(), closeIconRect.bottom() - 1);
- painter->drawLine(closeIconRect.left(), closeIconRect.top() + 1,
- closeIconRect.right() - 1, closeIconRect.bottom());
- painter->drawLine(closeIconRect.right() - 1, closeIconRect.top(),
- closeIconRect.left(), closeIconRect.bottom() - 1);
- painter->drawLine(closeIconRect.right(), closeIconRect.top() + 1,
- closeIconRect.left() + 1, closeIconRect.bottom());
- painter->drawPoint(closeIconRect.topLeft());
- painter->drawPoint(closeIconRect.topRight());
- painter->drawPoint(closeIconRect.bottomLeft());
- painter->drawPoint(closeIconRect.bottomRight());
+ const QLine lines[4] = {
+ QLine(closeIconRect.left() + 1, closeIconRect.top(),
+ closeIconRect.right(), closeIconRect.bottom() - 1),
+ QLine(closeIconRect.left(), closeIconRect.top() + 1,
+ closeIconRect.right() - 1, closeIconRect.bottom()),
+ QLine(closeIconRect.right() - 1, closeIconRect.top(),
+ closeIconRect.left(), closeIconRect.bottom() - 1),
+ QLine(closeIconRect.right(), closeIconRect.top() + 1,
+ closeIconRect.left() + 1, closeIconRect.bottom())
+ };
+ painter->drawLines(lines, 4);
+ const QPoint points[4] = {
+ closeIconRect.topLeft(),
+ closeIconRect.topRight(),
+ closeIconRect.bottomLeft(),
+ closeIconRect.bottomRight()
+ };
+ painter->drawPoints(points, 4);
painter->setPen(textColor);
painter->drawLine(closeIconRect.left() + 1, closeIconRect.top() + 1,
@@ -2806,10 +2881,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
painter->drawLine(frontWindowRect.left() + 1, frontWindowRect.top() + 1,
frontWindowRect.right() - 1, frontWindowRect.top() + 1);
painter->setPen(textAlphaColor);
- painter->drawPoint(frontWindowRect.topLeft());
- painter->drawPoint(frontWindowRect.topRight());
- painter->drawPoint(frontWindowRect.bottomLeft());
- painter->drawPoint(frontWindowRect.bottomRight());
+ const QPoint points[4] = {
+ frontWindowRect.topLeft(),
+ frontWindowRect.topRight(),
+ frontWindowRect.bottomLeft(),
+ frontWindowRect.bottomRight()
+ };
+ painter->drawPoints(points, 4);
QRect backWindowRect = normalButtonIconRect.adjusted(3, 0, 0, -3);
QRegion clipRegion = backWindowRect;
@@ -2821,10 +2899,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
painter->drawLine(backWindowRect.left() + 1, backWindowRect.top() + 1,
backWindowRect.right() - 1, backWindowRect.top() + 1);
painter->setPen(textAlphaColor);
- painter->drawPoint(backWindowRect.topLeft());
- painter->drawPoint(backWindowRect.topRight());
- painter->drawPoint(backWindowRect.bottomLeft());
- painter->drawPoint(backWindowRect.bottomRight());
+ const QPoint points2[4] = {
+ backWindowRect.topLeft(),
+ backWindowRect.topRight(),
+ backWindowRect.bottomLeft(),
+ backWindowRect.bottomRight()
+ };
+ painter->drawPoints(points2, 4);
painter->restore();
}
}
@@ -3498,10 +3579,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
handlePainter.save();
handlePainter.setRenderHint(QPainter::Antialiasing);
handlePainter.translate(0.5, 0.5);
- handlePainter.drawLine(QPoint(r.left(), r.bottom() - 2), QPoint(r.left() + 2, r.bottom()));
- handlePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left() + 2, r.top()));
- handlePainter.drawLine(QPoint(r.right(), r.bottom() - 2), QPoint(r.right() - 2, r.bottom()));
- handlePainter.drawLine(QPoint(r.right(), r.top() + 2), QPoint(r.right() - 2, r.top()));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left(), r.bottom() - 2), QPoint(r.left() + 2, r.bottom())),
+ QLine(QPoint(r.left(), r.top() + 2), QPoint(r.left() + 2, r.top())),
+ QLine(QPoint(r.right(), r.bottom() - 2), QPoint(r.right() - 2, r.bottom())),
+ QLine(QPoint(r.right(), r.top() + 2), QPoint(r.right() - 2, r.top()))
+ };
+ handlePainter.drawLines(lines, 4);
handlePainter.restore();;
handlePainter.setPen(QPen(outline.darker(130), 1));
handlePainter.drawLine(QPoint(r.left() + 3, r.top()), QPoint(r.right() - 3, r.top()));
diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp
index d61d291..0500bff 100644
--- a/src/gui/styles/qstyle.cpp
+++ b/src/gui/styles/qstyle.cpp
@@ -1897,11 +1897,9 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
Returns an integer representing the specified style \a hint for
the given \a widget described by the provided style \a option.
- Note that currently, the \a returnData and \a widget parameters
- are not used; they are provided for future enhancement. In
- addition, the \a option parameter is used only in case of the
- SH_ComboBox_Popup, SH_ComboBox_LayoutDirection, and
- SH_GroupBox_TextLabelColor style hints.
+ \c returnData is used when the querying widget needs more detailed data than
+ the integer that styleHint() returns. See the QStyleHintReturn class
+ description for details.
*/
/*!
diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp
index a54c701..3789854 100644
--- a/src/gui/styles/qwindowsvistastyle.cpp
+++ b/src/gui/styles/qwindowsvistastyle.cpp
@@ -1094,7 +1094,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
XPThemeData theme(widget, painter, QLatin1String("PROGRESS"), vertical ? PP_FILLVERT : PP_FILL);
theme.rect = option->rect;
- bool reverse = bar->direction == (Qt::LeftToRight && inverted) || (bar->direction == Qt::RightToLeft && !inverted);
+ bool reverse = (bar->direction == Qt::LeftToRight && inverted) || (bar->direction == Qt::RightToLeft && !inverted);
QTime current = QTime::currentTime();
if (isIndeterminate) {
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index 6978b45..f252444 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -2126,6 +2126,7 @@ void Parser::init(const QString &css, bool isFile)
hasEscapeSequences = false;
symbols.resize(0);
+ symbols.reserve(8);
Scanner::scan(Scanner::preprocess(styleSheet, &hasEscapeSequences), &symbols);
index = 0;
errorIndex = -1;
diff --git a/src/gui/widgets/qcalendarwidget.cpp b/src/gui/widgets/qcalendarwidget.cpp
index dfd8639..8ed57cd 100644
--- a/src/gui/widgets/qcalendarwidget.cpp
+++ b/src/gui/widgets/qcalendarwidget.cpp
@@ -1967,9 +1967,7 @@ void QCalendarWidgetPrivate::_q_editingFinished()
The widget is initialized with the current month and year, but
QCalendarWidget provides several public slots to change the year
- and month that is shown. The currently displayed month and year
- can be retrieved using the currentPageMonth() and currentPageYear()
- functions, respectively.
+ and month that is shown.
By default, today's date is selected, and the user can select a
date using both mouse and keyboard. The currently selected date
@@ -1982,6 +1980,9 @@ void QCalendarWidgetPrivate::_q_editingFinished()
all. Note that a date also can be selected programmatically using
the setSelectedDate() slot.
+ The currently displayed month and year can be retrieved using the
+ monthShown() and yearShown() functions, respectively.
+
A newly created calendar widget uses abbreviated day names, and
both Saturdays and Sundays are marked in red. The calendar grid is
not visible. The week numbers are displayed, and the first column
@@ -2287,7 +2288,7 @@ int QCalendarWidget::monthShown() const
selected date.
The currently displayed month and year can be retrieved using the
- currentPageMonth() and currentPageYear() functions respectively.
+ monthShown() and yearShown() functions respectively.
\sa yearShown(), monthShown(), showPreviousMonth(), showNextMonth(),
showPreviousYear(), showNextYear()
diff --git a/src/multimedia/audio/qaudioformat.cpp b/src/multimedia/audio/qaudioformat.cpp
index 71bbf83..6ae230f 100644
--- a/src/multimedia/audio/qaudioformat.cpp
+++ b/src/multimedia/audio/qaudioformat.cpp
@@ -57,10 +57,32 @@ public:
sampleType = QAudioFormat::Unknown;
}
+ QAudioFormatPrivate(const QAudioFormatPrivate &other):
+ QSharedData(other),
+ codec(other.codec),
+ byteOrder(other.byteOrder),
+ sampleType(other.sampleType),
+ frequency(other.frequency),
+ channels(other.channels),
+ sampleSize(other.sampleSize)
+ {
+ }
+
+ QAudioFormatPrivate& operator=(const QAudioFormatPrivate &other)
+ {
+ codec = other.codec;
+ byteOrder = other.byteOrder;
+ sampleType = other.sampleType;
+ frequency = other.frequency;
+ channels = other.channels;
+ sampleSize = other.sampleSize;
+
+ return *this;
+ }
+
QString codec;
QAudioFormat::Endian byteOrder;
QAudioFormat::SampleType sampleType;
-
int frequency;
int channels;
int sampleSize;
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index e68aa3a..bd6fa57 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -425,32 +425,25 @@ void QHttpNetworkConnectionPrivate::dequeueAndSendRequest(QAbstractSocket *socke
int i = indexOf(socket);
if (!highPriorityQueue.isEmpty()) {
- for (int j = highPriorityQueue.count() - 1; j >= 0; --j) {
- HttpMessagePair &messagePair = highPriorityQueue[j];
- if (!messagePair.second->d_func()->requestIsPrepared)
- prepareRequest(messagePair);
-
- channels[i].request = messagePair.first;
- channels[i].reply = messagePair.second;
- // remove before sendRequest! else we might pipeline the same request again
- highPriorityQueue.removeAt(j);
- channels[i].sendRequest();
- return;
- }
+ // remove from queue before sendRequest! else we might pipeline the same request again
+ HttpMessagePair messagePair = highPriorityQueue.takeLast();
+ if (!messagePair.second->d_func()->requestIsPrepared)
+ prepareRequest(messagePair);
+ channels[i].request = messagePair.first;
+ channels[i].reply = messagePair.second;
+ channels[i].sendRequest();
+ return;
}
if (!lowPriorityQueue.isEmpty()) {
- for (int j = lowPriorityQueue.count() - 1; j >= 0; --j) {
- HttpMessagePair &messagePair = lowPriorityQueue[j];
- if (!messagePair.second->d_func()->requestIsPrepared)
- prepareRequest(messagePair);
- channels[i].request = messagePair.first;
- channels[i].reply = messagePair.second;
- // remove before sendRequest! else we might pipeline the same request again
- lowPriorityQueue.removeAt(j);
- channels[i].sendRequest();
- return;
- }
+ // remove from queue before sendRequest! else we might pipeline the same request again
+ HttpMessagePair messagePair = lowPriorityQueue.takeLast();
+ if (!messagePair.second->d_func()->requestIsPrepared)
+ prepareRequest(messagePair);
+ channels[i].request = messagePair.first;
+ channels[i].reply = messagePair.second;
+ channels[i].sendRequest();
+ return;
}
}
@@ -519,7 +512,7 @@ bool QHttpNetworkConnectionPrivate::fillPipeline(QList<HttpMessagePair> &queue,
if (queue.isEmpty())
return true;
- for (int i = 0; i < queue.length(); i++) {
+ for (int i = queue.count() - 1; i >= 0; --i) {
HttpMessagePair messagePair = queue.at(i);
const QHttpNetworkRequest &request = messagePair.first;
diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp
index b624c24..be7896b 100644
--- a/src/network/access/qnetworkaccessbackend.cpp
+++ b/src/network/access/qnetworkaccessbackend.cpp
@@ -92,8 +92,11 @@ QNetworkAccessBackend *QNetworkAccessManagerPrivate::findBackend(QNetworkAccessM
QNetworkRequest::PreferNetwork).toInt());
if (mode == QNetworkRequest::AlwaysCache
&& (op == QNetworkAccessManager::GetOperation
- || op == QNetworkAccessManager::HeadOperation))
- return new QNetworkAccessCacheBackend;
+ || op == QNetworkAccessManager::HeadOperation)) {
+ QNetworkAccessBackend *backend = new QNetworkAccessCacheBackend;
+ backend->manager = this;
+ return backend;
+ }
if (!factoryDataShutdown) {
QMutexLocker locker(&factoryData()->mutex);
@@ -111,7 +114,6 @@ QNetworkAccessBackend *QNetworkAccessManagerPrivate::findBackend(QNetworkAccessM
return 0;
}
-
QNonContiguousByteDevice* QNetworkAccessBackend::createUploadByteDevice()
{
QNonContiguousByteDevice* device = 0;
@@ -143,6 +145,8 @@ void QNetworkAccessBackend::emitReplyUploadProgress(qint64 bytesSent, qint64 byt
}
QNetworkAccessBackend::QNetworkAccessBackend()
+ : manager(0)
+ , reply(0)
{
}
@@ -205,7 +209,9 @@ QList<QNetworkProxy> QNetworkAccessBackend::proxyList() const
QAbstractNetworkCache *QNetworkAccessBackend::networkCache() const
{
- return reply->networkCache; // should be the same as manager->networkCache
+ if (!manager)
+ return 0;
+ return manager->networkCache;
}
void QNetworkAccessBackend::setCachingEnabled(bool enable)
diff --git a/src/network/access/qnetworkaccesscachebackend.cpp b/src/network/access/qnetworkaccesscachebackend.cpp
index df66c9d..2be10db 100644
--- a/src/network/access/qnetworkaccesscachebackend.cpp
+++ b/src/network/access/qnetworkaccesscachebackend.cpp
@@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE
QNetworkAccessCacheBackend::QNetworkAccessCacheBackend()
: QNetworkAccessBackend()
+ , device(0)
{
}
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index d925e77..bc01e82 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -711,9 +711,6 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
// fourth step: setup the reply
priv->setup(op, request, outgoingData);
- if (request.attribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork).toInt() !=
- QNetworkRequest::AlwaysNetwork)
- priv->setNetworkCache(d->networkCache);
#ifndef QT_NO_NETWORKPROXY
QList<QNetworkProxy> proxyList = d->queryProxy(QNetworkProxyQuery(request.url()));
priv->proxyList = proxyList;
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index 3b0948b..a60a8dd 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
inline QNetworkReplyImplPrivate::QNetworkReplyImplPrivate()
: backend(0), outgoingData(0), outgoingDataBuffer(0),
- copyDevice(0), networkCache(0),
+ copyDevice(0),
cacheEnabled(false), cacheSaveDevice(0),
notificationHandlingPaused(false),
bytesDownloaded(0), lastBytesDownloaded(-1), bytesUploaded(-1),
@@ -252,11 +252,6 @@ void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const
q->QIODevice::open(QIODevice::ReadOnly);
}
-void QNetworkReplyImplPrivate::setNetworkCache(QAbstractNetworkCache *nc)
-{
- networkCache = nc;
-}
-
void QNetworkReplyImplPrivate::backendNotify(InternalNotifications notification)
{
Q_Q(QNetworkReplyImpl);
@@ -318,17 +313,28 @@ void QNetworkReplyImplPrivate::resumeNotificationHandling()
QCoreApplication::postEvent(q, new QEvent(QEvent::NetworkReplyUpdated));
}
+QAbstractNetworkCache *QNetworkReplyImplPrivate::networkCache() const
+{
+ if (!backend)
+ return 0;
+ return backend->networkCache();
+}
+
void QNetworkReplyImplPrivate::createCache()
{
// check if we can save and if we're allowed to
- if (!networkCache || !request.attribute(QNetworkRequest::CacheSaveControlAttribute, true).toBool())
+ if (!networkCache()
+ || !request.attribute(QNetworkRequest::CacheSaveControlAttribute, true).toBool()
+ || request.attribute(QNetworkRequest::CacheLoadControlAttribute,
+ QNetworkRequest::PreferNetwork).toInt()
+ == QNetworkRequest::AlwaysNetwork)
return;
cacheEnabled = true;
}
bool QNetworkReplyImplPrivate::isCachingEnabled() const
{
- return (cacheEnabled && networkCache != 0);
+ return (cacheEnabled && networkCache() != 0);
}
void QNetworkReplyImplPrivate::setCachingEnabled(bool enable)
@@ -352,7 +358,7 @@ void QNetworkReplyImplPrivate::setCachingEnabled(bool enable)
qDebug("QNetworkReplyImpl: setCachingEnabled(true) called after setCachingEnabled(false) -- "
"backend %s probably needs to be fixed",
backend->metaObject()->className());
- networkCache->remove(url);
+ networkCache()->remove(url);
cacheSaveDevice = 0;
cacheEnabled = false;
}
@@ -361,9 +367,9 @@ void QNetworkReplyImplPrivate::setCachingEnabled(bool enable)
void QNetworkReplyImplPrivate::completeCacheSave()
{
if (cacheEnabled && errorCode != QNetworkReplyImpl::NoError) {
- networkCache->remove(url);
+ networkCache()->remove(url);
} else if (cacheEnabled && cacheSaveDevice) {
- networkCache->insert(cacheSaveDevice);
+ networkCache()->insert(cacheSaveDevice);
}
cacheSaveDevice = 0;
cacheEnabled = false;
@@ -410,15 +416,15 @@ void QNetworkReplyImplPrivate::appendDownstreamData(QByteDataBuffer &data)
metaData.setAttributes(attributes);
}
- cacheSaveDevice = networkCache->prepare(metaData);
+ cacheSaveDevice = networkCache()->prepare(metaData);
if (!cacheSaveDevice || (cacheSaveDevice && !cacheSaveDevice->isOpen())) {
if (cacheSaveDevice && !cacheSaveDevice->isOpen())
qCritical("QNetworkReplyImpl: network cache returned a device that is not open -- "
"class %s probably needs to be fixed",
- networkCache->metaObject()->className());
+ networkCache()->metaObject()->className());
- networkCache->remove(url);
+ networkCache()->remove(url);
cacheSaveDevice = 0;
cacheEnabled = false;
}
@@ -566,7 +572,7 @@ QNetworkReplyImpl::~QNetworkReplyImpl()
{
Q_D(QNetworkReplyImpl);
if (d->isCachingEnabled())
- d->networkCache->remove(url());
+ d->networkCache()->remove(url());
}
void QNetworkReplyImpl::abort()
diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h
index 8cda7a4..04f8aa8 100644
--- a/src/network/access/qnetworkreplyimpl_p.h
+++ b/src/network/access/qnetworkreplyimpl_p.h
@@ -131,7 +131,6 @@ public:
void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request,
QIODevice *outgoingData);
- void setNetworkCache(QAbstractNetworkCache *networkCache);
void pauseNotificationHandling();
void resumeNotificationHandling();
@@ -160,7 +159,7 @@ public:
QIODevice *outgoingData;
QRingBuffer *outgoingDataBuffer;
QIODevice *copyDevice;
- QAbstractNetworkCache *networkCache;
+ QAbstractNetworkCache *networkCache() const;
bool cacheEnabled;
QIODevice *cacheSaveDevice;
diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp
index af8d6fb..908f01f 100644
--- a/src/network/kernel/qnetworkproxy.cpp
+++ b/src/network/kernel/qnetworkproxy.cpp
@@ -220,6 +220,7 @@
#ifndef QT_NO_NETWORKPROXY
+#include "private/qnetworkproxy_p.h"
#include "private/qsocks5socketengine_p.h"
#include "private/qhttpsocketengine_p.h"
#include "qauthenticator.h"
@@ -1156,6 +1157,29 @@ QNetworkProxyFactory::~QNetworkProxyFactory()
{
}
+
+/*!
+ Enables the use of the platform-specific proxy settings, and only those.
+ See systemProxyForQuery() for more information.
+
+ Internally, this method (when called with \a enable set to true)
+ sets an application-wide proxy factory. For this reason, this method
+ is mutually exclusive with setApplicationProxyFactory: calling
+ setApplicationProxyFactory overrides the use of the system-wide proxy,
+ and calling setUseSystemConfigurationEnabled overrides any
+ application proxy or proxy factory that was previously set.
+
+ \since 4.6
+*/
+void QNetworkProxyFactory::setUseSystemConfigurationEnabled(bool enable)
+{
+ if (enable) {
+ setApplicationProxyFactory(new QSystemConfigurationProxyFactory);
+ } else {
+ setApplicationProxyFactory(0);
+ }
+}
+
/*!
Sets the application-wide proxy factory to be \a factory. This
function will take ownership of that object and will delete it
diff --git a/src/network/kernel/qnetworkproxy.h b/src/network/kernel/qnetworkproxy.h
index d64ba09..01a88b8 100644
--- a/src/network/kernel/qnetworkproxy.h
+++ b/src/network/kernel/qnetworkproxy.h
@@ -171,6 +171,7 @@ public:
virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query = QNetworkProxyQuery()) = 0;
+ static void setUseSystemConfigurationEnabled(bool enable);
static void setApplicationProxyFactory(QNetworkProxyFactory *factory);
static QList<QNetworkProxy> proxyForQuery(const QNetworkProxyQuery &query);
static QList<QNetworkProxy> systemProxyForQuery(const QNetworkProxyQuery &query = QNetworkProxyQuery());
diff --git a/src/network/kernel/qnetworkproxy_p.h b/src/network/kernel/qnetworkproxy_p.h
new file mode 100644
index 0000000..facbfed
--- /dev/null
+++ b/src/network/kernel/qnetworkproxy_p.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 David Faure <dfaure@kdab.net>
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtNetwork module 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$
+**
+****************************************************************************/
+
+#ifndef QNETWORKPROXY_P_H
+#define QNETWORKPROXY_P_H
+
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the QLibrary class. This header file may change from
+// version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef QT_NO_NETWORKPROXY
+
+QT_BEGIN_NAMESPACE
+
+class QSystemConfigurationProxyFactory : public QNetworkProxyFactory
+{
+public:
+ QSystemConfigurationProxyFactory() : QNetworkProxyFactory() {}
+
+ virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery& query)
+ {
+ QList<QNetworkProxy> proxies = QNetworkProxyFactory::systemProxyForQuery(query);
+
+ // Make sure NoProxy is in the list, so that QTcpServer can work:
+ // it searches for the first proxy that can has the ListeningCapability capability
+ // if none have (as is the case with HTTP proxies), it fails to bind.
+ // NoProxy allows it to fallback to the 'no proxy' case and bind.
+ proxies.append(QNetworkProxy::NoProxy);
+
+ return proxies;
+ }
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_NETWORKINTERFACE
+
+#endif
+
diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp
index 34a702b..8080261 100644
--- a/src/network/kernel/qnetworkproxy_win.cpp
+++ b/src/network/kernel/qnetworkproxy_win.cpp
@@ -363,8 +363,13 @@ QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro
if (sp->isAutoConfig) {
WINHTTP_PROXY_INFO proxyInfo;
- // try to get the proxy config for the URL, if we have a URL
+ // try to get the proxy config for the URL
QUrl url = query.url();
+ // url could be empty, e.g. from QNetworkProxy::applicationProxy(), that's fine,
+ // we'll still ask for the proxy.
+ // But for a file url, we know we don't need one.
+ if (url.scheme() == QLatin1String("file") || url.scheme() == QLatin1String("qrc"))
+ return sp->defaultResult;
if (query.queryType() != QNetworkProxyQuery::UrlRequest) {
// change the scheme to https, maybe it'll work
url.setScheme(QLatin1String("https"));
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index bb0915a..9ef92e1 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -752,6 +752,7 @@ QHttpSocketEnginePrivate::QHttpSocketEnginePrivate()
, readNotificationPending(false)
, writeNotificationPending(false)
, connectionNotificationPending(false)
+ , pendingResponseData(0)
{
socket = 0;
state = QHttpSocketEngine::None;
diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp
index 3e56995..3d9aa61 100644
--- a/src/network/socket/qnativesocketengine.cpp
+++ b/src/network/socket/qnativesocketengine.cpp
@@ -389,10 +389,19 @@ bool QNativeSocketEngine::initialize(QAbstractSocket::SocketType socketType, QAb
qWarning("QNativeSocketEngine::initialize unable to inline out-of-band data");
}
- // Set the send and receive buffer sizes to a magic size, found
- // most optimal for our platforms.
- setReceiveBufferSize(49152);
- setSendBufferSize(49152);
+ // Before Qt 4.6, we always set the send and receive buffer size to 49152 as
+ // this was found to be an optimal value. However, modern OS
+ // all have some kind of auto tuning for this and we therefore don't set
+ // this explictly anymore.
+ // If it introduces any performance regressions for Qt 4.6.x (x > 0) then
+ // it will be put back in.
+ //
+ // You can use tests/manual/qhttpnetworkconnection to test HTTP download speed
+ // with this.
+ //
+ // pre-4.6:
+ // setReceiveBufferSize(49152);
+ // setSendBufferSize(49152);
d->socketType = socketType;
d->socketProtocol = protocol;
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp
index 666770d..3793b1e 100644
--- a/src/network/ssl/qsslcertificate.cpp
+++ b/src/network/ssl/qsslcertificate.cpp
@@ -250,14 +250,22 @@ void QSslCertificate::clear()
*/
QByteArray QSslCertificate::version() const
{
+ if (d->versionString.isEmpty() && d->x509)
+ d->versionString =
+ QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->version)) + 1);
+
return d->versionString;
}
/*!
- Returns the certificate's serial number string.
+ Returns the certificate's serial number string in decimal format.
*/
QByteArray QSslCertificate::serialNumber() const
{
+ if (d->serialNumberString.isEmpty() && d->x509)
+ d->serialNumberString =
+ QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->serialNumber)));
+
return d->serialNumberString;
}
diff --git a/src/network/ssl/qsslerror.cpp b/src/network/ssl/qsslerror.cpp
index 69d2ccd..d47c91d 100644
--- a/src/network/ssl/qsslerror.cpp
+++ b/src/network/ssl/qsslerror.cpp
@@ -105,10 +105,8 @@ public:
};
/*!
- Constructs a QSslError object. The two optional arguments specify the \a
- error that occurred, and which \a certificate the error relates to.
+ Constructs a QSslError object with no error and default certificate.
- \sa QSslCertificate
*/
// RVCT compiler in debug build does not like about default values in const-
@@ -120,6 +118,11 @@ QSslError::QSslError()
d->certificate = QSslCertificate();
}
+/*!
+ Constructs a QSslError object. The argument specifies the \a
+ error that occurred.
+
+*/
QSslError::QSslError(SslError error)
: d(new QSslErrorPrivate)
{
@@ -127,6 +130,12 @@ QSslError::QSslError(SslError error)
d->certificate = QSslCertificate();
}
+/*!
+ Constructs a QSslError object. The two arguments specify the \a
+ error that occurred, and which \a certificate the error relates to.
+
+ \sa QSslCertificate
+*/
QSslError::QSslError(SslError error, const QSslCertificate &certificate)
: d(new QSslErrorPrivate)
{
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 6858d40..0e0c347 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -1745,7 +1745,13 @@ qint64 QSslSocket::writeData(const char *data, qint64 len)
\internal
*/
QSslSocketPrivate::QSslSocketPrivate()
- : initialized(false), readyReadEmittedPointer(0), plainSocket(0)
+ : initialized(false)
+ , mode(QSslSocket::UnencryptedMode)
+ , autoStartHandshake(false)
+ , connectionEncrypted(false)
+ , ignoreAllSslErrors(false)
+ , readyReadEmittedPointer(0)
+ , plainSocket(0)
{
QSslConfigurationPrivate::deepCopyDefaultConfiguration(&configuration);
}
diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp
index 5b04a57..d3dcd51 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp
+++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp
@@ -94,6 +94,7 @@ QT_BEGIN_NAMESPACE
#ifdef SSLEAY_MACROS
DEFINEFUNC3(void *, ASN1_dup, i2d_of_void *a, a, d2i_of_void *b, b, char *c, c, return 0, return)
#endif
+DEFINEFUNC(long, ASN1_INTEGER_get, ASN1_INTEGER *a, a, return 0, return)
DEFINEFUNC(unsigned char *, ASN1_STRING_data, ASN1_STRING *a, a, return 0, return)
DEFINEFUNC(int, ASN1_STRING_length, ASN1_STRING *a, a, return 0, return)
DEFINEFUNC4(long, BIO_ctrl, BIO *a, a, int b, b, long c, c, void *d, d, return -1, return)
@@ -608,6 +609,7 @@ bool q_resolveOpenSslSymbols()
#ifdef SSLEAY_MACROS
RESOLVEFUNC(ASN1_dup)
#endif
+ RESOLVEFUNC(ASN1_INTEGER_get)
RESOLVEFUNC(ASN1_STRING_data)
RESOLVEFUNC(ASN1_STRING_length)
RESOLVEFUNC(BIO_ctrl)
diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h
index f9c92e5..30762ca 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols_p.h
+++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h
@@ -201,6 +201,7 @@ QT_BEGIN_NAMESPACE
#endif // !defined QT_LINKED_OPENSSL
bool q_resolveOpenSslSymbols();
+long q_ASN1_INTEGER_get(ASN1_INTEGER *a);
unsigned char * q_ASN1_STRING_data(ASN1_STRING *a);
int q_ASN1_STRING_length(ASN1_STRING *a);
long q_BIO_ctrl(BIO *a, int b, long c, void *d);
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
index 891c027..d48a7b6 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
@@ -570,20 +570,34 @@ bool QGLEngineShaderManager::useCorrectShaderProg()
requiredProgram.program->link();
if (!requiredProgram.program->isLinked()) {
+ QLatin1String none("none");
+ QLatin1String br("\n");
QString error;
- qWarning() << "Shader program failed to link,"
+ error = QLatin1String("Shader program failed to link,")
#if defined(QT_DEBUG)
- << '\n'
- << " Shaders Used:" << '\n'
- << " mainVertexShader = " << requiredProgram.mainVertexShader->objectName() << '\n'
- << " positionVertexShader = " << requiredProgram.positionVertexShader->objectName() << '\n'
- << " mainFragShader = " << requiredProgram.mainFragShader->objectName() << '\n'
- << " srcPixelFragShader = " << requiredProgram.srcPixelFragShader->objectName() << '\n'
- << " maskFragShader = " << requiredProgram.maskFragShader->objectName() << '\n'
- << " compositionFragShader = "<< requiredProgram.compositionFragShader->objectName() << '\n'
+ + br
+ + QLatin1String(" Shaders Used:\n")
+ + QLatin1String(" mainVertexShader = ")
+ + (requiredProgram.mainVertexShader ?
+ requiredProgram.mainVertexShader->objectName() : none) + br
+ + QLatin1String(" positionVertexShader = ")
+ + (requiredProgram.positionVertexShader ?
+ requiredProgram.positionVertexShader->objectName() : none) + br
+ + QLatin1String(" mainFragShader = ")
+ + (requiredProgram.mainFragShader ?
+ requiredProgram.mainFragShader->objectName() : none) + br
+ + QLatin1String(" srcPixelFragShader = ")
+ + (requiredProgram.srcPixelFragShader ?
+ requiredProgram.srcPixelFragShader->objectName() : none) + br
+ + QLatin1String(" maskFragShader = ")
+ + (requiredProgram.maskFragShader ?
+ requiredProgram.maskFragShader->objectName() : none) + br
+ + QLatin1String(" compositionFragShader = ")
+ + (requiredProgram.compositionFragShader ?
+ requiredProgram.compositionFragShader->objectName() : none) + br
#endif
- << " Error Log:" << '\n'
- << " " << requiredProgram.program->log();
+ + QLatin1String(" Error Log:\n")
+ + QLatin1String(" ") + requiredProgram.program->log();
qWarning() << error;
delete requiredProgram.program;
} else {
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 895dd65..0c01263 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -226,6 +226,7 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height)
glDisable(GL_DEPTH_TEST);
glDisable(GL_SCISSOR_TEST);
+ glDisable(GL_BLEND);
glViewport(0, 0, oldWidth, oldHeight);
@@ -379,7 +380,7 @@ void QGL2PaintEngineExPrivate::useSimpleShader()
}
if (simpleShaderDepthUniformDirty) {
- shaderManager->simpleProgram()->setUniformValue("depth", (GLfloat)q->state()->currentDepth);
+ shaderManager->simpleProgram()->setUniformValue("depth", normalizedDeviceDepth(q->state()->currentDepth));
simpleShaderDepthUniformDirty = false;
}
}
@@ -730,7 +731,6 @@ void QGL2PaintEngineExPrivate::resetGLState()
glActiveTexture(GL_TEXTURE0);
glDisable(GL_DEPTH_TEST);
glDisable(GL_SCISSOR_TEST);
- glDepthFunc(GL_LESS);
glDepthMask(true);
glClearDepth(1);
}
@@ -958,7 +958,7 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
}
if (depthUniformDirty) {
- shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), (GLfloat)q->state()->currentDepth);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), normalizedDeviceDepth(q->state()->currentDepth));
depthUniformDirty = false;
}
@@ -1350,7 +1350,7 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
if (!d->inRenderText) {
glDisable(GL_DEPTH_TEST);
glDisable(GL_SCISSOR_TEST);
- glDepthFunc(GL_LEQUAL);
+ glDepthFunc(GL_LESS);
glDepthMask(false);
}
@@ -1440,7 +1440,7 @@ void QGL2PaintEngineEx::ensureActive()
if (d->needsSync) {
glViewport(0, 0, d->width, d->height);
glDepthMask(false);
- glDepthFunc(GL_LEQUAL);
+ glDepthFunc(GL_LESS);
setState(state());
d->needsSync = false;
}
@@ -1491,7 +1491,7 @@ void QGL2PaintEngineEx::clipEnabledChanged()
d->regenerateDepthClip();
} else {
if (d->use_system_clip) {
- state()->currentDepth = -0.5f;
+ state()->currentDepth = 0;
} else {
state()->depthTestEnabled = false;
}
@@ -1500,7 +1500,7 @@ void QGL2PaintEngineEx::clipEnabledChanged()
}
}
-void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, float depth)
+void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint depth)
{
transferMode(BrushDrawingMode);
@@ -1509,7 +1509,7 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, float depth)
if (q->state()->needsDepthBufferClear) {
glDepthMask(true);
- glClearDepth(0.5);
+ glClearDepth(rawDepth(2));
glClear(GL_DEPTH_BUFFER_BIT);
q->state()->needsDepthBufferClear = false;
glDepthMask(false);
@@ -1531,7 +1531,7 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, float depth)
glColorMask(false, false, false, false);
glDepthMask(true);
- shaderManager->simpleProgram()->setUniformValue("depth", depth);
+ shaderManager->simpleProgram()->setUniformValue("depth", normalizedDeviceDepth(depth));
simpleShaderDepthUniformDirty = true;
glEnable(GL_DEPTH_TEST);
@@ -1595,12 +1595,12 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
glDepthFunc(GL_ALWAYS);
- state()->maxDepth = 0.5f;
+ state()->maxDepth = 4;
d->writeClip(qtVectorPathForPath(path), state()->maxDepth);
- state()->currentDepth = 0.25f;
+ state()->currentDepth = 3;
state()->depthTestEnabled = true;
- glDepthFunc(GL_LEQUAL);
+ glDepthFunc(GL_LESS);
glEnable(GL_DEPTH_TEST);
}
@@ -1609,7 +1609,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
if (d->use_system_clip) {
glEnable(GL_DEPTH_TEST);
state()->depthTestEnabled = true;
- state()->currentDepth = -0.5;
+ state()->currentDepth = 0;
} else {
glDisable(GL_DEPTH_TEST);
state()->depthTestEnabled = false;
@@ -1617,18 +1617,18 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
state()->canRestoreClip = false;
break;
case Qt::IntersectClip:
- state()->maxDepth = (1.0f + state()->maxDepth) * 0.5;
+ ++state()->maxDepth;
d->writeClip(path, state()->maxDepth);
- state()->currentDepth = 1.5 * state()->maxDepth - 0.5f;
+ state()->currentDepth = state()->maxDepth - 1;
state()->depthTestEnabled = true;
break;
case Qt::ReplaceClip:
d->systemStateChanged();
state()->rectangleClip = QRect();
- state()->maxDepth = 0.5f;
+ state()->maxDepth = 4;
glDepthFunc(GL_ALWAYS);
d->writeClip(path, state()->maxDepth);
- state()->currentDepth = 0.25f;
+ state()->currentDepth = 3;
state()->canRestoreClip = false;
state()->depthTestEnabled = true;
break;
@@ -1640,7 +1640,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
break;
}
- glDepthFunc(GL_LEQUAL);
+ glDepthFunc(GL_LESS);
if (state()->depthTestEnabled) {
glEnable(GL_DEPTH_TEST);
d->simpleShaderDepthUniformDirty = true;
@@ -1671,8 +1671,8 @@ void QGL2PaintEngineExPrivate::systemStateChanged()
glDisable(GL_SCISSOR_TEST);
- q->state()->currentDepth = -0.5f;
- q->state()->maxDepth = 0.5f;
+ q->state()->currentDepth = 1;
+ q->state()->maxDepth = 4;
q->state()->rectangleClip = QRect(0, 0, width, height);
@@ -1707,8 +1707,8 @@ void QGL2PaintEngineExPrivate::systemStateChanged()
path.addRegion(systemClip);
glDepthFunc(GL_ALWAYS);
- writeClip(qtVectorPathForPath(path), 0.0f);
- glDepthFunc(GL_LEQUAL);
+ writeClip(qtVectorPathForPath(path), 2);
+ glDepthFunc(GL_LESS);
glEnable(GL_DEPTH_TEST);
q->state()->depthTestEnabled = true;
@@ -1717,7 +1717,7 @@ void QGL2PaintEngineExPrivate::systemStateChanged()
q->transformChanged();
}
- q->state()->currentDepth = -0.5f;
+ q->state()->currentDepth = 1;
simpleShaderDepthUniformDirty = true;
depthUniformDirty = true;
}
@@ -1756,7 +1756,7 @@ void QGL2PaintEngineEx::setState(QPainterState *new_state)
if (old_state && old_state != s && old_state->canRestoreClip) {
d->updateDepthScissorTest();
glDepthMask(false);
- glDepthFunc(GL_LEQUAL);
+ glDepthFunc(GL_LESS);
s->maxDepth = old_state->maxDepth;
} else {
d->regenerateDepthClip();
@@ -1801,8 +1801,8 @@ QOpenGL2PaintEngineState::QOpenGL2PaintEngineState()
needsDepthBufferClear = true;
depthTestEnabled = false;
scissorTestEnabled = false;
- currentDepth = -0.5f;
- maxDepth = 0.5f;
+ currentDepth = 1;
+ maxDepth = 4;
canRestoreClip = true;
hasRectangleClip = false;
}
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index 58fcde1..552e390 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -82,8 +82,8 @@ public:
bool depthTestEnabled;
bool scissorTestEnabled;
- qreal currentDepth;
- qreal maxDepth;
+ uint maxDepth;
+ uint currentDepth;
bool canRestoreClip;
QRect rectangleClip;
@@ -230,13 +230,26 @@ public:
QGLEngineShaderManager* shaderManager;
- void writeClip(const QVectorPath &path, float depth);
+ void writeClip(const QVectorPath &path, uint depth);
void updateDepthScissorTest();
void setScissor(const QRect &rect);
void regenerateDepthClip();
void systemStateChanged();
uint use_system_clip : 1;
+ static inline GLfloat rawDepth(uint depth)
+ {
+ // assume at least 16 bits in the depth buffer, and
+ // use 2^15 depth levels to be safe with regard to
+ // rounding issues etc
+ return depth * (1.0f / GLfloat((1 << 15) - 1));
+ }
+
+ static inline GLfloat normalizedDeviceDepth(uint depth)
+ {
+ return 2.0f * rawDepth(depth) - 1.0f;
+ }
+
uint location(QGLEngineShaderManager::Uniform uniform)
{
return shaderManager->getUniformLocation(uniform);
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index f8a9196..8b7674e 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1273,6 +1273,14 @@ bool operator!=(const QGLFormat& a, const QGLFormat& b)
/*****************************************************************************
QGLContext implementation
*****************************************************************************/
+QGLContextPrivate::~QGLContextPrivate()
+{
+ if (!group->m_refs.deref()) {
+ Q_ASSERT(group->context() == q_ptr);
+ delete group;
+ }
+}
+
void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format)
{
Q_Q(QGLContext);
@@ -4861,40 +4869,40 @@ bool QGLDrawable::autoFillBackground() const
bool QGLShareRegister::checkSharing(const QGLContext *context1, const QGLContext *context2) {
- bool sharing = (context1 && context2 && context1->d_ptr->groupResources == context2->d_ptr->groupResources);
+ bool sharing = (context1 && context2 && context1->d_ptr->group == context2->d_ptr->group);
return sharing;
}
void QGLShareRegister::addShare(const QGLContext *context, const QGLContext *share) {
Q_ASSERT(context && share);
- if (context->d_ptr->groupResources == share->d_ptr->groupResources)
+ if (context->d_ptr->group == share->d_ptr->group)
return;
// Make sure 'context' is not already shared with another group of contexts.
- Q_ASSERT(reg.find(context->d_ptr->groupResources) == reg.end());
- Q_ASSERT(context->d_ptr->groupResources->refs == 1);
+ Q_ASSERT(reg.find(context->d_ptr->group) == reg.end());
+ Q_ASSERT(context->d_ptr->group->m_refs == 1);
// Free 'context' group resources and make it use the same resources as 'share'.
- delete context->d_ptr->groupResources;
- context->d_ptr->groupResources = share->d_ptr->groupResources;
- context->d_ptr->groupResources->refs.ref();
+ delete context->d_ptr->group;
+ context->d_ptr->group = share->d_ptr->group;
+ context->d_ptr->group->m_refs.ref();
// Maintain a list of all the contexts in each group of sharing contexts.
- SharingHash::iterator it = reg.find(share->d_ptr->groupResources);
+ SharingHash::iterator it = reg.find(share->d_ptr->group);
if (it == reg.end())
- it = reg.insert(share->d_ptr->groupResources, ContextList() << share);
+ it = reg.insert(share->d_ptr->group, ContextList() << share);
it.value() << context;
}
QList<const QGLContext *> QGLShareRegister::shares(const QGLContext *context) {
- SharingHash::const_iterator it = reg.find(context->d_ptr->groupResources);
+ SharingHash::const_iterator it = reg.find(context->d_ptr->group);
if (it == reg.end())
return ContextList();
return it.value();
}
void QGLShareRegister::removeShare(const QGLContext *context) {
- SharingHash::iterator it = reg.find(context->d_ptr->groupResources);
+ SharingHash::iterator it = reg.find(context->d_ptr->group);
if (it == reg.end())
return;
@@ -4902,6 +4910,10 @@ void QGLShareRegister::removeShare(const QGLContext *context) {
Q_ASSERT(count == 1);
Q_UNUSED(count);
+ // Update context group representative.
+ if (context->d_ptr->group->m_context == context)
+ context->d_ptr->group->m_context = it.value().first();
+
Q_ASSERT(it.value().size() != 0);
if (it.value().size() == 1)
reg.erase(it);
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 2fd3070..a39c52c 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -193,11 +193,24 @@ public:
#endif
};
-struct QGLContextGroupResources
+// QGLContextPrivate has the responsibility of creating context groups.
+// QGLContextPrivate and QGLShareRegister will both maintain the reference counter and destroy
+// context groups when needed.
+// QGLShareRegister has the responsibility of keeping the context pointer up to date.
+class QGLContextGroup
{
- QGLContextGroupResources() : refs(1) { }
- QGLExtensionFuncs extensionFuncs;
- QAtomicInt refs;
+public:
+ QGLExtensionFuncs &extensionFuncs() {return m_extensionFuncs;}
+ const QGLContext *context() const {return m_context;}
+private:
+ QGLContextGroup(const QGLContext *context) : m_context(context), m_refs(1) { }
+
+ QGLExtensionFuncs m_extensionFuncs;
+ const QGLContext *m_context; // context group's representative
+ QAtomicInt m_refs;
+
+ friend class QGLShareRegister;
+ friend class QGLContextPrivate;
};
class QGLTexture;
@@ -206,8 +219,8 @@ class QGLContextPrivate
{
Q_DECLARE_PUBLIC(QGLContext)
public:
- explicit QGLContextPrivate(QGLContext *context) : internal_context(false), q_ptr(context) {groupResources = new QGLContextGroupResources;}
- ~QGLContextPrivate() {if (!groupResources->refs.deref()) delete groupResources;}
+ explicit QGLContextPrivate(QGLContext *context) : internal_context(false), q_ptr(context) {group = new QGLContextGroup(context);}
+ ~QGLContextPrivate();
QGLTexture *bindTexture(const QImage &image, GLenum target, GLint format,
QGLContext::BindOptions options);
QGLTexture *bindTexture(const QImage &image, GLenum target, GLint format, const qint64 key,
@@ -269,23 +282,23 @@ public:
QGLContext *q_ptr;
QGLFormat::OpenGLVersionFlags version_flags;
- QGLContextGroupResources *groupResources;
+ QGLContextGroup *group;
GLint max_texture_size;
GLuint current_fbo;
QPaintEngine *active_engine;
- static inline QGLContextGroupResources *qt_get_context_group(const QGLContext *ctx) { return ctx->d_ptr->groupResources; }
+ static inline QGLContextGroup *contextGroup(const QGLContext *ctx) { return ctx->d_ptr->group; }
#ifdef Q_WS_WIN
- static inline QGLExtensionFuncs& qt_get_extension_funcs(const QGLContext *ctx) { return ctx->d_ptr->groupResources->extensionFuncs; }
- static inline QGLExtensionFuncs& qt_get_extension_funcs(QGLContextGroupResources *ctx) { return ctx->extensionFuncs; }
+ static inline QGLExtensionFuncs& extensionFuncs(const QGLContext *ctx) { return ctx->d_ptr->group->extensionFuncs(); }
+ static inline QGLExtensionFuncs& extensionFuncs(QGLContextGroup *ctx) { return ctx->extensionFuncs(); }
#endif
#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
static QGLExtensionFuncs qt_extensionFuncs;
- static inline QGLExtensionFuncs& qt_get_extension_funcs(const QGLContext *) { return qt_extensionFuncs; }
- static inline QGLExtensionFuncs& qt_get_extension_funcs(QGLContextGroupResources *ctx) { return qt_extensionFuncs; }
+ static inline QGLExtensionFuncs& extensionFuncs(const QGLContext *) { return qt_extensionFuncs; }
+ static inline QGLExtensionFuncs& extensionFuncs(QGLContextGroup *) { return qt_extensionFuncs; }
#endif
QPixmapFilter *createPixmapFilter(int type) const;
@@ -402,9 +415,9 @@ public:
QList<const QGLContext *> shares(const QGLContext *context);
void removeShare(const QGLContext *context);
private:
- // Use a context's 'groupResources' pointer to uniquely identify a group.
+ // Use a context's 'group' pointer to uniquely identify a group.
typedef QList<const QGLContext *> ContextList;
- typedef QHash<const QGLContextGroupResources *, ContextList> SharingHash;
+ typedef QHash<const QGLContextGroup *, ContextList> SharingHash;
SharingHash reg;
};
diff --git a/src/opengl/qglextensions.cpp b/src/opengl/qglextensions.cpp
index e1ab6a4..a883c42 100644
--- a/src/opengl/qglextensions.cpp
+++ b/src/opengl/qglextensions.cpp
@@ -175,10 +175,10 @@ bool qt_resolve_glsl_extensions(QGLContext *ctx)
#if defined(QT_OPENGL_ES_2)
// The GLSL shader functions are always present in OpenGL/ES 2.0.
// The only exceptions are glGetProgramBinaryOES and glProgramBinaryOES.
- if (!QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glslResolved) {
+ if (!QGLContextPrivate::extensionFuncs(ctx).qt_glslResolved) {
glGetProgramBinaryOES = (_glGetProgramBinaryOES) ctx->getProcAddress(QLatin1String("glGetProgramBinaryOES"));
glProgramBinaryOES = (_glProgramBinaryOES) ctx->getProcAddress(QLatin1String("glProgramBinaryOES"));
- QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glslResolved = true;
+ QGLContextPrivate::extensionFuncs(ctx).qt_glslResolved = true;
}
return true;
#else
diff --git a/src/opengl/qglextensions_p.h b/src/opengl/qglextensions_p.h
index 60a4173..8839f60 100644
--- a/src/opengl/qglextensions_p.h
+++ b/src/opengl/qglextensions_p.h
@@ -605,114 +605,114 @@ struct QGLExtensionFuncs
#if !defined(QT_OPENGL_ES_2)
-#define glProgramStringARB QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glProgramStringARB
-#define glBindProgramARB QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glBindProgramARB
-#define glDeleteProgramsARB QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glDeleteProgramsARB
-#define glGenProgramsARB QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glGenProgramsARB
-#define glProgramLocalParameter4fvARB QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glProgramLocalParameter4fvARB
+#define glProgramStringARB QGLContextPrivate::extensionFuncs(ctx).qt_glProgramStringARB
+#define glBindProgramARB QGLContextPrivate::extensionFuncs(ctx).qt_glBindProgramARB
+#define glDeleteProgramsARB QGLContextPrivate::extensionFuncs(ctx).qt_glDeleteProgramsARB
+#define glGenProgramsARB QGLContextPrivate::extensionFuncs(ctx).qt_glGenProgramsARB
+#define glProgramLocalParameter4fvARB QGLContextPrivate::extensionFuncs(ctx).qt_glProgramLocalParameter4fvARB
-#define glActiveStencilFaceEXT QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glActiveStencilFaceEXT
+#define glActiveStencilFaceEXT QGLContextPrivate::extensionFuncs(ctx).qt_glActiveStencilFaceEXT
-#define glMultiTexCoord4f QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glMultiTexCoord4f
+#define glMultiTexCoord4f QGLContextPrivate::extensionFuncs(ctx).qt_glMultiTexCoord4f
-#define glActiveTexture QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glActiveTexture
+#define glActiveTexture QGLContextPrivate::extensionFuncs(ctx).qt_glActiveTexture
#endif // !defined(QT_OPENGL_ES_2)
// FBOs
#if !defined(QT_OPENGL_ES_2)
-#define glIsRenderbuffer QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glIsRenderbuffer
-#define glBindRenderbuffer QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glBindRenderbuffer
-#define glDeleteRenderbuffers QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glDeleteRenderbuffers
-#define glGenRenderbuffers QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glGenRenderbuffers
-#define glRenderbufferStorage QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glRenderbufferStorage
-#define glGetRenderbufferParameteriv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glGetRenderbufferParameteriv
-#define glIsFramebuffer QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glIsFramebuffer
-#define glBindFramebuffer QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glBindFramebuffer
-#define glDeleteFramebuffers QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glDeleteFramebuffers
-#define glGenFramebuffers QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glGenFramebuffers
-#define glCheckFramebufferStatus QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glCheckFramebufferStatus
-#define glFramebufferTexture2D QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glFramebufferTexture2D
-#define glFramebufferRenderbuffer QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glFramebufferRenderbuffer
-#define glGetFramebufferAttachmentParameteriv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glGetFramebufferAttachmentParameteriv
-#define glGenerateMipmap QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glGenerateMipmap
+#define glIsRenderbuffer QGLContextPrivate::extensionFuncs(ctx).qt_glIsRenderbuffer
+#define glBindRenderbuffer QGLContextPrivate::extensionFuncs(ctx).qt_glBindRenderbuffer
+#define glDeleteRenderbuffers QGLContextPrivate::extensionFuncs(ctx).qt_glDeleteRenderbuffers
+#define glGenRenderbuffers QGLContextPrivate::extensionFuncs(ctx).qt_glGenRenderbuffers
+#define glRenderbufferStorage QGLContextPrivate::extensionFuncs(ctx).qt_glRenderbufferStorage
+#define glGetRenderbufferParameteriv QGLContextPrivate::extensionFuncs(ctx).qt_glGetRenderbufferParameteriv
+#define glIsFramebuffer QGLContextPrivate::extensionFuncs(ctx).qt_glIsFramebuffer
+#define glBindFramebuffer QGLContextPrivate::extensionFuncs(ctx).qt_glBindFramebuffer
+#define glDeleteFramebuffers QGLContextPrivate::extensionFuncs(ctx).qt_glDeleteFramebuffers
+#define glGenFramebuffers QGLContextPrivate::extensionFuncs(ctx).qt_glGenFramebuffers
+#define glCheckFramebufferStatus QGLContextPrivate::extensionFuncs(ctx).qt_glCheckFramebufferStatus
+#define glFramebufferTexture2D QGLContextPrivate::extensionFuncs(ctx).qt_glFramebufferTexture2D
+#define glFramebufferRenderbuffer QGLContextPrivate::extensionFuncs(ctx).qt_glFramebufferRenderbuffer
+#define glGetFramebufferAttachmentParameteriv QGLContextPrivate::extensionFuncs(ctx).qt_glGetFramebufferAttachmentParameteriv
+#define glGenerateMipmap QGLContextPrivate::extensionFuncs(ctx).qt_glGenerateMipmap
#endif // QT_OPENGL_ES_2
-#define glBlitFramebufferEXT QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glBlitFramebufferEXT
-#define glRenderbufferStorageMultisampleEXT QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glRenderbufferStorageMultisampleEXT
+#define glBlitFramebufferEXT QGLContextPrivate::extensionFuncs(ctx).qt_glBlitFramebufferEXT
+#define glRenderbufferStorageMultisampleEXT QGLContextPrivate::extensionFuncs(ctx).qt_glRenderbufferStorageMultisampleEXT
// Buffer objects
#if !defined(QT_OPENGL_ES_2)
-#define glBindBuffer QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glBindBuffer
-#define glDeleteBuffers QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glDeleteBuffers
-#define glGenBuffers QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glGenBuffers
-#define glBufferData QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glBufferData
+#define glBindBuffer QGLContextPrivate::extensionFuncs(ctx).qt_glBindBuffer
+#define glDeleteBuffers QGLContextPrivate::extensionFuncs(ctx).qt_glDeleteBuffers
+#define glGenBuffers QGLContextPrivate::extensionFuncs(ctx).qt_glGenBuffers
+#define glBufferData QGLContextPrivate::extensionFuncs(ctx).qt_glBufferData
#endif
-#define glMapBufferARB QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glMapBufferARB
-#define glUnmapBufferARB QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glUnmapBufferARB
+#define glMapBufferARB QGLContextPrivate::extensionFuncs(ctx).qt_glMapBufferARB
+#define glUnmapBufferARB QGLContextPrivate::extensionFuncs(ctx).qt_glUnmapBufferARB
// GLSL
#if !defined(QT_OPENGL_ES_2)
-#define glCreateShader QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glCreateShader
-#define glShaderSource QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glShaderSource
-#define glShaderBinary QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glShaderBinary
-#define glCompileShader QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glCompileShader
-#define glDeleteShader QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glDeleteShader
-#define glIsShader QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glIsShader
-
-#define glCreateProgram QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glCreateProgram
-#define glAttachShader QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glAttachShader
-#define glDetachShader QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glDetachShader
-#define glLinkProgram QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glLinkProgram
-#define glUseProgram QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glUseProgram
-#define glDeleteProgram QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glDeleteProgram
-#define glIsProgram QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glIsProgram
-
-#define glGetShaderInfoLog QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glGetShaderInfoLog
-#define glGetShaderiv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glGetShaderiv
-#define glGetShaderSource QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glGetShaderSource
-#define glGetProgramiv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glGetProgramiv
-#define glGetProgramInfoLog QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glGetProgramInfoLog
-
-#define glGetUniformLocation QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glGetUniformLocation
-#define glUniform4fv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glUniform4fv
-#define glUniform3fv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glUniform3fv
-#define glUniform2fv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glUniform2fv
-#define glUniform1fv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glUniform1fv
-#define glUniform1i QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glUniform1i
-#define glUniform1iv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glUniform1iv
-#define glUniformMatrix2fv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glUniformMatrix2fv
-#define glUniformMatrix3fv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glUniformMatrix3fv
-#define glUniformMatrix4fv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glUniformMatrix4fv
-#define glUniformMatrix2x3fv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glUniformMatrix2x3fv
-#define glUniformMatrix2x4fv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glUniformMatrix2x4fv
-#define glUniformMatrix3x2fv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glUniformMatrix3x2fv
-#define glUniformMatrix3x4fv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glUniformMatrix3x4fv
-#define glUniformMatrix4x2fv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glUniformMatrix4x2fv
-#define glUniformMatrix4x3fv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glUniformMatrix4x3fv
-
-#define glBindAttribLocation QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glBindAttribLocation
-#define glGetAttribLocation QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glGetAttribLocation
-#define glVertexAttrib1fv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glVertexAttrib1fv
-#define glVertexAttrib2fv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glVertexAttrib2fv
-#define glVertexAttrib3fv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glVertexAttrib3fv
-#define glVertexAttrib4fv QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glVertexAttrib4fv
-#define glVertexAttribPointer QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glVertexAttribPointer
-#define glDisableVertexAttribArray QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glDisableVertexAttribArray
-#define glEnableVertexAttribArray QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glEnableVertexAttribArray
+#define glCreateShader QGLContextPrivate::extensionFuncs(ctx).qt_glCreateShader
+#define glShaderSource QGLContextPrivate::extensionFuncs(ctx).qt_glShaderSource
+#define glShaderBinary QGLContextPrivate::extensionFuncs(ctx).qt_glShaderBinary
+#define glCompileShader QGLContextPrivate::extensionFuncs(ctx).qt_glCompileShader
+#define glDeleteShader QGLContextPrivate::extensionFuncs(ctx).qt_glDeleteShader
+#define glIsShader QGLContextPrivate::extensionFuncs(ctx).qt_glIsShader
+
+#define glCreateProgram QGLContextPrivate::extensionFuncs(ctx).qt_glCreateProgram
+#define glAttachShader QGLContextPrivate::extensionFuncs(ctx).qt_glAttachShader
+#define glDetachShader QGLContextPrivate::extensionFuncs(ctx).qt_glDetachShader
+#define glLinkProgram QGLContextPrivate::extensionFuncs(ctx).qt_glLinkProgram
+#define glUseProgram QGLContextPrivate::extensionFuncs(ctx).qt_glUseProgram
+#define glDeleteProgram QGLContextPrivate::extensionFuncs(ctx).qt_glDeleteProgram
+#define glIsProgram QGLContextPrivate::extensionFuncs(ctx).qt_glIsProgram
+
+#define glGetShaderInfoLog QGLContextPrivate::extensionFuncs(ctx).qt_glGetShaderInfoLog
+#define glGetShaderiv QGLContextPrivate::extensionFuncs(ctx).qt_glGetShaderiv
+#define glGetShaderSource QGLContextPrivate::extensionFuncs(ctx).qt_glGetShaderSource
+#define glGetProgramiv QGLContextPrivate::extensionFuncs(ctx).qt_glGetProgramiv
+#define glGetProgramInfoLog QGLContextPrivate::extensionFuncs(ctx).qt_glGetProgramInfoLog
+
+#define glGetUniformLocation QGLContextPrivate::extensionFuncs(ctx).qt_glGetUniformLocation
+#define glUniform4fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniform4fv
+#define glUniform3fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniform3fv
+#define glUniform2fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniform2fv
+#define glUniform1fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniform1fv
+#define glUniform1i QGLContextPrivate::extensionFuncs(ctx).qt_glUniform1i
+#define glUniform1iv QGLContextPrivate::extensionFuncs(ctx).qt_glUniform1iv
+#define glUniformMatrix2fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniformMatrix2fv
+#define glUniformMatrix3fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniformMatrix3fv
+#define glUniformMatrix4fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniformMatrix4fv
+#define glUniformMatrix2x3fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniformMatrix2x3fv
+#define glUniformMatrix2x4fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniformMatrix2x4fv
+#define glUniformMatrix3x2fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniformMatrix3x2fv
+#define glUniformMatrix3x4fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniformMatrix3x4fv
+#define glUniformMatrix4x2fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniformMatrix4x2fv
+#define glUniformMatrix4x3fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniformMatrix4x3fv
+
+#define glBindAttribLocation QGLContextPrivate::extensionFuncs(ctx).qt_glBindAttribLocation
+#define glGetAttribLocation QGLContextPrivate::extensionFuncs(ctx).qt_glGetAttribLocation
+#define glVertexAttrib1fv QGLContextPrivate::extensionFuncs(ctx).qt_glVertexAttrib1fv
+#define glVertexAttrib2fv QGLContextPrivate::extensionFuncs(ctx).qt_glVertexAttrib2fv
+#define glVertexAttrib3fv QGLContextPrivate::extensionFuncs(ctx).qt_glVertexAttrib3fv
+#define glVertexAttrib4fv QGLContextPrivate::extensionFuncs(ctx).qt_glVertexAttrib4fv
+#define glVertexAttribPointer QGLContextPrivate::extensionFuncs(ctx).qt_glVertexAttribPointer
+#define glDisableVertexAttribArray QGLContextPrivate::extensionFuncs(ctx).qt_glDisableVertexAttribArray
+#define glEnableVertexAttribArray QGLContextPrivate::extensionFuncs(ctx).qt_glEnableVertexAttribArray
#else // QT_OPENGL_ES_2
-#define glGetProgramBinaryOES QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glGetProgramBinaryOES
-#define glProgramBinaryOES QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glProgramBinaryOES
+#define glGetProgramBinaryOES QGLContextPrivate::extensionFuncs(ctx).qt_glGetProgramBinaryOES
+#define glProgramBinaryOES QGLContextPrivate::extensionFuncs(ctx).qt_glProgramBinaryOES
#endif // QT_OPENGL_ES_2
#if !defined(QT_OPENGL_ES_2)
-#define glStencilOpSeparate QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glStencilOpSeparate
+#define glStencilOpSeparate QGLContextPrivate::extensionFuncs(ctx).qt_glStencilOpSeparate
#endif
#if defined(QT_OPENGL_ES_2)
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index fe967e7..427aab3 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -262,7 +262,7 @@ GLenum QGLFramebufferObjectFormat::internalFormat() const
class QGLFramebufferObjectPrivate
{
public:
- QGLFramebufferObjectPrivate() : depth_stencil_buffer(0), valid(false), bound(false), ctx(0), previous_fbo(0) {}
+ QGLFramebufferObjectPrivate() : depth_stencil_buffer(0), valid(false), bound(false), ctx(0), previous_fbo(0), engine(0) {}
~QGLFramebufferObjectPrivate() {}
void init(const QSize& sz, QGLFramebufferObject::Attachment attachment,
@@ -280,6 +280,7 @@ public:
QGLFramebufferObject::Attachment fbo_attachment;
QGLContext *ctx; // for Windows extension ptrs
GLuint previous_fbo;
+ mutable QPaintEngine *engine;
};
bool QGLFramebufferObjectPrivate::checkFramebufferStatus() const
@@ -723,6 +724,8 @@ QGLFramebufferObject::~QGLFramebufferObject()
Q_D(QGLFramebufferObject);
QGL_FUNC_CONTEXT;
+ delete d->engine;
+
if (isValid()
&& (d->ctx == QGLContext::currentContext()
|| qgl_share_reg()->checkSharing(d->ctx, QGLContext::currentContext())))
@@ -872,9 +875,22 @@ QImage QGLFramebufferObject::toImage() const
if (!d->valid)
return QImage();
- const_cast<QGLFramebufferObject *>(this)->bind();
+ // qt_gl_read_framebuffer doesn't work on a multisample FBO
+ if (format().samples() != 0) {
+ QGLFramebufferObject temp(size(), QGLFramebufferObjectFormat());
+
+ QRect rect(QPoint(0, 0), size());
+ blitFramebuffer(&temp, rect, const_cast<QGLFramebufferObject *>(this), rect);
+
+ return temp.toImage();
+ }
+
+ bool wasBound = isBound();
+ if (!wasBound)
+ const_cast<QGLFramebufferObject *>(this)->bind();
QImage image = qt_gl_read_framebuffer(d->size, d->ctx->format().alpha(), true);
- const_cast<QGLFramebufferObject *>(this)->release();
+ if (!wasBound)
+ const_cast<QGLFramebufferObject *>(this)->release();
return image;
}
@@ -890,16 +906,32 @@ Q_GLOBAL_STATIC(QOpenGLPaintEngine, qt_buffer_engine)
/*! \reimp */
QPaintEngine *QGLFramebufferObject::paintEngine() const
{
-#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL)
- return qt_buffer_engine();
-#elif defined(QT_OPENGL_ES_2)
- return qt_buffer_2_engine();
-#else
Q_D(const QGLFramebufferObject);
- if (qt_gl_preferGL2Engine())
- return qt_buffer_2_engine();
- else
- return qt_buffer_engine();
+ if (d->engine)
+ return d->engine;
+
+#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
+#if !defined (QT_OPENGL_ES_2)
+ if (qt_gl_preferGL2Engine()) {
+#endif
+ QPaintEngine *engine = qt_buffer_2_engine();
+ if (engine->isActive() && engine->paintDevice() != this) {
+ d->engine = new QGL2PaintEngineEx;
+ return d->engine;
+ }
+ return engine;
+#if !defined (QT_OPENGL_ES_2)
+ }
+#endif
+#endif
+
+#if !defined(QT_OPENGL_ES_2)
+ QPaintEngine *engine = qt_buffer_engine();
+ if (engine->isActive() && engine->paintDevice() != this) {
+ d->engine = new QOpenGLPaintEngine;
+ return d->engine;
+ }
+ return engine;
#endif
}
diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp
index 808038b..c51ccc7 100644
--- a/src/opengl/qglpixmapfilter.cpp
+++ b/src/opengl/qglpixmapfilter.cpp
@@ -119,6 +119,8 @@ private:
mutable QSize m_textureSize;
+ mutable bool m_horizontalBlur;
+
QGLShaderProgram *m_program;
};
@@ -336,46 +338,37 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glBindTexture(GL_TEXTURE_2D, 0);
- QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(painter->paintEngine());
-
- painter->save();
-
- // ensure GL_LINEAR filtering is used
- painter->setRenderHint(QPainter::SmoothPixmapTransform);
-
// prepare for updateUniforms
m_textureSize = src.size();
- // first pass, to fbo
- fbo->bind();
+ // horizontal pass, to pixmap
+ m_horizontalBlur = true;
+
+ QPainter fboPainter(fbo);
+
if (src.hasAlphaChannel()) {
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
}
- filter->setOnPainter(painter);
-
- QTransform transform = engine->state()->matrix;
- if (!transform.isIdentity()) {
- engine->state()->matrix = QTransform();
- engine->transformChanged();
- }
-
- engine->drawPixmap(src.rect().translated(0, painter->device()->height() - fbo->height()),
- src, src.rect());
+ // ensure GL_LINEAR filtering is used
+ fboPainter.setRenderHint(QPainter::SmoothPixmapTransform);
+ filter->setOnPainter(&fboPainter);
+ fboPainter.drawPixmap(0, 0, src);
+ filter->removeFromPainter(&fboPainter);
+ fboPainter.end();
- if (!transform.isIdentity()) {
- engine->state()->matrix = transform;
- engine->transformChanged();
- }
+ QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(painter->paintEngine());
- fbo->release();
+ // vertical pass, to painter
+ m_horizontalBlur = false;
- // second pass, to widget
- m_program->setUniformValue("delta", 0.0, 1.0);
+ painter->save();
+ // ensure GL_LINEAR filtering is used
+ painter->setRenderHint(QPainter::SmoothPixmapTransform);
+ filter->setOnPainter(painter);
engine->drawTexture(src.rect().translated(pos.x(), pos.y()), fbo->texture(), fbo->size(), src.rect().translated(0, fbo->height() - src.height()));
filter->removeFromPainter(painter);
-
painter->restore();
qgl_fbo_pool()->release(fbo);
@@ -386,7 +379,11 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const
void QGLPixmapBlurFilter::setUniforms(QGLShaderProgram *program)
{
program->setUniformValue("invTextureSize", 1.0 / m_textureSize.width(), 1.0 / m_textureSize.height());
- program->setUniformValue("delta", 1.0, 0.0);
+
+ if (m_horizontalBlur)
+ program->setUniformValue("delta", 1.0, 0.0);
+ else
+ program->setUniformValue("delta", 0.0, 1.0);
m_program = program;
}
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp
index c9bfd08..56b55d0 100644
--- a/src/opengl/qglshaderprogram.cpp
+++ b/src/opengl/qglshaderprogram.cpp
@@ -194,7 +194,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \enum QGLShader::ShaderType
+ \enum QGLShader::ShaderTypeBits
This enum specifies the type of QGLShader that is being created.
\value VertexShader Vertex shader written in the OpenGL Shading Language (GLSL).
@@ -246,10 +246,10 @@ QT_BEGIN_NAMESPACE
#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
#endif
-inline bool qt_check_sharing_with_current_context(QGLContextGroupResources *group)
+inline bool qt_check_sharing_with_current_context(QGLContextGroup *group)
{
const QGLContext *context = QGLContext::currentContext();
- return context && QGLContextPrivate::qt_get_context_group(context) == group;
+ return context && QGLContextPrivate::contextGroup(context) == group;
}
class QGLShaderPrivate
@@ -265,7 +265,7 @@ public:
{
}
- QGLContextGroupResources *ctx;
+ QGLContextGroup *ctx;
GLuint shader;
QGLShader::ShaderType shaderType;
bool compiled;
@@ -284,7 +284,7 @@ bool QGLShaderPrivate::create(const QGLContext *context)
context = QGLContext::currentContext();
if (!context)
return false;
- ctx = QGLContextPrivate::qt_get_context_group(context);
+ ctx = QGLContextPrivate::contextGroup(context);
if (isPartial)
return true;
if (qt_resolve_glsl_extensions(const_cast<QGLContext *>(context))) {
@@ -367,7 +367,7 @@ QGLShader::QGLShader
d = new QGLShaderPrivate(type);
if (d->create(QGLContext::currentContext()) && !compileFile(fileName)) {
if (d->shader) {
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
glDeleteShader(d->shader);
}
d->shader = 0;
@@ -421,7 +421,7 @@ QGLShader::QGLShader
#endif
if (d->create(context) && !compileFile(fileName)) {
if (d->shader) {
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
glDeleteShader(d->shader);
}
d->shader = 0;
@@ -436,7 +436,7 @@ QGLShader::QGLShader
QGLShader::~QGLShader()
{
if (d->shader) {
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
#ifndef QT_NO_DEBUG
if (!qt_check_sharing_with_current_context(ctx))
qWarning("QGLShader::~QGLShader: Shader is not associated with current context.");
@@ -501,6 +501,25 @@ bool QGLShader::compile(const char *source)
return d->compile(this);
} else if (d->shader) {
QVarLengthArray<const char *> src;
+ int headerLen = 0;
+ while (source && source[headerLen] == '#') {
+ // Skip #version and #extension directives at the start of
+ // the shader code. We need to insert the qualifierDefines
+ // and redefineHighp just after them.
+ if (qstrncmp(source + headerLen, "#version", 8) != 0 &&
+ qstrncmp(source + headerLen, "#extension", 10) != 0) {
+ break;
+ }
+ while (source[headerLen] != '\0' && source[headerLen] != '\n')
+ ++headerLen;
+ if (source[headerLen] == '\n')
+ ++headerLen;
+ }
+ QByteArray header;
+ if (headerLen > 0) {
+ header = QByteArray(source, headerLen);
+ src.append(header.constData());
+ }
#ifdef QGL_DEFINE_QUALIFIERS
src.append(qualifierDefines);
#endif
@@ -509,8 +528,8 @@ bool QGLShader::compile(const char *source)
d->shaderType == PartialFragmentShader)
src.append(redefineHighp);
#endif
- src.append(source);
- QGLContextGroupResources *ctx = d->ctx;
+ src.append(source + headerLen);
+ QGLContextGroup *ctx = d->ctx;
glShaderSource(d->shader, src.size(), src.data(), 0);
return d->compile(this);
} else {
@@ -593,7 +612,7 @@ bool QGLShader::compileFile(const QString& fileName)
*/
bool QGLShader::setShaderBinary(GLenum format, const void *binary, int length)
{
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
#ifndef QT_NO_DEBUG
if (!qt_check_sharing_with_current_context(ctx)) {
qWarning("QGLShader::setShaderBinary: Shader is not associated with current context.");
@@ -633,7 +652,7 @@ bool QGLShader::setShaderBinary(GLenum format, const void *binary, int length)
bool QGLShader::setShaderBinary
(QGLShader& otherShader, GLenum format, const void *binary, int length)
{
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
#ifndef QT_NO_DEBUG
if (!qt_check_sharing_with_current_context(ctx)) {
qWarning("QGLShader::setShaderBinary: Shader is not associated with current context.");
@@ -699,7 +718,7 @@ QByteArray QGLShader::sourceCode() const
if (!d->shader)
return QByteArray();
GLint size = 0;
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
glGetShaderiv(d->shader, GL_SHADER_SOURCE_LENGTH, &size);
if (size <= 0)
return QByteArray();
@@ -749,7 +768,7 @@ class QGLShaderProgramPrivate
{
public:
QGLShaderProgramPrivate(const QGLContext *context)
- : ctx(context ? QGLContextPrivate::qt_get_context_group(context) : 0)
+ : ctx(context ? QGLContextPrivate::contextGroup(context) : 0)
, program(0)
, linked(false)
, inited(false)
@@ -761,7 +780,7 @@ public:
}
~QGLShaderProgramPrivate();
- QGLContextGroupResources *ctx;
+ QGLContextGroup *ctx;
GLuint program;
bool linked;
bool inited;
@@ -832,7 +851,7 @@ bool QGLShaderProgram::init()
if (!context)
return false;
if (!d->ctx)
- d->ctx = QGLContextPrivate::qt_get_context_group(context);
+ d->ctx = QGLContextPrivate::contextGroup(context);
#ifndef QT_NO_DEBUG
else if (!qt_check_sharing_with_current_context(d->ctx)) {
qWarning("QGLShaderProgram: Shader program is not associated with current context.");
@@ -840,7 +859,7 @@ bool QGLShaderProgram::init()
}
#endif
if (qt_resolve_glsl_extensions(const_cast<QGLContext *>(context))) {
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
d->program = glCreateProgram();
if (!(d->program)) {
qWarning() << "QGLShaderProgram: could not create shader program";
@@ -886,7 +905,7 @@ bool QGLShaderProgram::addShader(QGLShader *shader)
if (!shader->d->isPartial) {
if (!shader->d->shader)
return false;
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
glAttachShader(d->program, shader->d->shader);
} else {
d->hasPartialShaders = true;
@@ -999,7 +1018,7 @@ bool QGLShaderProgram::addShaderFromFile
void QGLShaderProgram::removeShader(QGLShader *shader)
{
if (d->program && shader && shader->d->shader) {
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
#ifndef QT_NO_DEBUG
if (!qt_check_sharing_with_current_context(ctx))
qWarning("QGLShaderProgram::removeShader: Program is not associated with current context.");
@@ -1037,7 +1056,7 @@ QList<QGLShader *> QGLShaderProgram::shaders() const
void QGLShaderProgram::removeAllShaders()
{
d->removingShaders = true;
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
#ifndef QT_NO_DEBUG
if (!qt_check_sharing_with_current_context(ctx))
qWarning("QGLShaderProgram::removeAllShaders: Program is not associated with current context.");
@@ -1094,6 +1113,12 @@ QByteArray QGLShaderProgram::programBinary(int *format) const
if (!isLinked())
return QByteArray();
+ QGLContextGroup *ctx = d->ctx;
+#ifndef QT_NO_DEBUG
+ if (!qt_check_sharing_with_current_context(ctx))
+ qWarning("QGLShaderProgram::programBinary: Program is not associated with current context.");
+#endif
+
// Get the length of the binary data, bailing out if there is none.
GLint length = 0;
glGetProgramiv(d->program, GL_PROGRAM_BINARY_LENGTH_OES, &length);
@@ -1124,6 +1149,12 @@ QByteArray QGLShaderProgram::programBinary(int *format) const
bool QGLShaderProgram::setProgramBinary(int format, const QByteArray& binary)
{
#if defined(QT_OPENGL_ES_2)
+ QGLContextGroup *ctx = d->ctx;
+#ifndef QT_NO_DEBUG
+ if (!qt_check_sharing_with_current_context(ctx))
+ qWarning("QGLShaderProgram::setProgramBinary: Program is not associated with current context.");
+#endif
+
// Load the binary and check that it was linked correctly.
glProgramBinaryOES(d->program, (GLenum)format,
binary.constData(), binary.size());
@@ -1193,7 +1224,7 @@ bool QGLShaderProgram::link()
{
if (!d->program)
return false;
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
#ifndef QT_NO_DEBUG
if (!qt_check_sharing_with_current_context(ctx)) {
qWarning("QGLShaderProgram::link: Program is not associated with current context.");
@@ -1303,7 +1334,7 @@ bool QGLShaderProgram::enable()
return false;
if (!d->linked && !link())
return false;
- QGLContextGroupResources *ctx = d->ctx;
+ QGLContextGroup *ctx = d->ctx;
#ifndef QT_NO_DEBUG
if (!qt_check_sharing_with_current_context(ctx)) {
qWarning("QGLShaderProgram::enable: Program is not associated with current context.");
diff --git a/src/plugins/gfxdrivers/directfb/directfb.pro b/src/plugins/gfxdrivers/directfb/directfb.pro
index c5da3df..d397050 100644
--- a/src/plugins/gfxdrivers/directfb/directfb.pro
+++ b/src/plugins/gfxdrivers/directfb/directfb.pro
@@ -1,47 +1,15 @@
TARGET = qdirectfbscreen
include(../../qpluginbase.pri)
+include($$QT_SOURCE_TREE/src/gui/embedded/directfb.pri)
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers
-# These defines might be necessary if your DirectFB driver doesn't
-# support all of the DirectFB API.
-#
-#DEFINES += QT_DIRECTFB_WINDOW_AS_CURSOR
-#DEFINES += QT_NO_DIRECTFB_IMAGEPROVIDER
-#DEFINES += QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
-#DEFINES += QT_DIRECTFB_IMAGECACHE
-#DEFINES += QT_NO_DIRECTFB_WM
-#DEFINES += QT_NO_DIRECTFB_LAYER
-#DEFINES += QT_NO_DIRECTFB_PALETTE
-#DEFINES += QT_NO_DIRECTFB_PREALLOCATED
-#DEFINES += QT_NO_DIRECTFB_MOUSE
-#DEFINES += QT_NO_DIRECTFB_KEYBOARD
-#DEFINES += QT_DIRECTFB_TIMING
-#DEFINES += QT_NO_DIRECTFB_OPAQUE_DETECTION
-#DIRECTFB_DRAWINGOPERATIONS=DRAW_RECTS|DRAW_LINES|DRAW_IMAGE|DRAW_PIXMAP|DRAW_TILED_PIXMAP|STROKE_PATH|DRAW_PATH|DRAW_POINTS|DRAW_ELLIPSE|DRAW_POLYGON|DRAW_TEXT|FILL_PATH|FILL_RECT|DRAW_COLORSPANS
-#DEFINES += \"QT_DIRECTFB_WARN_ON_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\"
-#DEFINES += \"QT_DIRECTFB_DISABLE_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\"
-
target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers
INSTALLS += target
-HEADERS = qdirectfbscreen.h \
- qdirectfbwindowsurface.h \
- qdirectfbpaintengine.h \
- qdirectfbpaintdevice.h \
- qdirectfbpixmap.h \
- qdirectfbkeyboard.h \
- qdirectfbmouse.h
-
-SOURCES = qdirectfbscreen.cpp \
- qdirectfbscreenplugin.cpp \
- qdirectfbwindowsurface.cpp \
- qdirectfbpaintengine.cpp \
- qdirectfbpaintdevice.cpp \
- qdirectfbpixmap.cpp \
- qdirectfbkeyboard.cpp \
- qdirectfbmouse.cpp
+SOURCES += qdirectfbscreenplugin.cpp
QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB
LIBS += $$QT_LIBS_DIRECTFB
DEFINES += $$QT_DEFINES_DIRECTFB
+contains(gfx-plugins, directfb):DEFINES += QT_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp
index fe77fd1..f207ebc 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp
@@ -41,7 +41,7 @@
#include "qdirectfbkeyboard.h"
-#ifndef QT_NO_DIRECTFB
+#ifndef QT_NO_QWS_DIRECTFB
#include "qdirectfbscreen.h"
#include <qobject.h>
@@ -53,6 +53,8 @@
#include <fcntl.h>
#include <errno.h>
+QT_BEGIN_NAMESPACE
+
class KeyMap : public QHash<DFBInputDeviceKeySymbol, Qt::Key>
{
public:
@@ -429,6 +431,6 @@ KeyMap::KeyMap()
insert(DIKS_TILDE , Qt::Key_AsciiTilde);
}
+QT_END_NAMESPACE
#include "qdirectfbkeyboard.moc"
-
-#endif // QT_NO_DIRECTFB
+#endif // QT_NO_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h
index 756892f..96d73ac 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h
@@ -42,13 +42,16 @@
#ifndef QDIRECTFBKEYBOARD_H
#define QDIRECTFBKEYBOARD_H
+#include <qglobal.h>
#include <QtGui/qkbd_qws.h>
+#ifndef QT_NO_QWS_DIRECTFB
+
QT_BEGIN_HEADER
-QT_MODULE(Gui)
+QT_BEGIN_NAMESPACE
-#ifndef QT_NO_DIRECTFB
+QT_MODULE(Gui)
class QDirectFBKeyboardHandlerPrivate;
@@ -62,7 +65,9 @@ private:
QDirectFBKeyboardHandlerPrivate *d;
};
-#endif // QT_NO_DIRECTFB
+QT_END_NAMESPACE
+
+#endif // QT_NO_QWS_DIRECTFB
QT_END_HEADER
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
index 1f2b363..896f512 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
@@ -41,6 +41,8 @@
#include "qdirectfbmouse.h"
+#ifndef QT_NO_QWS_DIRECTFB
+
#include "qdirectfbscreen.h"
#include <qsocketnotifier.h>
@@ -49,6 +51,8 @@
#include <fcntl.h>
#include <errno.h>
+QT_BEGIN_NAMESPACE
+
class QDirectFBMouseHandlerPrivate : public QObject
{
Q_OBJECT
@@ -117,8 +121,8 @@ QDirectFBMouseHandlerPrivate::QDirectFBMouseHandlerPrivate(QDirectFBMouseHandler
return;
}
- int flags = ::fcntl(fd, F_GETFL, 0);
- ::fcntl(fd, F_SETFL, flags | O_NONBLOCK);
+ int flags = fcntl(fd, F_GETFL, 0);
+ fcntl(fd, F_SETFL, flags | O_NONBLOCK);
// DirectFB seems to assume that the mouse always starts centered
prevPoint = QPoint(screen->deviceWidth() / 2, screen->deviceHeight() / 2);
@@ -269,5 +273,8 @@ void QDirectFBMouseHandler::resume()
d->setEnabled(true);
}
+QT_END_NAMESPACE
#include "qdirectfbmouse.moc"
+#endif // QT_NO_QWS_DIRECTFB
+
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h
index 14026ee..5ef229c 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h
@@ -42,13 +42,16 @@
#ifndef QDIRECTFBMOUSE_H
#define QDIRECTFBMOUSE_H
+#include <qglobal.h>
#include <QtGui/qmouse_qws.h>
+#ifndef QT_NO_QWS_DIRECTFB
+
QT_BEGIN_HEADER
-QT_MODULE(Gui)
+QT_BEGIN_NAMESPACE
-#ifndef QT_NO_DIRECTFB
+QT_MODULE(Gui)
class QDirectFBMouseHandlerPrivate;
@@ -65,8 +68,8 @@ protected:
QDirectFBMouseHandlerPrivate *d;
};
-#endif // QT_NO_DIRECTFB
+QT_END_NAMESPACE
QT_END_HEADER
-
+#endif // QT_NO_QWS_DIRECTFB
#endif // QDIRECTFBMOUSE_H
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
index dec4bdd..2e56b9a 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
@@ -39,21 +39,38 @@
**
****************************************************************************/
-#ifndef QT_NO_DIRECTFB
-
#include "qdirectfbscreen.h"
#include "qdirectfbpaintdevice.h"
#include "qdirectfbpaintengine.h"
+#ifndef QT_NO_QWS_DIRECTFB
+
+QT_BEGIN_NAMESPACE
+
QDirectFBPaintDevice::QDirectFBPaintDevice(QDirectFBScreen *scr)
- : QCustomRasterPaintDevice(0), dfbSurface(0), lockedImage(0), screen(scr),
- bpl(-1), lockFlgs(DFBSurfaceLockFlags(0)), mem(0), engine(0),
- imageFormat(QImage::Format_Invalid)
-{}
+ : QCustomRasterPaintDevice(0), dfbSurface(0), screen(scr),
+ bpl(-1), lockFlgs(DFBSurfaceLockFlags(0)), mem(0), engine(0), imageFormat(QImage::Format_Invalid)
+{
+#ifdef QT_DIRECTFB_SUBSURFACE
+ subSurface = 0;
+ syncPending = false;
+#endif
+}
QDirectFBPaintDevice::~QDirectFBPaintDevice()
{
- delete lockedImage;
+ unlockSurface();
+ if (QDirectFBScreen::instance()) {
+ unlockSurface();
+#ifdef QT_DIRECTFB_SUBSURFACE
+ if (subSurface) {
+ screen->releaseDFBSurface(subSurface);
+ }
+#endif
+ if (dfbSurface) {
+ screen->releaseDFBSurface(dfbSurface);
+ }
+ }
delete engine;
}
@@ -62,30 +79,57 @@ IDirectFBSurface *QDirectFBPaintDevice::directFBSurface() const
return dfbSurface;
}
-void QDirectFBPaintDevice::lockDirectFB(DFBSurfaceLockFlags flags)
+bool QDirectFBPaintDevice::lockSurface(DFBSurfaceLockFlags lockFlags)
{
- if (!(lockFlgs & flags)) {
- if (lockFlgs)
- unlockDirectFB();
- mem = QDirectFBScreen::lockSurface(dfbSurface, flags, &bpl);
+ if (lockFlgs && (lockFlags & ~lockFlgs))
+ unlockSurface();
+ if (!mem) {
+ Q_ASSERT(dfbSurface);
+#ifdef QT_DIRECTFB_SUBSURFACE
+ if (!subSurface) {
+ DFBResult result;
+ subSurface = screen->getSubSurface(dfbSurface, QRect(), QDirectFBScreen::TrackSurface, &result);
+ if (result != DFB_OK || !subSurface) {
+ DirectFBError("Couldn't create sub surface", result);
+ return false;
+ }
+ }
+ IDirectFBSurface *surface = subSurface;
+#else
+ IDirectFBSurface *surface = dfbSurface;
+#endif
+ Q_ASSERT(surface);
+ mem = QDirectFBScreen::lockSurface(surface, lockFlags, &bpl);
+ lockFlgs = lockFlags;
Q_ASSERT(mem);
+ Q_ASSERT(bpl > 0);
const QSize s = size();
- lockedImage = new QImage(mem, s.width(), s.height(), bpl,
- QDirectFBScreen::getImageFormat(dfbSurface));
- lockFlgs = flags;
+ lockedImage = QImage(mem, s.width(), s.height(), bpl,
+ QDirectFBScreen::getImageFormat(dfbSurface));
+ return true;
+ }
+#ifdef QT_DIRECTFB_SUBSURFACE
+ if (syncPending) {
+ syncPending = false;
+ screen->waitIdle();
}
+#endif
+ return false;
}
-void QDirectFBPaintDevice::unlockDirectFB()
+void QDirectFBPaintDevice::unlockSurface()
{
- if (!lockedImage || !QDirectFBScreen::instance())
- return;
-
- dfbSurface->Unlock(dfbSurface);
- delete lockedImage;
- lockedImage = 0;
- mem = 0;
- lockFlgs = DFBSurfaceLockFlags(0);
+ if (QDirectFBScreen::instance() && lockFlgs) {
+#ifdef QT_DIRECTFB_SUBSURFACE
+ IDirectFBSurface *surface = subSurface;
+#else
+ IDirectFBSurface *surface = dfbSurface;
+#endif
+ if (surface) {
+ surface->Unlock(surface);
+ lockFlgs = static_cast<DFBSurfaceLockFlags>(0);
+ }
+ }
}
void *QDirectFBPaintDevice::memory() const
@@ -100,17 +144,10 @@ QImage::Format QDirectFBPaintDevice::format() const
int QDirectFBPaintDevice::bytesPerLine() const
{
- if (bpl == -1) {
- // Can only get the stride when we lock the surface
- Q_ASSERT(!lockedImage);
- QDirectFBPaintDevice* that = const_cast<QDirectFBPaintDevice*>(this);
- that->lockDirectFB(DSLF_READ|DSLF_WRITE);
- Q_ASSERT(bpl != -1);
- }
+ Q_ASSERT(!mem || bpl != -1);
return bpl;
}
-
QSize QDirectFBPaintDevice::size() const
{
int w, h;
@@ -140,8 +177,8 @@ int QDirectFBPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
case QPaintDevice::PdmDepth:
return QDirectFBScreen::depth(imageFormat);
case QPaintDevice::PdmNumColors: {
- if (lockedImage)
- return lockedImage->numColors();
+ if (!lockedImage.isNull())
+ return lockedImage.numColors();
DFBResult result;
IDirectFBPalette *palette = 0;
@@ -169,5 +206,6 @@ QPaintEngine *QDirectFBPaintDevice::paintEngine() const
return engine;
}
-#endif
+QT_END_NAMESPACE
+#endif // QT_NO_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
index ca958c8..cdd2bea 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
@@ -43,11 +43,14 @@
#define QDIRECTFBPAINTDEVICE_H
#include <private/qpaintengine_raster_p.h>
-#include <directfb.h>
#include "qdirectfbscreen.h"
+#ifndef QT_NO_QWS_DIRECTFB
+
QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
+
QT_MODULE(Gui)
// Inherited by both window surface and pixmap
@@ -57,10 +60,10 @@ class QDirectFBPaintDevice : public QCustomRasterPaintDevice
public:
~QDirectFBPaintDevice();
- IDirectFBSurface *directFBSurface() const;
+ virtual IDirectFBSurface *directFBSurface() const;
- void lockDirectFB(DFBSurfaceLockFlags lock);
- void unlockDirectFB();
+ bool lockSurface(DFBSurfaceLockFlags lockFlags);
+ void unlockSurface();
// Reimplemented from QCustomRasterPaintDevice:
void *memory() const;
@@ -70,7 +73,6 @@ public:
int metric(QPaintDevice::PaintDeviceMetric metric) const;
DFBSurfaceLockFlags lockFlags() const { return lockFlgs; }
QPaintEngine *paintEngine() const;
-
protected:
QDirectFBPaintDevice(QDirectFBScreen *scr);
inline int dotsPerMeterX() const
@@ -81,19 +83,25 @@ protected:
{
return (screen->deviceHeight() * 1000) / screen->physicalHeight();
}
-protected:
+
IDirectFBSurface *dfbSurface;
- QImage *lockedImage;
+#ifdef QT_DIRECTFB_SUBSURFACE
+ IDirectFBSurface *subSurface;
+ friend class QDirectFBPaintEnginePrivate;
+ bool syncPending;
+#endif
+ QImage lockedImage;
QDirectFBScreen *screen;
int bpl;
DFBSurfaceLockFlags lockFlgs;
uchar *mem;
QDirectFBPaintEngine *engine;
QImage::Format imageFormat;
-private:
- Q_DISABLE_COPY(QDirectFBPaintDevice);
};
+QT_END_NAMESPACE
+
QT_END_HEADER
+#endif // QT_NO_QWS_DIRECTFB
#endif //QDIRECTFBPAINTDEVICE_H
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index 337e75a..5bad4de 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -41,7 +41,7 @@
#include "qdirectfbpaintengine.h"
-#ifndef QT_NO_DIRECTFB
+#ifndef QT_NO_QWS_DIRECTFB
#include "qdirectfbwindowsurface.h"
#include "qdirectfbscreen.h"
@@ -55,6 +55,8 @@
#include <private/qpixmap_raster_p.h>
#include <private/qimagepixmapcleanuphooks_p.h>
+QT_BEGIN_NAMESPACE
+
class SurfaceCache;
class QDirectFBPaintEnginePrivate : public QRasterPaintEnginePrivate
{
@@ -91,6 +93,7 @@ public:
inline void lock();
inline void unlock();
+ static inline void unlock(QDirectFBPaintDevice *device);
inline bool isSimpleBrush(const QBrush &brush) const;
@@ -107,7 +110,7 @@ public:
#endif
void prepareForBlit(bool alpha);
-private:
+
IDirectFBSurface *surface;
bool antialiased;
@@ -127,7 +130,6 @@ private:
QRect currentClip;
QDirectFBPaintEngine *q;
- friend class QDirectFBPaintEngine;
};
class SurfaceCache
@@ -145,7 +147,9 @@ private:
#ifdef QT_DIRECTFB_IMAGECACHE
+QT_BEGIN_INCLUDE_NAMESPACE
#include <private/qimage_p.h>
+QT_END_INCLUDE_NAMESPACE
struct CachedImage
{
IDirectFBSurface *surface;
@@ -218,6 +222,7 @@ template <class T>
static inline void drawRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface);
#define CLIPPED_PAINT(operation) { \
+ d->unlock(); \
DFBRegion clipRegion; \
switch (d->clipType) { \
case QDirectFBPaintEnginePrivate::NoClip: \
@@ -265,6 +270,7 @@ bool QDirectFBPaintEngine::begin(QPaintDevice *device)
QPixmapData *data = static_cast<QPixmap*>(device)->pixmapData();
Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
QDirectFBPixmapData *dfbPixmapData = static_cast<QDirectFBPixmapData*>(data);
+ QDirectFBPaintEnginePrivate::unlock(dfbPixmapData);
d->dfbDevice = static_cast<QDirectFBPaintDevice*>(dfbPixmapData);
}
@@ -405,14 +411,13 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount)
QRasterPaintEngine::drawRects(rects, rectCount);
return;
}
- d->unlock();
if (brush != Qt::NoBrush) {
d->setDFBColor(brush.color());
- CLIPPED_PAINT(::fillRects<QRect>(rects, rectCount, state()->matrix, d->surface));
+ CLIPPED_PAINT(QT_PREPEND_NAMESPACE(fillRects<QRect>)(rects, rectCount, state()->matrix, d->surface));
}
if (pen != Qt::NoPen) {
d->setDFBColor(pen.color());
- CLIPPED_PAINT(::drawRects<QRect>(rects, rectCount, state()->matrix, d->surface));
+ CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawRects<QRect>)(rects, rectCount, state()->matrix, d->surface));
}
}
@@ -434,14 +439,13 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount)
QRasterPaintEngine::drawRects(rects, rectCount);
return;
}
- d->unlock();
if (brush != Qt::NoBrush) {
d->setDFBColor(brush.color());
- CLIPPED_PAINT(::fillRects<QRectF>(rects, rectCount, state()->matrix, d->surface));
+ CLIPPED_PAINT(fillRects<QRectF>(rects, rectCount, state()->matrix, d->surface));
}
if (pen != Qt::NoPen) {
d->setDFBColor(pen.color());
- CLIPPED_PAINT(::drawRects<QRectF>(rects, rectCount, state()->matrix, d->surface));
+ CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawRects<QRectF>)(rects, rectCount, state()->matrix, d->surface));
}
}
@@ -460,9 +464,8 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount)
const QPen &pen = state()->pen;
if (pen != Qt::NoPen) {
- d->unlock();
d->setDFBColor(pen.color());
- CLIPPED_PAINT(::drawLines<QLine>(lines, lineCount, state()->matrix, d->surface));
+ CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines<QLine>)(lines, lineCount, state()->matrix, d->surface));
}
}
@@ -481,9 +484,8 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount)
const QPen &pen = state()->pen;
if (pen != Qt::NoPen) {
- d->unlock();
d->setDFBColor(pen.color());
- CLIPPED_PAINT(::drawLines<QLineF>(lines, lineCount, state()->matrix, d->surface));
+ CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines<QLineF>)(lines, lineCount, state()->matrix, d->surface));
}
}
@@ -529,7 +531,6 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image,
return;
}
#if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE
- d->unlock();
bool release;
IDirectFBSurface *imgSurface = d->getSurface(image, &release);
d->prepareForBlit(QDirectFBScreen::hasAlphaChannel(imgSurface));
@@ -557,25 +558,25 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap,
RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr);
d->lock();
QRasterPaintEngine::drawPixmap(r, pixmap, sr);
- } else if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
- || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
- || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
- || (state()->renderHints & QPainter::SmoothPixmapTransform
- && state()->matrix.mapRect(r).size() != sr.size())) {
- RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr);
- const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(DSLF_READ);
- d->lock();
- QRasterPaintEngine::drawImage(r, *img, sr);
} else {
- d->unlock();
- d->prepareForBlit(pixmap.hasAlphaChannel());
QPixmapData *data = pixmap.pixmapData();
Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data);
- dfbData->unlockDirectFB();
- IDirectFBSurface *s = dfbData->directFBSurface();
-
- CLIPPED_PAINT(d->blit(r, s, sr));
+ if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
+ || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
+ || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
+ || (state()->renderHints & QPainter::SmoothPixmapTransform
+ && state()->matrix.mapRect(r).size() != sr.size())) {
+ RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr);
+ const QImage *img = dfbData->buffer();
+ d->lock();
+ QRasterPaintEngine::drawImage(r, *img, sr);
+ } else {
+ QDirectFBPaintEnginePrivate::unlock(dfbData);
+ d->prepareForBlit(pixmap.hasAlphaChannel());
+ IDirectFBSurface *s = dfbData->directFBSurface();
+ CLIPPED_PAINT(d->blit(r, s, sr));
+ }
}
}
@@ -598,14 +599,16 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r,
|| d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
|| (state()->renderHints & QPainter::SmoothPixmapTransform && state()->matrix.isScaling())) {
RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset);
- const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(DSLF_READ);
+ QPixmapData *pixmapData = pixmap.pixmapData();
+ Q_ASSERT(pixmapData->classId() == QPixmapData::DirectFBClass);
+ QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(pixmapData);
+ const QImage *img = dfbData->buffer();
d->lock();
QRasterPixmapData *data = new QRasterPixmapData(QPixmapData::PixmapType);
data->fromImage(*img, Qt::AutoColor);
const QPixmap pix(data);
QRasterPaintEngine::drawTiledPixmap(r, pix, offset);
} else {
- d->unlock();
CLIPPED_PAINT(d->drawTiledPixmap(r, pixmap, offset));
}
}
@@ -704,7 +707,6 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
const QColor color = brush.color();
if (!color.isValid())
return;
- d->unlock();
d->setDFBColor(color);
const QRect r = state()->matrix.mapRect(rect).toRect();
CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height()));
@@ -721,7 +723,6 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
if (texture.pixmapData()->classId() != QPixmapData::DirectFBClass)
break;
- d->unlock();
CLIPPED_PAINT(d->drawTiledPixmap(rect, texture, rect.topLeft() - state()->brushOrigin));
return; }
default:
@@ -745,7 +746,6 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color)
d->lock();
QRasterPaintEngine::fillRect(rect, color);
} else {
- d->unlock();
d->setDFBColor(color);
const QRect r = state()->matrix.mapRect(rect).toRect();
CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height()));
@@ -807,8 +807,7 @@ void QDirectFBPaintEnginePrivate::lock()
// lock so we need to call the base implementation of prepare so
// it updates its rasterBuffer to point to the new buffer address.
Q_ASSERT(dfbDevice);
- if (dfbDevice->lockFlags() != (DSLF_WRITE|DSLF_READ)) {
- dfbDevice->lockDirectFB(DSLF_READ|DSLF_WRITE);
+ if (dfbDevice->lockSurface(DSLF_READ|DSLF_WRITE)) {
prepare(dfbDevice);
}
}
@@ -816,7 +815,21 @@ void QDirectFBPaintEnginePrivate::lock()
void QDirectFBPaintEnginePrivate::unlock()
{
Q_ASSERT(dfbDevice);
- dfbDevice->unlockDirectFB();
+#ifdef QT_DIRECTFB_SUBSURFACE
+ dfbDevice->syncPending = true;
+#else
+ QDirectFBPaintEnginePrivate::unlock(dfbDevice);
+#endif
+}
+
+void QDirectFBPaintEnginePrivate::unlock(QDirectFBPaintDevice *device)
+{
+#ifdef QT_NO_DIRECTFB_SUBSURFACE
+ Q_ASSERT(device);
+ device->unlockSurface();
+#else
+ Q_UNUSED(device);
+#endif
}
void QDirectFBPaintEnginePrivate::setTransform(const QTransform &transform)
@@ -1027,7 +1040,7 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix
QPixmapData *data = pixmap.pixmapData();
Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data);
- dfbData->unlockDirectFB();
+ QDirectFBPaintEnginePrivate::unlock(dfbData);
const QSize pixmapSize = dfbData->size();
IDirectFBSurface *sourceSurface = dfbData->directFBSurface();
if (transform.isScaling()) {
@@ -1036,8 +1049,8 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix
offset.ry() *= transform.m22();
const QSizeF mappedSize(pixmapSize.width() * transform.m11(), pixmapSize.height() * transform.m22());
- qreal y = ::fixCoord(destinationRect.y(), mappedSize.height(), offset.y());
- const qreal startX = ::fixCoord(destinationRect.x(), mappedSize.width(), offset.x());
+ qreal y = fixCoord(destinationRect.y(), mappedSize.height(), offset.y());
+ const qreal startX = fixCoord(destinationRect.x(), mappedSize.width(), offset.x());
while (y <= destinationRect.bottom()) {
qreal x = startX;
while (x <= destinationRect.right()) {
@@ -1048,8 +1061,8 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix
y += mappedSize.height();
}
} else {
- qreal y = ::fixCoord(destinationRect.y(), pixmapSize.height(), offset.y());
- const qreal startX = ::fixCoord(destinationRect.x(), pixmapSize.width(), offset.x());
+ qreal y = fixCoord(destinationRect.y(), pixmapSize.height(), offset.y());
+ const qreal startX = fixCoord(destinationRect.x(), pixmapSize.width(), offset.x());
int horizontal = qMax(1, destinationRect.width() / pixmapSize.width()) + 1;
if (startX != destinationRect.x())
++horizontal;
@@ -1161,12 +1174,12 @@ template <class T>
static inline void drawLines(const T *lines, int n, const QTransform &transform, IDirectFBSurface *surface)
{
if (n == 1) {
- const QLine l = ::map(transform, lines[0]);
+ const QLine l = map(transform, lines[0]);
surface->DrawLine(surface, l.x1(), l.y1(), l.x2(), l.y2());
} else {
QVarLengthArray<DFBRegion, 32> lineArray(n);
for (int i=0; i<n; ++i) {
- const QLine l = ::map(transform, lines[i]);
+ const QLine l = map(transform, lines[i]);
lineArray[i].x1 = l.x1();
lineArray[i].y1 = l.y1();
lineArray[i].x2 = l.x2();
@@ -1180,12 +1193,12 @@ template <class T>
static inline void fillRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface)
{
if (n == 1) {
- const QRect r = ::mapRect(transform, rects[0]);
+ const QRect r = mapRect(transform, rects[0]);
surface->FillRectangle(surface, r.x(), r.y(), r.width(), r.height());
} else {
QVarLengthArray<DFBRectangle, 32> rectArray(n);
for (int i=0; i<n; ++i) {
- const QRect r = ::mapRect(transform, rects[i]);
+ const QRect r = mapRect(transform, rects[i]);
rectArray[i].x = r.x();
rectArray[i].y = r.y();
rectArray[i].w = r.width();
@@ -1199,7 +1212,7 @@ template <class T>
static inline void drawRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface)
{
for (int i=0; i<n; ++i) {
- const QRect r = ::mapRect(transform, rects[i]);
+ const QRect r = mapRect(transform, rects[i]);
surface->DrawRectangle(surface, r.x(), r.y(), r.width(), r.height());
}
}
@@ -1246,4 +1259,7 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device *
}
#endif // QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
-#endif // QT_NO_DIRECTFB
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h
index 51468ad..b4f0b5d 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h
@@ -45,8 +45,12 @@
#include <QtGui/qpaintengine.h>
#include <private/qpaintengine_raster_p.h>
+#ifndef QT_NO_QWS_DIRECTFB
+
QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
+
QT_MODULE(Gui)
class QDirectFBPaintEnginePrivate;
@@ -107,6 +111,10 @@ public:
static void initImageCache(int size);
};
+QT_END_NAMESPACE
+
QT_END_HEADER
+#endif // QT_NO_QWS_DIRECTFB
+
#endif // QPAINTENGINE_DIRECTFB_P_H
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index 2e3d32d..6550683 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -41,6 +41,8 @@
#include "qdirectfbpixmap.h"
+#ifndef QT_NO_QWS_DIRECTFB
+
#include "qdirectfbscreen.h"
#include "qdirectfbpaintengine.h"
@@ -48,6 +50,9 @@
#include <QtCore/qfile.h>
#include <directfb.h>
+
+QT_BEGIN_NAMESPACE
+
static int global_ser_no = 0;
QDirectFBPixmapData::QDirectFBPixmapData(QDirectFBScreen *screen, PixelType pixelType)
@@ -59,9 +64,6 @@ QDirectFBPixmapData::QDirectFBPixmapData(QDirectFBScreen *screen, PixelType pixe
QDirectFBPixmapData::~QDirectFBPixmapData()
{
- unlockDirectFB();
- if (dfbSurface && QDirectFBScreen::instance())
- screen->releaseDFBSurface(dfbSurface);
}
void QDirectFBPixmapData::resize(int width, int height)
@@ -162,7 +164,7 @@ static bool checkForAlphaPixels(const QImage &img)
bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img)
{
#ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION
- return ::checkForAlphaPixels(img);
+ return checkForAlphaPixels(img);
#else
return img.hasAlphaChannel();
#endif
@@ -370,9 +372,13 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect)
QPixmapData::copy(data, rect);
return;
}
- unlockDirectFB();
const QDirectFBPixmapData *otherData = static_cast<const QDirectFBPixmapData*>(data);
+#ifdef QT_NO_DIRECTFB_SUBSURFACE
+ if (otherData->lockFlags()) {
+ const_cast<QDirectFBPixmapData*>(otherData)->unlockSurface();
+ }
+#endif
IDirectFBSurface *src = otherData->directFBSurface();
alpha = data->hasAlphaChannel();
imageFormat = (alpha
@@ -400,6 +406,7 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect)
h = rect.height();
d = otherData->d;
is_null = (w <= 0 || h <= 0);
+ unlockSurface();
DFBResult result = dfbSurface->Blit(dfbSurface, src, &blitRect, 0, 0);
#if (Q_DIRECTFB_VERSION >= 0x010000)
dfbSurface->ReleaseSource(dfbSurface);
@@ -438,7 +445,7 @@ void QDirectFBPixmapData::fill(const QColor &color)
alpha = (color.alpha() < 255);
- if (alpha && ::isOpaqueFormat(imageFormat)) {
+ if (alpha && isOpaqueFormat(imageFormat)) {
QSize size;
dfbSurface->GetSize(dfbSurface, &size.rwidth(), &size.rheight());
screen->releaseDFBSurface(dfbSurface);
@@ -460,18 +467,21 @@ QPixmap QDirectFBPixmapData::transformed(const QTransform &transform,
Qt::TransformationMode mode) const
{
QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this);
+#ifdef QT_NO_DIRECTFB_SUBSURFACE
+ if (lockFlags())
+ that->unlockSurface();
+#endif
+
if (!dfbSurface || transform.type() != QTransform::TxScale
|| mode != Qt::FastTransformation)
{
const QImage *image = that->buffer();
Q_ASSERT(image);
const QImage transformed = image->transformed(transform, mode);
- that->unlockDirectFB();
QDirectFBPixmapData *data = new QDirectFBPixmapData(screen, QPixmapData::PixmapType);
data->fromImage(transformed, Qt::AutoColor);
return QPixmap(data);
}
- that->unlockDirectFB();
const QSize size = transform.mapRect(QRect(0, 0, w, h)).size();
if (size.isEmpty())
@@ -551,14 +561,12 @@ QPaintEngine *QDirectFBPixmapData::paintEngine() const
QImage *QDirectFBPixmapData::buffer()
{
- lockDirectFB(DSLF_READ|DSLF_WRITE);
- return lockedImage;
-}
-
-QImage * QDirectFBPixmapData::buffer(DFBSurfaceLockFlags lockFlags)
-{
- lockDirectFB(lockFlags);
- return lockedImage;
+ if (!lockFlgs) {
+ lockSurface(DSLF_READ|DSLF_WRITE);
+ }
+ Q_ASSERT(lockFlgs);
+ Q_ASSERT(!lockedImage.isNull());
+ return &lockedImage;
}
void QDirectFBPixmapData::invalidate()
@@ -574,3 +582,9 @@ void QDirectFBPixmapData::invalidate()
imageFormat = QImage::Format_Invalid;
}
+QT_END_NAMESPACE
+
+#endif // QT_NO_QWS_DIRECTFB
+
+
+
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
index 8bf1e73..5d3a2f6 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
@@ -42,6 +42,10 @@
#ifndef QDIRECTFBPIXMAP_H
#define QDIRECTFBPIXMAP_H
+#include <qglobal.h>
+
+#ifndef QT_NO_QWS_DIRECTFB
+
#include <QtGui/private/qpixmapdata_p.h>
#include <QtGui/private/qpaintengine_raster_p.h>
#include "qdirectfbpaintdevice.h"
@@ -49,6 +53,8 @@
QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
+
QT_MODULE(Gui)
class QDirectFBPaintEngine;
@@ -75,11 +81,9 @@ public:
virtual QImage toImage() const;
virtual QPaintEngine *paintEngine() const;
virtual QImage *buffer();
- virtual int metric(QPaintDevice::PaintDeviceMetric m) const {return QDirectFBPaintDevice::metric(m);}
-
- QImage *buffer(DFBSurfaceLockFlags lockFlags);
-
// Pure virtual in QPixmapData, so re-implement here and delegate to QDirectFBPaintDevice
+ virtual int metric(QPaintDevice::PaintDeviceMetric m) const { return QDirectFBPaintDevice::metric(m); }
+
inline QImage::Format pixelFormat() const { return imageFormat; }
static bool hasAlphaChannel(const QImage &img);
inline bool hasAlphaChannel() const { return alpha; }
@@ -91,6 +95,10 @@ private:
bool alpha;
};
+QT_END_NAMESPACE
+
QT_END_HEADER
+#endif // QT_NO_QWS_DIRECTFB
+
#endif // QDIRECTFBPIXMAP_H
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 8be0355..599b2a9 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -54,6 +54,10 @@
#include <QtCore/qvector.h>
#include <QtCore/qrect.h>
+#ifndef QT_NO_QWS_DIRECTFB
+
+QT_BEGIN_NAMESPACE
+
class QDirectFBScreenPrivate : public QObject, public QWSGraphicsSystem
{
Q_OBJECT
@@ -94,8 +98,6 @@ public:
QDirectFBScreen *q;
};
-#include "qdirectfbscreen.moc"
-
QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *qptr)
: QWSGraphicsSystem(qptr), dfb(0), flipFlags(DSFLIP_NONE),
directFBFlags(QDirectFBScreen::NoFlags), alphaPixmapFormat(QImage::Format_Invalid),
@@ -317,14 +319,38 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc,
if (options & TrackSurface) {
d_ptr->allocatedSurfaces.insert(newSurface);
-
- //qDebug("Created a new DirectFB surface at %p. New count = %d",
- // newSurface, d_ptr->allocatedSurfaces.count());
}
return newSurface;
}
+#ifdef QT_DIRECTFB_SUBSURFACE
+IDirectFBSurface *QDirectFBScreen::getSubSurface(IDirectFBSurface *surface,
+ const QRect &rect,
+ SurfaceCreationOptions options,
+ DFBResult *resultPtr)
+{
+ Q_ASSERT(!(options & NoPreallocated));
+ Q_ASSERT(surface);
+ DFBResult res;
+ DFBResult &result = (resultPtr ? *resultPtr : res);
+ IDirectFBSurface *subSurface = 0;
+ if (rect.isNull()) {
+ result = surface->GetSubSurface(surface, 0, &subSurface);
+ } else {
+ const DFBRectangle subRect = { rect.x(), rect.y(), rect.width(), rect.height() };
+ result = surface->GetSubSurface(surface, &subRect, &subSurface);
+ }
+ if (result != DFB_OK) {
+ DirectFBError("Can't get sub surface", result);
+ } else if (options & TrackSurface) {
+ d_ptr->allocatedSurfaces.insert(subSurface);
+ }
+ return subSurface;
+}
+#endif
+
+
void QDirectFBScreen::releaseDFBSurface(IDirectFBSurface *surface)
{
Q_ASSERT(QDirectFBScreen::instance());
@@ -494,14 +520,6 @@ void QDirectFBScreen::setSurfaceColorTable(IDirectFBSurface *surface,
#endif // QT_NO_DIRECTFB_PALETTE
-#ifndef QT_NO_QWS_CURSOR
-#if defined QT_DIRECTFB_WM && defined QT_DIRECTFB_WINDOW_AS_CURSOR
-#define QT_DIRECTFB_CURSOR
-#elif defined QT_DIRECTFB_LAYER
-#define QT_DIRECTFB_CURSOR
-#endif
-#endif
-
#if defined QT_DIRECTFB_CURSOR
class Q_GUI_EXPORT QDirectFBScreenCursor : public QScreenCursor
{
@@ -1005,9 +1023,9 @@ static void printDirectFBInfo(IDirectFB *fb, IDirectFBSurface *primarySurface)
dev.name, dev.vendor, dev.driver.name, dev.driver.major,
dev.driver.minor, dev.driver.vendor, DFB_PIXELFORMAT_INDEX(pixelFormat),
QDirectFBScreen::getImageFormat(primarySurface), dev.acceleration_mask,
- ::flagDescriptions(dev.acceleration_mask, accelerationDescriptions).constData(),
- dev.blitting_flags, ::flagDescriptions(dev.blitting_flags, blitDescriptions).constData(),
- dev.drawing_flags, ::flagDescriptions(dev.drawing_flags, drawDescriptions).constData(),
+ flagDescriptions(dev.acceleration_mask, accelerationDescriptions).constData(),
+ dev.blitting_flags, flagDescriptions(dev.blitting_flags, blitDescriptions).constData(),
+ dev.drawing_flags, flagDescriptions(dev.drawing_flags, drawDescriptions).constData(),
(dev.video_memory >> 10));
}
#endif
@@ -1015,7 +1033,7 @@ static void printDirectFBInfo(IDirectFB *fb, IDirectFBSurface *primarySurface)
static inline bool setIntOption(const QStringList &arguments, const QString &variable, int *value)
{
Q_ASSERT(value);
- QRegExp rx(QString("%1=?(\\d+)").arg(variable));
+ QRegExp rx(QString::fromLatin1("%1=?(\\d+)").arg(variable));
rx.setCaseSensitivity(Qt::CaseInsensitive);
if (arguments.indexOf(rx) != -1) {
*value = rx.cap(1).toInt();
@@ -1024,36 +1042,6 @@ static inline bool setIntOption(const QStringList &arguments, const QString &var
return false;
}
-static inline int depth(QImage::Format format)
-{
- switch (format) {
- case QImage::Format_Mono:
- case QImage::Format_MonoLSB:
- return 1;
- case QImage::Format_Indexed8:
- return 8;
- case QImage::Format_RGB32:
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB32_Premultiplied:
- return 32;
- case QImage::Format_ARGB8565_Premultiplied:
- case QImage::Format_RGB666:
- case QImage::Format_ARGB6666_Premultiplied:
- case QImage::Format_ARGB8555_Premultiplied:
- case QImage::Format_RGB888:
- return 24;
- case QImage::Format_RGB555:
- case QImage::Format_RGB444:
- case QImage::Format_RGB16:
- case QImage::Format_ARGB4444_Premultiplied:
- return 16;
- case QImage::Format_Invalid:
- case QImage::NImageFormats:
- break;
- }
- return -1;
-}
-
bool QDirectFBScreen::connect(const QString &displaySpec)
{
DFBResult result = DFB_OK;
@@ -1103,7 +1091,7 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
#ifdef QT_DIRECTFB_IMAGECACHE
int imageCacheSize = 4 * 1024 * 1024; // 4 MB
- ::setIntOption(displayArgs, QLatin1String("imagecachesize"), &imageCacheSize);
+ setIntOption(displayArgs, QLatin1String("imagecachesize"), &imageCacheSize);
QDirectFBPaintEngine::initImageCache(imageCacheSize);
#endif
@@ -1199,7 +1187,7 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
break;
}
setPixelFormat(pixelFormat);
- QScreen::d = ::depth(pixelFormat);
+ QScreen::d = QDirectFBScreen::depth(pixelFormat);
data = 0;
lstep = 0;
size = 0;
@@ -1227,6 +1215,8 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
"Unable to get screen size!", result);
return false;
}
+ setIntOption(displayArgs, QLatin1String("width"), &w);
+ setIntOption(displayArgs, QLatin1String("height"), &h);
dw = w;
dh = h;
@@ -1234,8 +1224,8 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
Q_ASSERT(dw != 0 && dh != 0);
physWidth = physHeight = -1;
- ::setIntOption(displayArgs, QLatin1String("mmWidth"), &physWidth);
- ::setIntOption(displayArgs, QLatin1String("mmHeight"), &physHeight);
+ setIntOption(displayArgs, QLatin1String("mmWidth"), &physWidth);
+ setIntOption(displayArgs, QLatin1String("mmHeight"), &physHeight);
const int dpi = 72;
if (physWidth < 0)
physWidth = qRound(dw * 25.4 / dpi);
@@ -1252,7 +1242,7 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
surface->Release(surface);
#endif
- QRegExp backgroundColorRegExp("bgcolor=?(.+)");
+ QRegExp backgroundColorRegExp(QLatin1String("bgcolor=?(.+)"));
backgroundColorRegExp.setCaseSensitivity(Qt::CaseInsensitive);
if (displayArgs.indexOf(backgroundColorRegExp) != -1) {
d_ptr->backgroundColor.setNamedColor(backgroundColorRegExp.cap(1));
@@ -1305,12 +1295,10 @@ bool QDirectFBScreen::initDevice()
}
#endif
-#ifndef QT_NO_QWS_CURSOR
-#if defined QT_NO_DIRECTFB_WM || defined QT_NO_DIRECTFB_LAYER
- QScreenCursor::initSoftwareCursor();
-#else
+#ifdef QT_DIRECTFB_CURSOR
qt_screencursor = new QDirectFBScreenCursor;
-#endif
+#elif !defined QT_NO_QWS_CURSOR
+ QScreenCursor::initSoftwareCursor();
#endif
return true;
}
@@ -1370,17 +1358,18 @@ QWSWindowSurface *QDirectFBScreen::createSurface(const QString &key) const
// window surfaces. Normal, directFB surfaces are handled by DirectFB.
void QDirectFBScreen::exposeRegion(QRegion r, int changing)
{
-#ifdef QT_NO_DIRECTFB_WM
+#if defined QT_NO_DIRECTFB_WM
const QList<QWSWindow*> windows = QWSServer::instance()->clientWindows();
- if (changing < 0 || changing >= windows.size())
+ if (changing < 0 || changing >= windows.size()) {
return;
-
+ }
QWSWindow *win = windows.at(changing);
QWSWindowSurface *s = win->windowSurface();
r &= region();
- if (r.isEmpty())
+ if (r.isEmpty()) {
return;
+ }
const QRect brect = r.boundingRect();
@@ -1398,15 +1387,18 @@ void QDirectFBScreen::exposeRegion(QRegion r, int changing)
? static_cast<QDirectFBWindowSurface*>(s) : 0;
if (dfbWindowSurface) {
IDirectFBSurface *surface = dfbWindowSurface->directFBSurface();
+ Q_ASSERT(surface);
const int n = insideWindow.numRects();
if (n == 1 || d_ptr->directFBFlags & BoundingRectFlip) {
const QRect source = (insideWindow.boundingRect().intersected(windowGeometry)).translated(-windowGeometry.topLeft());
const DFBRectangle rect = {
source.x(), source.y(), source.width(), source.height()
};
+
d_ptr->primarySurface->Blit(d_ptr->primarySurface, surface, &rect,
windowGeometry.x() + source.x(),
windowGeometry.y() + source.y());
+
} else {
const QVector<QRect> rects = insideWindow.rects();
QVarLengthArray<DFBRectangle, 16> dfbRectangles(n);
@@ -1429,6 +1421,7 @@ void QDirectFBScreen::exposeRegion(QRegion r, int changing)
}
}
+#ifdef QT_NO_DIRECTFB_CURSOR
if (QScreenCursor *cursor = QScreenCursor::instance()) {
const QRect cursorRectangle = cursor->boundingRect();
if (cursor->isVisible() && !cursor->isAccelerated() && cursorRectangle.intersects(brect)) {
@@ -1442,6 +1435,7 @@ void QDirectFBScreen::exposeRegion(QRegion r, int changing)
#endif
}
}
+#endif
flipSurface(d_ptr->primarySurface, d_ptr->flipFlags, r, QPoint());
#else
Q_UNUSED(r);
@@ -1459,8 +1453,8 @@ void QDirectFBScreen::solidFill(const QColor &color, const QRegion &region)
return;
d_ptr->primarySurface->SetColor(d_ptr->primarySurface,
- color.red(), color.green(), color.blue(),
- color.alpha());
+ color.red(), color.green(), color.blue(),
+ color.alpha());
const int n = region.numRects();
if (n > 1) {
const QRect r = region.boundingRect();
@@ -1557,6 +1551,11 @@ void QDirectFBScreen::setDirectFBImageProvider(IDirectFBImageProvider *provider)
}
#endif
+void QDirectFBScreen::waitIdle()
+{
+ d_ptr->dfb->WaitIdle(d_ptr->dfb);
+}
+
IDirectFBSurface * QDirectFBScreen::surfaceForWidget(const QWidget *widget, QRect *rect) const
{
Q_ASSERT(widget);
@@ -1570,6 +1569,7 @@ IDirectFBSurface * QDirectFBScreen::surfaceForWidget(const QWidget *widget, QRec
return 0;
}
+#ifdef QT_DIRECTFB_SUBSURFACE
IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, const QRect &area) const
{
Q_ASSERT(widget);
@@ -1580,7 +1580,7 @@ IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, co
if (!area.isNull())
rect &= area.translated(widget->mapTo(widget->window(), QPoint(0, 0)));
if (!rect.isNull()) {
- const DFBRectangle subRect = {rect.x(), rect.y(), rect.width(), rect.height() };
+ const DFBRectangle subRect = { rect.x(), rect.y(), rect.width(), rect.height() };
const DFBResult result = surface->GetSubSurface(surface, &subRect, &subSurface);
if (result != DFB_OK) {
DirectFBError("QDirectFBScreen::subSurface(): Can't get sub surface", result);
@@ -1589,4 +1589,10 @@ IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, co
}
return subSurface;
}
+#endif
+
+QT_END_NAMESPACE
+
+#include "qdirectfbscreen.moc"
+#endif // QT_NO_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
index df0eea4..0ce7a53 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
@@ -42,14 +42,21 @@
#ifndef QDIRECTFBSCREEN_H
#define QDIRECTFBSCREEN_H
+#include <qglobal.h>
+#ifndef QT_NO_QWS_DIRECTFB
#include <QtGui/qscreen_qws.h>
#include <directfb.h>
#include <directfb_version.h>
QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
+
QT_MODULE(Gui)
+#if !defined QT_NO_DIRECTFB_SUBSURFACE && !defined QT_DIRECTFB_SUBSURFACE
+#define QT_DIRECTFB_SUBSURFACE
+#endif
#if !defined QT_NO_DIRECTFB_LAYER && !defined QT_DIRECTFB_LAYER
#define QT_DIRECTFB_LAYER
#endif
@@ -83,6 +90,16 @@ QT_MODULE(Gui)
#if !defined QT_NO_DIRECTFB_OPAQUE_DETECTION && !defined QT_DIRECTFB_OPAQUE_DETECTION
#define QT_DIRECTFB_OPAQUE_DETECTION
#endif
+#ifndef QT_NO_QWS_CURSOR
+#if defined QT_DIRECTFB_WM && defined QT_DIRECTFB_WINDOW_AS_CURSOR
+#define QT_DIRECTFB_CURSOR
+#elif defined QT_DIRECTFB_LAYER
+#define QT_DIRECTFB_CURSOR
+#endif
+#endif
+#ifndef QT_DIRECTFB_CURSOR
+#define QT_NO_DIRECTFB_CURSOR
+#endif
#if defined QT_NO_DIRECTFB_LAYER && defined QT_DIRECTFB_WM
#error QT_NO_DIRECTFB_LAYER requires QT_NO_DIRECTFB_WM
#endif
@@ -152,8 +169,11 @@ public:
return static_cast<QDirectFBScreen*>(inst);
}
+ void waitIdle();
IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const;
+#ifdef QT_DIRECTFB_SUBSURFACE
IDirectFBSurface *subSurfaceForWidget(const QWidget *widget, const QRect &area = QRect()) const;
+#endif
IDirectFB *dfb();
#ifdef QT_NO_DIRECTFB_WM
@@ -185,6 +205,12 @@ public:
IDirectFBSurface *createDFBSurface(DFBSurfaceDescription desc,
SurfaceCreationOptions options,
DFBResult *result);
+#ifdef QT_DIRECTFB_SUBSURFACE
+ IDirectFBSurface *getSubSurface(IDirectFBSurface *surface,
+ const QRect &rect,
+ SurfaceCreationOptions options,
+ DFBResult *result);
+#endif
void flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags flipFlags,
const QRegion &region, const QPoint &offset);
@@ -269,6 +295,10 @@ inline bool QDirectFBScreen::hasAlphaChannel(IDirectFBSurface *surface)
return QDirectFBScreen::hasAlphaChannel(format);
}
+QT_END_NAMESPACE
+
QT_END_HEADER
+#endif // QT_NO_QWS_DIRECTFB
#endif // QDIRECTFBSCREEN_H
+
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp
index 4caee414..05fe70f 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp
@@ -43,6 +43,7 @@
#include <QtGui/qscreendriverplugin_qws.h>
#include <QtCore/qstringlist.h>
+#ifndef QT_NO_QWS_DIRECTFB
class DirectFBScreenDriverPlugin : public QScreenDriverPlugin
{
@@ -73,3 +74,5 @@ QScreen* DirectFBScreenDriverPlugin::create(const QString& driver,
}
Q_EXPORT_PLUGIN2(qdirectfbscreen, DirectFBScreenDriverPlugin)
+
+#endif
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index a05ad21..e288199 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -48,11 +48,15 @@
#include <qpaintdevice.h>
#include <qvarlengtharray.h>
+#ifndef QT_NO_QWS_DIRECTFB
+
+QT_BEGIN_NAMESPACE
+
QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr)
: QDirectFBPaintDevice(scr)
+ , sibling(0)
#ifndef QT_NO_DIRECTFB_WM
, dfbWindow(0)
- , sibling(0)
#endif
, flipFlags(flip)
, boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
@@ -69,9 +73,9 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect
QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr, QWidget *widget)
: QWSWindowSurface(widget), QDirectFBPaintDevice(scr)
+ , sibling(0)
#ifndef QT_NO_DIRECTFB_WM
, dfbWindow(0)
- , sibling(0)
#endif
, flipFlags(flip)
, boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
@@ -98,6 +102,11 @@ QDirectFBWindowSurface::~QDirectFBWindowSurface()
{
}
+bool QDirectFBWindowSurface::isValid() const
+{
+ return true;
+}
+
#ifdef QT_DIRECTFB_WM
void QDirectFBWindowSurface::raise()
{
@@ -107,14 +116,7 @@ void QDirectFBWindowSurface::raise()
sibling->raise();
}
}
-#endif
-bool QDirectFBWindowSurface::isValid() const
-{
- return true;
-}
-
-#ifndef QT_NO_DIRECTFB_WM
void QDirectFBWindowSurface::createWindow()
{
IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer();
@@ -144,10 +146,8 @@ void QDirectFBWindowSurface::createWindow()
dfbWindow->GetSurface(dfbWindow, &dfbSurface);
updateFormat();
}
-#endif // QT_NO_DIRECTFB_WM
-#ifndef QT_NO_DIRECTFB_WM
-static DFBResult setGeometry(IDirectFBWindow *dfbWindow, const QRect &old, const QRect &rect)
+static DFBResult setWindowGeometry(IDirectFBWindow *dfbWindow, const QRect &old, const QRect &rect)
{
DFBResult result = DFB_OK;
const bool isMove = old.isEmpty() || rect.topLeft() != old.topLeft();
@@ -174,7 +174,7 @@ static DFBResult setGeometry(IDirectFBWindow *dfbWindow, const QRect &old, const
#endif
return result;
}
-#endif
+#endif // QT_NO_DIRECTFB_WM
void QDirectFBWindowSurface::setGeometry(const QRect &rect)
{
@@ -201,11 +201,10 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect)
const QRect oldRect = geometry();
DFBResult result = DFB_OK;
// If we're in a resize, the surface shouldn't be locked
- Q_ASSERT((lockedImage == 0) || (rect.size() == geometry().size()));
#ifdef QT_DIRECTFB_WM
if (!dfbWindow)
createWindow();
- ::setGeometry(dfbWindow, oldRect, rect);
+ setWindowGeometry(dfbWindow, oldRect, rect);
#else
if (mode == Primary) {
if (dfbSurface && dfbSurface != primarySurface)
@@ -243,23 +242,16 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect)
QByteArray QDirectFBWindowSurface::permanentState() const
{
-#ifdef QT_DIRECTFB_WM
QByteArray state(sizeof(this), 0);
*reinterpret_cast<const QDirectFBWindowSurface**>(state.data()) = this;
return state;
-#endif
- return QByteArray();
}
void QDirectFBWindowSurface::setPermanentState(const QByteArray &state)
{
-#ifdef QT_DIRECTFB_WM
if (state.size() == sizeof(this)) {
sibling = *reinterpret_cast<QDirectFBWindowSurface *const*>(state.constData());
}
-#else
- Q_UNUSED(state);
-#endif
}
static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy)
@@ -274,12 +266,12 @@ bool QDirectFBWindowSurface::scroll(const QRegion &region, int dx, int dy)
return false;
dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX);
if (region.numRects() == 1) {
- ::scrollSurface(dfbSurface, region.boundingRect(), dx, dy);
+ scrollSurface(dfbSurface, region.boundingRect(), dx, dy);
} else {
const QVector<QRect> rects = region.rects();
const int n = rects.size();
for (int i=0; i<n; ++i) {
- ::scrollSurface(dfbSurface, rects.at(i), dx, dy);
+ scrollSurface(dfbSurface, rects.at(i), dx, dy);
}
}
return true;
@@ -381,6 +373,7 @@ void QDirectFBWindowSurface::flush(QWidget *, const QRegion &region,
}
}
+#ifdef QT_NO_DIRECTFB_CURSOR
if (QScreenCursor *cursor = QScreenCursor::instance()) {
const QRect cursorRectangle = cursor->boundingRect();
if (cursor->isVisible() && !cursor->isAccelerated()
@@ -396,6 +389,7 @@ void QDirectFBWindowSurface::flush(QWidget *, const QRegion &region,
#endif
}
}
+#endif
if (mode == Offscreen) {
screen->flipSurface(primarySurface, flipFlags, region, offset + windowGeometry.topLeft());
} else
@@ -421,9 +415,19 @@ void QDirectFBWindowSurface::beginPaint(const QRegion &)
void QDirectFBWindowSurface::endPaint(const QRegion &)
{
- unlockDirectFB();
+#ifdef QT_NO_DIRECTFB_SUBSURFACE
+ unlockSurface();
+#endif
}
+IDirectFBSurface *QDirectFBWindowSurface::directFBSurface() const
+{
+ if (!dfbSurface && sibling && sibling->dfbSurface)
+ return sibling->dfbSurface;
+ return dfbSurface;
+}
+
+
IDirectFBSurface *QDirectFBWindowSurface::surfaceForWidget(const QWidget *widget, QRect *rect) const
{
Q_ASSERT(widget);
@@ -449,3 +453,9 @@ void QDirectFBWindowSurface::updateFormat()
{
imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid;
}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_QWS_DIRECTFB
+
+
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
index a2861e5..ca76613 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
@@ -46,9 +46,10 @@
#include "qdirectfbpaintdevice.h"
#include "qdirectfbscreen.h"
+#ifndef QT_NO_QWS_DIRECTFB
+
#include <private/qpaintengine_raster_p.h>
#include <private/qwindowsurface_qws_p.h>
-#include <directfb.h>
#ifdef QT_DIRECTFB_TIMING
#include <qdatetime.h>
@@ -56,6 +57,8 @@
QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
+
QT_MODULE(Gui)
class QDirectFBWindowSurface : public QWSWindowSurface, public QDirectFBPaintDevice
@@ -89,12 +92,14 @@ public:
void endPaint(const QRegion &);
IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const;
+ IDirectFBSurface *directFBSurface() const;
private:
void updateFormat();
+ QDirectFBWindowSurface *sibling;
+
#ifdef QT_DIRECTFB_WM
void createWindow();
IDirectFBWindow *dfbWindow;
- QDirectFBWindowSurface *sibling;
#else
enum Mode {
Primary,
@@ -110,6 +115,10 @@ private:
#endif
};
+QT_END_NAMESPACE
+
QT_END_HEADER
+#endif // QT_NO_QWS_DIRECTFB
+
#endif // QDIRECFBWINDOWSURFACE_H
diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp
index de985d8..0f6a349 100644
--- a/src/plugins/imageformats/gif/qgifhandler.cpp
+++ b/src/plugins/imageformats/gif/qgifhandler.cpp
@@ -234,7 +234,7 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
#define LM(l, m) (((m)<<8)|l)
digress = false;
- int initial = length;
+ const int initial = length;
while (!digress && length) {
length--;
unsigned char ch=*buffer++;
@@ -333,7 +333,7 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
sheight = newtop + newheight;
QImage::Format format = trans_index >= 0 ? QImage::Format_ARGB32 : QImage::Format_RGB32;
- if (image->isNull() || (image->size() != QSize(swidth, sheight)) || image->format() != format) {
+ if (image->isNull()) {
(*image) = QImage(swidth, sheight, format);
memset(image->bits(), 0, image->numBytes());
diff --git a/src/plugins/qpluginbase.pri b/src/plugins/qpluginbase.pri
index 10563c1..a3abc98 100644
--- a/src/plugins/qpluginbase.pri
+++ b/src/plugins/qpluginbase.pri
@@ -1,6 +1,6 @@
TEMPLATE = lib
isEmpty(QT_MAJOR_VERSION) {
- VERSION=4.5.3
+ VERSION=4.6.0
} else {
VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
}
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index d467250..3ffc9c5 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -3622,9 +3622,7 @@ QScriptEngineAgent *QScriptEngine::agent() const
QScriptString QScriptEngine::toStringHandle(const QString &str)
{
Q_D(QScriptEngine);
- QScriptString ss;
- QScriptStringPrivate::init(ss, this, JSC::Identifier(d->currentFrame, str));
- return ss;
+ return d->scriptStringFromJSCIdentifier(JSC::Identifier(d->currentFrame, str));
}
/*!
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index f06f717..f8eee87 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -58,6 +58,7 @@
#include <QtCore/qhash.h>
#include <QtCore/qset.h>
#include "qscriptvalue_p.h"
+#include "qscriptstring_p.h"
#include "RefPtr.h"
#include "Structure.h"
@@ -122,6 +123,7 @@ public:
inline QScriptValue scriptValueFromJSCValue(JSC::JSValue value);
inline JSC::JSValue scriptValueToJSCValue(const QScriptValue &value);
+ inline QScriptString scriptStringFromJSCIdentifier(const JSC::Identifier &id);
QScriptValue scriptValueFromVariant(const QVariant &value);
QVariant scriptValueToVariant(const QScriptValue &value, int targetType);
@@ -362,6 +364,14 @@ inline QScriptValue QScriptValuePrivate::property(const QString &name, int resol
return property(JSC::Identifier(exec, name), resolveMode);
}
+inline QScriptString QScriptEnginePrivate::scriptStringFromJSCIdentifier(const JSC::Identifier &id)
+{
+ QScriptString q;
+ q.d_ptr = new QScriptStringPrivate(q_func(), id);
+ return q;
+}
+
+
QT_END_NAMESPACE
#endif
diff --git a/src/script/api/qscriptstring.cpp b/src/script/api/qscriptstring.cpp
index 58a7c2b..6de1d88 100644
--- a/src/script/api/qscriptstring.cpp
+++ b/src/script/api/qscriptstring.cpp
@@ -86,16 +86,6 @@ QScriptStringPrivate::~QScriptStringPrivate()
}
/*!
- \internal
-*/
-void QScriptStringPrivate::init(QScriptString &q, QScriptEngine *engine,
- const JSC::Identifier &value)
-{
- Q_ASSERT(!q.isValid());
- q.d_ptr = new QScriptStringPrivate(engine, value);
-}
-
-/*!
Constructs an invalid QScriptString.
*/
QScriptString::QScriptString()
diff --git a/src/script/api/qscriptstring.h b/src/script/api/qscriptstring.h
index 30e6856..e6224a2 100644
--- a/src/script/api/qscriptstring.h
+++ b/src/script/api/qscriptstring.h
@@ -76,6 +76,7 @@ public:
private:
QExplicitlySharedDataPointer<QScriptStringPrivate> d_ptr;
friend class QScriptValue;
+ friend class QScriptEnginePrivate;
Q_DECLARE_PRIVATE(QScriptString)
};
diff --git a/src/script/api/qscriptstring_p.h b/src/script/api/qscriptstring_p.h
index 8f76648..bba4b58 100644
--- a/src/script/api/qscriptstring_p.h
+++ b/src/script/api/qscriptstring_p.h
@@ -72,8 +72,6 @@ public:
QScriptStringPrivate(QScriptEngine *engine, const JSC::Identifier &id);
~QScriptStringPrivate();
- static void init(QScriptString &q, QScriptEngine *engine, const JSC::Identifier &id);
-
QBasicAtomicInt ref;
#ifndef QT_NO_QOBJECT
QPointer<QScriptEngine> engine;
diff --git a/src/script/bridge/qscriptactivationobject.cpp b/src/script/bridge/qscriptactivationobject.cpp
index c6d405e..1c7b912 100644
--- a/src/script/bridge/qscriptactivationobject.cpp
+++ b/src/script/bridge/qscriptactivationobject.cpp
@@ -52,8 +52,8 @@ namespace JSC
QT_BEGIN_NAMESPACE
/*!
-\class QScriptActivationObject
-\internal
+ \class QScript::QScriptActivationObject
+ \internal
Represent a scope for native function call.
*/
diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp
index c8633ab..fcd0124 100644
--- a/src/script/bridge/qscriptclassobject.cpp
+++ b/src/script/bridge/qscriptclassobject.cpp
@@ -97,8 +97,7 @@ bool ClassObjectDelegate::getOwnPropertySlot(QScriptObject* object,
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
- QString name(propertyName.ustring());
- QScriptString scriptName = QScriptEnginePrivate::get(engine)->toStringHandle(name);
+ QScriptString scriptName = engine->scriptStringFromJSCIdentifier(propertyName);
uint id = 0;
QScriptClass::QueryFlags flags = m_scriptClass->queryProperty(
scriptObject, scriptName, QScriptClass::HandlesReadAccess, &id);
@@ -116,8 +115,7 @@ void ClassObjectDelegate::put(QScriptObject* object, JSC::ExecState *exec,
{
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
- QString name(propertyName.ustring());
- QScriptString scriptName = QScriptEnginePrivate::get(engine)->toStringHandle(name);
+ QScriptString scriptName = engine->scriptStringFromJSCIdentifier(propertyName);
uint id = 0;
QScriptClass::QueryFlags flags = m_scriptClass->queryProperty(
scriptObject, scriptName, QScriptClass::HandlesWriteAccess, &id);
@@ -135,8 +133,7 @@ bool ClassObjectDelegate::deleteProperty(QScriptObject* object, JSC::ExecState *
// ### avoid duplication of put()
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
- QString name(propertyName.ustring());
- QScriptString scriptName = QScriptEnginePrivate::get(engine)->toStringHandle(name);
+ QScriptString scriptName = engine->scriptStringFromJSCIdentifier(propertyName);
uint id = 0;
QScriptClass::QueryFlags flags = m_scriptClass->queryProperty(
scriptObject, scriptName, QScriptClass::HandlesWriteAccess, &id);
@@ -155,8 +152,7 @@ bool ClassObjectDelegate::getPropertyAttributes(const QScriptObject* object, JSC
{
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
- QString name(propertyName.ustring());
- QScriptString scriptName = QScriptEnginePrivate::get(engine)->toStringHandle(name);
+ QScriptString scriptName = engine->scriptStringFromJSCIdentifier(propertyName);
uint id = 0;
QScriptClass::QueryFlags flags = m_scriptClass->queryProperty(
scriptObject, scriptName, QScriptClass::HandlesReadAccess, &id);
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
index fa79460..b29e742 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/sql/drivers/mysql/qsql_mysql.cpp
@@ -1310,23 +1310,38 @@ QSqlResult *QMYSQLDriver::createResult() const
QStringList QMYSQLDriver::tables(QSql::TableType type) const
{
QStringList tl;
- if (!isOpen())
- return tl;
- if (!(type & QSql::Tables))
- return tl;
-
- MYSQL_RES* tableRes = mysql_list_tables(d->mysql, NULL);
- MYSQL_ROW row;
- int i = 0;
- while (tableRes) {
- mysql_data_seek(tableRes, i);
- row = mysql_fetch_row(tableRes);
- if (!row)
- break;
- tl.append(toUnicode(d->tc, row[0]));
- i++;
+ if( mysql_get_server_version(d->mysql) < 50000)
+ {
+ if (!isOpen())
+ return tl;
+ if (!(type & QSql::Tables))
+ return tl;
+
+ MYSQL_RES* tableRes = mysql_list_tables(d->mysql, NULL);
+ MYSQL_ROW row;
+ int i = 0;
+ while (tableRes) {
+ mysql_data_seek(tableRes, i);
+ row = mysql_fetch_row(tableRes);
+ if (!row)
+ break;
+ tl.append(toUnicode(d->tc, row[0]));
+ i++;
+ }
+ mysql_free_result(tableRes);
+ } else {
+ QSqlQuery q(createResult());
+ if(type & QSql::Tables) {
+ q.exec(QLatin1String("select table_name from information_schema.tables where table_type = 'BASE TABLE'"));
+ while(q.next())
+ tl.append(q.value(0).toString());
+ }
+ if(type & QSql::Views) {
+ q.exec(QLatin1String("select table_name from information_schema.tables where table_type = 'VIEW'"));
+ while(q.next())
+ tl.append(q.value(0).toString());
+ }
}
- mysql_free_result(tableRes);
return tl;
}
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index 742d596..2692c96 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -323,12 +323,12 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
colSize *= 2; // a tiny bit faster, since it saves a SQLGetData() call
}
}
- char* buf = new char[colSize];
+ QVarLengthArray<char> buf(colSize);
while (true) {
r = SQLGetData(hStmt,
column+1,
unicode ? SQL_C_WCHAR : SQL_C_CHAR,
- (SQLPOINTER)buf,
+ (SQLPOINTER)buf.data(),
colSize,
&lengthIndicator);
if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) {
@@ -343,11 +343,12 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
// colSize-1: remove 0 termination when there is more data to fetch
int rSize = (r == SQL_SUCCESS_WITH_INFO) ? (unicode ? colSize-2 : colSize-1) : lengthIndicator;
if (unicode) {
- fieldVal += QString((QChar*) buf, rSize / 2);
+ fieldVal += QString((const QChar*) buf.constData(), rSize / 2);
} else {
- fieldVal += QString::fromAscii(buf, rSize);
+ fieldVal += QString::fromAscii(buf.constData(), rSize);
}
- if (lengthIndicator - fieldVal.size() <= 0) {
+ memset(buf.data(), 0, colSize);
+ if (lengthIndicator < colSize) {
// workaround for Drivermanagers that don't return SQL_NO_DATA
break;
}
@@ -359,7 +360,6 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
break;
}
}
- delete[] buf;
return fieldVal;
}
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index d0b52da..9683efd 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -64,6 +64,7 @@
#include "qdebug.h"
#include "qmath.h"
#include "qnumeric.h"
+#include "qvarlengtharray.h"
#include "private/qmath_p.h"
#include "float.h"
@@ -181,21 +182,21 @@ QSvgAttributes::QSvgAttributes(const QXmlStreamAttributes &xmlAttributes, QSvgHa
case 's':
if (name.length() > 5 && QStringRef(name.string(), name.position() + 1, 5) == QLatin1String("troke")) {
QStringRef strokeRef(name.string(), name.position() + 6, name.length() - 6);
- if (name.isEmpty())
+ if (strokeRef.isEmpty())
stroke = value;
- else if (name == QLatin1String("-dasharray"))
+ else if (strokeRef == QLatin1String("-dasharray"))
strokeDashArray = value;
- else if (name == QLatin1String("-dashoffset"))
+ else if (strokeRef == QLatin1String("-dashoffset"))
strokeDashOffset = value;
- else if (name == QLatin1String("-linecap"))
+ else if (strokeRef == QLatin1String("-linecap"))
strokeLineCap = value;
- else if (name == QLatin1String("-linejoin"))
+ else if (strokeRef == QLatin1String("-linejoin"))
strokeLineJoin = value;
- else if (name == QLatin1String("-miterlimit"))
+ else if (strokeRef == QLatin1String("-miterlimit"))
strokeMiterLimit = value;
- else if (name == QLatin1String("-opacity"))
+ else if (strokeRef == QLatin1String("-opacity"))
strokeOpacity = value;
- else if (name == QLatin1String("-width"))
+ else if (strokeRef == QLatin1String("-width"))
strokeWidth = value;
}
else if (name == QLatin1String("stop-color"))
@@ -276,21 +277,21 @@ QSvgAttributes::QSvgAttributes(const QXmlStreamAttributes &xmlAttributes, QSvgHa
case 's':
if (name.length() > 5 && QStringRef(name.string(), name.position() + 1, 5) == QLatin1String("troke")) {
QStringRef strokeRef(name.string(), name.position() + 6, name.length() - 6);
- if (name.isEmpty())
+ if (strokeRef.isEmpty())
stroke = value;
- else if (name == QLatin1String("-dasharray"))
+ else if (strokeRef == QLatin1String("-dasharray"))
strokeDashArray = value;
- else if (name == QLatin1String("-dashoffset"))
+ else if (strokeRef == QLatin1String("-dashoffset"))
strokeDashOffset = value;
- else if (name == QLatin1String("-linecap"))
+ else if (strokeRef == QLatin1String("-linecap"))
strokeLineCap = value;
- else if (name == QLatin1String("-linejoin"))
+ else if (strokeRef == QLatin1String("-linejoin"))
strokeLineJoin = value;
- else if (name == QLatin1String("-miterlimit"))
+ else if (strokeRef == QLatin1String("-miterlimit"))
strokeMiterLimit = value;
- else if (name == QLatin1String("-opacity"))
+ else if (strokeRef == QLatin1String("-opacity"))
strokeOpacity = value;
- else if (name == QLatin1String("-width"))
+ else if (strokeRef == QLatin1String("-width"))
strokeWidth = value;
}
else if (name == QLatin1String("stop-color"))
@@ -474,6 +475,13 @@ public:
}
};
+// '0' is 0x30 and '9' is 0x39
+static inline bool isDigit(ushort ch)
+{
+ static quint16 magic = 0x3ff;
+ return ((ch >> 4) == 3) && (magic >> (ch & 15));
+}
+
static qreal toDouble(const QChar *&str)
{
const int maxLen = 255;//technically doubles can go til 308+ but whatever
@@ -486,7 +494,7 @@ static qreal toDouble(const QChar *&str)
} else if (*str == QLatin1Char('+')) {
++str;
}
- while (*str >= QLatin1Char('0') && *str <= QLatin1Char('9') && pos < maxLen) {
+ while (isDigit(str->unicode()) && pos < maxLen) {
temp[pos++] = str->toLatin1();
++str;
}
@@ -494,7 +502,7 @@ static qreal toDouble(const QChar *&str)
temp[pos++] = '.';
++str;
}
- while (*str >= QLatin1Char('0') && *str <= QLatin1Char('9') && pos < maxLen) {
+ while (isDigit(str->unicode()) && pos < maxLen) {
temp[pos++] = str->toLatin1();
++str;
}
@@ -507,7 +515,7 @@ static qreal toDouble(const QChar *&str)
temp[pos++] = str->toLatin1();
++str;
}
- while (*str >= QLatin1Char('0') && *str <= QLatin1Char('9') && pos < maxLen) {
+ while (isDigit(str->unicode()) && pos < maxLen) {
temp[pos++] = str->toLatin1();
++str;
}
@@ -587,7 +595,7 @@ static QVector<qreal> parseNumbersList(const QChar *&str)
while (*str == QLatin1Char(' '))
++str;
- while ((*str >= QLatin1Char('0') && *str <= QLatin1Char('9')) ||
+ while (isDigit(str->unicode()) ||
*str == QLatin1Char('-') || *str == QLatin1Char('+') ||
*str == QLatin1Char('.')) {
@@ -606,6 +614,27 @@ static QVector<qreal> parseNumbersList(const QChar *&str)
return points;
}
+static inline void parseNumbersArray(const QChar *&str, QVarLengthArray<qreal, 8> &points)
+{
+ while (*str == QLatin1Char(' '))
+ ++str;
+ while (isDigit(str->unicode()) ||
+ *str == QLatin1Char('-') || *str == QLatin1Char('+') ||
+ *str == QLatin1Char('.')) {
+
+ points.append(toDouble(str));
+
+ while (*str == QLatin1Char(' '))
+ ++str;
+ if (*str == QLatin1Char(','))
+ ++str;
+
+ //eat the rest of space
+ while (*str == QLatin1Char(' '))
+ ++str;
+ }
+}
+
static QVector<qreal> parsePercentageList(const QChar *&str)
{
QVector<qreal> points;
@@ -656,6 +685,28 @@ static QString idFromUrl(const QString &url)
return id;
}
+static inline QStringRef trimRef(const QStringRef &str)
+{
+ if (str.isEmpty())
+ return QStringRef();
+ const QChar *s = str.string()->constData() + str.position();
+ int end = str.length() - 1;
+ if (!s[0].isSpace() && !s[end].isSpace())
+ return str;
+
+ int start = 0;
+ while (start<=end && s[start].isSpace()) // skip white space from start
+ start++;
+ if (start <= end) { // only white space
+ while (s[end].isSpace()) // skip white space from end
+ end--;
+ }
+ int l = end - start + 1;
+ if (l <= 0)
+ return QStringRef();
+ return QStringRef(str.string(), str.position() + start, l);
+}
+
/**
* returns true when successfuly set the color. false signifies
* that the color should be inherited
@@ -874,12 +925,16 @@ static void parseBrush(QSvgNode *node,
-static QMatrix parseTransformationMatrix(const QString &value)
+static QMatrix parseTransformationMatrix(const QStringRef &value)
{
+ if (value.isEmpty())
+ return QMatrix();
+
QMatrix matrix;
const QChar *str = value.constData();
+ const QChar *end = str + value.length();
- while (*str != QLatin1Char(0)) {
+ while (str < end) {
if (str->isSpace() || *str == QLatin1Char(',')) {
++str;
continue;
@@ -944,12 +999,13 @@ static QMatrix parseTransformationMatrix(const QString &value)
}
- while (str->isSpace())
+ while (str < end && str->isSpace())
++str;
if (*str != QLatin1Char('('))
goto error;
++str;
- QVector<qreal> points = parseNumbersList(str);
+ QVarLengthArray<qreal, 8> points;
+ parseNumbersArray(str, points);
if (*str != QLatin1Char(')'))
goto error;
++str;
@@ -1182,10 +1238,7 @@ static void parseTransform(QSvgNode *node,
{
if (attributes.transform.isEmpty())
return;
- QString value = attributes.transform.toString().trimmed();
- if (value.isEmpty())
- return;
- QMatrix matrix = parseTransformationMatrix(value);
+ QMatrix matrix = parseTransformationMatrix(trimRef(attributes.transform));
if (!matrix.isIdentity()) {
node->appendStyleProperty(new QSvgTransformStyle(QTransform(matrix)), someId(attributes));
@@ -1361,24 +1414,29 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
QChar pathElem = *str;
++str;
QChar endc = *end;
- *const_cast<QChar *>(end) = 0; // parseNumbersList requires 0-termination that QStringRef cannot guarantee
- QVector<qreal> arg = parseNumbersList(str);
+ *const_cast<QChar *>(end) = 0; // parseNumbersArray requires 0-termination that QStringRef cannot guarantee
+ QVarLengthArray<qreal, 8> arg;
+ parseNumbersArray(str, arg);
*const_cast<QChar *>(end) = endc;
if (pathElem == QLatin1Char('z') || pathElem == QLatin1Char('Z'))
arg.append(0);//dummy
- while (!arg.isEmpty()) {
+ const qreal *num = arg.constData();
+ int count = arg.count();
+ while (count > 0) {
qreal offsetX = x; // correction offsets
qreal offsetY = y; // for relative commands
switch (pathElem.unicode()) {
case 'm': {
- if (arg.count() < 2) {
- arg.pop_front();
+ if (count < 2) {
+ num++;
+ count--;
break;
}
- x = x0 = arg[0] + offsetX;
- y = y0 = arg[1] + offsetY;
+ x = x0 = num[0] + offsetX;
+ y = y0 = num[1] + offsetY;
+ num += 2;
+ count -= 2;
path.moveTo(x0, y0);
- arg.pop_front(); arg.pop_front();
// As per 1.2 spec 8.3.2 The "moveto" commands
// If a 'moveto' is followed by multiple pairs of coordinates without explicit commands,
@@ -1387,15 +1445,16 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
}
break;
case 'M': {
- if (arg.count() < 2) {
- arg.pop_front();
+ if (count < 2) {
+ num++;
+ count--;
break;
}
- x = x0 = arg[0];
- y = y0 = arg[1];
-
+ x = x0 = num[0];
+ y = y0 = num[1];
+ num += 2;
+ count -= 2;
path.moveTo(x0, y0);
- arg.pop_front(); arg.pop_front();
// As per 1.2 spec 8.3.2 The "moveto" commands
// If a 'moveto' is followed by multiple pairs of coordinates without explicit commands,
@@ -1407,96 +1466,104 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
case 'Z': {
x = x0;
y = y0;
+ count--; // skip dummy
+ num++;
path.closeSubpath();
- arg.pop_front();//pop dummy
}
break;
case 'l': {
- if (arg.count() < 2) {
- arg.pop_front();
+ if (count < 2) {
+ num++;
+ count--;
break;
}
- x = arg.front() + offsetX;
- arg.pop_front();
- y = arg.front() + offsetY;
- arg.pop_front();
+ x = x0 = num[0] + offsetX;
+ y = y0 = num[1] + offsetY;
+ num += 2;
+ count -= 2;
path.lineTo(x, y);
}
break;
case 'L': {
- if (arg.count() < 2) {
- arg.pop_front();
+ if (count < 2) {
+ num++;
+ count--;
break;
}
- x = arg.front(); arg.pop_front();
- y = arg.front(); arg.pop_front();
+ x = x0 = num[0];
+ y = y0 = num[1];
+ num += 2;
+ count -= 2;
path.lineTo(x, y);
}
break;
case 'h': {
- x = arg.front() + offsetX; arg.pop_front();
+ x = num[0] + offsetX;
+ num++;
+ count--;
path.lineTo(x, y);
}
break;
case 'H': {
- x = arg[0];
+ x = num[0];
+ num++;
+ count--;
path.lineTo(x, y);
- arg.pop_front();
}
break;
case 'v': {
- y = arg[0] + offsetY;
+ y = num[0] + offsetY;
+ num++;
+ count--;
path.lineTo(x, y);
- arg.pop_front();
}
break;
case 'V': {
- y = arg[0];
+ y = num[0];
+ num++;
+ count--;
path.lineTo(x, y);
- arg.pop_front();
}
break;
case 'c': {
- if (arg.count() < 6) {
- while (arg.count())
- arg.pop_front();
+ if (count < 6) {
+ num += count;
+ count = 0;
break;
}
- QPointF c1(arg[0]+offsetX, arg[1]+offsetY);
- QPointF c2(arg[2]+offsetX, arg[3]+offsetY);
- QPointF e(arg[4]+offsetX, arg[5]+offsetY);
+ QPointF c1(num[0] + offsetX, num[1] + offsetY);
+ QPointF c2(num[2] + offsetX, num[3] + offsetY);
+ QPointF e(num[4] + offsetX, num[5] + offsetY);
+ num += 6;
+ count -= 6;
path.cubicTo(c1, c2, e);
ctrlPt = c2;
x = e.x();
y = e.y();
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
break;
}
case 'C': {
- if (arg.count() < 6) {
- while (arg.count())
- arg.pop_front();
+ if (count < 6) {
+ num += count;
+ count = 0;
break;
}
- QPointF c1(arg[0], arg[1]);
- QPointF c2(arg[2], arg[3]);
- QPointF e(arg[4], arg[5]);
+ QPointF c1(num[0], num[1]);
+ QPointF c2(num[2], num[3]);
+ QPointF e(num[4], num[5]);
+ num += 6;
+ count -= 6;
path.cubicTo(c1, c2, e);
ctrlPt = c2;
x = e.x();
y = e.y();
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
break;
}
case 's': {
- if (arg.count() < 4) {
- while (arg.count())
- arg.pop_front();
+ if (count < 4) {
+ num += count;
+ count = 0;
break;
}
QPointF c1;
@@ -1505,20 +1572,20 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
c1 = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
else
c1 = QPointF(x, y);
- QPointF c2(arg[0]+offsetX, arg[1]+offsetY);
- QPointF e(arg[2]+offsetX, arg[3]+offsetY);
+ QPointF c2(num[0] + offsetX, num[1] + offsetY);
+ QPointF e(num[2] + offsetX, num[3] + offsetY);
+ num += 4;
+ count -= 4;
path.cubicTo(c1, c2, e);
ctrlPt = c2;
x = e.x();
y = e.y();
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
break;
}
case 'S': {
- if (arg.count() < 4) {
- while (arg.count())
- arg.pop_front();
+ if (count < 4) {
+ num += count;
+ count = 0;
break;
}
QPointF c1;
@@ -1527,55 +1594,57 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
c1 = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
else
c1 = QPointF(x, y);
- QPointF c2(arg[0], arg[1]);
- QPointF e(arg[2], arg[3]);
+ QPointF c2(num[0], num[1]);
+ QPointF e(num[2], num[3]);
+ num += 4;
+ count -= 4;
path.cubicTo(c1, c2, e);
ctrlPt = c2;
x = e.x();
y = e.y();
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
break;
}
case 'q': {
- if (arg.count() < 4) {
- while (arg.count())
- arg.pop_front();
+ if (count < 4) {
+ num += count;
+ count = 0;
break;
}
- QPointF c(arg[0]+offsetX, arg[1]+offsetY);
- QPointF e(arg[2]+offsetX, arg[3]+offsetY);
+ QPointF c(num[0] + offsetX, num[1] + offsetY);
+ QPointF e(num[2] + offsetX, num[3] + offsetY);
+ num += 4;
+ count -= 4;
path.quadTo(c, e);
ctrlPt = c;
x = e.x();
y = e.y();
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
break;
}
case 'Q': {
- if (arg.count() < 4) {
- while (arg.count())
- arg.pop_front();
+ if (count < 4) {
+ num += count;
+ count = 0;
break;
}
- QPointF c(arg[0], arg[1]);
- QPointF e(arg[2], arg[3]);
+ QPointF c(num[0], num[1]);
+ QPointF e(num[2], num[3]);
+ num += 4;
+ count -= 4;
path.quadTo(c, e);
ctrlPt = c;
x = e.x();
y = e.y();
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
break;
}
case 't': {
- if (arg.count() < 2) {
- while (arg.count())
- arg.pop_front();
+ if (count < 2) {
+ num += count;
+ count = 0;
break;
}
- QPointF e(arg[0]+offsetX, arg[1]+offsetY);
+ QPointF e(num[0] + offsetX, num[1] + offsetY);
+ num += 2;
+ count -= 2;
QPointF c;
if (lastMode == 'q' || lastMode == 'Q' ||
lastMode == 't' || lastMode == 'T')
@@ -1586,16 +1655,17 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
ctrlPt = c;
x = e.x();
y = e.y();
- arg.pop_front(); arg.pop_front();
break;
}
case 'T': {
- if (arg.count() < 2) {
- while (arg.count())
- arg.pop_front();
+ if (count < 2) {
+ num += count;
+ count = 0;
break;
}
- QPointF e(arg[0], arg[1]);
+ QPointF e(num[0], num[1]);
+ num += 2;
+ count -= 2;
QPointF c;
if (lastMode == 'q' || lastMode == 'Q' ||
lastMode == 't' || lastMode == 'T')
@@ -1606,22 +1676,22 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
ctrlPt = c;
x = e.x();
y = e.y();
- arg.pop_front(); arg.pop_front();
break;
}
case 'a': {
- if (arg.count() < 7) {
- while (arg.count())
- arg.pop_front();
+ if (count < 7) {
+ num += count;
+ count = 0;
break;
}
- qreal rx = arg[0];
- qreal ry = arg[1];
- qreal xAxisRotation = arg[2];
- qreal largeArcFlag = arg[3];
- qreal sweepFlag = arg[4];
- qreal ex = arg[5] + offsetX;
- qreal ey = arg[6] + offsetY;
+ qreal rx = (*num++);
+ qreal ry = (*num++);
+ qreal xAxisRotation = (*num++);
+ qreal largeArcFlag = (*num++);
+ qreal sweepFlag = (*num++);
+ qreal ex = (*num++) + offsetX;
+ qreal ey = (*num++) + offsetY;
+ count -= 7;
qreal curx = x;
qreal cury = y;
pathArc(path, rx, ry, xAxisRotation, int(largeArcFlag),
@@ -1629,36 +1699,29 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
x = ex;
y = ey;
-
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
- arg.pop_front();
}
break;
case 'A': {
- if (arg.count() < 7) {
- while (arg.count())
- arg.pop_front();
+ if (count < 7) {
+ num += count;
+ count = 0;
break;
}
- qreal rx = arg[0];
- qreal ry = arg[1];
- qreal xAxisRotation = arg[2];
- qreal largeArcFlag = arg[3];
- qreal sweepFlag = arg[4];
- qreal ex = arg[5];
- qreal ey = arg[6];
+ qreal rx = (*num++);
+ qreal ry = (*num++);
+ qreal xAxisRotation = (*num++);
+ qreal largeArcFlag = (*num++);
+ qreal sweepFlag = (*num++);
+ qreal ex = (*num++);
+ qreal ey = (*num++);
+ count -= 7;
qreal curx = x;
qreal cury = y;
pathArc(path, rx, ry, xAxisRotation, int(largeArcFlag),
int(sweepFlag), ex, ey, curx, cury);
+
x = ex;
y = ey;
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
- arg.pop_front(); arg.pop_front();
- arg.pop_front();
}
break;
default:
@@ -1819,27 +1882,49 @@ static inline QStringList stringToList(const QString &str)
static bool parseCoreNode(QSvgNode *node,
const QXmlStreamAttributes &attributes)
{
- QString featuresStr = attributes.value(QLatin1String("requiredFeatures")).toString();
- QString extensionsStr = attributes.value(QLatin1String("requiredExtensions")).toString();
- QString languagesStr = attributes.value(QLatin1String("systemLanguage")).toString();
- QString formatsStr = attributes.value(QLatin1String("requiredFormats")).toString();
- QString fontsStr = attributes.value(QLatin1String("requiredFonts")).toString();
- QString nodeIdStr = someId(attributes);
- QString xmlClassStr = attributes.value(QLatin1String("class")).toString();
+ QStringList features;
+ QStringList extensions;
+ QStringList languages;
+ QStringList formats;
+ QStringList fonts;
+ QString xmlClassStr;
-
- QStringList features = stringToList(featuresStr);
- QStringList extensions = stringToList(extensionsStr);
- QStringList languages = stringToList(languagesStr);
- QStringList formats = stringToList(formatsStr);
- QStringList fonts = stringToList(fontsStr);
+ for (int i = 0; i < attributes.count(); ++i) {
+ const QXmlStreamAttribute &attribute = attributes.at(i);
+ QStringRef name = attribute.qualifiedName();
+ if (name.isEmpty())
+ continue;
+ QStringRef value = attribute.value();
+ switch (name.at(0).unicode()) {
+ case 'c':
+ if (name == QLatin1String("class"))
+ xmlClassStr = value.toString();
+ break;
+ case 'r':
+ if (name == QLatin1String("requiredFeatures"))
+ features = stringToList(value.toString());
+ else if (name == QLatin1String("requiredExtensions"))
+ extensions = stringToList(value.toString());
+ else if (name == QLatin1String("requiredFormats"))
+ formats = stringToList(value.toString());
+ else if (name == QLatin1String("requiredFonts"))
+ fonts = stringToList(value.toString());
+ break;
+ case 's':
+ if (name == QLatin1String("systemLanguage"))
+ languages = stringToList(value.toString());
+ break;
+ default:
+ break;
+ }
+ }
node->setRequiredFeatures(features);
node->setRequiredExtensions(extensions);
node->setRequiredLanguages(languages);
node->setRequiredFormats(formats);
node->setRequiredFonts(fonts);
- node->setNodeId(nodeIdStr);
+ node->setNodeId(someId(attributes));
node->setXmlClass(xmlClassStr);
return true;
@@ -1981,8 +2066,9 @@ static void parseOthers(QSvgNode *node,
const QSvgAttributes &attributes,
QSvgHandler *)
{
- QString displayStr = attributes.display.toString();
- displayStr = displayStr.trimmed();
+ if (attributes.display.isEmpty())
+ return;
+ QString displayStr = attributes.display.toString().trimmed();
if (!displayStr.isEmpty()) {
node->setDisplayMode(displayStringToEnum(displayStr));
@@ -2530,7 +2616,7 @@ static void parseBaseGradient(QSvgNode *node,
QSvgHandler *handler)
{
QString link = attributes.value(QLatin1String("xlink:href")).toString();
- QString trans = attributes.value(QLatin1String("gradientTransform")).toString();
+ QStringRef trans = attributes.value(QLatin1String("gradientTransform"));
QString spread = attributes.value(QLatin1String("spreadMethod")).toString();
QString units = attributes.value(QLatin1String("gradientUnits")).toString();
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index c655cad..b9636c9 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -2121,6 +2121,10 @@ bool QTest::compare_string_helper(const char *t1, const char *t2, const char *ac
\internal
*/
+/*! \fn bool QTest::qCompare(bool const &t1, int const &t2, const char *actual, const char *expected, const char *file, int line)
+ \internal
+ */
+
/*! \fn bool QTest::qTest(const T& actual, const char *elementName, const char *actualStr, const char *expected, const char *file, int line)
\internal
*/
diff --git a/tests/auto/gestures/customgesturerecognizer.cpp b/tests/auto/gestures/customgesturerecognizer.cpp
deleted file mode 100644
index 96028be..0000000
--- a/tests/auto/gestures/customgesturerecognizer.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite module 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 "customgesturerecognizer.h"
-#include "qgesture.h"
-
-const char* SingleshotGestureRecognizer::Name = "SingleshotGesture";
-const char* PinchGestureRecognizer::Name = "PinchGesture";
-const char* SecondFingerGestureRecognizer::Name = "SecondFingerGesture";
-const char* PanGestureRecognizer::Name = "PanGesture";
-
-SingleshotGestureRecognizer::SingleshotGestureRecognizer(QObject *parent)
- : QGestureRecognizer(QString(SingleshotGestureRecognizer::Name), parent)
-{
- gesture = new SingleshotGesture(this, SingleshotGestureRecognizer::Name);
-}
-
-QGestureRecognizer::Result SingleshotGestureRecognizer::filterEvent(const QEvent *event)
-{
- if (event->type() == SingleshotEvent::Type) {
- gesture->setHotSpot(static_cast<const SingleshotEvent*>(event)->point);
- return QGestureRecognizer::GestureFinished;
- }
- return QGestureRecognizer::NotGesture;
-}
-
-void SingleshotGestureRecognizer::reset()
-{
- gesture->setHotSpot(QPoint());
- gesture->offset = QPoint();
-}
-
-PinchGestureRecognizer::PinchGestureRecognizer(QObject *parent)
- : QGestureRecognizer(PinchGestureRecognizer::Name, parent)
-{
- gesture = new PinchGesture(this, PinchGestureRecognizer::Name);
-}
-
-QGestureRecognizer::Result PinchGestureRecognizer::filterEvent(const QEvent *event)
-{
- if (event->type() != TouchEvent::Type)
- return QGestureRecognizer::Ignore;
-
- const TouchEvent *e = static_cast<const TouchEvent*>(event);
- if (e->points[0].state == TouchPoint::Begin)
- gesture->startPoints[0] = e->points[0];
- if (e->points[1].state == TouchPoint::Begin)
- gesture->startPoints[1] = e->points[1];
- gesture->lastPoints[0] = gesture->points[0];
- gesture->lastPoints[1] = gesture->points[1];
- gesture->points[0] = e->points[0];
- gesture->points[1] = e->points[1];
- if (((e->points[0].state == TouchPoint::Begin || e->points[0].state == TouchPoint::Update))) {
- if (e->points[1].state == TouchPoint::End || e->points[1].state == TouchPoint::None)
- return MaybeGesture;
- return GestureStarted;
- } else if (((e->points[1].state == TouchPoint::Begin || e->points[1].state == TouchPoint::Update))) {
- if (e->points[0].state == TouchPoint::End || e->points[0].state == TouchPoint::None)
- return MaybeGesture;
- return GestureStarted;
- } else if ((e->points[0].state == TouchPoint::End && e->points[1].state == TouchPoint::End) ||
- (e->points[0].state == TouchPoint::End && e->points[1].state == TouchPoint::None) ||
- (e->points[0].state == TouchPoint::None && e->points[1].state == TouchPoint::End)) {
- return QGestureRecognizer::NotGesture;
- }
- return QGestureRecognizer::NotGesture;
-}
-
-void PinchGestureRecognizer::reset()
-{
- gesture->startPoints[0] = TouchPoint();
- gesture->startPoints[1] = TouchPoint();
- gesture->lastPoints[0] = TouchPoint();
- gesture->lastPoints[1] = TouchPoint();
- gesture->points[0] = TouchPoint();
- gesture->points[1] = TouchPoint();
- gesture->offset = QPoint();
-}
-
-SecondFingerGestureRecognizer::SecondFingerGestureRecognizer(QObject *parent)
- : QGestureRecognizer(SecondFingerGestureRecognizer::Name, parent)
-{
- gesture = new SecondFingerGesture(this, SecondFingerGestureRecognizer::Name);
-}
-
-QGestureRecognizer::Result SecondFingerGestureRecognizer::filterEvent(const QEvent *event)
-{
- if (event->type() != TouchEvent::Type)
- return QGestureRecognizer::Ignore;
-
- const TouchEvent *e = static_cast<const TouchEvent*>(event);
- if (e->points[1].state != TouchPoint::None) {
- if (e->points[1].state == TouchPoint::Begin)
- gesture->startPoint = e->points[1];
- gesture->lastPoint = gesture->point;
- gesture->point = e->points[1];
- if (e->points[1].state == TouchPoint::End)
- return QGestureRecognizer::GestureFinished;
- else if (e->points[1].state != TouchPoint::None)
- return QGestureRecognizer::GestureStarted;
- }
- return QGestureRecognizer::NotGesture;
-}
-
-void SecondFingerGestureRecognizer::reset()
-{
- gesture->startPoint = TouchPoint();
- gesture->lastPoint = TouchPoint();
- gesture->point = TouchPoint();
- gesture->offset = QPoint();
-}
-
-PanGestureRecognizer::PanGestureRecognizer(QObject *parent)
- : QGestureRecognizer(PanGestureRecognizer::Name, parent)
-{
- gesture = new PanGesture(this, PanGestureRecognizer::Name);
-}
-
-QGestureRecognizer::Result PanGestureRecognizer::filterEvent(const QEvent *event)
-{
- if (event->type() != QEvent::TouchBegin &&
- event->type() != QEvent::TouchUpdate &&
- event->type() != QEvent::TouchEnd)
- return QGestureRecognizer::Ignore;
-
- const QTouchEvent *e = static_cast<const QTouchEvent*>(event);
- const QList<QTouchEvent::TouchPoint> &points = e->touchPoints();
-
- if (points.size() >= 1) {
- gesture->lastPoints[0] = gesture->points[0];
- gesture->points[0].id = points.at(0).id();
- gesture->points[0].pt = points.at(0).startPos().toPoint();
- gesture->points[0].state = (TouchPoint::State)points.at(0).state();
- if (points.at(0).state() == Qt::TouchPointPressed) {
- gesture->startPoints[0] = gesture->points[0];
- gesture->lastPoints[0] = gesture->points[0];
- }
- }
- if (points.size() >= 2) {
- gesture->lastPoints[1] = gesture->points[1];
- gesture->points[1].id = points.at(1).id();
- gesture->points[1].pt = points.at(1).startPos().toPoint();
- gesture->points[1].state = (TouchPoint::State)points.at(1).state();
- if (points.at(1).state() == Qt::TouchPointPressed) {
- gesture->startPoints[1] = gesture->points[1];
- gesture->lastPoints[1] = gesture->points[1];
- }
- }
-
- if (points.size() == 2)
- return QGestureRecognizer::GestureStarted;
- if (points.size() > 2)
- return QGestureRecognizer::MaybeGesture;
- if (points.at(0).state() == Qt::TouchPointPressed)
- return QGestureRecognizer::MaybeGesture;
- if (points.at(0).state() == Qt::TouchPointReleased)
- return QGestureRecognizer::GestureFinished;
- return QGestureRecognizer::GestureStarted;
-}
-
-void PanGestureRecognizer::reset()
-{
- gesture->startPoints[0] = TouchPoint();
- gesture->startPoints[1] = TouchPoint();
- gesture->lastPoints[0] = TouchPoint();
- gesture->lastPoints[1] = TouchPoint();
- gesture->points[0] = TouchPoint();
- gesture->points[1] = TouchPoint();
- gesture->offset = QPoint();
-}
diff --git a/tests/auto/gestures/customgesturerecognizer.h b/tests/auto/gestures/customgesturerecognizer.h
deleted file mode 100644
index 2a24efb..0000000
--- a/tests/auto/gestures/customgesturerecognizer.h
+++ /dev/null
@@ -1,228 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** 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$
-**
-****************************************************************************/
-
-#ifndef CUSTOMGESTURERECOGNIZER_H
-#define CUSTOMGESTURERECOGNIZER_H
-
-#include "qgesturerecognizer.h"
-#include "qgesture.h"
-#include "qevent.h"
-
-class SingleshotEvent : public QEvent
-{
-public:
- static const int Type = QEvent::User + 1;
-
- QPoint point;
-
- explicit SingleshotEvent(int x = 0, int y = 0)
- : QEvent(QEvent::Type(Type)), point(x, y) { }
-};
-
-class SingleshotGesture : public QGesture
-{
- Q_OBJECT
-public:
- SingleshotGesture(QObject *parent, const QString &type)
- : QGesture(parent, type) { }
-
- QPoint offset;
-
-protected:
- void translate(const QPoint &pt)
- {
- offset += pt;
- }
-};
-
-class SingleshotGestureRecognizer : public QGestureRecognizer
-{
- Q_OBJECT
-public:
- static const char *Name;
-
- SingleshotGestureRecognizer(QObject *parent = 0);
-
- QGestureRecognizer::Result filterEvent(const QEvent *event);
- QGesture* getGesture() { return gesture; }
- void reset();
-
-private:
- SingleshotGesture *gesture;
-};
-
-struct TouchPoint {
- enum State
- {
- None = 0,
- Begin = Qt::TouchPointPressed,
- Update = Qt::TouchPointMoved,
- End = Qt::TouchPointReleased
- };
- int id;
- QPoint pt;
- State state;
- TouchPoint() : id(0), state(None) { }
- TouchPoint(int id_, int x_, int y_, State state_) : id(id_), pt(x_, y_), state(state_) { }
-};
-
-class TouchEvent : public QEvent
-{
-public:
- static const int Type = QEvent::User + 2;
-
- TouchEvent()
- : QEvent(QEvent::Type(Type))
- {
- }
-
- TouchPoint points[2];
-};
-
-class PinchGesture : public QGesture
-{
- Q_OBJECT
-public:
- PinchGesture(QObject *parent, const QString &type)
- : QGesture(parent, type) { }
-
- TouchPoint startPoints[2];
- TouchPoint lastPoints[2];
- TouchPoint points[2];
-
- QPoint offset;
-
-protected:
- void translate(const QPoint &pt)
- {
- offset += pt;
- }
-};
-
-class PinchGestureRecognizer : public QGestureRecognizer
-{
- Q_OBJECT
-public:
- static const char *Name;
-
- PinchGestureRecognizer(QObject *parent = 0);
-
- QGestureRecognizer::Result filterEvent(const QEvent *event);
- QGesture* getGesture() { return gesture; }
- void reset();
-
-private:
- PinchGesture *gesture;
-};
-
-class SecondFingerGesture : public QGesture
-{
- Q_OBJECT
-public:
- SecondFingerGesture(QObject *parent, const QString &type)
- : QGesture(parent, type) { }
-
- TouchPoint startPoint;
- TouchPoint lastPoint;
- TouchPoint point;
-
- QPoint offset;
-
-protected:
- void translate(const QPoint &pt)
- {
- offset += pt;
- }
-};
-
-class SecondFingerGestureRecognizer : public QGestureRecognizer
-{
- Q_OBJECT
-public:
- static const char *Name;
-
- SecondFingerGestureRecognizer(QObject *parent = 0);
-
- QGestureRecognizer::Result filterEvent(const QEvent *event);
- QGesture* getGesture() { return gesture; }
- void reset();
-
-private:
- SecondFingerGesture *gesture;
-};
-
-class PanGesture : public QGesture
-{
- Q_OBJECT
-public:
- PanGesture(QObject *parent, const QString &type)
- : QGesture(parent, type) { }
-
- TouchPoint startPoints[2];
- TouchPoint lastPoints[2];
- TouchPoint points[2];
-
- QPoint offset;
-
-protected:
- void translate(const QPoint &pt)
- {
- offset += pt;
- }
-};
-
-class PanGestureRecognizer : public QGestureRecognizer
-{
- Q_OBJECT
-public:
- static const char *Name;
-
- PanGestureRecognizer(QObject *parent = 0);
-
- QGestureRecognizer::Result filterEvent(const QEvent *event);
- QGesture* getGesture() { return gesture; }
- void reset();
-
-private:
- PanGesture *gesture;
-};
-
-#endif
diff --git a/tests/auto/gestures/gestures.pro b/tests/auto/gestures/gestures.pro
deleted file mode 100644
index ac99b19..0000000
--- a/tests/auto/gestures/gestures.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-load(qttest_p4)
-SOURCES += tst_gestures.cpp customgesturerecognizer.cpp
-HEADERS += customgesturerecognizer.h
diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp
deleted file mode 100644
index 85fd355..0000000
--- a/tests/auto/gestures/tst_gestures.cpp
+++ /dev/null
@@ -1,962 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** 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 <QtGui>
-
-#include <QtTest/QtTest>
-
-#include "customgesturerecognizer.h"
-
-//TESTED_CLASS=
-//TESTED_FILES=
-
-// color generator for syntax highlighting from QQ-26 by Helder Correia
-QVector<QColor> highlight(const QColor &bg, const
- QColor &fg, int noColors)
-{
- QVector<QColor> colors;
- const int HUE_BASE = (bg.hue() == -1) ? 90 : bg.hue();
- int h, s, v;
- for (int i = 0; i < noColors; i++) {
- h = int(HUE_BASE + (360.0 / noColors * i)) % 360;
- s = 240;
- v = int(qMax(bg.value(), fg.value()) * 0.85);
-
- const int M = 35;
- if ((h < bg.hue() + M && h > bg.hue() - M)
- || (h < fg.hue() + M && h > fg.hue() - M))
- {
- h = ((bg.hue() + fg.hue()) / (i+1)) % 360;
- s = ((bg.saturation() + fg.saturation() + 2*i)
- / 2) % 256;
- v = ((bg.value() + fg.value() + 2*i) / 2)
- % 256;
- }
- colors.append(QColor::fromHsv(h, s, v));
- }
- return colors;
-}
-
-
-// a hack to mark an event as spontaneous.
-class QETWidget
-{
-public:
- static void setSpont(QEvent *event, bool spont) { event->spont = spont; }
-};
-
-struct GestureState
-{
- int seenGestureEvent;
- struct LastGestureEvent
- {
- struct SingleshotGesture
- {
- bool delivered;
- QPoint offset;
- } singleshot;
- struct PinchGesture
- {
- bool delivered;
- TouchPoint startPoints[2];
- TouchPoint lastPoints[2];
- TouchPoint points[2];
- QPoint offset;
- } pinch;
- struct SecondFingerGesture
- {
- bool delivered;
- TouchPoint startPoint;
- TouchPoint lastPoint;
- TouchPoint point;
- QPoint offset;
- } secondfinger;
- struct PanGesture
- {
- bool delivered;
- TouchPoint startPoints[2];
- TouchPoint lastPoints[2];
- TouchPoint points[2];
- QPoint offset;
- } pan;
- QSet<QString> cancelled;
- } last;
-
- GestureState() { reset(); }
- void reset()
- {
- seenGestureEvent = 0;
- last.singleshot.delivered = false;
- last.singleshot.offset = QPoint();
- last.pinch.delivered = false;
- last.pinch.startPoints[0] = TouchPoint();
- last.pinch.startPoints[1] = TouchPoint();
- last.pinch.lastPoints[0] = TouchPoint();
- last.pinch.lastPoints[1] = TouchPoint();
- last.pinch.points[0] = TouchPoint();
- last.pinch.points[1] = TouchPoint();
- last.pinch.offset = QPoint();
- last.secondfinger.delivered = false;
- last.secondfinger.startPoint = TouchPoint();
- last.secondfinger.lastPoint = TouchPoint();
- last.secondfinger.point = TouchPoint();
- last.secondfinger.offset = QPoint();
- last.pan.delivered = false;
- last.pan.startPoints[0] = TouchPoint();
- last.pan.startPoints[1] = TouchPoint();
- last.pan.lastPoints[0] = TouchPoint();
- last.pan.lastPoints[1] = TouchPoint();
- last.pan.points[0] = TouchPoint();
- last.pan.points[1] = TouchPoint();
- last.cancelled.clear();
- }
-};
-
-struct TouchState
-{
- int seenTouchBeginEvent;
- int seenTouchUpdateEvent;
- int seenTouchEndEvent;
-
- TouchState() { reset(); }
- void reset()
- {
- seenTouchBeginEvent = seenTouchUpdateEvent = seenTouchEndEvent = 0;
- }
-};
-
-class GestureWidget : public QWidget
-{
- Q_OBJECT
- static QVector<QColor> colors;
- static int numberOfWidgets;
-
-public:
- enum Type { DoNotGrabGestures, GrabAllGestures, GrabSingleshot,
- GrabPinch, GrabSecondFinger, GrabPan };
-
- static const int LeftMargin = 10;
- static const int TopMargin = 20;
-
- GestureWidget(Type type = GrabAllGestures)
- {
- if (colors.isEmpty()) {
- colors = highlight(palette().color(QPalette::Window), palette().color(QPalette::Text), 5);
- }
- QPalette p = palette();
- p.setColor(QPalette::Window, colors[numberOfWidgets % colors.size()]);
- setPalette(p);
- setAutoFillBackground(true);
- ++numberOfWidgets;
-
- QVBoxLayout *l = new QVBoxLayout(this);
- l->setSpacing(0);
- l->setContentsMargins(LeftMargin, TopMargin, LeftMargin, TopMargin);
-
- singleshotGestureId = -1;
- pinchGestureId = -1;
- secondFingerGestureId = -1;
- panGestureId = -1;
- if (type == GrabAllGestures || type == GrabSingleshot) {
- singleshotGestureId = grabGesture(SingleshotGestureRecognizer::Name);
- }
- if (type == GrabAllGestures || type == GrabPinch) {
- pinchGestureId = grabGesture(PinchGestureRecognizer::Name);
- }
- if (type == GrabAllGestures || type == GrabSecondFinger) {
- secondFingerGestureId = grabGesture(SecondFingerGestureRecognizer::Name);
- }
- if (type == GrabAllGestures || type == GrabPan) {
- panGestureId = grabGesture(PanGestureRecognizer::Name);
- }
- reset();
- }
- ~GestureWidget()
- {
- --numberOfWidgets;
- ungrabGestures();
- }
-
- void grabSingleshotGesture()
- {
- singleshotGestureId = grabGesture(SingleshotGestureRecognizer::Name);
- }
- void grabPinchGesture()
- {
- pinchGestureId = grabGesture(PinchGestureRecognizer::Name);
- }
- void grabSecondFingerGesture()
- {
- secondFingerGestureId = grabGesture(SecondFingerGestureRecognizer::Name);
- }
- void grabPanGesture()
- {
- panGestureId = grabGesture(PanGestureRecognizer::Name);
- }
- void ungrabGestures()
- {
- releaseGesture(singleshotGestureId);
- singleshotGestureId = -1;
- releaseGesture(pinchGestureId);
- pinchGestureId = -1;
- releaseGesture(secondFingerGestureId);
- secondFingerGestureId = -1;
- releaseGesture(panGestureId);
- panGestureId = -1;
- }
-
- int singleshotGestureId;
- int pinchGestureId;
- int secondFingerGestureId;
- int panGestureId;
-
- bool shouldAcceptSingleshotGesture;
- bool shouldAcceptPinchGesture;
- bool shouldAcceptSecondFingerGesture;
- bool shouldAcceptPanGesture;
-
- GestureState gesture;
- TouchState touch;
-
- void reset()
- {
- shouldAcceptSingleshotGesture = true;
- shouldAcceptPinchGesture = true;
- shouldAcceptSecondFingerGesture = true;
- shouldAcceptPanGesture = true;
- gesture.reset();
- touch.reset();
- }
-protected:
- bool event(QEvent *event)
- {
- if (event->type() == QEvent::TouchBegin) {
- event->accept();
- ++touch.seenTouchBeginEvent;
- return true;
- } else if (event->type() == QEvent::TouchUpdate) {
- ++touch.seenTouchUpdateEvent;
- } else if (event->type() == QEvent::TouchEnd) {
- ++touch.seenTouchEndEvent;
- } else if (event->type() == QEvent::Gesture) {
- QGestureEvent *e = static_cast<QGestureEvent*>(event);
- ++gesture.seenGestureEvent;
- if (SingleshotGesture *g = (SingleshotGesture*)e->gesture(SingleshotGestureRecognizer::Name)) {
- gesture.last.singleshot.delivered = true;
- gesture.last.singleshot.offset = g->offset;
- if (shouldAcceptSingleshotGesture)
- g->accept();
- }
- if (PinchGesture *g = (PinchGesture*)e->gesture(PinchGestureRecognizer::Name)) {
- gesture.last.pinch.delivered = true;
- gesture.last.pinch.startPoints[0] = g->startPoints[0];
- gesture.last.pinch.startPoints[1] = g->startPoints[1];
- gesture.last.pinch.lastPoints[0] = g->lastPoints[0];
- gesture.last.pinch.lastPoints[1] = g->lastPoints[1];
- gesture.last.pinch.points[0] = g->points[0];
- gesture.last.pinch.points[1] = g->points[1];
- gesture.last.pinch.offset = g->offset;
- if (shouldAcceptPinchGesture)
- g->accept();
- }
- if (SecondFingerGesture *g = (SecondFingerGesture*)e->gesture(SecondFingerGestureRecognizer::Name)) {
- gesture.last.secondfinger.delivered = true;
- gesture.last.secondfinger.startPoint = g->startPoint;
- gesture.last.secondfinger.lastPoint = g->lastPoint;
- gesture.last.secondfinger.point = g->point;
- gesture.last.secondfinger.offset = g->offset;
- if (shouldAcceptSecondFingerGesture)
- g->accept();
- }
- if (PanGesture *g = (PanGesture*)e->gesture(PanGestureRecognizer::Name)) {
- gesture.last.pan.delivered = true;
- gesture.last.pan.startPoints[0] = g->startPoints[0];
- gesture.last.pan.startPoints[1] = g->startPoints[1];
- gesture.last.pan.lastPoints[0] = g->lastPoints[0];
- gesture.last.pan.lastPoints[1] = g->lastPoints[1];
- gesture.last.pan.points[0] = g->points[0];
- gesture.last.pan.points[1] = g->points[1];
- gesture.last.pan.offset = g->offset;
- if (shouldAcceptPanGesture)
- g->accept();
- }
- gesture.last.cancelled = e->cancelledGestures();
- return true;
- }
- return QWidget::event(event);
- }
-};
-QVector<QColor> GestureWidget::colors;
-int GestureWidget::numberOfWidgets = 0;
-
-class GraphicsScene : public QGraphicsScene
-{
-public:
- GraphicsScene()
- {
- reset();
- }
- bool shouldAcceptSingleshotGesture;
- bool shouldAcceptPinchGesture;
- bool shouldAcceptSecondFingerGesture;
- GestureState gesture;
-
- void reset()
- {
- shouldAcceptSingleshotGesture = false;
- shouldAcceptPinchGesture = false;
- shouldAcceptSecondFingerGesture = false;
- gesture.reset();
- }
-protected:
- bool event(QEvent *event)
- {
- if (event->type() == QEvent::GraphicsSceneGesture) {
- QGraphicsSceneGestureEvent *e = static_cast<QGraphicsSceneGestureEvent*>(event);
- ++gesture.seenGestureEvent;
- QGraphicsScene::event(event);
- if (SingleshotGesture *g = (SingleshotGesture*)e->gesture(SingleshotGestureRecognizer::Name)) {
- gesture.last.singleshot.delivered = true;
- gesture.last.singleshot.offset = g->offset;
- if (shouldAcceptSingleshotGesture)
- g->accept();
- }
- if (PinchGesture *g = (PinchGesture*)e->gesture(PinchGestureRecognizer::Name)) {
- gesture.last.pinch.delivered = true;
- gesture.last.pinch.startPoints[0] = g->startPoints[0];
- gesture.last.pinch.startPoints[1] = g->startPoints[1];
- gesture.last.pinch.lastPoints[0] = g->lastPoints[0];
- gesture.last.pinch.lastPoints[1] = g->lastPoints[1];
- gesture.last.pinch.points[0] = g->points[0];
- gesture.last.pinch.points[1] = g->points[1];
- gesture.last.pinch.offset = g->offset;
- if (shouldAcceptPinchGesture)
- g->accept();
- }
- if (SecondFingerGesture *g = (SecondFingerGesture*)e->gesture(SecondFingerGestureRecognizer::Name)) {
- gesture.last.secondfinger.delivered = true;
- gesture.last.secondfinger.startPoint = g->startPoint;
- gesture.last.secondfinger.lastPoint = g->lastPoint;
- gesture.last.secondfinger.point = g->point;
- gesture.last.secondfinger.offset = g->offset;
- if (shouldAcceptSecondFingerGesture)
- g->accept();
- }
- gesture.last.cancelled = e->cancelledGestures();
- return true;
- }
- return QGraphicsScene::event(event);
- }
-};
-
-class GraphicsItem : public QGraphicsItem
-{
-public:
- GraphicsItem(int w = 100, int h = 100)
- : width(w), height(h)
- {
- reset();
- }
-
- QRectF boundingRect() const
- {
- return QRectF(0, 0, width, height);
- }
-
- void paint(QPainter *painter, const QStyleOptionGraphicsItem*, QWidget*)
- {
- painter->setBrush(Qt::green);
- painter->drawRect(0, 0, width, height);
- }
-
- void grabSingleshotGesture()
- {
- singleshotGestureId = grabGesture(SingleshotGestureRecognizer::Name);
- }
- void grabPinchGesture()
- {
- pinchGestureId = grabGesture(PinchGestureRecognizer::Name);
- }
- void grabSecondFingerGesture()
- {
- secondFingerGestureId = grabGesture(SecondFingerGestureRecognizer::Name);
- }
- void ungrabGestures()
- {
- releaseGesture(singleshotGestureId);
- singleshotGestureId = -1;
- releaseGesture(pinchGestureId);
- pinchGestureId = -1;
- releaseGesture(secondFingerGestureId);
- secondFingerGestureId = -1;
- }
-
- int width;
- int height;
-
- int singleshotGestureId;
- int pinchGestureId;
- int secondFingerGestureId;
-
- bool shouldAcceptSingleshotGesture;
- bool shouldAcceptPinchGesture;
- bool shouldAcceptSecondFingerGesture;
- GestureState gesture;
-
- TouchState touch;
-
- void reset()
- {
- shouldAcceptSingleshotGesture = true;
- shouldAcceptPinchGesture = true;
- shouldAcceptSecondFingerGesture = true;
- gesture.reset();
- }
-protected:
- bool sceneEvent(QEvent *event)
- {
- if (event->type() == QEvent::TouchBegin) {
- event->accept();
- ++touch.seenTouchBeginEvent;
- return true;
- } else if (event->type() == QEvent::TouchUpdate) {
- ++touch.seenTouchUpdateEvent;
- } else if (event->type() == QEvent::TouchEnd) {
- ++touch.seenTouchEndEvent;
- } else if (event->type() == QEvent::GraphicsSceneGesture) {
- QGraphicsSceneGestureEvent *e = static_cast<QGraphicsSceneGestureEvent*>(event);
- ++gesture.seenGestureEvent;
- if (SingleshotGesture *g = (SingleshotGesture*)e->gesture(SingleshotGestureRecognizer::Name)) {
- gesture.last.singleshot.delivered = true;
- gesture.last.singleshot.offset = g->offset;
- if (shouldAcceptSingleshotGesture)
- g->accept();
- }
- if (PinchGesture *g = (PinchGesture*)e->gesture(PinchGestureRecognizer::Name)) {
- gesture.last.pinch.delivered = true;
- gesture.last.pinch.startPoints[0] = g->startPoints[0];
- gesture.last.pinch.startPoints[1] = g->startPoints[1];
- gesture.last.pinch.lastPoints[0] = g->lastPoints[0];
- gesture.last.pinch.lastPoints[1] = g->lastPoints[1];
- gesture.last.pinch.points[0] = g->points[0];
- gesture.last.pinch.points[1] = g->points[1];
- gesture.last.pinch.offset = g->offset;
- if (shouldAcceptPinchGesture)
- g->accept();
- }
- if (SecondFingerGesture *g = (SecondFingerGesture*)e->gesture(SecondFingerGestureRecognizer::Name)) {
- gesture.last.secondfinger.delivered = true;
- gesture.last.secondfinger.startPoint = g->startPoint;
- gesture.last.secondfinger.lastPoint = g->lastPoint;
- gesture.last.secondfinger.point = g->point;
- gesture.last.secondfinger.offset = g->offset;
- if (shouldAcceptSecondFingerGesture)
- g->accept();
- }
- gesture.last.cancelled = e->cancelledGestures();
- return true;
- }
- return QGraphicsItem::sceneEvent(event);
- }
-};
-
-class tst_Gestures : public QObject
-{
- Q_OBJECT
-
-public:
- tst_Gestures();
- virtual ~tst_Gestures();
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-
-private slots:
- void singleshotGesture();
- void pinchGesture();
-
- void simplePropagation();
- void simplePropagation2();
- void acceptedGesturePropagation();
-
- void simpleGraphicsView();
- void simpleGraphicsItem();
- void overlappingGraphicsItems();
-
- void touch_widget();
- void touch_graphicsView();
-
- void panOnWidgets();
-
-private:
- SingleshotGestureRecognizer *singleshotRecognizer;
- PinchGestureRecognizer *pinchRecognizer;
- SecondFingerGestureRecognizer *secondFingerRecognizer;
- PanGestureRecognizer *panGestureRecognizer;
- GestureWidget *mainWidget;
-
- void sendPinchEvents(QWidget *receiver, const QPoint &fromFinger1, const QPoint &fromFinger2);
-};
-
-tst_Gestures::tst_Gestures()
-{
- singleshotRecognizer = new SingleshotGestureRecognizer;
- pinchRecognizer = new PinchGestureRecognizer;
- secondFingerRecognizer = new SecondFingerGestureRecognizer;
- panGestureRecognizer = new PanGestureRecognizer;
- qApp->addGestureRecognizer(singleshotRecognizer);
- qApp->addGestureRecognizer(pinchRecognizer);
- qApp->addGestureRecognizer(secondFingerRecognizer);
- qApp->addGestureRecognizer(panGestureRecognizer);
-}
-
-tst_Gestures::~tst_Gestures()
-{
-}
-
-
-void tst_Gestures::initTestCase()
-{
- mainWidget = new GestureWidget(GestureWidget::DoNotGrabGestures);
- mainWidget->setObjectName("MainGestureWidget");
- mainWidget->resize(500, 600);
- mainWidget->show();
-}
-
-void tst_Gestures::cleanupTestCase()
-{
- delete mainWidget; mainWidget = 0;
-}
-
-void tst_Gestures::init()
-{
- // TODO: Add initialization code here.
- // This will be executed immediately before each test is run.
- mainWidget->reset();
-}
-
-void tst_Gestures::cleanup()
-{
-}
-
-bool sendSpontaneousEvent(QWidget *receiver, QEvent *event)
-{
- QETWidget::setSpont(event, true);
- return qApp->notify(receiver, event);
-}
-
-void tst_Gestures::singleshotGesture()
-{
- mainWidget->grabSingleshotGesture();
- SingleshotEvent event;
- sendSpontaneousEvent(mainWidget, &event);
- QVERIFY(mainWidget->gesture.seenGestureEvent);
- QVERIFY(mainWidget->gesture.last.singleshot.delivered);
- QVERIFY(mainWidget->gesture.last.cancelled.isEmpty());
-}
-
-void tst_Gestures::sendPinchEvents(QWidget *receiver, const QPoint &fromFinger1, const QPoint &fromFinger2)
-{
- int x1 = fromFinger1.x();
- int y1 = fromFinger1.x();
- int x2 = fromFinger2.x();
- int y2 = fromFinger2.x();
-
- TouchEvent event;
- event.points[0] = TouchPoint(0,x1,y1, TouchPoint::Begin);
- event.points[1] = TouchPoint();
- sendSpontaneousEvent(receiver, &event);
- event.points[0] = TouchPoint(0, x1+=2,y1+=2, TouchPoint::Update);
- event.points[1] = TouchPoint();
- sendSpontaneousEvent(receiver, &event);
- event.points[0] = TouchPoint(0, x1,y1, TouchPoint::Update);
- event.points[1] = TouchPoint(1, x2,y2, TouchPoint::Begin);
- sendSpontaneousEvent(receiver, &event);
- event.points[0] = TouchPoint(0, x1+=5,y1+=10, TouchPoint::End);
- event.points[1] = TouchPoint(1, x2+=3,y2+=6, TouchPoint::Update);
- sendSpontaneousEvent(receiver, &event);
- event.points[0] = TouchPoint();
- event.points[1] = TouchPoint(1, x2+=10,y2+=15, TouchPoint::Update);
- sendSpontaneousEvent(receiver, &event);
- event.points[0] = TouchPoint();
- event.points[1] = TouchPoint(1, x2,y2, TouchPoint::End);
- sendSpontaneousEvent(receiver, &event);
-}
-
-void tst_Gestures::pinchGesture()
-{
- mainWidget->grabPinchGesture();
- sendPinchEvents(mainWidget, QPoint(10,10), QPoint(20,20));
-
- QVERIFY(mainWidget->gesture.seenGestureEvent);
- QVERIFY(!mainWidget->gesture.last.singleshot.delivered);
- QVERIFY(mainWidget->gesture.last.cancelled.isEmpty());
- QVERIFY(mainWidget->gesture.last.pinch.delivered);
- QCOMPARE(mainWidget->gesture.last.pinch.startPoints[0].pt, QPoint(10,10));
- QCOMPARE(mainWidget->gesture.last.pinch.startPoints[1].pt, QPoint(20,20));
- QCOMPARE(mainWidget->gesture.last.pinch.offset, QPoint(0,0));
-}
-
-void tst_Gestures::simplePropagation()
-{
- mainWidget->grabSingleshotGesture();
- GestureWidget offsetWidget(GestureWidget::DoNotGrabGestures);
- offsetWidget.setFixedSize(30, 30);
- mainWidget->layout()->addWidget(&offsetWidget);
- GestureWidget nonGestureWidget(GestureWidget::DoNotGrabGestures);
- mainWidget->layout()->addWidget(&nonGestureWidget);
- QApplication::processEvents();
-
- SingleshotEvent event;
- sendSpontaneousEvent(&nonGestureWidget, &event);
- QVERIFY(!offsetWidget.gesture.seenGestureEvent);
- QVERIFY(!nonGestureWidget.gesture.seenGestureEvent);
- QVERIFY(mainWidget->gesture.seenGestureEvent);
- QVERIFY(mainWidget->gesture.last.cancelled.isEmpty());
- QVERIFY(mainWidget->gesture.last.singleshot.delivered);
- QCOMPARE(mainWidget->gesture.last.singleshot.offset, QPoint(GestureWidget::LeftMargin, 30 + GestureWidget::TopMargin));
-}
-
-void tst_Gestures::simplePropagation2()
-{
- mainWidget->grabSingleshotGesture();
- mainWidget->grabPinchGesture();
- GestureWidget nonGestureMiddleWidget(GestureWidget::DoNotGrabGestures);
- GestureWidget secondGestureWidget(GestureWidget::GrabPinch);
- nonGestureMiddleWidget.layout()->addWidget(&secondGestureWidget);
- mainWidget->layout()->addWidget(&nonGestureMiddleWidget);
- QApplication::processEvents();
-
- SingleshotEvent event;
- sendSpontaneousEvent(&secondGestureWidget, &event);
- QVERIFY(!secondGestureWidget.gesture.seenGestureEvent);
- QVERIFY(!nonGestureMiddleWidget.gesture.seenGestureEvent);
- QVERIFY(mainWidget->gesture.seenGestureEvent);
- QVERIFY(mainWidget->gesture.last.singleshot.delivered);
- QVERIFY(mainWidget->gesture.last.cancelled.isEmpty());
- QCOMPARE(mainWidget->gesture.last.singleshot.offset, QPoint(GestureWidget::LeftMargin*2,GestureWidget::TopMargin*2));
-
- mainWidget->reset();
- nonGestureMiddleWidget.reset();
- secondGestureWidget.reset();
-
- sendPinchEvents(&secondGestureWidget, QPoint(10,10), QPoint(20,20));
- QVERIFY(secondGestureWidget.gesture.seenGestureEvent);
- QVERIFY(!secondGestureWidget.gesture.last.singleshot.delivered);
- QVERIFY(secondGestureWidget.gesture.last.pinch.delivered);
- QCOMPARE(secondGestureWidget.gesture.last.pinch.startPoints[0].pt, QPoint(10,10));
- QCOMPARE(secondGestureWidget.gesture.last.pinch.startPoints[1].pt, QPoint(20,20));
- QCOMPARE(secondGestureWidget.gesture.last.pinch.offset, QPoint(0,0));
- QVERIFY(!nonGestureMiddleWidget.gesture.seenGestureEvent);
- QVERIFY(!mainWidget->gesture.seenGestureEvent);
-}
-
-void tst_Gestures::acceptedGesturePropagation()
-{
- mainWidget->grabSingleshotGesture();
- mainWidget->grabPinchGesture();
- mainWidget->grabSecondFingerGesture();
- GestureWidget nonGestureMiddleWidget(GestureWidget::DoNotGrabGestures);
- nonGestureMiddleWidget.setObjectName("nonGestureMiddleWidget");
- GestureWidget secondGestureWidget(GestureWidget::GrabSecondFinger);
- secondGestureWidget.setObjectName("secondGestureWidget");
- nonGestureMiddleWidget.layout()->addWidget(&secondGestureWidget);
- mainWidget->layout()->addWidget(&nonGestureMiddleWidget);
- QApplication::processEvents();
-
- sendPinchEvents(&secondGestureWidget, QPoint(10, 10), QPoint(40, 40));
- QVERIFY(secondGestureWidget.gesture.seenGestureEvent);
- QVERIFY(!secondGestureWidget.gesture.last.singleshot.delivered);
- QVERIFY(!secondGestureWidget.gesture.last.pinch.delivered);
- QVERIFY(secondGestureWidget.gesture.last.secondfinger.delivered);
- QCOMPARE(secondGestureWidget.gesture.last.secondfinger.startPoint.pt, QPoint(40,40));
- QVERIFY(!nonGestureMiddleWidget.gesture.seenGestureEvent);
- QVERIFY(mainWidget->gesture.seenGestureEvent);
- QVERIFY(!mainWidget->gesture.last.singleshot.delivered);
- QVERIFY(!mainWidget->gesture.last.secondfinger.delivered);
- QVERIFY(mainWidget->gesture.last.pinch.delivered);
- QCOMPARE(mainWidget->gesture.last.pinch.startPoints[0].pt, QPoint(10,10));
- QCOMPARE(mainWidget->gesture.last.pinch.startPoints[1].pt, QPoint(40,40));
-
- mainWidget->reset();
- nonGestureMiddleWidget.reset();
- secondGestureWidget.reset();
-
- // don't accept it and make sure it propagates to parent
- secondGestureWidget.shouldAcceptSecondFingerGesture = false;
- sendPinchEvents(&secondGestureWidget, QPoint(10, 10), QPoint(40, 40));
- QVERIFY(secondGestureWidget.gesture.seenGestureEvent);
- QVERIFY(secondGestureWidget.gesture.last.secondfinger.delivered);
- QVERIFY(!nonGestureMiddleWidget.gesture.seenGestureEvent);
- QVERIFY(mainWidget->gesture.seenGestureEvent);
- QVERIFY(!mainWidget->gesture.last.singleshot.delivered);
- QVERIFY(mainWidget->gesture.last.secondfinger.delivered);
- QVERIFY(mainWidget->gesture.last.pinch.delivered);
-}
-
-void tst_Gestures::simpleGraphicsView()
-{
- mainWidget->grabSingleshotGesture();
- GraphicsScene scene;
- QGraphicsView view(&scene);
- view.grabGesture(SingleshotGestureRecognizer::Name);
- mainWidget->layout()->addWidget(&view);
- QApplication::processEvents();
-
- scene.shouldAcceptSingleshotGesture = true;
-
- SingleshotEvent event;
- sendSpontaneousEvent(&view, &event);
- QVERIFY(!mainWidget->gesture.seenGestureEvent);
- QVERIFY(scene.gesture.seenGestureEvent);
- QVERIFY(scene.gesture.last.singleshot.delivered);
- QVERIFY(scene.gesture.last.cancelled.isEmpty());
-}
-
-void tst_Gestures::simpleGraphicsItem()
-{
- mainWidget->grabSingleshotGesture();
- GraphicsScene scene;
- QGraphicsView view(&scene);
- mainWidget->layout()->addWidget(&view);
- GraphicsItem *item = new GraphicsItem;
- item->grabSingleshotGesture();
- item->setPos(30, 50);
- scene.addItem(item);
- QApplication::processEvents();
-
- QPoint pt = view.mapFromScene(item->mapToScene(30, 30));
- SingleshotEvent event(pt.x(), pt.y());
- sendSpontaneousEvent(&view, &event);
- QVERIFY(item->gesture.seenGestureEvent);
- QVERIFY(scene.gesture.seenGestureEvent);
- QVERIFY(!mainWidget->gesture.seenGestureEvent);
-
- item->reset();
- scene.reset();
- mainWidget->reset();
-
- item->shouldAcceptSingleshotGesture = false;
- // outside of the graphicsitem
- pt = view.mapFromScene(item->mapToScene(-10, -10));
- SingleshotEvent event2(pt.x(), pt.y());
- sendSpontaneousEvent(&view, &event2);
- QVERIFY(!item->gesture.seenGestureEvent);
- QVERIFY(scene.gesture.seenGestureEvent);
- QVERIFY(mainWidget->gesture.seenGestureEvent);
-}
-
-void tst_Gestures::overlappingGraphicsItems()
-{
- mainWidget->grabSingleshotGesture();
- GraphicsScene scene;
- QGraphicsView view(&scene);
- mainWidget->layout()->addWidget(&view);
-
- GraphicsItem *item = new GraphicsItem(300, 100);
- item->setPos(30, 50);
- scene.addItem(item);
- GraphicsItem *subitem1 = new GraphicsItem(50, 70);
- subitem1->setPos(70, 70);
- subitem1->setZValue(1);
- scene.addItem(subitem1);
- GraphicsItem *subitem2 = new GraphicsItem(50, 70);
- subitem2->setPos(250, 70);
- subitem2->setZValue(1);
- scene.addItem(subitem2);
- QApplication::processEvents();
-
- item->grabSingleshotGesture();
- item->grabPinchGesture();
- item->grabSecondFingerGesture();
- subitem1->grabSingleshotGesture();
- subitem2->grabSecondFingerGesture();
-
- QPoint pt = view.mapFromScene(subitem1->mapToScene(20, 20));
- SingleshotEvent event(pt.x(), pt.y());
- sendSpontaneousEvent(&view, &event);
- QVERIFY(scene.gesture.seenGestureEvent);
- QVERIFY(!subitem2->gesture.seenGestureEvent);
- QVERIFY(!item->gesture.seenGestureEvent);
- QVERIFY(!mainWidget->gesture.seenGestureEvent);
- QVERIFY(subitem1->gesture.seenGestureEvent);
- QVERIFY(subitem1->gesture.last.singleshot.delivered);
-
- item->reset();
- subitem1->reset();
- subitem2->reset();
- scene.reset();
- mainWidget->reset();
-
- subitem1->shouldAcceptSingleshotGesture = false;
- SingleshotEvent event2(pt.x(), pt.y());
- sendSpontaneousEvent(&view, &event2);
- QVERIFY(scene.gesture.seenGestureEvent);
- QVERIFY(!subitem2->gesture.seenGestureEvent);
- QVERIFY(subitem1->gesture.seenGestureEvent);
- QVERIFY(item->gesture.seenGestureEvent);
- QVERIFY(!mainWidget->gesture.seenGestureEvent);
- QVERIFY(subitem1->gesture.last.singleshot.delivered);
- QVERIFY(item->gesture.last.singleshot.delivered);
-}
-
-void tst_Gestures::touch_widget()
-{
- GestureWidget leftWidget(GestureWidget::DoNotGrabGestures);
- leftWidget.setObjectName("leftWidget");
- leftWidget.setAttribute(Qt::WA_AcceptTouchEvents);
- GestureWidget rightWidget(GestureWidget::DoNotGrabGestures);
- rightWidget.setObjectName("rightWidget");
- rightWidget.setAttribute(Qt::WA_AcceptTouchEvents);
- delete mainWidget->layout();
- (void)new QHBoxLayout(mainWidget);
- mainWidget->layout()->addWidget(&leftWidget);
- mainWidget->layout()->addWidget(&rightWidget);
- QApplication::processEvents();
-
- QTest::touchEvent()
- .press(0, QPoint(10, 10), &leftWidget);
- QTest::touchEvent()
- .move(0, QPoint(12, 30), &leftWidget);
- QTest::touchEvent()
- .stationary(0)
- .press(1, QPoint(15, 15), &rightWidget);
- QTest::touchEvent()
- .move(0, QPoint(10, 35), &leftWidget)
- .press(1, QPoint(15, 15), &rightWidget);
- QTest::touchEvent()
- .move(0, QPoint(10, 40), &leftWidget)
- .move(1, QPoint(20, 50), &rightWidget);
- QTest::touchEvent()
- .release(0, QPoint(10, 40), &leftWidget)
- .release(1, QPoint(20, 50), &rightWidget);
- QVERIFY(!mainWidget->touch.seenTouchBeginEvent);
- QVERIFY(leftWidget.touch.seenTouchBeginEvent);
- QVERIFY(leftWidget.touch.seenTouchUpdateEvent);
- QVERIFY(leftWidget.touch.seenTouchEndEvent);
- QVERIFY(rightWidget.touch.seenTouchBeginEvent);
- QVERIFY(rightWidget.touch.seenTouchUpdateEvent);
- QVERIFY(rightWidget.touch.seenTouchEndEvent);
-}
-
-void tst_Gestures::touch_graphicsView()
-{
- mainWidget->setAttribute(Qt::WA_AcceptTouchEvents);
- GraphicsScene scene;
- QGraphicsView view(&scene);
- view.viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
- mainWidget->layout()->addWidget(&view);
-
- GraphicsItem *item = new GraphicsItem(300, 100);
- item->setAcceptTouchEvents(true);
- item->setPos(30, 50);
- scene.addItem(item);
- GraphicsItem *subitem1 = new GraphicsItem(50, 70);
- subitem1->setAcceptTouchEvents(true);
- subitem1->setPos(70, 70);
- scene.addItem(subitem1);
- GraphicsItem *subitem2 = new GraphicsItem(50, 70);
- subitem2->setAcceptTouchEvents(true);
- subitem2->setPos(250, 70);
- scene.addItem(subitem2);
- QApplication::processEvents();
-
- QRect itemRect = view.mapFromScene(item->mapRectToScene(item->boundingRect())).boundingRect();
- QPoint pt = itemRect.center();
- QTest::touchEvent(view.viewport())
- .press(0, pt)
- .press(1, pt);
- QTest::touchEvent(view.viewport())
- .move(0, pt + QPoint(20, 30))
- .move(1, QPoint(300, 300));
- QTest::touchEvent(view.viewport())
- .stationary(0)
- .move(1, QPoint(330, 330));
- QTest::touchEvent(view.viewport())
- .release(0, QPoint(120, 120))
- .release(1, QPoint(300, 300));
-
- QVERIFY(item->touch.seenTouchBeginEvent);
- QVERIFY(item->touch.seenTouchUpdateEvent);
- QVERIFY(item->touch.seenTouchEndEvent);
-}
-
-void tst_Gestures::panOnWidgets()
-{
- GestureWidget leftWidget(GestureWidget::GrabPan);
- leftWidget.setObjectName("leftWidget");
- leftWidget.setAttribute(Qt::WA_AcceptTouchEvents);
- GestureWidget rightWidget(GestureWidget::GrabPan);
- rightWidget.setObjectName("rightWidget");
- rightWidget.setAttribute(Qt::WA_AcceptTouchEvents);
- delete mainWidget->layout();
- (void)new QHBoxLayout(mainWidget);
- mainWidget->layout()->addWidget(&leftWidget);
- mainWidget->layout()->addWidget(&rightWidget);
- QApplication::processEvents();
-
- QTest::touchEvent()
- .press(0, QPoint(10, 10), &leftWidget);
- QTest::touchEvent()
- .move(0, QPoint(12, 30), &leftWidget);
- QTest::touchEvent()
- .stationary(0)
- .press(1, QPoint(15, 15), &rightWidget);
- QTest::touchEvent()
- .move(0, QPoint(10, 35), &leftWidget)
- .press(1, QPoint(15, 15), &rightWidget);
- QTest::touchEvent()
- .move(0, QPoint(10, 40), &leftWidget)
- .move(1, QPoint(20, 50), &rightWidget);
- QTest::touchEvent()
- .release(0, QPoint(10, 40), &leftWidget)
- .release(1, QPoint(20, 50), &rightWidget);
-
- QVERIFY(leftWidget.gesture.last.pan.delivered);
- QVERIFY(rightWidget.gesture.last.pan.delivered);
-}
-
-QTEST_MAIN(tst_Gestures)
-#include "tst_gestures.moc"
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp
index eb4a09b..e6668a9 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore module 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$
+**
+****************************************************************************/
+
// IMPORTANT!!!! If you want to add testdata to this file,
// always add it to the end in order to not change the linenumbers of translations!!!
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main2.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main2.cpp
index 1c72ac2..61029b3 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main2.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main2.cpp
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore module 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$
+**
+****************************************************************************/
+
// IMPORTANT!!!! If you want to add testdata to this file,
// always add it to the end in order to not change the linenumbers of translations!!!
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main3.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main3.cpp
index 731d5cdf..6a80349 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main3.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main3.cpp
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore module 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$
+**
+****************************************************************************/
+
// IMPORTANT!!!! If you want to add testdata to this file,
// always add it to the end in order to not change the linenumbers of translations!!!
diff --git a/tests/auto/mediaobject/dummy/dummy.pro b/tests/auto/mediaobject/dummy/dummy.pro
index b4f6109..9febde7 100644
--- a/tests/auto/mediaobject/dummy/dummy.pro
+++ b/tests/auto/mediaobject/dummy/dummy.pro
@@ -1,7 +1,7 @@
TEMPLATE = lib
isEmpty(QT_MAJOR_VERSION) {
- VERSION=4.5.2
+ VERSION=4.6.0
} else {
VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
}
diff --git a/tests/auto/qabstractitemmodel/dynamictreemodel.cpp b/tests/auto/qabstractitemmodel/dynamictreemodel.cpp
index 6425dcd..dd0615d 100644
--- a/tests/auto/qabstractitemmodel/dynamictreemodel.cpp
+++ b/tests/auto/qabstractitemmodel/dynamictreemodel.cpp
@@ -41,13 +41,10 @@
#include "dynamictreemodel.h"
-#include <QHash>
-#include <QList>
-#include <QTimer>
+#include <QtCore/QHash>
+#include <QtCore/QList>
+#include <QtCore/QTimer>
-#include <QDebug>
-
-#include <kdebug.h>
DynamicTreeModel::DynamicTreeModel(QObject *parent)
: QAbstractItemModel(parent),
diff --git a/tests/auto/qabstractitemmodel/dynamictreemodel.h b/tests/auto/qabstractitemmodel/dynamictreemodel.h
index d84bf68..a769c38 100644
--- a/tests/auto/qabstractitemmodel/dynamictreemodel.h
+++ b/tests/auto/qabstractitemmodel/dynamictreemodel.h
@@ -42,14 +42,11 @@
#ifndef DYNAMICTREEMODEL_H
#define DYNAMICTREEMODEL_H
-#include <QAbstractItemModel>
+#include <QtCore/QAbstractItemModel>
-#include <QHash>
-#include <QList>
+#include <QtCore/QHash>
+#include <QtCore/QList>
-#include <QDebug>
-
-#include <kdebug.h>
template<typename T> class QList;
diff --git a/tests/auto/qabstractitemmodel/qabstractitemmodel.pro b/tests/auto/qabstractitemmodel/qabstractitemmodel.pro
index 84ed5a2..a31868b 100644
--- a/tests/auto/qabstractitemmodel/qabstractitemmodel.pro
+++ b/tests/auto/qabstractitemmodel/qabstractitemmodel.pro
@@ -2,5 +2,5 @@ load(qttest_p4)
SOURCES += tst_qabstractitemmodel.cpp dynamictreemodel.cpp
HEADERS += dynamictreemodel.h
-QT = core
+
diff --git a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp
index da65e7d..58832c7 100644
--- a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp
+++ b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp
@@ -43,7 +43,7 @@
#include <QtTest/QtTest>
#include <QtCore/QtCore>
-#include <QSortFilterProxyModel>
+#include <QtGui/QSortFilterProxyModel>
//TESTED_CLASS=QAbstractListModel QAbstractTableModel
//TESTED_FILES=
diff --git a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
index fa36845..19fa502 100644
--- a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
+++ b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
@@ -69,6 +69,8 @@ private slots:
void cacheControl_data();
void cacheControl();
+ void deleteCache();
+
private:
void check();
};
@@ -84,8 +86,8 @@ public:
#ifdef Q_OS_SYMBIAN
QString location = QLatin1String("./cache/");
#else
- QString location = QDesktopServices::storageLocation(QDesktopServices::DataLocation)
- + QLatin1String("/cache/");
+ QString location = QDesktopServices::storageLocation(QDesktopServices::CacheLocation)
+ + QLatin1String("/qnetworkdiskcache/");
#endif
setCacheDirectory(location);
clear();
@@ -275,6 +277,20 @@ void tst_QAbstractNetworkCache::check()
QCOMPARE(diskCache->gotData, fetchFromCache);
}
+void tst_QAbstractNetworkCache::deleteCache()
+{
+ QNetworkAccessManager manager;
+ NetworkDiskCache *diskCache = new NetworkDiskCache(&manager);
+ manager.setCache(diskCache);
+
+ QString url = "httpcachetest_cachecontrol.cgi?max-age=1000";
+ QNetworkRequest request(QUrl(TESTFILE + url));
+ QNetworkReply *reply = manager.get(request);
+ QSignalSpy downloaded1(reply, SIGNAL(finished()));
+ manager.setCache(0);
+ QTRY_COMPARE(downloaded1.count(), 1);
+}
+
QTEST_MAIN(tst_QAbstractNetworkCache)
#include "tst_qabstractnetworkcache.moc"
diff --git a/tests/auto/qatomicint/tst_qatomicint.cpp b/tests/auto/qatomicint/tst_qatomicint.cpp
index c3ea31d..5fde633 100644
--- a/tests/auto/qatomicint/tst_qatomicint.cpp
+++ b/tests/auto/qatomicint/tst_qatomicint.cpp
@@ -59,6 +59,8 @@ public:
~tst_QAtomicInt();
private slots:
+ void warningFree();
+
// QAtomicInt members
void constructor_data();
void constructor();
@@ -101,6 +103,9 @@ private slots:
void testAndSet_loop();
void fetchAndAdd_loop();
void fetchAndAdd_threadedLoop();
+
+private:
+ static void warningFreeHelper();
};
tst_QAtomicInt::tst_QAtomicInt()
@@ -109,6 +114,45 @@ tst_QAtomicInt::tst_QAtomicInt()
tst_QAtomicInt::~tst_QAtomicInt()
{ }
+void tst_QAtomicInt::warningFreeHelper()
+{
+ Q_ASSERT(false);
+ // The code below is bogus, and shouldn't be run. We're looking for warnings, only.
+
+ QBasicAtomicInt i = Q_BASIC_ATOMIC_INITIALIZER(0);
+
+ int expectedValue = 0;
+ int newValue = 0;
+ int valueToAdd = 0;
+
+ i.ref();
+ i.deref();
+
+ i.testAndSetRelaxed(expectedValue, newValue);
+ i.testAndSetAcquire(expectedValue, newValue);
+ i.testAndSetRelease(expectedValue, newValue);
+ i.testAndSetOrdered(expectedValue, newValue);
+
+ i.fetchAndStoreRelaxed(newValue);
+ i.fetchAndStoreAcquire(newValue);
+ i.fetchAndStoreRelease(newValue);
+ i.fetchAndStoreOrdered(newValue);
+
+ i.fetchAndAddRelaxed(valueToAdd);
+ i.fetchAndAddAcquire(valueToAdd);
+ i.fetchAndAddRelease(valueToAdd);
+ i.fetchAndAddOrdered(valueToAdd);
+}
+
+void tst_QAtomicInt::warningFree()
+{
+ // This is a compile time check for warnings.
+ // No need for actual work here.
+
+ void (*foo)() = &warningFreeHelper;
+ (void)foo;
+}
+
void tst_QAtomicInt::constructor_data()
{
QTest::addColumn<int>("value");
diff --git a/tests/auto/qatomicpointer/tst_qatomicpointer.cpp b/tests/auto/qatomicpointer/tst_qatomicpointer.cpp
index b9636a0..c1e0efd 100644
--- a/tests/auto/qatomicpointer/tst_qatomicpointer.cpp
+++ b/tests/auto/qatomicpointer/tst_qatomicpointer.cpp
@@ -58,6 +58,8 @@ public:
~tst_QAtomicPointer();
private slots:
+ void warningFree();
+
void constructor();
void copy_constructor();
void equality_operator();
@@ -78,6 +80,9 @@ private slots:
void isFetchAndAddWaitFree();
void fetchAndAdd_data();
void fetchAndAdd();
+
+private:
+ static void warningFreeHelper();
};
tst_QAtomicPointer::tst_QAtomicPointer()
@@ -86,6 +91,49 @@ tst_QAtomicPointer::tst_QAtomicPointer()
tst_QAtomicPointer::~tst_QAtomicPointer()
{ }
+struct WFHC
+{
+ void bar() {}
+};
+
+void tst_QAtomicPointer::warningFreeHelper()
+{
+ Q_ASSERT(false);
+ // The code below is bogus, and shouldn't be run. We're looking for warnings, only.
+
+ QBasicAtomicPointer<WFHC> p = Q_BASIC_ATOMIC_INITIALIZER(0);
+
+ p->bar();
+
+ WFHC *expectedValue = 0;
+ WFHC *newValue = 0;
+ qptrdiff valueToAdd = 0;
+
+ p.testAndSetRelaxed(expectedValue, newValue);
+ p.testAndSetAcquire(expectedValue, newValue);
+ p.testAndSetRelease(expectedValue, newValue);
+ p.testAndSetOrdered(expectedValue, newValue);
+
+ p.fetchAndStoreRelaxed(newValue);
+ p.fetchAndStoreAcquire(newValue);
+ p.fetchAndStoreRelease(newValue);
+ p.fetchAndStoreOrdered(newValue);
+
+ p.fetchAndAddRelaxed(valueToAdd);
+ p.fetchAndAddAcquire(valueToAdd);
+ p.fetchAndAddRelease(valueToAdd);
+ p.fetchAndAddOrdered(valueToAdd);
+}
+
+void tst_QAtomicPointer::warningFree()
+{
+ // This is a compile time check for warnings.
+ // No need for actual work here.
+
+ void (*foo)() = &warningFreeHelper;
+ (void)foo;
+}
+
void tst_QAtomicPointer::constructor()
{
void *one = this;
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp
index 073afc8..f979174 100644
--- a/tests/auto/qgl/tst_qgl.cpp
+++ b/tests/auto/qgl/tst_qgl.cpp
@@ -46,6 +46,7 @@
#include <qdebug.h>
#include <qgl.h>
#include <qglpixelbuffer.h>
+#include <qglframebufferobject.h>
#include <qglcolormap.h>
#include <qpaintengine.h>
@@ -71,6 +72,8 @@ private slots:
void partialGLWidgetUpdates_data();
void partialGLWidgetUpdates();
void glWidgetRendering();
+ void glFBORendering();
+ void glFBOUseInGLWidget();
void glPBufferRendering();
void glWidgetReparent();
void colormap();
@@ -706,6 +709,121 @@ void tst_QGL::glWidgetRendering()
QCOMPARE(fb, reference);
}
+// NOTE: This tests that CombinedDepthStencil attachment works by assuming the
+// GL2 engine is being used and is implemented the same way as it was when
+// this autotest was written. If this is not the case, there may be some
+// false-positives: I.e. The test passes when either the depth or stencil
+// buffer is actually missing. But that's probably ok anyway.
+void tst_QGL::glFBORendering()
+{
+ if (!QGLFramebufferObject::hasOpenGLFramebufferObjects())
+ QSKIP("QGLFramebufferObject not supported on this platform", SkipSingle);
+
+ QGLWidget glw;
+ glw.makeCurrent();
+
+ // No multisample with combined depth/stencil attachment:
+ QGLFramebufferObjectFormat fboFormat(0, QGLFramebufferObject::CombinedDepthStencil);
+
+ // Don't complicate things by using NPOT:
+ QGLFramebufferObject *fbo = new QGLFramebufferObject(256, 128, fboFormat);
+
+ QPainter fboPainter;
+ bool painterBegun = fboPainter.begin(fbo);
+ QVERIFY(painterBegun);
+
+ QPainterPath intersectingPath;
+ intersectingPath.moveTo(0, 0);
+ intersectingPath.lineTo(100, 0);
+ intersectingPath.lineTo(0, 100);
+ intersectingPath.lineTo(100, 100);
+ intersectingPath.closeSubpath();
+
+ QPainterPath trianglePath;
+ trianglePath.moveTo(50, 0);
+ trianglePath.lineTo(100, 100);
+ trianglePath.lineTo(0, 100);
+ trianglePath.closeSubpath();
+
+ fboPainter.fillRect(0, 0, fbo->width(), fbo->height(), Qt::red); // Background
+ fboPainter.translate(14, 14);
+ fboPainter.fillPath(intersectingPath, Qt::blue); // Test stencil buffer works
+ fboPainter.translate(128, 0);
+ fboPainter.setClipPath(trianglePath); // Test depth buffer works
+ fboPainter.setTransform(QTransform()); // reset xform
+ fboPainter.fillRect(0, 0, fbo->width(), fbo->height(), Qt::green);
+ fboPainter.end();
+
+ QImage fb = fbo->toImage().convertToFormat(QImage::Format_RGB32);
+ delete fbo;
+
+ // As we're doing more than trivial painting, we can't just compare to
+ // an image rendered with raster. Instead, we sample at well-defined
+ // test-points:
+ QCOMPARE(fb.pixel(39, 64), QColor(Qt::red).rgb());
+ QCOMPARE(fb.pixel(89, 64), QColor(Qt::red).rgb());
+ QCOMPARE(fb.pixel(64, 39), QColor(Qt::blue).rgb());
+ QCOMPARE(fb.pixel(64, 89), QColor(Qt::blue).rgb());
+
+ QCOMPARE(fb.pixel(167, 39), QColor(Qt::red).rgb());
+ QCOMPARE(fb.pixel(217, 39), QColor(Qt::red).rgb());
+ QCOMPARE(fb.pixel(192, 64), QColor(Qt::green).rgb());
+}
+
+class FBOUseInGLWidget : public QGLWidget
+{
+public:
+ bool widgetPainterBeginOk;
+ bool fboPainterBeginOk;
+ QImage fboImage;
+protected:
+ void paintEvent(QPaintEvent*)
+ {
+ QPainter widgetPainter;
+ widgetPainterBeginOk = widgetPainter.begin(this);
+ QGLFramebufferObjectFormat fboFormat(0, QGLFramebufferObject::CombinedDepthStencil);
+ QGLFramebufferObject *fbo = new QGLFramebufferObject(128, 128, fboFormat);
+
+ QPainter fboPainter;
+ fboPainterBeginOk = fboPainter.begin(fbo);
+ fboPainter.fillRect(0, 0, 128, 128, Qt::red);
+ fboPainter.end();
+ fboImage = fbo->toImage();
+
+ widgetPainter.fillRect(rect(), Qt::blue);
+
+ delete fbo;
+ }
+
+};
+
+void tst_QGL::glFBOUseInGLWidget()
+{
+ if (!QGLFramebufferObject::hasOpenGLFramebufferObjects())
+ QSKIP("QGLFramebufferObject not supported on this platform", SkipSingle);
+
+ FBOUseInGLWidget w;
+ w.resize(128, 128);
+ w.show();
+
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&w);
+#endif
+ QTest::qWait(200);
+
+ QVERIFY(w.widgetPainterBeginOk);
+ QVERIFY(w.fboPainterBeginOk);
+
+ QImage widgetFB = w.grabFrameBuffer(false);
+ QImage widgetReference(widgetFB.size(), widgetFB.format());
+ widgetReference.fill(0xff0000ff);
+ QCOMPARE(widgetFB, widgetReference);
+
+ QImage fboReference(w.fboImage.size(), w.fboImage.format());
+ fboReference.fill(0xffff0000);
+ QCOMPARE(w.fboImage, fboReference);
+}
+
void tst_QGL::glWidgetReparent()
{
// Try it as a top-level first:
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 541b5ba..aa1f2b8 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -289,6 +289,9 @@ private slots:
void setGraphicsEffect();
void panel();
void addPanelToActiveScene();
+ void activate();
+ void setActivePanelOnInactiveScene();
+ void activationOnShowHide();
// task specific tests below me
void task141694_textItemEnsureVisible();
@@ -5417,6 +5420,7 @@ void tst_QGraphicsItem::contextMenuEventPropagation()
qt_x11_wait_for_window_manager(&view);
#endif
view.resize(200, 200);
+ QTest::qWait(250);
QContextMenuEvent event(QContextMenuEvent::Mouse, QPoint(10, 10),
view.viewport()->mapToGlobal(QPoint(10, 10)));
@@ -7823,26 +7827,15 @@ void tst_QGraphicsItem::panel()
// No previous activation, so the scene is active.
QVERIFY(scene.isActive());
- QVERIFY(!scene.activePanel());
- QVERIFY(!panel1->isActive());
- QVERIFY(!panel2->isActive());
- QVERIFY(!panel3->isActive());
- QVERIFY(!panel4->isActive());
- QVERIFY(notPanel1->isActive());
- QVERIFY(notPanel2->isActive());
- QCOMPARE(spy_activate_notPanel1.count(), 1);
- QCOMPARE(spy_activate_notPanel2.count(), 1);
-
- // Switch to panel1.
- scene.setActivePanel(panel1);
+ QCOMPARE(scene.activePanel(), (QGraphicsItem *)panel1);
QVERIFY(panel1->isActive());
QVERIFY(!panel2->isActive());
QVERIFY(!panel3->isActive());
QVERIFY(!panel4->isActive());
QVERIFY(!notPanel1->isActive());
QVERIFY(!notPanel2->isActive());
- QCOMPARE(spy_deactivate_notPanel1.count(), 1);
- QCOMPARE(spy_deactivate_notPanel2.count(), 1);
+ QCOMPARE(spy_deactivate_notPanel1.count(), 0);
+ QCOMPARE(spy_deactivate_notPanel2.count(), 0);
QCOMPARE(spy_activate_panel1.count(), 1);
QCOMPARE(spy_activate_panel2.count(), 0);
QCOMPARE(spy_activate_panel3.count(), 0);
@@ -7857,8 +7850,8 @@ void tst_QGraphicsItem::panel()
QVERIFY(!panel4->isActive());
QVERIFY(notPanel1->isActive());
QVERIFY(notPanel2->isActive());
- QCOMPARE(spy_activate_notPanel1.count(), 2);
- QCOMPARE(spy_activate_notPanel2.count(), 2);
+ QCOMPARE(spy_activate_notPanel1.count(), 1);
+ QCOMPARE(spy_activate_notPanel2.count(), 1);
// Deactivate the scene
QApplication::sendEvent(&scene, &deactivate);
@@ -7869,8 +7862,8 @@ void tst_QGraphicsItem::panel()
QVERIFY(!panel4->isActive());
QVERIFY(!notPanel1->isActive());
QVERIFY(!notPanel2->isActive());
- QCOMPARE(spy_deactivate_notPanel1.count(), 2);
- QCOMPARE(spy_deactivate_notPanel2.count(), 2);
+ QCOMPARE(spy_deactivate_notPanel1.count(), 1);
+ QCOMPARE(spy_deactivate_notPanel2.count(), 1);
// Reactivate the scene
QApplication::sendEvent(&scene, &activate);
@@ -7881,14 +7874,14 @@ void tst_QGraphicsItem::panel()
QVERIFY(!panel4->isActive());
QVERIFY(notPanel1->isActive());
QVERIFY(notPanel2->isActive());
- QCOMPARE(spy_activate_notPanel1.count(), 3);
- QCOMPARE(spy_activate_notPanel2.count(), 3);
+ QCOMPARE(spy_activate_notPanel1.count(), 2);
+ QCOMPARE(spy_activate_notPanel2.count(), 2);
// Switch to panel1
scene.setActivePanel(panel1);
QVERIFY(panel1->isActive());
- QCOMPARE(spy_deactivate_notPanel1.count(), 3);
- QCOMPARE(spy_deactivate_notPanel2.count(), 3);
+ QCOMPARE(spy_deactivate_notPanel1.count(), 2);
+ QCOMPARE(spy_deactivate_notPanel2.count(), 2);
QCOMPARE(spy_activate_panel1.count(), 2);
// Deactivate the scene
@@ -7942,5 +7935,173 @@ void tst_QGraphicsItem::addPanelToActiveScene()
QCOMPARE(scene.activePanel(), (QGraphicsItem *)rect);
}
+void tst_QGraphicsItem::activate()
+{
+ QGraphicsScene scene;
+ QGraphicsRectItem *rect = scene.addRect(-10, -10, 20, 20);
+ QVERIFY(!rect->isActive());
+
+ QEvent activate(QEvent::WindowActivate);
+ QEvent deactivate(QEvent::WindowDeactivate);
+
+ QApplication::sendEvent(&scene, &activate);
+
+ // Non-panel item (active when scene is active).
+ QVERIFY(rect->isActive());
+
+ QGraphicsRectItem *rect2 = new QGraphicsRectItem;
+ rect2->setFlag(QGraphicsItem::ItemIsPanel);
+ QGraphicsRectItem *rect3 = new QGraphicsRectItem;
+ rect3->setFlag(QGraphicsItem::ItemIsPanel);
+
+ // Test normal activation.
+ QVERIFY(!rect2->isActive());
+ scene.addItem(rect2);
+ QVERIFY(rect2->isActive()); // first panel item is activated
+ scene.addItem(rect3);
+ QVERIFY(!rect3->isActive()); // second panel item is _not_ activated
+ rect3->setActive(true);
+ QVERIFY(rect3->isActive());
+ scene.removeItem(rect3);
+ QVERIFY(!rect3->isActive()); // no panel is active anymore
+ QCOMPARE(scene.activePanel(), (QGraphicsItem *)0);
+ scene.addItem(rect3);
+ QVERIFY(rect3->isActive()); // second panel item is activated
+
+ // Test pending activation.
+ scene.removeItem(rect3);
+ rect2->setActive(true);
+ QVERIFY(rect2->isActive()); // first panel item is activated
+ rect3->setActive(true);
+ QVERIFY(!rect3->isActive()); // not active (yet)
+ scene.addItem(rect3);
+ QVERIFY(rect3->isActive()); // now becomes active
+
+ // Test pending deactivation.
+ scene.removeItem(rect3);
+ rect3->setActive(false);
+ scene.addItem(rect3);
+ QVERIFY(!rect3->isActive()); // doesn't become active
+
+ // Child of panel activation.
+ rect3->setActive(true);
+ QGraphicsRectItem *rect4 = new QGraphicsRectItem;
+ rect4->setFlag(QGraphicsItem::ItemIsPanel);
+ QGraphicsRectItem *rect5 = new QGraphicsRectItem(rect4);
+ QGraphicsRectItem *rect6 = new QGraphicsRectItem(rect5);
+ scene.addItem(rect4);
+ QCOMPARE(scene.activePanel(), (QGraphicsItem *)rect3);
+ scene.removeItem(rect4);
+ rect6->setActive(true);
+ scene.addItem(rect4);
+ QVERIFY(rect4->isActive());
+ QVERIFY(rect5->isActive());
+ QVERIFY(rect6->isActive());
+ QCOMPARE(scene.activePanel(), (QGraphicsItem *)rect4);
+ scene.removeItem(rect4); // no active panel
+ rect6->setActive(false);
+ scene.addItem(rect4);
+ QVERIFY(!rect4->isActive());
+ QVERIFY(!rect5->isActive());
+ QVERIFY(!rect6->isActive());
+ QCOMPARE(scene.activePanel(), (QGraphicsItem *)0);
+
+ // Controlling auto-activation when the scene changes activation.
+ rect4->setActive(true);
+ QApplication::sendEvent(&scene, &deactivate);
+ QVERIFY(!scene.isActive());
+ QVERIFY(!rect4->isActive());
+ rect4->setActive(false);
+ QApplication::sendEvent(&scene, &activate);
+ QVERIFY(scene.isActive());
+ QVERIFY(!scene.activePanel());
+ QVERIFY(!rect4->isActive());
+}
+
+void tst_QGraphicsItem::setActivePanelOnInactiveScene()
+{
+ QGraphicsScene scene;
+ QGraphicsRectItem *item = scene.addRect(QRectF());
+ QGraphicsRectItem *panel = scene.addRect(QRectF());
+ panel->setFlag(QGraphicsItem::ItemIsPanel);
+
+ EventSpy itemActivateSpy(&scene, item, QEvent::WindowActivate);
+ EventSpy itemDeactivateSpy(&scene, item, QEvent::WindowDeactivate);
+ EventSpy panelActivateSpy(&scene, panel, QEvent::WindowActivate);
+ EventSpy panelDeactivateSpy(&scene, panel, QEvent::WindowDeactivate);
+ EventSpy sceneActivationChangeSpy(&scene, QEvent::ActivationChange);
+
+ scene.setActivePanel(panel);
+ QCOMPARE(scene.activePanel(), (QGraphicsItem *)0);
+ QCOMPARE(itemActivateSpy.count(), 0);
+ QCOMPARE(itemDeactivateSpy.count(), 0);
+ QCOMPARE(panelActivateSpy.count(), 0);
+ QCOMPARE(panelDeactivateSpy.count(), 0);
+ QCOMPARE(sceneActivationChangeSpy.count(), 0);
+}
+
+void tst_QGraphicsItem::activationOnShowHide()
+{
+ QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
+ QGraphicsRectItem *rootPanel = scene.addRect(QRectF());
+ rootPanel->setFlag(QGraphicsItem::ItemIsPanel);
+ rootPanel->setActive(true);
+
+ QGraphicsRectItem *subPanel = new QGraphicsRectItem;
+ subPanel->setFlag(QGraphicsItem::ItemIsPanel);
+
+ // Reparenting onto an active panel auto-activates the child panel.
+ subPanel->setParentItem(rootPanel);
+ QVERIFY(subPanel->isActive());
+ QVERIFY(!rootPanel->isActive());
+
+ // Hiding an active child panel will reactivate the parent panel.
+ subPanel->hide();
+ QVERIFY(rootPanel->isActive());
+
+ // Showing a child panel will auto-activate it.
+ subPanel->show();
+ QVERIFY(subPanel->isActive());
+ QVERIFY(!rootPanel->isActive());
+
+ // Adding an unrelated panel doesn't affect activation.
+ QGraphicsRectItem *otherPanel = new QGraphicsRectItem;
+ otherPanel->setFlag(QGraphicsItem::ItemIsPanel);
+ scene.addItem(otherPanel);
+ QVERIFY(subPanel->isActive());
+
+ // Showing an unrelated panel doesn't affect activation.
+ otherPanel->hide();
+ otherPanel->show();
+ QVERIFY(subPanel->isActive());
+
+ // Add a non-panel item.
+ QGraphicsRectItem *otherItem = new QGraphicsRectItem;
+ scene.addItem(otherItem);
+ otherItem->setActive(true);
+ QVERIFY(otherItem->isActive());
+
+ // Reparent a panel onto an active non-panel item.
+ subPanel->setParentItem(otherItem);
+ QVERIFY(subPanel->isActive());
+
+ // Showing a child panel of a non-panel item will activate it.
+ subPanel->hide();
+ QVERIFY(!subPanel->isActive());
+ QVERIFY(otherItem->isActive());
+ subPanel->show();
+ QVERIFY(subPanel->isActive());
+
+ // Hiding a toplevel active panel will pass activation back
+ // to the non-panel items.
+ rootPanel->setActive(true);
+ rootPanel->hide();
+ QVERIFY(!rootPanel->isActive());
+ QVERIFY(otherItem->isActive());
+}
+
QTEST_MAIN(tst_QGraphicsItem)
#include "tst_qgraphicsitem.moc"
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index 663de22..65e6e56 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -352,12 +352,12 @@ void tst_QGraphicsWidget::activation()
QEvent activateEvent(QEvent::WindowActivate);
QApplication::sendEvent(&scene, &activateEvent);
- QVERIFY(widget->isActiveWindow());
- QVERIFY(!window1->isActiveWindow());
+ QVERIFY(!widget->isActiveWindow());
+ QVERIFY(window1->isActiveWindow());
QVERIFY(!window2->isActiveWindow());
scene.setActiveWindow(window1);
- QVERIFY(widget->isActiveWindow());
+ QVERIFY(!widget->isActiveWindow());
QVERIFY(window1->isActiveWindow());
QVERIFY(!window2->isActiveWindow());
diff --git a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
index 6549be8..419eb71 100644
--- a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
+++ b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
@@ -189,7 +189,9 @@ void tst_QHttpNetworkConnection::head()
QCOMPARE(reply->statusCode(), statusCode);
QCOMPARE(reply->reasonPhrase(), statusString);
- QCOMPARE(reply->contentLength(), qint64(contentLength));
+ // only check it if it is set
+ if (reply->contentLength() != -1)
+ QCOMPARE(reply->contentLength(), qint64(contentLength));
QVERIFY(reply->isFinished());
@@ -249,7 +251,9 @@ void tst_QHttpNetworkConnection::get()
QCOMPARE(reply->statusCode(), statusCode);
QCOMPARE(reply->reasonPhrase(), statusString);
- QCOMPARE(reply->contentLength(), qint64(contentLength));
+ // only check it if it is set
+ if (reply->contentLength() != -1)
+ QCOMPARE(reply->contentLength(), qint64(contentLength));
stopWatch.start();
QByteArray ba;
diff --git a/tests/auto/qicon/tst_qicon.cpp b/tests/auto/qicon/tst_qicon.cpp
index b614ab9..bacf7a5 100644
--- a/tests/auto/qicon/tst_qicon.cpp
+++ b/tests/auto/qicon/tst_qicon.cpp
@@ -609,8 +609,7 @@ void tst_QIcon::task184901_badCache()
void tst_QIcon::fromTheme()
{
- const QString prefix = QLatin1String(SRCDIR) + QLatin1String("/");
- QString searchPath = prefix + QLatin1String("/icons");
+ QString searchPath = QLatin1String(":/icons");
QIcon::setThemeSearchPaths(QStringList() << searchPath);
QVERIFY(QIcon::themeSearchPaths().size() == 1);
QCOMPARE(searchPath, QIcon::themeSearchPaths()[0]);
diff --git a/tests/auto/qicon/tst_qicon.qrc b/tests/auto/qicon/tst_qicon.qrc
index 1e1a030..7925a33 100644
--- a/tests/auto/qicon/tst_qicon.qrc
+++ b/tests/auto/qicon/tst_qicon.qrc
@@ -2,5 +2,19 @@
<qresource prefix="/">
<file>image.png</file>
<file>rect.png</file>
+<file>./icons/testtheme/16x16/actions/appointment-new.png</file>
+<file>./icons/testtheme/22x22/actions/appointment-new.png</file>
+<file>./icons/testtheme/32x32/actions/appointment-new.png</file>
+<file>./icons/testtheme/index.theme</file>
+<file>./icons/testtheme/scalable/actions/svg-only.svg</file>
+<file>./icons/themeparent/16x16/actions/address-book-new.png</file>
+<file>./icons/themeparent/16x16/actions/appointment-new.png</file>
+<file>./icons/themeparent/22x22/actions/address-book-new.png</file>
+<file>./icons/themeparent/22x22/actions/appointment-new.png</file>
+<file>./icons/themeparent/32x32/actions/address-book-new.png</file>
+<file>./icons/themeparent/32x32/actions/appointment-new.png</file>
+<file>./icons/themeparent/index.theme</file>
+<file>./icons/themeparent/scalable/actions/address-book-new.svg</file>
+<file>./icons/themeparent/scalable/actions/appointment-new.svg</file>
</qresource>
</RCC>
diff --git a/tests/auto/qimagereader/images/qt.gif b/tests/auto/qimagereader/images/qt.gif
new file mode 100644
index 0000000..e0a5a80
--- /dev/null
+++ b/tests/auto/qimagereader/images/qt.gif
Binary files differ
diff --git a/tests/auto/qimagereader/images/qt1.gif b/tests/auto/qimagereader/images/qt1.gif
new file mode 100644
index 0000000..0ce910c
--- /dev/null
+++ b/tests/auto/qimagereader/images/qt1.gif
Binary files differ
diff --git a/tests/auto/qimagereader/images/qt2.gif b/tests/auto/qimagereader/images/qt2.gif
new file mode 100644
index 0000000..993a315
--- /dev/null
+++ b/tests/auto/qimagereader/images/qt2.gif
Binary files differ
diff --git a/tests/auto/qimagereader/images/qt3.gif b/tests/auto/qimagereader/images/qt3.gif
new file mode 100644
index 0000000..7391678
--- /dev/null
+++ b/tests/auto/qimagereader/images/qt3.gif
Binary files differ
diff --git a/tests/auto/qimagereader/images/qt4.gif b/tests/auto/qimagereader/images/qt4.gif
new file mode 100644
index 0000000..41109a9
--- /dev/null
+++ b/tests/auto/qimagereader/images/qt4.gif
Binary files differ
diff --git a/tests/auto/qimagereader/images/qt5.gif b/tests/auto/qimagereader/images/qt5.gif
new file mode 100644
index 0000000..5a3fb54
--- /dev/null
+++ b/tests/auto/qimagereader/images/qt5.gif
Binary files differ
diff --git a/tests/auto/qimagereader/images/qt6.gif b/tests/auto/qimagereader/images/qt6.gif
new file mode 100644
index 0000000..f22e7c9
--- /dev/null
+++ b/tests/auto/qimagereader/images/qt6.gif
Binary files differ
diff --git a/tests/auto/qimagereader/images/qt7.gif b/tests/auto/qimagereader/images/qt7.gif
new file mode 100644
index 0000000..a315671
--- /dev/null
+++ b/tests/auto/qimagereader/images/qt7.gif
Binary files differ
diff --git a/tests/auto/qimagereader/images/qt8.gif b/tests/auto/qimagereader/images/qt8.gif
new file mode 100644
index 0000000..2a7d09e
--- /dev/null
+++ b/tests/auto/qimagereader/images/qt8.gif
Binary files differ
diff --git a/tests/auto/qimagereader/qimagereader.qrc b/tests/auto/qimagereader/qimagereader.qrc
index c6b963b..11b9406 100644
--- a/tests/auto/qimagereader/qimagereader.qrc
+++ b/tests/auto/qimagereader/qimagereader.qrc
@@ -1,5 +1,5 @@
-<!DOCTYPE RCC><RCC version="1.0">
- <qresource>
+<RCC>
+ <qresource prefix="/" >
<file>images/16bpp.bmp</file>
<file>images/4bpp-rle.bmp</file>
<file>images/YCbCr_cmyk.jpg</file>
@@ -48,5 +48,14 @@
<file>images/tst7.png</file>
<file>images/transparent.xpm</file>
<file>images/trolltech.gif</file>
+ <file>images/qt.gif</file>
+ <file>images/qt1.gif</file>
+ <file>images/qt2.gif</file>
+ <file>images/qt3.gif</file>
+ <file>images/qt4.gif</file>
+ <file>images/qt5.gif</file>
+ <file>images/qt6.gif</file>
+ <file>images/qt7.gif</file>
+ <file>images/qt8.gif</file>
</qresource>
</RCC>
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 27c6925..a325a33 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -140,6 +140,7 @@ private slots:
#if defined QTEST_HAVE_GIF
void gifHandlerBugs();
+ void animatedGif();
#endif
void readCorruptImage_data();
@@ -710,6 +711,18 @@ void tst_QImageReader::gifHandlerBugs()
QCOMPARE(im1.convertToFormat(QImage::Format_ARGB32), im2.convertToFormat(QImage::Format_ARGB32));
}
}
+
+void tst_QImageReader::animatedGif()
+{
+ QImageReader io(prefix + "qt.gif");
+ QImage image= io.read();
+ int i=0;
+ while(!image.isNull()){
+ QString frameName = QString(prefix + "qt%1.gif").arg(++i);
+ QCOMPARE(image, QImage(frameName));
+ image=io.read();
+ }
+}
#endif
class Server : public QObject
diff --git a/tests/auto/qmargins/qmargins.pro b/tests/auto/qmargins/qmargins.pro
new file mode 100644
index 0000000..5a6aa4f
--- /dev/null
+++ b/tests/auto/qmargins/qmargins.pro
@@ -0,0 +1,3 @@
+load(qttest_p4)
+SOURCES += tst_qmargins.cpp
+QT = core
diff --git a/tests/auto/qmargins/tst_qmargins.cpp b/tests/auto/qmargins/tst_qmargins.cpp
new file mode 100644
index 0000000..6ee2495
--- /dev/null
+++ b/tests/auto/qmargins/tst_qmargins.cpp
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 <QtTest/QtTest>
+#include <qmargins.h>
+
+Q_DECLARE_METATYPE(QMargins)
+
+//TESTED_CLASS=
+//TESTED_FILES=
+
+class tst_QMargins : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QMargins();
+ virtual ~tst_QMargins();
+
+
+public slots:
+ void init();
+ void cleanup();
+private slots:
+ void getSetCheck();
+};
+
+// Testing get/set functions
+void tst_QMargins::getSetCheck()
+{
+ QMargins margins;
+ // int QMargins::width()
+ // void QMargins::setWidth(int)
+ margins.setLeft(0);
+ QCOMPARE(0, margins.left());
+ margins.setTop(INT_MIN);
+ QCOMPARE(INT_MIN, margins.top());
+ margins.setBottom(INT_MAX);
+ QCOMPARE(INT_MAX, margins.bottom());
+ margins.setRight(INT_MAX);
+ QCOMPARE(INT_MAX, margins.right());
+
+ margins = QMargins();
+ QVERIFY(margins.isNull());
+ margins.setLeft(5);
+ margins.setRight(5);
+ QVERIFY(!margins.isNull());
+ QCOMPARE(margins, QMargins(5, 0, 5, 0));
+}
+
+tst_QMargins::tst_QMargins()
+{
+}
+
+tst_QMargins::~tst_QMargins()
+{
+}
+
+void tst_QMargins::init()
+{
+}
+
+void tst_QMargins::cleanup()
+{
+}
+
+
+
+QTEST_APPLESS_MAIN(tst_QMargins)
+#include "tst_qmargins.moc"
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 52e967f..a223d1c 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -1366,8 +1366,10 @@ void tst_QNetworkReply::getFromHttp()
QCOMPARE(reply->url(), request.url());
QCOMPARE(reply->error(), QNetworkReply::NoError);
QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
-
- QCOMPARE(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), reference.size());
+ QCOMPARE(reply->size(), reference.size());
+ // only compare when the header is set.
+ if (reply->header(QNetworkRequest::ContentLengthHeader).isValid())
+ QCOMPARE(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), reference.size());
QCOMPARE(reply->readAll(), reference.readAll());
}
diff --git a/tests/auto/qpainterpath/tst_qpainterpath.cpp b/tests/auto/qpainterpath/tst_qpainterpath.cpp
index 26c1f9b..9c4cbc4 100644
--- a/tests/auto/qpainterpath/tst_qpainterpath.cpp
+++ b/tests/auto/qpainterpath/tst_qpainterpath.cpp
@@ -1145,8 +1145,9 @@ void tst_QPainterPath::testToFillPolygons()
path.lineTo(QPointF(70, 100));
path.lineTo(QPointF(40, 100));
- QPolygonF polygon = path.toFillPolygons(QMatrix()).first();
- QCOMPARE(polygon.count(QPointF(70, 50)), 2);
+ const QList<QPolygonF> polygons = path.toFillPolygons();
+ QCOMPARE(polygons.size(), 2);
+ QCOMPARE(polygons.first().count(QPointF(70, 50)), 0);
}
void tst_QPainterPath::connectPathDuplicatePoint()
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 02ab1cc..7752a4f 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -95,6 +95,9 @@ private slots:
void fromImage_data();
void fromImage();
+ void fromUninitializedImage_data();
+ void fromUninitializedImage();
+
void convertFromImage_data();
void convertFromImage();
@@ -318,6 +321,32 @@ void tst_QPixmap::fromImage()
QCOMPARE(result, image);
}
+
+void tst_QPixmap::fromUninitializedImage_data()
+{
+ QTest::addColumn<QImage::Format>("format");
+
+ QTest::newRow("Format_Mono") << QImage::Format_Mono;
+ QTest::newRow("Format_MonoLSB") << QImage::Format_MonoLSB;
+ QTest::newRow("Format_Indexed8") << QImage::Format_Indexed8;
+ QTest::newRow("Format_RGB32") << QImage::Format_RGB32;
+ QTest::newRow("Format_ARGB32") << QImage::Format_ARGB32;
+ QTest::newRow("Format_ARGB32_Premultiplied") << QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("Format_RGB16") << QImage::Format_RGB16;
+}
+
+void tst_QPixmap::fromUninitializedImage()
+{
+ QFETCH(QImage::Format, format);
+
+ QImage image(100, 100, format);
+ QPixmap pix = QPixmap::fromImage(image);
+
+ // it simply shouldn't crash...
+ QVERIFY(true);
+
+}
+
void tst_QPixmap::convertFromImage_data()
{
QTest::addColumn<QImage>("img1");
diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp
index 68f0620..8fe6839 100644
--- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp
+++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp
@@ -155,7 +155,7 @@ struct ScriptEngineEvent
lineNumber(lineNumber)
{ }
- ScriptEngineEvent(Type type, qint64 scriptId = -1)
+ ScriptEngineEvent(Type type, qint64 scriptId = -777)
: type(type), scriptId(scriptId)
{ }
@@ -1593,8 +1593,6 @@ void tst_QScriptEngineAgent::exceptionThrowAndCatch()
{
spy->clear();
eng.evaluate("try { throw new Error('ciao'); } catch (e) { }");
- if (qt_script_isJITEnabled())
- QEXPECT_FAIL("", "Some events are missing when JIT is enabled", Abort);
QCOMPARE(spy->count(), 2);
QCOMPARE(spy->at(0).type, ScriptEngineEvent::ExceptionThrow);
@@ -1606,6 +1604,8 @@ void tst_QScriptEngineAgent::exceptionThrowAndCatch()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::ExceptionCatch);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
+ if (qt_script_isJITEnabled())
+ QEXPECT_FAIL("", "Exception value is not passed in exceptionCatch event when JIT is enabled", Continue);
QVERIFY(spy->at(1).value.strictlyEquals(spy->at(0).value));
}
}
@@ -1728,8 +1728,6 @@ void tst_QScriptEngineAgent::eventOrder_throwAndCatch()
{
spy->clear();
eng.evaluate("try { throw new Error('ciao') } catch (e) { void(e); }");
- if (qt_script_isJITEnabled())
- QEXPECT_FAIL("", "One event is missing when JIT is enabled", Abort);
QCOMPARE(spy->count(), 12);
// load
QCOMPARE(spy->at(0).type, ScriptEngineEvent::ScriptLoad);
@@ -1751,6 +1749,8 @@ void tst_QScriptEngineAgent::eventOrder_throwAndCatch()
QVERIFY(spy->at(7).hasExceptionHandler);
// catch
QCOMPARE(spy->at(8).type, ScriptEngineEvent::ExceptionCatch);
+ if (qt_script_isJITEnabled())
+ QEXPECT_FAIL("", "Exception value is not passed in exceptionCatch event when JIT is enabled", Continue);
QVERIFY(spy->at(8).value.isError());
// void(e)
QCOMPARE(spy->at(9).type, ScriptEngineEvent::PositionChange);
@@ -1914,8 +1914,6 @@ void tst_QScriptEngineAgent::eventOrder_throwCatchFinally()
{
spy->clear();
eng.evaluate("try { throw 1; } catch(e) { i = e; } finally { i = 2; }");
- if (qt_script_isJITEnabled())
- QEXPECT_FAIL("", "One event is missing when JIT is enabled", Abort);
QCOMPARE(spy->count(), 9);
// load
@@ -2100,6 +2098,7 @@ void tst_QScriptEngineAgent::syntaxError()
i = 2;
QCOMPARE(spy->at(i).type, ScriptEngineEvent::ContextPush);
+ QEXPECT_FAIL("","The test is broken, contextPush event do not provide scriptId", Continue);
QVERIFY(spy->at(i).scriptId == -1);
i = 3;
QCOMPARE(spy->at(i).type, ScriptEngineEvent::FunctionEntry);
@@ -2109,6 +2108,7 @@ void tst_QScriptEngineAgent::syntaxError()
QVERIFY(spy->at(i).scriptId == -1);
i = 5;
QCOMPARE(spy->at(i).type, ScriptEngineEvent::ContextPop);
+ QEXPECT_FAIL("","The test is broken, contextPop event do not provide scriptId", Continue);
QVERIFY(spy->at(i).scriptId == -1);
i = 6;
QCOMPARE(spy->at(i).type, ScriptEngineEvent::ExceptionThrow);
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index a6b887a..a6d2c26 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -180,6 +180,8 @@ private slots:
void odbc_uintfield();
void odbc_bindBoolean_data() { generic_data("QODBC"); }
void odbc_bindBoolean();
+ void odbc_testqGetString_data() { generic_data("QODBC"); }
+ void odbc_testqGetString();
void oci_serverDetach_data() { generic_data("QOCI"); }
void oci_serverDetach(); // For task 154518
@@ -347,6 +349,7 @@ void tst_QSqlDatabase::dropTestTables(QSqlDatabase db)
<< qTableName("numericfields")
<< qTableName("qtest_ibaseblobs")
<< qTableName("qtestBindBool")
+ << qTableName("testqGetString")
<< qTableName("qtest_sqlguid")
<< qTableName("uint_table")
<< qTableName("uint_test")
@@ -510,10 +513,6 @@ void tst_QSqlDatabase::tables()
QVERIFY(tables.contains(qTableName("qtest"), Qt::CaseInsensitive));
QVERIFY(!tables.contains("sql_features", Qt::CaseInsensitive)); //check for postgres 7.4 internal tables
if (views) {
- if (db.driverName().startsWith("QMYSQL"))
- // MySQL doesn't differentiate between tables and views when calling QSqlDatabase::tables()
- // May be fixable by doing a select on informational_schema.tables instead of using the client library api
- QEXPECT_FAIL("", "MySQL driver thinks that views are tables", Continue);
QVERIFY(!tables.contains(qTableName("qtest_view"), Qt::CaseInsensitive));
}
if (tempTables)
@@ -521,10 +520,6 @@ void tst_QSqlDatabase::tables()
tables = db.tables(QSql::Views);
if (views) {
- if (db.driverName().startsWith("QMYSQL"))
- // MySQL doesn't give back anything when calling QSqlDatabase::tables() with QSql::Views
- // May be fixable by doing a select on informational_schema.views instead of using the client library api
- QEXPECT_FAIL("", "MySQL driver thinks that views are tables", Continue);
if(!tables.contains(qTableName("qtest_view"), Qt::CaseInsensitive))
qDebug() << "failed to find" << qTableName("qtest_view") << "in" << tables;
QVERIFY(tables.contains(qTableName("qtest_view"), Qt::CaseInsensitive));
@@ -2024,6 +2019,44 @@ void tst_QSqlDatabase::odbc_bindBoolean()
QCOMPARE(q.value(1).toBool(), false);
}
+void tst_QSqlDatabase::odbc_testqGetString()
+{
+ QFETCH(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE(db);
+
+ QSqlQuery q(db);
+ QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("testqGetString") + "(id int, vcvalue varchar(65538))"));
+
+ QString largeString;
+ largeString.fill('A', 65536);
+
+ // Bind and insert
+ QVERIFY_SQL(q, prepare("INSERT INTO " + qTableName("testqGetString") + " VALUES(?, ?)"));
+ q.bindValue(0, 1);
+ q.bindValue(1, largeString);
+ QVERIFY_SQL(q, exec());
+ q.bindValue(0, 2);
+ q.bindValue(1, largeString+QLatin1Char('B'));
+ QVERIFY_SQL(q, exec());
+ q.bindValue(0, 3);
+ q.bindValue(1, largeString+QLatin1Char('B')+QLatin1Char('C'));
+ QVERIFY_SQL(q, exec());
+
+ // Retrive
+ QVERIFY_SQL(q, exec("SELECT id, vcvalue FROM " + qTableName("testqGetString") + " ORDER BY id"));
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toInt(), 1);
+ QCOMPARE(q.value(1).toString().length(), 65536);
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toInt(), 2);
+ QCOMPARE(q.value(1).toString().length(), 65537);
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toInt(), 3);
+ QCOMPARE(q.value(1).toString().length(), 65538);
+}
+
+
void tst_QSqlDatabase::mysql_multiselect()
{
QFETCH(QString, dbName);
diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
index add48c4..4dfb6b9 100644
--- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
+++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
@@ -267,6 +267,8 @@ void tst_QSslCertificate::compareCertificates(
QCOMPARE(cert1.alternateSubjectNames(), cert2.alternateSubjectNames());
QCOMPARE(cert1.effectiveDate(), cert2.effectiveDate());
QCOMPARE(cert1.expiryDate(), cert2.expiryDate());
+ QCOMPARE(cert1.version(), cert2.version());
+ QCOMPARE(cert1.serialNumber(), cert2.serialNumber());
// ### add more functions here ...
}
@@ -677,7 +679,9 @@ void tst_QSslCertificate::certInfo()
QCOMPARE(cert.subjectInfo("C"), QString("NO"));
QCOMPARE(cert.subjectInfo("ST"), QString());
- QCOMPARE(cert.version(), QByteArray());
+ QCOMPARE(cert.version(), QByteArray::number(1));
+ QCOMPARE(cert.serialNumber(), QByteArray::number(17));
+
QCOMPARE(cert.toPem().constData(), (const char*)pem);
QCOMPARE(cert.toDer(), QByteArray::fromHex(der));
diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
index b797c39..5a84cc1 100644
--- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
+++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
@@ -93,6 +93,8 @@ private slots:
void renameFdLeak();
void reOpenThroughQFile();
void keepOpenMode();
+ void resetTemplateAfterError();
+ void setTemplateAfterOpen();
public:
};
@@ -476,5 +478,85 @@ void tst_QTemporaryFile::keepOpenMode()
}
}
+void tst_QTemporaryFile::resetTemplateAfterError()
+{
+ // calling setFileTemplate on a failed open
+
+ QString tempPath = QDir::tempPath();
+
+ QString const fileTemplate("destination/qt_temp_file_test.XXXXXX");
+ QString const fileTemplate2(tempPath + "/qt_temp_file_test.XXXXXX");
+
+ QVERIFY2( QDir(tempPath).exists() || QDir().mkpath(tempPath), "Test precondition" );
+ QVERIFY2( !QFile::exists("destination"), "Test precondition" );
+ QVERIFY2( !QFile::exists(fileTemplate2) || QFile::remove(fileTemplate2), "Test precondition" );
+
+ QFile file(fileTemplate2);
+ QByteArray fileContent("This file is intentionally NOT left empty.");
+
+ QVERIFY( file.open(QIODevice::ReadWrite | QIODevice::Truncate) );
+ QCOMPARE( file.write(fileContent), (qint64)fileContent.size() );
+ QVERIFY( file.flush() );
+
+ QString fileName;
+ {
+ QTemporaryFile temp;
+
+ QVERIFY( temp.fileName().isEmpty() );
+ QVERIFY( !temp.fileTemplate().isEmpty() );
+
+ temp.setFileTemplate( fileTemplate );
+
+ QVERIFY( temp.fileName().isEmpty() );
+ QCOMPARE( temp.fileTemplate(), fileTemplate );
+
+ QVERIFY( !temp.open() );
+
+ QVERIFY( temp.fileName().isEmpty() );
+ QCOMPARE( temp.fileTemplate(), fileTemplate );
+
+ temp.setFileTemplate( fileTemplate2 );
+ QVERIFY( temp.open() );
+
+ fileName = temp.fileName();
+ QVERIFY( QFile::exists(fileName) );
+ QVERIFY( !fileName.isEmpty() );
+ QVERIFY2( fileName != fileTemplate2,
+ ("Generated name shouldn't be same as template: " + fileTemplate2).toLocal8Bit().constData() );
+ }
+
+ QVERIFY( !QFile::exists(fileName) );
+
+ file.seek(0);
+ QCOMPARE( QString(file.readAll()), QString(fileContent) );
+ QVERIFY( file.remove() );
+}
+
+void tst_QTemporaryFile::setTemplateAfterOpen()
+{
+ QTemporaryFile temp;
+
+ QVERIFY( temp.fileName().isEmpty() );
+ QVERIFY( !temp.fileTemplate().isEmpty() );
+
+ QVERIFY( temp.open() );
+
+ QString const fileName = temp.fileName();
+ QString const newTemplate("funny-path/funny-name-XXXXXX.tmp");
+
+ QVERIFY( !fileName.isEmpty() );
+ QVERIFY( QFile::exists(fileName) );
+ QVERIFY( !temp.fileTemplate().isEmpty() );
+ QVERIFY( temp.fileTemplate() != newTemplate );
+
+ temp.close(); // QTemporaryFile::setFileTemplate will assert on isOpen() up to 4.5.2
+ temp.setFileTemplate(newTemplate);
+ QCOMPARE( temp.fileTemplate(), newTemplate );
+
+ QVERIFY( temp.open() );
+ QCOMPARE( temp.fileName(), fileName );
+ QCOMPARE( temp.fileTemplate(), newTemplate );
+}
+
QTEST_MAIN(tst_QTemporaryFile)
#include "tst_qtemporaryfile.moc"
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp
index ef43c3a..6709807 100644
--- a/tests/auto/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/qtreeview/tst_qtreeview.cpp
@@ -233,6 +233,7 @@ private slots:
void task239271_addRowsWithFirstColumnHidden();
void task254234_proxySort();
void task248022_changeSelection();
+ void task245654_changeModelAndExpandAll();
};
class QtTestModel: public QAbstractItemModel
@@ -3463,6 +3464,35 @@ void tst_QTreeView::task248022_changeSelection()
QCOMPARE(view.selectionModel()->selectedIndexes().count(), list.count());
}
+void tst_QTreeView::task245654_changeModelAndExpandAll()
+{
+ QTreeView view;
+ QStandardItemModel *model = new QStandardItemModel;
+ QStandardItem *top = new QStandardItem("top");
+ QStandardItem *sub = new QStandardItem("sub");
+ top->appendRow(sub);
+ model->appendRow(top);
+ view.setModel(model);
+ view.expandAll();
+ QApplication::processEvents();
+ QVERIFY(view.isExpanded(top->index()));
+
+ //now let's try to delete the model
+ //then repopulate and expand again
+ delete model;
+ model = new QStandardItemModel;
+ top = new QStandardItem("top");
+ sub = new QStandardItem("sub");
+ top->appendRow(sub);
+ model->appendRow(top);
+ view.setModel(model);
+ view.expandAll();
+ QApplication::processEvents();
+ QVERIFY(view.isExpanded(top->index()));
+
+}
+
+
QTEST_MAIN(tst_QTreeView)
#include "tst_qtreeview.moc"
diff --git a/tests/benchmarks/qgraphicsanchorlayout/qgraphicsanchorlayout.pro b/tests/benchmarks/qgraphicsanchorlayout/qgraphicsanchorlayout.pro
new file mode 100644
index 0000000..0d563b9
--- /dev/null
+++ b/tests/benchmarks/qgraphicsanchorlayout/qgraphicsanchorlayout.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qgraphicsanchorlayout
+
+SOURCES += tst_qgraphicsanchorlayout.cpp
+
diff --git a/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
new file mode 100644
index 0000000..986ceb6
--- /dev/null
+++ b/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
@@ -0,0 +1,197 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation 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 <QtTest/QtTest>
+#include <QtGui/qgraphicsanchorlayout.h>
+#include <QtGui/qgraphicswidget.h>
+#include <QtGui/qgraphicsview.h>
+
+class tst_QGraphicsAnchorLayout : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QGraphicsAnchorLayout() {}
+ ~tst_QGraphicsAnchorLayout() {}
+
+private slots:
+ void s60_hard_complex_data();
+ void s60_hard_complex();
+};
+
+
+class RectWidget : public QGraphicsWidget
+{
+public:
+ RectWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent){}
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+ {
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+ painter->drawRoundRect(rect());
+ painter->drawLine(rect().topLeft(), rect().bottomRight());
+ painter->drawLine(rect().bottomLeft(), rect().topRight());
+ }
+};
+
+static QGraphicsWidget *createItem(const QSizeF &minimum = QSizeF(100.0, 100.0),
+ const QSizeF &preferred = QSize(150.0, 100.0),
+ const QSizeF &maximum = QSizeF(200.0, 100.0),
+ const QString &name = QString())
+{
+ QGraphicsWidget *w = new RectWidget;
+ w->setMinimumSize(minimum);
+ w->setPreferredSize(preferred);
+ w->setMaximumSize(maximum);
+ w->setData(0, name);
+ return w;
+}
+
+static void setAnchor(QGraphicsAnchorLayout *l,
+ QGraphicsLayoutItem *firstItem,
+ Qt::AnchorPoint firstEdge,
+ QGraphicsLayoutItem *secondItem,
+ Qt::AnchorPoint secondEdge,
+ qreal spacing)
+{
+ l->addAnchor(firstItem, firstEdge, secondItem, secondEdge);
+ l->setAnchorSpacing(firstItem, firstEdge, secondItem, secondEdge, spacing);
+}
+
+void tst_QGraphicsAnchorLayout::s60_hard_complex_data()
+{
+ QTest::addColumn<int>("whichSizeHint");
+ QTest::newRow("minimumSizeHint")
+ << int(Qt::MinimumSize);
+ QTest::newRow("preferredSizeHint")
+ << int(Qt::PreferredSize);
+ QTest::newRow("maximumSizeHint")
+ << int(Qt::MaximumSize);
+ // Add it as a reference to see how much overhead the body of effectiveSizeHint takes.
+ QTest::newRow("noSizeHint")
+ << -1;
+}
+
+void tst_QGraphicsAnchorLayout::s60_hard_complex()
+{
+ QFETCH(int, whichSizeHint);
+
+ // Test for "hard" complex case, taken from wiki
+ // https://cwiki.nokia.com/S60QTUI/AnchorLayoutComplexCases
+ QSizeF min(0, 10);
+ QSizeF pref(50, 10);
+ QSizeF max(100, 10);
+
+ QGraphicsWidget *a = createItem(min, pref, max, "a");
+ QGraphicsWidget *b = createItem(min, pref, max, "b");
+ QGraphicsWidget *c = createItem(min, pref, max, "c");
+ QGraphicsWidget *d = createItem(min, pref, max, "d");
+ QGraphicsWidget *e = createItem(min, pref, max, "e");
+ QGraphicsWidget *f = createItem(min, pref, max, "f");
+ QGraphicsWidget *g = createItem(min, pref, max, "g");
+
+ QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
+ l->setContentsMargins(0, 0, 0, 0);
+
+ //<!-- Trunk -->
+ setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 10);
+ setAnchor(l, a, Qt::AnchorRight, b, Qt::AnchorLeft, 10);
+ setAnchor(l, b, Qt::AnchorRight, c, Qt::AnchorLeft, 10);
+ setAnchor(l, c, Qt::AnchorRight, d, Qt::AnchorLeft, 10);
+ setAnchor(l, d, Qt::AnchorRight, l, Qt::AnchorRight, 10);
+
+ //<!-- Above trunk -->
+ setAnchor(l, b, Qt::AnchorLeft, e, Qt::AnchorLeft, 10);
+ setAnchor(l, e, Qt::AnchorRight, d, Qt::AnchorLeft, 10);
+
+ //<!-- Below trunk -->
+ setAnchor(l, a, Qt::AnchorHorizontalCenter, g, Qt::AnchorLeft, 10);
+ setAnchor(l, g, Qt::AnchorRight, f, Qt::AnchorHorizontalCenter, 10);
+ setAnchor(l, c, Qt::AnchorLeft, f, Qt::AnchorLeft, 10);
+ setAnchor(l, f, Qt::AnchorRight, d, Qt::AnchorRight, 10);
+
+ //<!-- vertical is simpler -->
+ setAnchor(l, l, Qt::AnchorTop, e, Qt::AnchorTop, 0);
+ setAnchor(l, e, Qt::AnchorBottom, a, Qt::AnchorTop, 0);
+ setAnchor(l, e, Qt::AnchorBottom, b, Qt::AnchorTop, 0);
+ setAnchor(l, e, Qt::AnchorBottom, c, Qt::AnchorTop, 0);
+ setAnchor(l, e, Qt::AnchorBottom, d, Qt::AnchorTop, 0);
+ setAnchor(l, a, Qt::AnchorBottom, f, Qt::AnchorTop, 0);
+ setAnchor(l, a, Qt::AnchorBottom, b, Qt::AnchorBottom, 0);
+ setAnchor(l, a, Qt::AnchorBottom, c, Qt::AnchorBottom, 0);
+ setAnchor(l, a, Qt::AnchorBottom, d, Qt::AnchorBottom, 0);
+ setAnchor(l, f, Qt::AnchorBottom, g, Qt::AnchorTop, 0);
+ setAnchor(l, g, Qt::AnchorBottom, l, Qt::AnchorBottom, 0);
+
+ // It won't query the size hint if it already has a size set.
+ // If only one of the sizes is unset it will query sizeHint only of for that hint type.
+ l->setMinimumSize(60,40);
+ l->setPreferredSize(220,40);
+ l->setMaximumSize(240,40);
+
+ switch (whichSizeHint) {
+ case Qt::MinimumSize:
+ l->setMinimumSize(-1, -1);
+ break;
+ case Qt::PreferredSize:
+ l->setPreferredSize(-1, -1);
+ break;
+ case Qt::MaximumSize:
+ l->setMaximumSize(-1, -1);
+ break;
+ default:
+ break;
+ }
+
+ QSizeF sizeHint;
+ // warm up instruction cache
+ l->invalidate();
+ sizeHint = l->effectiveSizeHint((Qt::SizeHint)whichSizeHint);
+ // ...then measure...
+ QBENCHMARK {
+ l->invalidate();
+ sizeHint = l->effectiveSizeHint((Qt::SizeHint)whichSizeHint);
+ }
+}
+
+QTEST_MAIN(tst_QGraphicsAnchorLayout)
+
+#include "tst_qgraphicsanchorlayout.moc"
diff --git a/tests/manual/qhttpnetworkconnection/main.cpp b/tests/manual/qhttpnetworkconnection/main.cpp
new file mode 100644
index 0000000..b15a7ed
--- /dev/null
+++ b/tests/manual/qhttpnetworkconnection/main.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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$
+**
+****************************************************************************/
+// This file contains benchmarks for QNetworkReply functions.
+
+#include <QDebug>
+#include <qtest.h>
+#include <QtTest/QtTest>
+#include <QtNetwork/qnetworkreply.h>
+#include <QtNetwork/qnetworkrequest.h>
+#include <QtNetwork/qnetworkaccessmanager.h>
+#include "../../auto/network-settings.h"
+
+class tst_qhttpnetworkconnection : public QObject
+{
+ Q_OBJECT
+private slots:
+ void bigRemoteFile();
+
+};
+
+void tst_qhttpnetworkconnection::bigRemoteFile()
+{
+ QNetworkAccessManager manager;
+ qint64 size;
+ QTime t;
+ QNetworkRequest request(QUrl("http://nds1.nokia.com/files/support/global/phones/software/Nokia_Ovi_Suite_webinstaller.exe"));
+ QNetworkReply* reply = manager.get(request);
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection);
+ qDebug() << "Starting download";
+ t.start();
+ QTestEventLoop::instance().enterLoop(50);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ size = reply->size();
+ delete reply;
+ qDebug() << "Finished!" << endl;
+ qDebug() << "Time:" << t.elapsed() << "msec";
+ qDebug() << "Bytes:" << size;
+ qDebug() << "Speed:" << (size / 1024) / (t.elapsed() / 1000) << "KB/sec";
+}
+
+QTEST_MAIN(tst_qhttpnetworkconnection)
+
+#include "main.moc"
diff --git a/tests/manual/qhttpnetworkconnection/qhttpnetworkconnection.pro b/tests/manual/qhttpnetworkconnection/qhttpnetworkconnection.pro
new file mode 100644
index 0000000..2471389
--- /dev/null
+++ b/tests/manual/qhttpnetworkconnection/qhttpnetworkconnection.pro
@@ -0,0 +1,13 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qhttpnetworkconnection
+DEPENDPATH += .
+INCLUDEPATH += .
+
+QT -= gui
+QT += network
+
+CONFIG += release
+
+# Input
+SOURCES += main.cpp
diff --git a/tests/manual/qtabletevent/main.cpp b/tests/manual/qtabletevent/device_information/main.cpp
index 44afcaf..69867bc 100644
--- a/tests/manual/qtabletevent/main.cpp
+++ b/tests/manual/qtabletevent/device_information/main.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the test suite module of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -47,4 +47,4 @@ int main(int argc, char **argv) {
TabletWidget tabletWidget;
tabletWidget.showMaximized();
return app.exec();
-}
+}
diff --git a/tests/manual/qtabletevent/qtabletevent.pro b/tests/manual/qtabletevent/device_information/qtabletevent.pro
index e0ed549..e0ed549 100644
--- a/tests/manual/qtabletevent/qtabletevent.pro
+++ b/tests/manual/qtabletevent/device_information/qtabletevent.pro
diff --git a/tests/manual/qtabletevent/tabletwidget.cpp b/tests/manual/qtabletevent/device_information/tabletwidget.cpp
index 15a3d80..15a3d80 100644
--- a/tests/manual/qtabletevent/tabletwidget.cpp
+++ b/tests/manual/qtabletevent/device_information/tabletwidget.cpp
diff --git a/tests/manual/qtabletevent/tabletwidget.h b/tests/manual/qtabletevent/device_information/tabletwidget.h
index d3ccb32..d3ccb32 100644
--- a/tests/manual/qtabletevent/tabletwidget.h
+++ b/tests/manual/qtabletevent/device_information/tabletwidget.h
diff --git a/tests/manual/qtabletevent/event_compression/event_compression.pro b/tests/manual/qtabletevent/event_compression/event_compression.pro
new file mode 100644
index 0000000..273fd6c
--- /dev/null
+++ b/tests/manual/qtabletevent/event_compression/event_compression.pro
@@ -0,0 +1,7 @@
+TEMPLATE = app
+QT += testlib
+
+# Input
+SOURCES += main.cpp \
+ mousestatwidget.cpp
+HEADERS += mousestatwidget.h
diff --git a/tests/manual/qtabletevent/event_compression/main.cpp b/tests/manual/qtabletevent/event_compression/main.cpp
new file mode 100644
index 0000000..26611d3
--- /dev/null
+++ b/tests/manual/qtabletevent/event_compression/main.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 "mousestatwidget.h"
+
+#include <QApplication>
+#include <QWidget>
+#include <QVBoxLayout>
+
+int main(int argc, char **argv){
+ QApplication app(argc, argv);
+
+ QWidget main;
+ QVBoxLayout *layout = new QVBoxLayout(&main);
+ layout->addWidget(new MouseStatWidget(true));
+ layout->addWidget(new MouseStatWidget(false));
+ main.resize(800, 600);
+ main.show();
+ return app.exec();
+}
diff --git a/tests/manual/qtabletevent/event_compression/mousestatwidget.cpp b/tests/manual/qtabletevent/event_compression/mousestatwidget.cpp
new file mode 100644
index 0000000..024e14a
--- /dev/null
+++ b/tests/manual/qtabletevent/event_compression/mousestatwidget.cpp
@@ -0,0 +1,99 @@
+#include "mousestatwidget.h"
+
+#include <QTabletEvent>
+#include <QPainter>
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite module 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 <QTextOption>
+#include <QTest>
+
+MouseStatWidget::MouseStatWidget(bool acceptTabletEvent):acceptTabletEvent(acceptTabletEvent),
+ receivedMouseEventCount(0),
+ receivedMouseEventCountToPaint(0),
+ receivedTabletEventCount(0),
+ receivedTabletEventCountToPaint(0)
+{
+ startTimer(1000);
+}
+
+
+void MouseStatWidget::tabletEvent(QTabletEvent *event)
+{
+ ++receivedTabletEventCount;
+ if (acceptTabletEvent)
+ event->accept();
+ else
+ event->ignore();
+ // make sure the event loop is slow
+ QTest::qSleep(15);
+}
+
+void MouseStatWidget::mouseMoveEvent(QMouseEvent *)
+{
+ ++receivedMouseEventCount;
+}
+
+void MouseStatWidget::timerEvent(QTimerEvent *)
+{
+ receivedMouseEventCountToPaint = receivedMouseEventCount;
+ receivedTabletEventCountToPaint = receivedTabletEventCount;
+ receivedMouseEventCount = 0;
+ receivedTabletEventCount = 0;
+ update();
+}
+
+void MouseStatWidget::paintEvent(QPaintEvent *)
+{
+ QPainter painter(this);
+ painter.setPen(Qt::black);
+ painter.drawRect(rect());
+ QStringList text;
+ text << ((acceptTabletEvent) ? " - tablet events accepted - " : " - tablet events ignored - ");
+ text << QString("Number of tablet events received in the last second: %1").arg(QString::number(receivedTabletEventCountToPaint));
+ text << QString("Number of mouse events received in the last second: %1").arg(QString::number(receivedMouseEventCountToPaint));
+
+ QTextOption textOption(Qt::AlignCenter);
+ textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
+ painter.drawText(rect(),
+ text.join("\n"),
+ textOption);
+}
diff --git a/tests/manual/qtabletevent/event_compression/mousestatwidget.h b/tests/manual/qtabletevent/event_compression/mousestatwidget.h
new file mode 100644
index 0000000..22c0dff
--- /dev/null
+++ b/tests/manual/qtabletevent/event_compression/mousestatwidget.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite module 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$
+**
+****************************************************************************/
+
+#ifndef MOUSESTATWIDGET_H
+#define MOUSESTATWIDGET_H
+
+#include <QWidget>
+
+class QTabletEvent;
+class QMouseEvent;
+class QTimerEvent;
+class QPaintEvent;
+
+class MouseStatWidget : public QWidget
+{
+public:
+ MouseStatWidget(bool acceptTabletEvent = true);
+protected:
+ void tabletEvent(QTabletEvent *);
+ void mouseMoveEvent(QMouseEvent *);
+ void timerEvent(QTimerEvent *);
+ void paintEvent(QPaintEvent *);
+private:
+ const bool acceptTabletEvent;
+ int receivedMouseEventCount;
+ int receivedMouseEventCountToPaint;
+ int receivedTabletEventCount;
+ int receivedTabletEventCountToPaint;
+};
+
+#endif // MOUSESTATWIDGET_H
diff --git a/tools/assistant/tools/assistant/doc/assistant.qdocconf b/tools/assistant/tools/assistant/doc/assistant.qdocconf
index 9566e90..161d34f 100644
--- a/tools/assistant/tools/assistant/doc/assistant.qdocconf
+++ b/tools/assistant/tools/assistant/doc/assistant.qdocconf
@@ -12,5 +12,5 @@ HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \
"<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \
"<td width=\"30%\" align=\"left\">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>\n" \
"<td width=\"40%\" align=\"center\">Trademarks</td>\n" \
- "<td width=\"30%\" align=\"right\"><div align=\"right\">Qt 4.5.3</div></td>\n" \
+ "<td width=\"30%\" align=\"right\"><div align=\"right\">Qt 4.6.0</div></td>\n" \
"</tr></table></div></address>"
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 5b30b4e..25a4cb4 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -3638,10 +3638,14 @@ bool Configure::showLicense(QString orgLicenseFile)
return true;
}
+ bool haveGpl3 = false;
QString licenseFile = orgLicenseFile;
QString theLicense;
if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
- theLicense = "GNU General Public License (GPL) version 3 \nor the GNU Lesser General Public License (LGPL) version 2.1";
+ haveGpl3 = QFile::exists(orgLicenseFile + "/LICENSE.GPL3");
+ theLicense = "GNU Lesser General Public License (LGPL) version 2.1";
+ if (haveGpl3)
+ theLicense += "\nor the GNU General Public License (GPL) version 3";
} else {
// the first line of the license file tells us which license it is
QFile file(licenseFile);
@@ -3658,7 +3662,8 @@ bool Configure::showLicense(QString orgLicenseFile)
<< "the " << theLicense << "." << endl
<< endl;
if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
- cout << "Type '3' to view the GNU General Public License version 3 (GPLv3)." << endl;
+ if (haveGpl3)
+ cout << "Type '3' to view the GNU General Public License version 3 (GPLv3)." << endl;
cout << "Type 'L' to view the Lesser GNU General Public License version 2.1 (LGPLv2.1)." << endl;
} else {
cout << "Type '?' to view the " << theLicense << "." << endl;
diff --git a/tools/qdoc3/test/classic.css b/tools/qdoc3/test/classic.css
index f97bdbe..c0bc3d47 100644
--- a/tools/qdoc3/test/classic.css
+++ b/tools/qdoc3/test/classic.css
@@ -251,45 +251,25 @@ span.string,span.char
.qmlname {
white-space: nowrap;
- font-weight: bold;
- font-size: 125%;
}
.qmltype {
- font-weight: bold;
- font-size: 125%;
-}
-
-.qmlproto, .qmldoc {
- // border-top: 1px solid #84b0c7;
+ text-align: center;
+ font-size: 160%;
}
.qmlproto {
- padding: 0;
- //background-color: #e4e4e4;//#d5e1e8;
- //font-weight: bold;
- //-webkit-border-top-left-radius: 8px;
- //-webkit-border-top-right-radius: 8px;
- //-moz-border-radius-topleft: 8px;
- //-moz-border-radius-topright: 8px;
+ background-color: #eee;
+ border-width: 1px;
+ border-style: solid;
+ border-color: #ddd;
+ font-weight: bold;
+ padding: 6px 0px 6px 10px;
+ margin: 42px 0px 0px 0px;
}
.qmldoc {
- border-top: 1px solid #e4e4e4;
- //padding: 2px 5px;
- //background-color: #eef3f5;
- //border-top-width: 0;
- //-webkit-border-bottom-left-radius: 8px;
- //-webkit-border-bottom-right-radius: 8px;
- //-moz-border-radius-bottomleft: 8px;
- //-moz-border-radius-bottomright: 8px;
-}
-
-.qmldoc p, .qmldoc dl, .qmldoc ul {
- //margin: 6px 0;
}
*.qmlitem p {
- //margin-top: 0px;
- //margin-bottom: 0px;
}