Commit Graph

1008 Commits

Author SHA1 Message Date
Marco Bubke
c4c3d4cc33 QmlDesigner: Remove findInSorted function
Using std::lower_bound is more generic and we have less code which
could lead to less bugs.

Change-Id: Iacf6ea550182b51a8d5dd6b18a92de68914f4df1
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-04-27 10:26:03 +00:00
Marco Bubke
3862f67b8d QmlDesigner: Improve storage handling in StorageCache
Using an explicit class for the storage not even makes the code easier
to understand but enables the possibility of code optimizations too.

Change-Id: I9239919d3385ba1bf141c23bdc3013b6c1e624ed
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-04-27 10:25:58 +00:00
Marco Bubke
c236a25339 QmlDesigner: Add storage cache
Task-number: QDS-4237
Change-Id: I7d587f615b5e26cc6014ea3a63dedd203fdd35eb
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-04-26 14:52:24 +00:00
Marco Bubke
f69314b6ae Sqlite: Add range getter
Sometimes it is handy to return a range so you can break in a for range
loop. So you can now write:

for (auto [key, value] :
    statement.range<std::tuple<long long, std::string>>()) {
    values.push_back(value);
    if (value == Tuple{"foo", 23.3, 2})
         break;
}

for (auto [key, value] :
    statement.rangeWithTransaction<std::tuple<long long, std::string>>()) {
    values.push_back(value);
    if (value == Tuple{"foo", 23.3, 2})
         break;
}

It will only step over the statement to the break. So you don't fetch
not used values anymore. The second version will add a transaction
around the range.

But be careful. The range is view to the statement. Holding it longer or
reusing it can lead to strange behavior because the state of the
statement is changing.

Change-Id: I90191f7da5a015c7d8077d5bc428655a2b53246c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-04-26 09:42:40 +00:00
Marco Bubke
44b4c461ff Sqlite: Fix sqlite
Missed to remove the not anymore used ResultTypeCount.

Change-Id: Ia150e945bd650cc1e3d19fcb9426621d93fa16c3
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-04-26 09:06:50 +00:00
Eike Ziller
3d1ad9db60 Merge remote-tracking branch 'origin/4.15'
Change-Id: I1d13f3543ab4bb17f0cbfe26bbea3f154f856ca6
2021-04-20 10:42:55 +02:00
Marco Bubke
5203c478a5 QmlDesigner: Add some useful iterator algorithms to NodeListProperty
Now there is iter_swap, rotate and reverse in the node list property. With
that methods we can implement slide too.

Task-number: QDS-4159
Change-Id: Ie7f80f64fd26e517ca696158a878262928dc82c4
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-04-19 12:25:29 +00:00
Marco Bubke
2bf45ec998 Sqlite: Fix handling of blob and blob views
Change-Id: I90c31307ff3299975f820e191085ba93ed8afe0f
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-04-19 12:25:22 +00:00
Marco Bubke
040854c6f1 QmlDesigner: Add node list iterators
Task-number: QDS-4159
Change-Id: Ie6635d87beb66f766b9995f68972b80baa100ed6
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-04-19 12:25:15 +00:00
Christian Kandeler
f307c55eac ClangBackEnd: Fix mis-detection of operator<
Inside the body of a function template, clang reports a different cursor
type for operators in some cases. Make sure we don't mistake such
operator< or operator> as opening or closing a template, respectively.

Fixes: QTCREATORBUG-25596
Change-Id: Ifc357e199ea13e44ac501613639e667c333d48e3
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-04-19 07:51:24 +00:00
Christian Kandeler
c80c724b52 ClangCodeModel: Fix template highlighting bug
We need to take into account that the ">>" in constructs such as
std::vector<std::pair<int, int>> is only one token on the clang side.

Change-Id: I90f002ca56f236032f6d39c338593a2ff7590061
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-04-16 07:02:19 +00:00
Eike Ziller
872660fcc5 Merge remote-tracking branch 'origin/4.15'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri

Change-Id: Ibc60debb3c409ae27e99df6071cf6115b272d6d8
2021-04-15 15:48:30 +02:00
Marco Bubke
76bd140c7c UnitTests: Fix flaky test
ImageCacheGenerator.CleanIsCallingAbortCallback was not waiting for the
expected call.

Task-number: QTCREATORBUG-25580
Change-Id: I43265389a36e568dea7c7ece5524ef597232d049
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-15 12:05:20 +00:00
Christian Kandeler
b88b73d9c1 ClangFormat: Sprinkle some more magic pixie dust
Apparently, we can prevent clang-format from removing line breaks by
adding an empty comment at the end of the line.

Change-Id: Ia78ecb9e7351d059c544cbda11d33af5734e2218
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-12 09:28:55 +00:00
Eike Ziller
c0cfafdd3d Merge remote-tracking branch 'origin/4.15'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp

Change-Id: I403b236c40d73a61ae22304e289e9d4374366395
2021-04-06 15:17:40 +02:00
Christian Kandeler
98012fb89d Unit test: Fix qbs build
Change-Id: I6046fe9b99e288dcd14a763bce9c337ab45c2eb5
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-30 11:15:09 +00:00
David Schulz
33359883f2 Fix qbs unittest build
Change-Id: Ifb7f564217921c9907dd7e300bc1c31ad7ae1536
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2021-03-30 10:25:00 +00:00
Marco Bubke
710b96cc89 Sqlite: Value can now handle blob too
This can be quite handy if we want to handle images in the database
dynamically.

Change-Id: I76b87d6b59e999b043bb2335192c90a371187431
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-03-30 07:30:08 +00:00
Marco Bubke
393c65e34e Sqlite: Use std::byte
Change-Id: Ie5bdbae67f7d0f9e533ad20ddb66d03057df2028
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-03-30 07:30:02 +00:00
Marco Bubke
7785a3a651 Sqlite: Move result count to class declaration
It move the magic number of column results to the sql statement
and improves the mock a little bit.

Change-Id: I101067444cf27ec5dea0c72de7fd484a7e8710f0
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-03-26 12:24:37 +00:00
Christian Stenger
98ac237b7f Unittest: Rename test cases to reflect their content
Amends b746a3e562.

Change-Id: I96e37d31be7efc72533c767c882ffa62967e7a6c
Reviewed-by: Tom Praschan <tom@praschan.de>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2021-03-22 19:59:35 +00:00
Christian Stenger
b746a3e562 Unittest: Fix expectations
Amends 5fcd52fe83.

Change-Id: I68ce291176ab8e095b09ae6f0d64d2564e52cf0f
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-18 10:49:48 +00:00
Eike Ziller
768d4321f9 Merge remote-tracking branch 'origin/4.14'
Change-Id: I214b8d59e8ff7fe0511cd6116ec7725ddc4376ee
2021-02-18 09:26:22 +01:00
Christian Kandeler
dfa24f09ad ClangCodeModel: Show only valid applicable overloads when completing
libclang is smart enough to filter the overloads according to which
arguments have already been entered, so let's make use of that.

Fixes: QTCREATORBUG-650
Change-Id: Ic2711f460c908c6fd9c8efe28c3c63a0ce2d9205
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-02-17 07:09:37 +00:00
Christian Kandeler
74177a559e clangbackend: Work around libclang cursor bug
... involving accessing the member of a nested anonymous union from
within the surrounding class. libclang reports a CXCursor_CXXThisExpr
for this location instead of a CXCursor_MemberRefExpr. However, the
latter is still locatable in the AST, so we can correct this.

Fixes: QTCREATORBUG-25342
Change-Id: I1eba13d5153205a52b3689d8ad52493a56b76c07
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-02-15 12:18:36 +00:00
Marco Bubke
e3d12e659a Sqlite: Add readTo method
There are cases when you want to read to an already existing container.
This will prepare for the RETURNING extension in the next Sqlite version
where you can write and read. That will simplify quite some code.

Change-Id: I740ffbedecf72bb5518392f3707a0a6b2221db56
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-02-15 10:39:45 +00:00
Marco Bubke
18fe4233f8 Sqlite: Add callback method
Sometimes it is better to have a callback instead of returning a container.
The call has to manage the state if an exception is called but otherwise
it will reduce the memory footprint. There will be to a RETURNING
to Sqlite which will read back values as you write.

Change-Id: I7eb49850e2c76f883a03277b31c5e713e9774c92
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-02-15 10:39:30 +00:00
Christian Kandeler
5f5f38e028 ClangCodeModel: Support "parentheses" matching for ternary operator
That is, show which ":" belongs to which "?" when the cursor is on one
of them.

Fixes: QTCREATORBUG-1410
Change-Id: Ie19360b3dfc82d92c264d99a5aa1864eda66e5c8
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-02-11 08:52:17 +00:00
Marco Bubke
e34eb170dc QmlDesigner: Add an reason parameter to the image cache abort callback
Sometimes we abort the request, sometimes it failed. In the first case
we maybe want the cancel the imageprovider request, in the second we
return an empty image.

Fixes: QDS-3388
Change-Id: Iaef76aa09ac734795f86447e1a7cf6a5c7b5ae81
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
2021-02-01 16:24:16 +00:00
Marco Bubke
62582877f6 QmlDesigner: Fix flacky test AsynchronousImageCache.WaitForFinished
Change-Id: I94afa8ec2925b85f5dbf44e7b2ad5db484f48148
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-02-01 16:06:23 +00:00
Marco Bubke
6a0cfc0c6e QmlDesigner: Fix flacky test ImageCacheGenerator.WaitForFinished
Change-Id: I7c08ec68d20a54e125805ad98f87879c99b1aad3
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-02-01 16:06:19 +00:00
Marco Bubke
1cf09e5979 QmlDesigner: Compress generator tasks
A document change can generate new image request and if the are not in the
database new task for the collector are generated. But if there are already
tasks for an equal id they would generated twice. So the tasks are now
merged. The auxilialry data is not merged because it is expected that
it is not changing.

Task-number: QDS-3388
Change-Id: Id1aceb564dd9dc7c5a1ea5ae4680d7ee36611cda
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-02-01 16:06:13 +00:00
Christian Kandeler
11d1b8bb4c Unit test: Add missing switch cases
Amends d8c1e51bfe.

Change-Id: Ida799fdf3ac8da78c892f4f6823009a33b65340b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-01-26 09:52:53 +00:00
Eike Ziller
aae3bf4ef7 Merge remote-tracking branch 'origin/4.14'
Change-Id: I516e87eed1b716ec085095c9dd4f47f04a99de7c
2021-01-25 09:06:36 +01:00
Christian Kandeler
bfb63acb09 clangbackend: Fix missing completion for private member functions
... when trying to complete the name of a function definition. libclang
tags such completions as "not accessible", even though we are not in a
call context.

Fixes: QTCREATORBUG-25244
Change-Id: I4b03b1a43be7a85c37c7d2b2bfe2d83112075674
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-01-22 14:49:54 +00:00
Christian Kandeler
d8c1e51bfe ClangCodeModel: Support highlighting angle brackets
... in template declarations and instantiations.

Fixes: QTCREATORBUG-16799
Change-Id: I82bc6411ca980ecbe2a6c70ae37580166a4b89e9
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-01-22 10:48:33 +00:00
Marco Bubke
7dc72c533e QmlDesigner: Improve imagecache
Instead of coding some arguments to extraId(state) we provide now a
std::variant there extra arguments can be saved. Because it's a
std::variant it can be easlily extended by new structs. There is a new
synchronous interface too. It has an extra method for QIcon which saves
icons in an extra table. It would be even nicer if we would have a
mipmap image too. So we could do it asynchonously too but so far it works
only in the main thread.

Task-number: QDS-3579
Fixes: QDS-3584
Change-Id: If368d84d82308a91a5f4f037021e749c9ef868ed
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-01-21 13:14:28 +00:00
David Schulz
7fc015aca9 UnitTest: Fix debug qbs build against release llvm
Change-Id: Iadc073f3904123f62b642843bd94935476055555
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-01-08 13:36:10 +00:00
Tim Jenssen
b801a9339d Merge remote-tracking branch 'origin/4.14'
Change-Id: I70504e096be620434f38cd990c593950da8b24ba
2021-01-07 14:23:46 +00:00
Marco Bubke
b11d8aa92a Sqlite: Update Sqlite from 3.31.1 to 3.34 and adapt carray
You can now pass everything you can convert to a span directly and bind it
with a carray instead of using the pointer interface. This is working for
int, long long, double and null terminated C strings.

Change-Id: I274c218e2dec0f11e68576545bb78601f85462bd
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-01-06 14:41:01 +00:00
Björn Schäpers
8987996500 clang-tidy: Suppress clang warnings
Those warnings should be printed via the clang code model, which can be
fine tuned to (de-)activate warnings. The clang-diagnostic-* warnings
from clang-tidy are not shown in the dialog an thus can not be
selectivly activated by the user.

Change-Id: I80b2cad227a9fd8fa0de253c73c40abfa8076be6
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-12-15 19:38:30 +00:00
Eike Ziller
1e78fdb71f Merge remote-tracking branch 'origin/4.14'
Change-Id: Id4c4c06b086dfe38960f4d68694ae23f3e00109f
2020-12-03 11:57:42 +01:00
Christian Kandeler
990aa5e45b CppTools: Adapt autotest
Amends 370804c2ab.

Change-Id: I054a44948cd4a473ae22284d7669c4a7adb2fc86
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-12-01 10:15:04 +00:00
Christian Kandeler
aabdbb7d9e clangbackend: More libclang cursor adjustments
Fixes: QTCREATORBUG-21856
Change-Id: I034b463238b4b8da4c36f95cacab79adf94c11eb
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-11-30 11:35:24 +00:00
Eike Ziller
8245523653 Merge remote-tracking branch 'origin/4.14'
Conflicts:
	src/plugins/designer/cpp/formclasswizard.h
	src/plugins/designer/cpp/formclasswizarddialog.h

Change-Id: I9f9d166e1a9249022305503f9cbe571136c2a2b1
2020-11-25 11:25:34 +01:00
Eike Ziller
eaec56e6b6 cmake build: Fix issue with tests and CMake < 3.14
For the CPlusPlus target the target sources contain
"$<TARGET_OBJECTS:3rd_cplusplus>" with older CMake versions.
Looks like that was fixed in CMake 3.14.
Work around it by removing TARGET_OBJECT entries, which we definitely
don't want.

Change-Id: I036720f122aa2d0727e85b611f1e32c65fae57ae
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-11-24 09:55:11 +00:00
Christian Kandeler
0d12c8cba8 clangbackend: More cursor adjustments
Fixes: QTCREATORBUG-21534
Change-Id: Ia8a6f277b186bd6decdfec26bfca30b36802c1c2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-11-23 13:03:34 +00:00
Christian Stenger
6b62a99a8a cmake: Fix building debug with release libclang
Parts of QC cannot be linked against a release build of clangTooling
libs and vice versa when building on Windows.
Check whether the provided libs match the current build mode and
disable respective parts if necessary.
Re-use this information to decide whether unittest should be build
or not.

Change-Id: Ibc2aab0d7886e78ebbf8f15a43152efad49f1eff
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-11-23 11:07:49 +00:00
Christian Kandeler
b0dd6b748f clangbackend: Try harder to get the proper cursor
... in cases where it appears that clang_annotateTokens() did not do
what we wanted.

Fixes: QTCREATORBUG-21522
Change-Id: I272061cb6c4b51a5d779ace5b4e06912c0a386e5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-11-23 09:59:27 +00:00
Eike Ziller
5ca70bdcb3 Merge remote-tracking branch 'origin/4.14'
Change-Id: Iea84f23cf394de13e99a9ed777c8c113e4eff473
2020-11-19 15:38:13 +01:00