Commit Graph

21688 Commits

Author SHA1 Message Date
Tobias Koenig
699455b90a Haiku: Make examples compile on Haiku
Change-Id: I469619b5d749be1043e0bc43e9199a39ace61f16
Reviewed-by: Augustin Cavalier <waddlesplash@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-01-14 05:37:12 +01:00
Tobias Koenig
ab1b1afb83 Haiku: Make network module compile on Haiku
Add the missing definition for IFF_RUNNING like
documented on http://ports.haiku-files.org/wiki/CommonProblems

Change-Id: Iea3fa224dc8e7e1e36674026efbb28289d2efa2a
Reviewed-by: Augustin Cavalier <waddlesplash@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-01-14 05:36:56 +01:00
J-P Nurmi
ce84a1bde3 Reduce excessive painting caused by transient scrollbars
The step logic in scrollByDelta() made scrollbar position to go
temporarily outside its min/max boundaries, and then setValue()
corrected it immediately back within its bounds. The false change
notifications caused by this position vs. value ping pong caused
plenty of unnecessary updates.

Task-number: QTBUG-30316
Change-Id: I32dd5bdb7b0c578dfc5dfa1deecceb19bb98a2b3
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
2015-01-14 00:46:43 +01:00
Giuseppe D'Angelo
940530ab67 QComboBox: make setModel reset the root model index
When changing models it makes no sense to keep the old root model index,
pointing into a possibly deleted model. Reset it to the root
of the new model is the best line of action.

[ChangeLog][QtWidgets][QComboBox] QComboBox will now reset its root
model index when a new model is set on it.

Task-number: QTBUG-43350
Change-Id: I113d558ce19fcaed31f13abfbedc7a24302e28d7
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
2015-01-13 22:52:05 +01:00
Olivier Goffart
14583137ae Introduce Q_ENUM and Q_FLAG macros
In replacement for Q_ENUMS and Q_FLAGS.

Q_ENUM(Foo) has to be put after the declaration of Foo in an object.
It will tell moc to include the enum in the meta object (just like
Q_ENUMS) and will allow templated code to get the metaobject for
that enum.

Will be used by QDebug and QMetaType

Change-Id: Iefaf8ae07dc0359828102bf384809346629b3e23
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-01-13 17:52:14 +01:00
Shawn Rutledge
74443d7bbb Add QWheelEvent::source
This is analogous to 0a92295ca8
which added QMouseEvent::source.

For now, we say that a wheel event is synthetic when it comes from
a trackpad or other device that provides scrolling by some means
other than an actual wheel.

Change-Id: I0452ca2080b551b18b9c2f6e42db925d14ae339e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2015-01-13 13:14:57 +01:00
J-P Nurmi
9d5b1fd151 Make QStyleHints usable in QML
Change-Id: Ia8f143d12c754b4af4a29bb9542cd050b5ae2ab0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-13 13:05:48 +01:00
Andy Maloney
75f2a0b4ef Extend selections in QGraphicsView when selection extension key down
If the user has some objects selected and holds down the "extend selection"
key (Control on Windows, Command on Mac OS X), clicking and dragging a
rubber band selection deselects the current selection.  This is
counter-intuitive and confusing for users.

This commit fixes the behavior so users can extend selections using the
rubber band when the proper key is held down.

Task-number: QTBUG-6523
Change-Id: Ieda4aaa50adb351c0405f5cb8aae23332eec58a9
Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
2015-01-13 13:04:40 +01:00
Jędrzej Nowacki
f0f5beb0e5 Remove unnecessary call to strlen
The call was invalid from C99 perspective.

Change-Id: Ie07310735736eddf5eb0e142297e56164fde7fe4
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
2015-01-13 12:59:57 +01:00
Kai Koehne
883f672db5 QOpenGLWindow example: Remove unused code
Change-Id: Ide47a9edf726298b2032e45d6865511801f94fcb
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2015-01-13 12:59:38 +01:00
Kai Koehne
2fe8c06cf1 ANGLE: Disable MSVC warning 4996 for debug builds
Disable compiler warning 4996 about the use of C++ standard
library functions like std::copy:

'std::copy': Function call with parameters that may be unsafe -
this call relies on the caller to check that the passed values are
correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See
documentation on how to use Visual C++ 'Checked Iterators'

Commit 0a76b6bc already silenced the warning in the
general MSVC mkspecs, the flags set there are however overwritten
for ANGLE.

Change-Id: I8f9a84d19171057715a8f9be1e8338e02a6c5ba0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-01-13 12:59:24 +01:00
Jędrzej Nowacki
9e53325cfc Avoid double cache lookup in QHostInfoCache
Change-Id: If5ef2d2f117fe8c1abdf361f1122e32075e14385
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-13 12:47:24 +01:00
Alex Blasche
0d4485fd78 Support QMetaType::equals()
This avoids having to define operator< for types where operator== is
required but operator< doesn't make any sense (e.g. QGeoCoordinate).

Change-Id: I81f6a9d8fc0009a4514c974b5e02b446c50d1e31
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-13 12:18:47 +01:00
Rafael Roquetto
8fdd1bb8cb QNX: Enable QSharedMemory and QSystemSemaphore support.
Commit 96995db4af implements the necessary bits for this to work
under QNX.

Change-Id: Ie9e2f421f4f27fcaf40697dd363e9ed047754f0d
Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-01-13 11:54:12 +01:00
Joerg Bornemann
bbb40616d2 remove dead code
In ancient times, the existence of QMAKE_RUN_CXX_IMP determined the
use of implicit rules. The code path for implicit rules was turned
off in 2006 (0287fe3c), which probably was a refactoring artifact.
Later, implicit rules were enabled again using a different approach.
These days, the non-existence of QMAKE_RUN_CXX determines the use of
implicit rules.
We remove the dead code path now and rely on the latter condition.

One part of the dead code is a feature that turns off inference rules if
the OBJECTS_DIR is set or source file names do not match expectations.
If somebody ever missed this, it has been reimplemented otherwise.
Or not.

Change-Id: If3ce9904d9c1df6e4048c58c2452854cce7fa206
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-01-13 11:47:39 +01:00
Joerg Bornemann
13ed47690d use QSet<T> instead of QHash<T, void*>
Change-Id: Ifdc4d7c8e5fcb86834b2ee2c9db73decfffb4ff6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-01-13 11:47:35 +01:00
Maurice Kalinowski
2a02a01709 WinRT: Refactor icon specification usage
Naming for different logo sizes on WinRT has been varying in the
past and evolved from using small/medium/large to some being
explicit (71x71).

Add new values introduced by 8.1 (310x150, 310x310,...) and clean up
mixed usage. Detailed pixel versions overrule general specification
and latter ones stay mostly for compatibility reasons. Still the
preferred way is to use explicit pixel values.

Task-number: QTBUG-43644
Change-Id: I9173ec2951a82e5eac9d8c9956bfb0bb4d1a2459
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2015-01-13 11:29:42 +01:00
Gabriel de Dietrich
e18f4bca28 moc: Don't link to inexistent parent staticMetaObject
Contrarily to Q_OBJECTs, Q_GADGETs are not guaranteed to
descend from a Q_GADGET. Here, we ensure that if the first
superclass is a Q_GADGET, then the derived class will be
treated as one. This allows gaps in the Q_GADGET hierarchy
while preventing from trying to link to the inexistent
staticMetaObject if there's no such ancestor.

Change-Id: If10fb952e23655102a425bb18fe8babaf447a47f
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-01-13 11:25:53 +01:00
Martin Smith
df6d2290e6 qdoc: qdoc's 'square bracket' parameters were evaluated too early
qdoc's link command (\l) allows an optional first argument enclosed in
square brackets. This argument is used for narrowing and focusing the
search for the link target. The argument should not be evaluated until
the generate phase, but it was being evaluated in the prepare
phase. This was also a problem when running qdoc in the single-exec
mode. This update prevents qdoc from evaluating the argument until it
is used in the generate phase.

Change-Id: I82785e97077053fb5f5c11f0592155675334aaeb
Task-number: QTBUG-42880
Reviewed-by: Martin Smith <martin.smith@digia.com>
2015-01-12 13:12:05 +01:00
Marco Martin
9da1a12864 Add D-Bus types marshalling for Linux tray icon support
Add marshalling for icon pixmaps to be used in DBus tray icon support
according to the specification
http://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/Icons/

Task-number: QTBUG-31762
Change-Id: I16e66c272eef413a7c94345c273e5fd3a8c0f771
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Albert Astals Cid <albert.astals@canonical.com>
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
2015-01-12 08:49:16 +01:00
Orgad Shaneh
a3617296f4 QFileSystemEntry: Replace manual seek in string with lastIndexOf()
Change-Id: Icf45795a962baa7102c02293cb7ce1781b8f2f56
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-11 05:08:53 +01:00
Thiago Macieira
79eef021cb Remove Q_STATIC_GLOBALxxx_OPERATOR macros
These macros existed for working around an RVCT compiler bug, but since
we stopped trying to work around it, the macros are no longer necessary.

Change-Id: I76cc88d863b41f74f60cd9975dcc1959778c2740
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2015-01-11 03:41:54 +01:00
Thiago Macieira
0f569f5900 Clean up ltcg.prf with variables, including a new static mode
By using the special "ar" and "ranlib" tools, the symbol table is made
visible, so we don't need fat LTO binaries. Since we need to store the
new tool names, we may as well clean up ltcg.prf with variable names for
the fat mode too.

Change-Id: I7e53af0c74a3d069313f38500b72538af1d61128
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-01-11 03:41:48 +01:00
Thiago Macieira
d7795559a7 Let qmake find the number of processors online
Instead of trying to load in ltcg.prf and cache the value.

Change-Id: If485ff68fc6ff9d9cf7009cd72d5e702d0199c7f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-01-11 03:41:35 +01:00
Thiago Macieira
62b752b3a2 Do the same for qDebug of QByteArray and QLatin1String
QLatin1String are actually Unicode, so print them with \uXXXX sequences.
QByteArray are binary (arbitrary), so print as hex. Since hex escape
sequences in C are not limited in length (\x00000F is a valid hex
sequence), we need to insert "" if the next character is a valid hex
digit.

[ChangeLog][QtCore][QDebug] Similarly, printing of QByteArrays whenever
"noquote" is not active now prints the arrays in a format consumable in
C++, with all non-printable characters printed in hex escape sequences.

Change-Id: Ibd0c1a97cbac98610c65c1091bfbcf5581c835db
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-01-11 03:40:43 +01:00
Thiago Macieira
2c01d402e1 QDebug: pretty-print QStrings and QStringRefs
[ChangeLog][QtCore][QDebug] Printing of QStrings and QStringRefs
whenever "noquote" is not active now prints the strings in a format that
can be copied back to C++ code. All characters that aren't printable in
US-ASCII are escaped (this includes printable Unicode characters outside
of US-ASCII). Pretty-printing will not respect QTextFormat padding or
field widths.

Change-Id: I169a8a0508e24693f5652f0129defe7f709e5d08
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-11 03:40:38 +01:00
Thiago Macieira
e00d8ad86b Prettify the per-compiler setting of Makefile.win32
This just reindents and makes it easier to read what's going on.

Change-Id: Id0afcdfb8f468b4553bba8c5a572a1d0115b0886
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-01-11 03:38:40 +01:00
Thiago Macieira
56c153c271 Remove support for MSVC mkspecs that don't exist anymore
Change-Id: Ic5d393bfd36e48a193fcffff13b73b9578a9f7ff
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-01-11 03:38:32 +01:00
Gunnar Sletta
aa8e8e2e41 Support threaded OpenGL on linux again.
Broken since 8758f532ae.

Change-Id: Ifadf37252cc7c1ca68b0a82320b12833f97bf302
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
2015-01-10 21:54:25 +01:00
Jørgen Lind
cd7532ad7b Fix a couple of bugs in the QOpenGLWindow example
Also make the fragment shader a bit simpler

Change-Id: Ie50940da0a4f896504c9f5962cdb6c455983302f
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2015-01-10 19:40:31 +01:00
Tobias Koenig
c2b86ade9e Haiku: Make corelib compile on Haiku
Change-Id: I66bc492390eedd723ab7866d3c7a38539d708727
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-01-10 15:26:00 +01:00
Kai Pastor
82413cd35f Android: Don't assume native window decoration in QDockWidget
Android does not decorate a floating QDockWidget, leaving the user with
no option to close or move such a widget. This changes activates Qt's
own drawing of window decorations for this case (similar to Win CE).

[ChangeLog][Android][QtWidgets] Enable QDockWidget window decorations.

Change-Id: Id46a994a8be9b8f3e7b530af118315cd36b5fb0e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-01-10 15:18:39 +01:00
Friedemann Kleint
936b671332 QWindowsVistaStyle: Draw PE_PanelItemViewItem for non-item view widgets.
Task-number: QTBUG-43157
Change-Id: I2a5f721cadc0dfffbb81902ef1d06ba34a729300
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
2015-01-10 15:08:13 +01:00
Marc Mutz
6c8c72a9ef QHash: clean up class definition
...by removing redundant '<Key, T>' and 'inline'.

Change-Id: I9d81950c6384927633de07de511712f7274a1283
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-10 08:43:23 +01:00
Marc Mutz
390b16aea8 QtCore: mark some operations nothrow
This shotgun-surgery approach is motivated by trying to get a
clean(er) build for -Wnoexcept on GCC, so it is expected that
for any class touched here, there will be more operations that
can be marked nothrow. But they don't show up in conditional
noexcept clauses, yet, so they are deferred to some later
commit.

Change-Id: I0eb10d75a26c361fb22cf785399e83b434bdf233
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-10 08:43:15 +01:00
Marc Mutz
2c2801860d QPen: mark copy/move/swap as nothrow
Change-Id: Ib13d60256d96253934e0627d4c3015248e002e3f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-10 08:43:09 +01:00
Marc Mutz
676cb678cc Remove qSwap specialization from Q_DECLARE_SHARED
The way swapping is supposed to work is:

1. Each type supplies a swap() function or function template in its
   namespace. Any good STL implementation will find it there through
   ADL. As will the primary qSwap() template.
2. Each use of swap() in Qt, in particular in template code, should
   use qSwap() instead of std::swap() or the using+swap-trick, because
   qSwap() automatically enables ADL. It also has a sophisticated
   conditional noexcept specification that can be used in the
   custom swap() functions' own noexcept clause.

This change also allows us to convert implicitly-shared classes'
member-swap functions to noexcept one at a time, because the
specialization will no longer be in conflict with the primary
template regarding exception specifications. The primary's
specification could, of course, be reused here, but it's complex
and if the machinery around it is changed later on, it will not
affect Q_DECLARE_SHARED classes.

Change-Id: I3389a655a9fd8de370f363c8fcef60269a9f506c
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-10 08:43:02 +01:00
Marc Mutz
a627c8628f QUnicodeTables: mark all functions as nothrow
Yes, this is necessary. The noexcept operator looks for noexcept tagging,
not at the contents of the function to determine whether to return true.

The more conditionally-noexcept functions are used, the more important it
becomes that low-level functions are correctly marked noexcept. In that, it
is like constexpr.

Change-Id: I4bca178444d1fd7caf3a92f996b1536eebdb5014
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-10 08:42:55 +01:00
Marc Mutz
35915e90f6 QModelIndex: plaster API with Q_DECL_NOTHROW
This is mostly straight-forward, but some things are worth noting:

1. Yes, this is necessary. The noexcept operator looks for noexcept tagging,
   not at the contents of the function to determine whether to return true.
   The more conditionally-noexcept functions are used, the more important it
   becomes that low-level classes are correctly marked noexcept. In that, it
   is like constexpr.
2. The functions that actually call into the model (data(), flags(), sibling(),
   ...) can throw (bad_alloc, if nothing else).
   Consequently, they're not marked nothrow. They're the only ones.

Change-Id: Id0413212b0f1c049a339480ee449a53c3ca9fea0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-10 08:42:47 +01:00
Alex Trotsenko
076148c7dd QRingBuffer: retrieve pointer to data more carefully
An empty ring buffer always has a pre-cached byte array in its
container. In this case size() indicates that no data is
available, but readPointer() tries to resolve this byte array.
To avoid an illegal pointer as a result, return Q_NULLPTR instead.

Change-Id: Icc5f08f071a8f02a14c112b6e1adbe5373bd9466
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-09 21:40:37 +01:00
Laszlo Agocs
f496c7186c eglfs: Update screen destruction to follow the new approach
Call destroyScreen(), like other platform plugins do since
9b4fbe85d2.

Change-Id: Idbddb026d7a964f15c00acfacf70064405dc3f16
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
2015-01-09 14:29:30 +01:00
Kai Koehne
8836a4d5f0 moc: Work around 'unused variable' MSVC warning
MSVC prints warnings if all slots are actually static methods:

moc_xxx.cpp:71: warning: C4189: '_t' : local variable is initialized but not referenced

This can be easily avoided by using Q_UNUSED.

Change-Id: Ice134a8a8d3e6aef1df1e7a89e9a2867281580fd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2015-01-09 13:27:58 +01:00
Kai Koehne
0a76b6bc7f MSVC: Disable compiler warning 4996 for debug builds
Move compiler warning 4996 from level 3 to 4. This is needed to avoid
warnings about the use of C++ standard library functions like std::copy,
which is used e.g. in qvector.h (since c6752c5aa1):

'std::copy': Function call with parameters that may be unsafe -
this call relies on the caller to check that the passed values are
correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See
documentation on how to use Visual C++ 'Checked Iterators'

Because the warning has to be disabled before any standard C++ header
is included one cannot just fix this locally in qvector.h.

Change-Id: I929f1535656bca9f5beb7fd0d557178370c232c6
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-01-09 13:14:59 +01:00
Kai Koehne
979e0512ac Get rid of QT_NO_QWARNING_MACRO
Just use QT_NO_QDEBUG_MACRO, like we do already for qInfo.

Change-Id: I4b2ef68427fbe6f253fe02a3ab161fa25186e834
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-09 13:14:11 +01:00
Kai Koehne
ef6279fd51 Add QtInfoMsg
Add an 'info' message type that can be used for messages that are neither
warnings (QtWarningMsg), nor for debugging only (QtDebugMsg). This is
useful mainly for applications that do not have to adhere to the
'do not print anything by default' paradigm that we have for
the Qt libraries itself.

[ChangeLog][QtCore][Logging] QtInfoMsg got added as a new QtMsgType.
  Use the new qInfo(), qCInfo() macros to log to it.

Change-Id: I810995d63de46c41a9a99a34d37c0d417fa87a05
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2015-01-09 13:14:05 +01:00
David Faure
4c980aedc1 QStandardPaths: add AppConfigLocation.
ConfigLocation was erroneously inconsistent, by adding the org name
and app name on Windows (unintentionally) and not on Unix (while having
subdirs in ~/.config is actually common practice for some XDG desktops)

Therefore this adds AppConfigLocation, which always has the org name
and app name (while GenericConfigLocation never does).

[ChangeLog][QtCore][QStandardPaths] Added QStandardPaths::AppConfigLocation,
for application-specific configuration directory. ConfigLocation was inconsistent.

Task-number: QTBUG-38872
Task-number: QTBUG-38845
Change-Id: I80fb98f296436261f3996c9df87571c29b06ab35
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-09 12:15:59 +01:00
Marc Mutz
3b9629e8bd QStateMachine: replace a QHash key involving a QPointer
Using QPointers (or any type that makes a QPointer part of its identity) as a key
in any associative container is wrong. They get externally set to nullptr,
violating the associative container's class invariants, which could lead to
data corruption, even though bucket-based hash implementations are less susceptible
than binary trees.

To fix, write a new class that acts much like the old QPair<QPointer<>,QByteArray>,
but uses the QPointer only as a guard, not as part of its identity. To preseve
identity, also saves the naked pointer originally passed and uses that for op==
and qHash().

Change-Id: I4fa5a6bf86bad8fe7f5abe53d7c7f3ad3754d8d6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-09 12:06:23 +01:00
Marc Mutz
65eb573926 QStateMachine: fix some misleading code
The old code creates a RestorableId from the passed (QObject*, QByteArray)
and used it for lookup in a hash table (ok) and as a container for the
(QObject*, QByteArray), satisfying later references to those parameters
from the RestorableId instance instead of using the parameters directly.

Now, RestorableId holds the QObject* in a QPointer, so the code might have
wanted to detect the object being destroyed as part of the operation, BUT:
a) the operation is a read-only one, and b) the code didn't check for
nullness before dereferencing the QObject*.

Fix by moving the creation of the RestorableId into the scope it's used
and otherwise using the parameters directly.

Change-Id: Iaf12f722fe6841ee1a55037fe33a6115aa699aca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-09 12:06:15 +01:00
Marc Mutz
3ecc44d5d2 Docs: e.g. -> for example in qhash.cpp
Change-Id: Ifee0117ddadfaa774fdd575467b03ca5b0baf433
Reviewed-by: Martin Smith <martin.smith@digia.com>
2015-01-09 12:05:51 +01:00
Marc Mutz
315ca08e36 QVersionNumber: use qHashRange()
Change-Id: Ia7cfb8030cded33f4246206392b46d1013067ef3
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Keith Gardner <kreios4004@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-09 12:05:45 +01:00