Commit Graph

11663 Commits

Author SHA1 Message Date
Robin Burchell 6f84a09dfb QQuickWindow: Process a synthetic hover once per frame
This removes the limitation that hover only changes when the mouse moves, and
(in my opinion) is required to make hover functionality even remotely useful.
QtQuick scenes are a dynamic medium, items can move (or change) frequently, so
only changing this in response to a user action means it will frequently end up
out of date.

A very simple example of this is a ListView of delegates that each have a
background set on hover: when flicking the list, it won't reset the hover to
actually match the item under the mouse.

This is now not a (very) expensive operation to do, as deliverHoverEvent
does nothing if the item tree in question doesn't have hover enabled.

[ChangeLog][QtQuick][MouseArea] Hover state is now updated once per frame.
This means that MouseArea::containsMouse property will now be correct even
if the mouse is not moving, but items move under the cursor.  Likewise
the mouse position properties and positionChanged signal will act as if
the mouse had moved.

Task-number: QTBUG-40475
Task-number: QTBUG-42194
Task-number: QTBUG-33982
Task-number: QTBUG-42578
Task-number: QTBUG-52537
Change-Id: Ic2dcbb45339e11c07f5c6a9c95eb7f64957968eb
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
2016-05-26 17:37:41 +00:00
Erik Verbruggen 0ac9389dbd QML: re-use event objects across signal emissions.
This change creates a single key/mouse/wheel event for use in signals,
and re-uses that event across emissions. This prevents allocating a new
event (and it's QObjectPrivate data) for every key press / mouse move /
wheel spin.

Change-Id: I395f6ce3ed8588157e4175c8481351b330793fac
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2016-05-26 14:33:57 +00:00
Simon Hausmann 8457ca1b3d Simplify object to id-in-context mapping
By storing the calculated integer id for an id-named object in
CompiledData::Object we can simplify the code and replace a hash table with a
plain vector.

Change-Id: I4a84cdd00e98766d603d152e5a6574b232771a02
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-26 11:33:00 +00:00
Simon Hausmann 899c1ef0f7 Add a flag to CompiledData::Object record component boundaries
This allows simplifying some code and reducing the usage of the objectIndexToId
hash maps.

Change-Id: I1f08d4b224c4f9fa498d90471fa545ae4e4f2af4
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-26 11:32:56 +00:00
Erik Verbruggen 2cb3466baa V4: fix all pedantic warnings
- signed/unsigned conversions
- size conversions (i.e. int<->long)
- padding issues inside MemoryManager::Data

Change-Id: I3770de2c187d1520d98e2322d682b3ecc9a14671
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-26 08:59:25 +00:00
Simon Hausmann a548679d0c Minor cleanup of pool array allocation
We store the CompiledData::Function indices for a give QML object in a fixed sized
array in the memory pool in the IR. That array can be stored as pointer/len pair
directly, there is no need for another pointer indirection.

Change-Id: Iccad465ab873e0e7203dc563abb67cf6354a8bfd
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
2016-05-26 04:18:41 +00:00
Frank Meerkoetter 573356464b Fixed another batch of QHash/QMap::values() (mis)use
Avoid memory allocations.

Change-Id: I0b4cbef6a8c22184781a44d92172d93ac38e778c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-05-25 19:27:33 +00:00
Jan Arve Sæther b88e0091de Add QQuickWheelEvent::inverted()
When handling wheel events, it's useful to know whether or not
"natural" scrolling was enabled on platforms like OSX where
the scrolling direction can be reversed. It's especially useful
when implementing components like Slider (see QTBUG-35972).
This will soon be needed in QtQuick.Controls because we plan
to remove the WheelArea.

Change-Id: I2770e0aa39e7e54511d7f9f7cc12760580a55e5c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2016-05-25 11:31:38 +00:00
Erik Verbruggen 5f3b1e8125 V4: Get more code inlined in the MemoryManager.
Change-Id: I7cf6c5d3458b0c43283e63a7300ee9965ba803fb
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
2016-05-25 08:22:40 +00:00
Simon Hausmann 0ba6dffd96 Get rid of QQmlCompiledData::rootPropertyCache member
This would not seem like a member variable that is hot enough to keep there and
it is two loads away.

Change-Id: Id7088771bd33545a2846cc3497e5904dd8ac4f5d
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-24 14:08:26 +00:00
Simon Hausmann a681465023 Get rid of QQmlVMEMetaData
It is unused now and we can remove it as well as its QByteArray based storage.
The non-emptyness of the meta-data QByteArray was also used to indicate whether
it is necessary to create a VME meta-object when instantiating an object. This
bit is now folded into the flag of the QFlagPointer storing the property
caches.

Change-Id: I3c3604c61ff16a4e76912e68b1c19afdb0f2bd9d
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-24 14:08:23 +00:00
Simon Hausmann 6f4c8ff345 Fix compilation
Add missing qdebug.h include after some header file changes in qtbase.

Change-Id: Ie3bc9469650c954596a03fb471765767149b8f05
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2016-05-24 14:08:21 +00:00
Simon Hausmann 70c536b047 Get rid of QQmlVMEMetaData::AliasData
The remaining signal index for the changed signal of the alias target
is something that we need only once (when doing the initial alias endpoint
connection) and then we can retrieve it from the property cache.

Change-Id: Ifbd4625f9af3ca00c9b916eee5c82f58450d54ef
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-24 14:08:18 +00:00
Simon Hausmann 641beae327 Merge "Merge remote-tracking branch 'origin/5.7' into dev" into refs/staging/dev 2016-05-24 14:08:15 +00:00
Liang Qi 8ae479a8ea Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	src/qml/jsruntime/qv4engine_p.h
	src/qml/jsruntime/qv4runtime_p.h
	src/qml/qml/qqmldelayedcallqueue.cpp
	src/qml/qml/qqmlvaluetypewrapper.cpp
	src/qml/qml/qqmlvmemetaobject.cpp
	src/qml/qml/v8/qv8engine_p.h
	tests/auto/quick/qquicktext/tst_qquicktext.cpp

Change-Id: I3f0608c7beb88088cbbef4d0db59920f56deaea9
2016-05-24 14:00:39 +02:00
Simon Hausmann ec2b2a5f5d Fold QQmlVMEMetaData::Alias::flags into QV4::CompiledData::Alias::flags
We only need one bit, so this is easy to merge.

Change-Id: I98bf882b8c1bf10f2172a9e22331d621985d3ed4
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-24 05:55:06 +00:00
Simon Hausmann 46c6db6f58 Shrink QQmlVMEMetaData::AliasData
We can retrieve the alias property index from the QV4::CompiledData::Alias and the
property type from the property cache (only needed for aliases to value types).

Change-Id: Ibf0cb909a4cd1ce1c2d67b57e1be1de491d4d598
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-24 04:04:26 +00:00
Simon Hausmann 81dfb0bdeb Remove QQmlVMEMetaData::AliasData::contextIdx
We can store the id (in QQmlContextData::idValues) for the alias target in the QV4::CompiledData::Alias.

Change-Id: I3f32648aef28d96ddedff6b3d2cde75969a46fa1
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-23 20:35:10 +00:00
J-P Nurmi 15b2e6da74 Use the pre-defined QQmlExtensionInterface_iid macro
The others were changed in 5.6 commit 392c7b9. These are the last
remaining occurrences in 5.7.

Change-Id: I1b17e35b0d1dda6ad598c6c30727c1728b688074
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-05-23 20:34:49 +00:00
Simon Hausmann 1337e0d082 Shrink QQmlVMEMetaData
The count of properties, aliases, signals and methods is also accessible through
CompiledData::Object.

Change-Id: I4693ea672b643cdaabf752c3f0d71abdcc032395
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-23 09:02:24 +00:00
Simon Hausmann 16067fd85c Remove dependency of QQmlDesignerMetaObject to QQmlVMEMetaData
The constructor will use "fake" VME meta data if the provided QObject has a VME
meta object - that is the behavior of the vMEMetaDataForObject(object) call.
The QQmlVMEMetaObject constructor will set hasVMEMetaObject to true
unconditionally. By detecting the use of the fake meta data we can restore the
hasVMEMetaObject flag to what it was before. As I would like to remove the VME
meta-data, this patch removes the dependency to the meta data as a way of
detecting the situation where we have to restore the hasVMEMetaObject flag.
Instead this is done explicitly in the factor method that calls the constructor.

Change-Id: I9c5cbfbd8fb41ca65c597669ee04c1c5694dee2a
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-23 08:59:38 +00:00
Simon Hausmann 7f7e2b0c9c Simplify VME meta object meta-data
For each type of VME meta object we store an array of integers holding the
meta-type ids of the QML declared properties. We can replace that array with
access to the QV4::CompiledData::Property entry for each property, where the
type is also accessible.

This is a fairly straight-forward change, except for the bit in
QV4::CompilationUnit where we delay the release of the CompiledData::Unit and
friends until the destructor instead of releasing it at unlink time. That
should be a safe change and is necessary as there are a few tests around where
the VME meta object still needs access to this meta-data at a very late stage
in the life-cycle right before the deferred deletion is run.

Change-Id: I431de15d12766df837c0e0251192df16a5a76868
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-23 08:59:34 +00:00
Simon Hausmann b0377f4581 Optimize property/alias data structures
We used to store property declarations and alias declarations in the same
properties array in CompiledData::Object. However at run-time the
QQmlVMEMetaObject implements them separately, using separate data structures
(in the meta-data) and (most importantly) using separate property id segments:
First the properties, then the aliases. By reflecting the same separation in
CompiledData::Object with property arrays and alias arrays, we can pave the way
for getting rid of the meta-data in QQmlVMEMetaObject.

Change-Id: Ia84813fe3da6f3fdbd4d2b16136a8bf11fa175a6
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-23 06:35:16 +00:00
Simon Hausmann 02c384e48d Save a little bit of memory per declared property
We only need one bit for the flags, to save four bytes.

Change-Id: I73cbf8c2ef8b532dfe494b1b31ab242cccc38686
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-20 14:18:36 +00:00
Erik Verbruggen 607320ca9f V4: allow inlining of ExecutionEngine::{qml,js}Engine()
All other changes are just to be able to include qv8engine_p.h in
qv4engine_p.h

Change-Id: I71ba2ec42cdc20d5c7d97a74b99b4d1ada1a5ed8
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-05-20 13:44:13 +00:00
Erik Verbruggen 41a426d781 V4: create a fast-path for QObjectWrapper::wrap
The typical case is that there's already a QQmlData for a QObject, so
fast-path this, and fall back to the general case if there is none (or
it is deleted, etc.)

Change-Id: I00c890e5fe7abdd743c4e99316a7ce93eb3db9df
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-20 11:15:00 +00:00
Ralf Nolden 106054d3f5 Always use ::copysign instead of std::copysign where available
Change to remove the Q_OS_ANDROID define for using ::copysign there
instead of std::copysign as other systems are affected as well
(FreeBSD 9.3 with gcc 4.8 in particular). The distinction does cause
more problems than simply using ::copysign everywhere.

Change-Id: I1fe42fdee9c1c1bbb3e5930573ff29c600dfb5e0
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2016-05-20 10:20:49 +00:00
Simon Hausmann 5e841b26ee Minor optimization for VME meta objects
Instead of storing the methods of a qml object in an array of persistents,
let's just store them in the same member data array we also use for properties.
That reduces the amount of persistents and saves one pointer per instance.

Change-Id: I1ad1d9ec76b78fce01bc6ded7eaf536cb99dd245
Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-20 09:36:45 +00:00
Kai Koehne 541eb6b704 qmlplugindump: Allow dumping of WebEngine plugins
WebEngineView requires a shared opengl context. The plugin checks for
this when initializing.

Change-Id: I686b9c22be95f7ef16ea68ea49b8f9aee47789ae
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
2016-05-20 09:12:09 +00:00
Kari Hautamäki afd01a7341 Don't render when width is zero and elide is not None
Works now similarly as with very small text lengths (smaller than
elide characted length).

Change-Id: I0c4aafbcc50343bb0ec8b5f335045e1048a499fd
Task-number: QTBUG-34990
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
2016-05-20 08:20:07 +00:00
Erik Verbruggen ad069828db Fix compiler warnings.
Fixed a whole bunch of the following warnings:

warning: 'interface_cast' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]

Change-Id: I6cd6c16a6465d23e5e7c61d04ba87652df727bc1
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
2016-05-20 08:18:12 +00:00
Liang Qi 63ec33e79c Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp
	src/qml/jsruntime/qv4engine.cpp
	src/qml/jsruntime/qv4engine_p.h

Change-Id: I89ffccd699bee675732758d039e22224b275d60d
2016-05-19 20:41:34 +02:00
Simon Hausmann 219873c65f Fix regression with assignments to default properties
With commit ad8d760dec the precision of the
location (row/column) fields was reduced. The same fields are used to preserve
the insertion orer of bindings as they appear in the .qml file, which meant
that for large qml files without any line feeds we may end up with an overrun
in the column range (2048). This happened in the
Tests_TabView::test_mousePressOnTabBar test in qtquickcontrols.

The reduced precision is fine because those column/row fields should only be
used for error reporting. In this case where we need the precision we can just
as well use the file offset in the temporary QML-IR Binding data structure.

Task-number: QTBUG-53115
Change-Id: Ifb6f76b4f83a06fa228211134d12cc67c071bbec
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
2016-05-19 12:46:28 +00:00
Simon Hausmann ef6469a959 VME Method object data cleanup
Get rid of the redundant MethodData meta-data that is stored per-type.

Change-Id: I9faa284bdd0c9f0c9ebb3c66905ab5e34a9ee3a4
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-19 12:12:35 +00:00
Simon Hausmann a5626dbe67 Minor VME meta object context handling cleanup
There is no need to go through the public QQmlContext in order to retrieve
the QQmlContextData the QQmlVMEMetaObject is associated with.

Change-Id: I648454c217fa594d4017c3af67848eacab55edfc
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-19 09:20:46 +00:00
Simon Hausmann 7d5ce4284b Cleanup
Remove two dummy forwarding functions

Change-Id: I053f9aecc761772c932550a0ddbea390621049c1
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-19 09:20:43 +00:00
Liang Qi afc84775ef Merge remote-tracking branch 'origin/5.6.1' into 5.6
Change-Id: Ib7f8c60143c1efab279476dba390a3d9837ccc37
2016-05-19 06:34:04 +02:00
Simon Hausmann d63a75164a Merge "Merge remote-tracking branch 'origin/5.7' into dev" into refs/staging/dev 2016-05-18 14:24:43 +00:00
Simon Hausmann 5861dc4869 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	src/qml/qml/v8/qqmlbuiltinfunctions_p.h
	tests/auto/qml/qqmlqt/tst_qqmlqt.cpp

Change-Id: I9dd93732f4b19513576ca1dd89ae18c69de0203b
2016-05-18 15:17:37 +02:00
Ulf Hermann c78a4dcb61 V4 profiling: Don't needlessly resolve locations
Resolving locations is fairly expensive and we only need to do it once
per location.

Change-Id: I8716858f45da9c085e50527ada0611531641dafe
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-05-18 10:10:15 +00:00
Simon Hausmann 72515ebe5a Fix crashes when incubating objects asynchronously with initial properties
This is a regression from commit 94e337fa95 where
we accidentally ended up not having a calling QML context set anymore when
initializing the properties on newly incubated objects as provided by the
caller. The QML context is necessary as for example when we set a URL property,
the URL can be relative and it will be resolved to the base url of the context
when written, such as in in QQmlPropertyPrivate::write.

Change-Id: I1d896381fc92f653a7d76f4d82174bca48828f5e
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-18 10:08:30 +00:00
Simon Hausmann 6371b208a9 Revert "Remove this piece of code"
This reverts commit bad007360a.

The lookup in the global object is necessary to detect whether we've seen any
unresolved properties. This is used for the optimization of skipping binding
refresh updates when a context property changes.

Task-number: QTBUG-53431
Change-Id: Idb39a32e4b58b915496bbb9d8a098dc17a6f688a
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-18 07:44:45 +00:00
Oswald Buddenhagen 87cf6b7ae7 standardize on QT_CONFIG debug_and_release instead of build_all
the two flags are equivalent. use the same one everywhere.

Change-Id: I9ac0caad5a9a8d37813f8de4d81067e20656abc5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-05-17 15:31:44 +00:00
Robin Burchell 064dc6a29b QQuickTextInput: Remove redundant centerPoint calculations.
The default is to press/release in the center of the window, so we don't need to
DIY.

Change-Id: Id65b2b54c15d45e8d780a008d05275718f519a71
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-05-17 15:21:17 +00:00
Simon Hausmann 709f637088 Re-apply the cast part of commit 392c7b9934
We reverted this in 6f59c91c51 to avoid further
breakage in a patch release. Now let's do the right thing in the next minor
release and replace the qobject_cast on the instance with the IID check that
won't require instantiating the plugin in the qml loader thread.

[ChangeLog][QtQml][Important Behavior Changes] When the engine looks for QML
modules / extension plugins in statically linked applications, the plugins are
not instantiated in the qml loader thread anymore. For this to work however
it is necessary for plugins to use Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
in their class declaration instead of hardcoding the interface id as a string
literal.

Task-number: QTBUG-52012
Change-Id: I45fe8b9fec23b3d0408b7ee79ce297c7d47ce36d
Reviewed-by: Sebastian Lösch <Sebastian.Loesch@governikus.com>
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
2016-05-17 12:57:48 +00:00
Ulf Hermann 4b4cf31c7a QQuickWidget: update() when resetting updatePending in showEvent()
If updatePending is set, that means we want to call update()
eventually. If we just reset updatePending without calling
update(), we produce UI glitches.

Change-Id: Ie7353b2f5da567e196dbee8c113920e0e4702304
Task-number: QTCREATORBUG-16022
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2016-05-17 10:24:10 +00:00
Erik Verbruggen 27567f7c4c V4: Use built-in overflow checking add/mul for index calculation.
This signals the compiler the actual intent (i.e. it doesn't rely on
unsigned int overflow behavior) and even allows for slightly better
code generation.

Change-Id: I915ebbeab2e60decb6adf816e9cf010ab41d172a
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
2016-05-16 12:32:56 +00:00
Simon Hausmann 74628af12a Added changelog for 5.6.1
Change-Id: I272452ccc5f6154927b153d033683a0bf07e06c8
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
2016-05-16 04:25:23 +00:00
Simon Hausmann 1c51ae2911 Fix visibility of properties in value types
It should be possible to enumerate the properties of value types (gadgets),
in order for things like JSON.stringify(Qt.point(10, 20)) to return something
sensible.

Task-number: QTBUG-43382
Task-number: QTBUG-34878
Change-Id: I3a2c09151ebe97fd97760dfbbf5a4f58e022bc94
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
2016-05-15 18:35:15 +00:00
Frank Meerkoetter 35d8d4bc2b Do not initialize twice
Change-Id: If801f84b90fa1335a019751dc097568202aa4750
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-05-14 04:46:12 +00:00