Commit Graph

14 Commits

Author SHA1 Message Date
hjk
41046c0d44 LayoutBuilder: Initialize BuilderItem::apply more directly
Also, add some timing information.

Change-Id: I5d38cac9e7ad0afb24504ff521f31d5202268462
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2024-07-18 09:59:01 +00:00
hjk
a0c8d8c0b4 LayoutBuilder: Update manual test to latest syntax changes
Change-Id: I9bf07e4ae896df0640a81847d33514b1f488a024
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2024-07-17 14:43:38 +00:00
hjk
878d4c74b7 LayoutBuilder: Add object guard in slot
Change-Id: I1912c206f5056cb19a8a7b73cfbe4dfd45978a2a
Reviewed-by: hjk <hjk@qt.io>
2024-06-28 07:35:15 +00:00
hjk
1c9242bab2 LayoutBuilder: Potentially save a few cycles
... by not actually creating the unused instances of the Id types.

Change-Id: I6955046fa1b457ea70d36090d3bf0051b31dfdaa
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2024-06-04 10:52:59 +00:00
hjk
308fb3f3fd LayoutBuilder: Update demo
Backport the learnings and simplification from the real use to
the demo case.

Change-Id: I3f501b03c760484961bfd586735c0db53ba080db
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2024-05-28 05:51:05 +00:00
hjk
acf1ecb47f LayoutBuilder: Complete experimental implementation
This adds support for inheritance to the existing experimental
implementation in tests/manual/layoutbuilder/experimental
and gets rid of the tight coupling and qobject_casts in the
setter implementations. Plan is to use this (minus "bindings"
via *::Id / id()) for utils/layoutbuilder.{h,cpp} later.

The "binding" support via id() is still experimental, and in
its current version not really useful. A possible idea would
be to re-use the Tasking::Storage idea, but it's not quite
clear how to expose that "long distance" (i.e. across multiple,
unrelated top-level builders). However, this is not used in
in current uses of the "old" layoutbuilder, so this is not
blocking anything.

Some notes:

The *Interface hierarchy is not strictly needed, it could directly
act on things in the QObject hierarchy but would then need #includes
of all "buildable" classes, which can be avoided in the current
implementation. Besides, the indirection allows us to tweak and/or
add functionailty to the Qt classes in the indirecting code, that
does not necessarily have to match 1:1 to the underlyings Qt classes.

The std::function based callbacks are quite fat and not functionally
needed and could be dropped  by "inlining" the relevant bits from
typical std::function implementations. However, these invariably seem
to end up calling functions through pointers to (ABI-compatible, but)
different types, which is for /user/ code formally undefined behavior
according to C++11 §5.2.10/6. To avoid a discussion whether doing
the same ourselves is tolerable or not, this uses std::function
and pays the price of the overhead.

Change-Id: I6d40c1bd48cf065fcf211eaff8d9a2298bca20eb
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2024-05-16 12:06:06 +00:00
hjk
123793fbb1 Utils: Add an 'If' LayoutItem
Change-Id: I700e28d03b6dc39e96fa969152f236760989bdb7
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-08-15 13:03:11 +00:00
hjk
02ac595a2e LayoutBuilder: Add some playground for potential implementations
Change-Id: I0955c503dc03f9e4d81d6cfe4df7af63cf86a638
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-07-05 14:26:06 +00:00
hjk
2e7930b56e LayoutBuilder: Rename Id to ID
The Id was only used in the demo. "ID" is Not exactly canonical naming,
but this clashes often with Utils::Id, so mis-spell until we settle on a
proper name.

Change-Id: I6fdf806c41abf224f7422ec6c9263db3eb357190
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-05-10 04:59:13 +00:00
hjk
cc45afdfb0 Layouting: Avoid a lambda in the demo
Change-Id: Ic11936fd2a6da2153a52e39249d49d174ffb8466
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2023-05-08 06:58:17 +00:00
hjk
62f3d29be4 Layouting: Introduce Ids for Items
Intenally just wrapping a 'bindTo' result, but less trigger potential
for pointer related peladophobia

Change-Id: I25171a2675fb0474ce97c04552ac1cf5ffd6ee56
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2023-05-05 15:08:23 +00:00
hjk
d5329d56b6 Layouting: Add demo
Currently almost the same as the comparison example, but planeed to
grow.

Change-Id: Id129266a1b5b12438e2fb643ee114e6d816581f6
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-05-05 13:09:02 +00:00
hjk
70b02d23e1 LayoutBuilder: Rework
Everying is a LayoutItem now, and everything is split into
a proper setup and execution phase.

Execution happens only via LayoutBuilder (directly or via
convenience wrappers in LayoutItem).

No direct access to the widget in creation, funnel out is
via the new bindTo() facility.

Change-Id: I7eb38fd736ae57a68f9a72a6add5c767da82b49f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-05-03 13:44:02 +00:00
hjk
3e953f4896 Layouting: Add some example code as show case
Change-Id: I92842c7859514397748e744949688090154772df
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-05-02 08:58:20 +00:00