Commit Graph

236 Commits

Author SHA1 Message Date
hjk
454e8a31e2 Analyzer: Base ISettingsAspect on Utils::AspectContainer
Change-Id: Ib4c19d0cb167911dc50d989771dd53f3569db087
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-12 13:15:13 +00:00
hjk
7471c3a378 Utils: Provide a method to set total cell span for aspects
Only row span used currently in some base aspects, can be
extended once needed.

Used in the Perf config widget to correct recent change.

Change-Id: I37fae178cbfb8d493e0232e53e877d0e317ec9f2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-09 07:08:22 +00:00
hjk
fa2129f76b Utils: Add a SelectionAspect way to pass values to QComboBox::itemData
Change-Id: I428fbb5deb66163e7c0a7561eb44c315db1ed823
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-08 07:51:24 +00:00
hjk
ba06114afa Utils: Improve handling of BoolAspects used for checked QGroupBoxes
Make the group box a registered subwidget of the BoolAspect, so it
properly triggers the necessary behavior in BaseAspect::isDirty.

Change-Id: I9f6291d87ef7ce4067e0d235de8b5be24de79a93
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-06 11:28:08 +00:00
hjk
6b82af5990 Utils: Make AspectContainer a QObject
... and add a 'void applied()' signal.

I actually wanted to avoid that, but it seems to be a recurring
pattern of usage to do something on top of plain apply for all
children, like triggering IVersionControl::configurationChanged
in the VCS plugins.

Change-Id: Ib64c3147c6ba30b178237e51a3a377a291c550f2
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-04-01 16:03:50 +00:00
Christian Stenger
f48586b8d8 Utils: Clear button storage after their deletion
Change-Id: I26650c645de67f5b1577f7c3a665f28397a64eec
Reviewed-by: hjk <hjk@qt.io>
2021-04-01 09:27:30 +00:00
hjk
cfae2812e7 Utils: Fix enable update for explicitly disabled StringAspects
The generic update that is triggered on all major interactions
did not take a explicitly set disabled flag into account.

Change-Id: I026bc0817ce534e92cfdd631beebcb80ddf7e6dd
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-01 09:26:48 +00:00
hjk
968d083631 Utils: Introduce a SelectionAspect::volatileChanged
Analog to BoolAspect::volatileChanged for cases when the availability
of some other aspect, line edit, ... is governed by a specific state
of a combobox.

Change-Id: I5c7903dde21ab997e799568b20a01308a25c4397
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-01 09:01:00 +00:00
hjk
cbc26f5dce AutoTest: Aspectify CatchTest settingspage
Change-Id: I281891fecdcd97e4ec450a795d51981cfb47ef69
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-31 12:10:45 +00:00
hjk
1d04466628 Autotest: Use LayoutBuilder for QtTestSettingsPage
Change-Id: I6f454bedbe0f1d2b9a1a14c146e35bcf41752533
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-31 11:56:36 +00:00
hjk
4cc6fef901 Utils: Merge BaseAspects and AspectContainer
They were quite similar, largest difference was the ownership of
subaspects, which is now handled by a bool property.

Change-Id: Ib3f2f20b9a84ef40ea8a9eb59da9c89c9a281750
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-03-31 11:56:04 +00:00
hjk
09f632d4c7 Utils: Delete aspect subwidgets one by one
Items deleted in finish() trigger via the connect in registerAspect their
own removal from m_subWidgets, invalidating container iterators used
by deleteAll().

The re-ordering to back-to front does not make a difference, I'd
still to destroy things in reverse construction order.

Change-Id: Ibb17da7cdc67013d744b159aa33fd1d119080e3b
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-29 12:38:25 +00:00
hjk
6a6e7c90df Utils: Add a StringAspect::valueChanged signal
Similar to what BoolAspect already has. Will help with the NimSettings
page.

Change-Id: Id373cd21769c129fb8329d9102ccfd97675e8d24
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-29 05:28:25 +00:00
hjk
7651601f19 Utils: Introduce a standard way to have a Reset button for StringAspects
Resets line edit contents to defaultValue(), disabled if current
contents is the default.

Usable later for BuildPropertySettings

Change-Id: I1fcbcfb8664eb7f66de62a6606d8d7556026f468
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-26 07:06:09 +00:00
hjk
bfe398072d Utils: Allow nested groups for settings keys
Will be helpful for the Autotest settings

Change-Id: I83a1cc27021124a14d8e8023164f20ede6c4d80e
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-25 13:40:32 +00:00
hjk
641bccacf1 Utils: Actually delete subwidgets on finish()
In the context of option pages, finish() means that the dialog is
dismissed somehow. Keeping the widgets around for subsequent re-use
is ok in principle, on the other hand it's a matter of hygiene and
give a defined clean slate next time addToLayout() is used.

This has not much practical impact yet as most option pages do not
forward finish() to their aspects right now.

Change-Id: Ifd591e3fa0d07c7943e86eb5474429efae2887f9
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-25 10:42:16 +00:00
hjk
b7b41f7cc3 Utils: Fix SelectionAspect with radio button display
Register subwidgets to make non-autoapply work.
Also delete the parent-less button group on destruction.

Change-Id: If6fb306a812c8aa950535dd138a2020145d80c34
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-25 10:36:11 +00:00
hjk
bc97b10488 Utils: Only set SelectionAspect value automatically if requested
This is in line with what the other aspects do. Without this,
non-auto-apply aspects behave as auto-apply, even if marked with
setAutoApply(false).

Change-Id: I39192f63bb3b6e47ee181527938c19ee5044a5ec
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-25 09:04:13 +00:00
David Schulz
c3ab90e30f Utils: directly use default value if settingsKey is not defined
This saves one value > variant > value transformation.

Change-Id: I16e5c464017fdcc0b9a07b895bbe90423022ac83
Reviewed-by: hjk <hjk@qt.io>
2021-03-25 08:15:29 +00:00
David Schulz
321652be19 Utils: prevent crashes in SelectionAspects
Change-Id: I21315f1cbbc43948f00f00dbef777fa82c9606f5
Reviewed-by: hjk <hjk@qt.io>
2021-03-24 14:04:18 +00:00
hjk
77dc087250 Utils: Allow aspects to modify values for loading and saving
In some cases it is useful when the persistent value is not the
internally used actual value, e.g.  Having the displayed string
of a SelectionAspect instead of a numerical index makes
the settings more readable for a human.

Change-Id: I11ecb8e75ab041ace2358cc45972ce9ee965b24d
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-24 13:28:55 +00:00
David Schulz
eeedf4cd8c Utils: simplify loading/saving grouped settings
Change-Id: I8e06fb301eab193137f3e77d841698b9f4881deb
Reviewed-by: hjk <hjk@qt.io>
2021-03-24 12:24:27 +00:00
hjk
a694487711 Utils/VcsBase: Move ability to specify group settings keys to base
Merge it with the read/writeSettings implementation that was already
there.

Change-Id: I25dfbdf6fd1cf122b17f89eae82cb2598d8470c8
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-24 10:14:25 +00:00
hjk
b2615c3f5e Utils: Set QLabel buddys for aspects
This lets us using & shortcut e.g. in settings pages.

Change-Id: If630ba221298374c9a59820e7955ded80b4166cc
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-23 11:12:36 +00:00
Eike Ziller
863260f1fd Merge remote-tracking branch 'origin/4.15'
Conflicts:
	src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
	src/plugins/debugger/gdb/gdboptionspage.cpp

Change-Id: I4149e860b6842ea63bff3a7eb9632b7a6c2919d8
2021-03-22 09:52:14 +01:00
Cristian Adam
637d45c66a CMakePM: Make "Build type" aspect visible
For single configuration projects if you change the build type
aspect you will change the CMAKE_BUILD_TYPE variable.

When switching the build directory the existing CMAKE_BUILD_TYPE
will be set as build type aspect.

Fixes: QTCREATORBUG-25451
Change-Id: I13519e95c316c556cc1348fba6121637d2fd4275
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-03-19 13:38:18 +00:00
hjk
421d428e34 Utils: Make StringAspect's (potential) PathChooser accessible
This is not advised use, but helps to avoid an awful hack in the
AppManager plugin.

Change-Id: If40535dfb2c7bd15ff6d4fe49f4fa45d68150ef6
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-03-19 12:06:27 +00:00
hjk
a292a18c38 Utils: Shortcut Aspect::isDirty for aspects that were never visible
Also do not access Aspect::volatileValue if aspect was never shown

In this case, user-induced unsaved changes cannot exist. This also
avoids QTC_ASSERT in the volatileValue() implementations in these cases.

Silences the contained QTC_ASSERTs properly and avoids returning
a null-variant that's likely not identical to the default value.

Change-Id: Idba89997d0b0b4f9b7dcac0881afe36b35ccdf7c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-19 06:28:20 +00:00
hjk
9602338ce8 Utils: Fix manual apply of BoolAspects
Amends b7acf45c1. The primary connection was already there, and
correctly if'd, and the patch added accidentally a second connection
which was harmless in the auto-apply case, but effectively made the
manual-apply case also auto-apply.

Change-Id: I5ee72ff4715fb0077a47f71e8d45a5b6251c4121
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-17 14:12:37 +00:00
hjk
bc3f8e9810 Utils: Make AspectContainer::setAutoApply sticky
So it applies to all subsequently registered subaspects.

Change-Id: I9cc215b6ed9637eefc3b1721db778d4097809faa
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-17 08:12:46 +00:00
hjk
035a6ff031 Utils: Avoid intermediate widgets when using LayoutBuilder
In most cases, the layout constructed in the builder was set
on a widget which in turn was put into a vbox in the actual
widget. This is not necessary, but needs some re-ordering.

Also make sure that using not-yet-parented widgets during
layout construction does not cause visible artifacts.

Change-Id: I75727a571da093d3131ea6fba467c2c646cdb6f1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-16 11:37:44 +00:00
hjk
687d6a76ec Utils: Add a AspectContainer::isDirty convenience function
Change-Id: I8503c715742bce8f59da9b0e6c7e7a85c5fc397b
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2021-03-16 07:18:38 +00:00
hjk
d5dec08893 Utils: Pass settings key to BaseAspect::saveToMap
Makes the code on the user side somewhat more symmetric and is a
bit more flexible, even if that's not used right now.

Change-Id: I29a5182463ead0e4a39fcb51ecf4fdd5adf2a203
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-12 11:30:22 +00:00
hjk
4cebde86da Utils: Remove two unused AspectContainer functions
Change-Id: I786c80a84ee40cb6ea6711c13c208bd00ee6ad82
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-12 09:14:30 +00:00
hjk
cb55af8e55 Utils: Replace BaseAspect::setVisibleDynamic by setVisible
This was a workaround from a time where BaseAspect didn't know about
subwidgets created by derived aspects. That's not the case anymore.
Subwidgets registered with registerSubWidget() get their visibility
adjusted by BaseAspect::setVisibility() nowadays.

Subwidgets not registered with registerSubWidget() should not exist.

Change-Id: I8cdf72e5ea1f93c519f606913e084c78afecb56f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-09 11:30:10 +00:00
Eike Ziller
08f8dd355d Merge remote-tracking branch 'origin/4.15'
Change-Id: I528bff4d19dc4dfcb600e1e18b0d375c232eb417
2021-03-05 17:55:17 +01:00
hjk
2152564329 Utils: Remove BaseAspect base from AspectContainer again
Turns out to get into the way more often than it helps, e.g.
'setAutoApply' operated on the base class' m_autoAspect flag
instead of spreading it over the items in the container.

Change-Id: I2711f2a488d1a6c30ec21d3fc481563cec6e55d4
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-05 06:01:34 +00:00
hjk
8bf6236e90 Utils: Implement SelectionAspect::{setV,v}olatileValue
Change-Id: Ib0b2644c1f7aae651df5af85d35b82f82bc22e8c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-04 13:56:23 +00:00
hjk
0e2445bc54 Valgrind: Aspectify settings
Change-Id: I2fbf8244a05ffb1b642843c6471f92e2b154cf8a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-04 13:37:35 +00:00
hjk
8cfc053c2d Utils: Don't pass updates from IntegerAspect spinboxes through apply
The same pattern as used in DoubleAspect to avoids the asserts on autoapply
state in apply().

Change-Id: Ie06bac7fd8ec24ad461dc932c8eb85fa043a6fb7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-04 11:44:37 +00:00
hjk
60f103b681 Utils: Keep editing position in StringAspects with TextDisplay
Fixes: QTCREATORBUG-25410
Change-Id: I414c90fe679d9f63bfc29361ab753979ff20bfe6
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-03-03 11:40:43 +00:00
hjk
2252b22b10 Utils: Introduce a few AspectContainer convenience functions
Change-Id: I89832ab1971d263e4db9b8be5e89d581fd598b41
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-03 07:39:08 +00:00
hjk
46402f2712 Utils: Disable a QTC_CHECK that legitimately can happen
Change-Id: I63770766796798a4394a031612762dd5b390ab6b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-03 07:26:25 +00:00
hjk
5f2edec6cb Utils: Fix setting up spinbox for IntegerAspect
setValue() has to be called after setRange(), otherwise the value will
by cut at the initial default 99 maximum.

Change-Id: Id4a7cf1db0e3044f32022d6de8f66810f9cd6b4e
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-02 07:31:42 +00:00
hjk
deeb845b93 Utils: Introduce an IntegersAspect
Change-Id: I71ed382633ec4527fcb99d3de49e81a01e9c1641
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-01 13:52:41 +00:00
hjk
b7acf45c13 Utils: Make BoolAspects also notify their changed values
... when triggered via base class setValue().

The pattern would probably be useful for other aspects, too, but e.g.
for actions in a menu (like switching on/off FakeVim) this already
covers most cases.

Change-Id: I7886f4b845883edb6d337df0fa53f989ae893f65
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-01 13:50:23 +00:00
hjk
383e756dc3 Utils: Introduce a DoubleAspect
To be used with doubles (and QDoubleSpinbox as representation)

Change-Id: I0ad8ce1e495c48a305a42328c48e226ab3d4278c
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-01 12:47:27 +00:00
hjk
e6fe923392 Utils: Add StringAspect::{append,remove}Value{,s} convenience functions
Change-Id: I3893d9512b7600328e127693da9dc07c771b305a
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-01 12:47:10 +00:00
hjk
60a9529485 Utils: Allow icons to be used for aspect actions
Useful for toggles in tool buttons, as used e.g. in valgrind.

Change-Id: I61f5d4ba86d1f39d0071e4c0e37d2447f408a91e
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-01 11:33:17 +00:00
hjk
a5d5887908 Utils: Use the user-set default value when (not) saving values
Change-Id: Iae05d767e28afcfbb581089f6253b633f1aab468
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-01 10:47:38 +00:00