summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/Palettes
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2018-09-10 15:58:51 +0300
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2018-09-11 06:47:51 +0000
commita3b7e665b7d5f6151da8252367f3bd7ef1129f5a (patch)
tree95897f67ce6f29d4b94f76a5a5aa4f42f14bc6d5 /src/Authoring/Studio/Palettes
parent64940700fadb35a49b4ad7bccbde66d4ecb06c38 (diff)
Ensure inspector's opened transactions get committed eventually
Leaving transactions open can interfere with other editor functionality, so commit open transactions on selection change and/or after a brief delay in case of transactions started by wheeling an inspector slider. Task-number: QT3DS-2289 Change-Id: I7d3429a3aeb81cbfb9f5be648e4cbcea92544f87 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Janne Kangas <janne.kangas@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/Authoring/Studio/Palettes')
-rw-r--r--src/Authoring/Studio/Palettes/Action/HandlerPropertyBaseSlider.qml29
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp6
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h1
3 files changed, 26 insertions, 10 deletions
diff --git a/src/Authoring/Studio/Palettes/Action/HandlerPropertyBaseSlider.qml b/src/Authoring/Studio/Palettes/Action/HandlerPropertyBaseSlider.qml
index 5693ee7b..d025a889 100644
--- a/src/Authoring/Studio/Palettes/Action/HandlerPropertyBaseSlider.qml
+++ b/src/Authoring/Studio/Palettes/Action/HandlerPropertyBaseSlider.qml
@@ -54,6 +54,7 @@ Row {
width: _valueWidth
function doCommitValue() {
+ wheelCommitTimer.stop();
if (rateLimiter.running)
rateLimiter.stop();
textField.setTextFieldValue();
@@ -82,9 +83,10 @@ Row {
delta = -delta;
slider.value = Number(slider.value + delta).toFixed(doubleValidator.decimals);
}
+ wheelCommitTimer.stop();
if (!rateLimiter.running)
rateLimiter.start();
- textField.setTextFieldValue()
+ textField.setTextFieldValue();
}
}
@@ -121,10 +123,10 @@ Row {
}
onMoved: {
- if (!rateLimiter.running) {
+ wheelCommitTimer.stop();
+ if (!rateLimiter.running)
rateLimiter.start();
- }
- textField.setTextFieldValue()
+ textField.setTextFieldValue();
}
// onPressedChanged is triggered both mouse clicks and arrow keys, so adjusting with arrow
@@ -142,15 +144,24 @@ Row {
var delta = (wheel.angleDelta.x != 0) ? wheel.angleDelta.x
: wheel.angleDelta.y;
- if (delta > 0) {
+ if (delta > 0)
slider.increase();
- } else {
+ else
slider.decrease();
- }
- if (!rateLimiter.running) {
+ if (!rateLimiter.running)
rateLimiter.start();
+ textField.setTextFieldValue();
+
+ // Leaving a transaction open can interfere with other editor functionality,
+ // so commit the wheel transaction after a brief delay
+ wheelCommitTimer.restart();
+ }
+ Timer {
+ id: wheelCommitTimer
+ interval: 1000
+ onTriggered: {
+ root.doCommitValue();
}
- textField.setTextFieldValue()
}
}
}
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
index 3d12e917..46093620 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
@@ -116,6 +116,12 @@ InspectorControlModel::InspectorControlModel(QObject *parent)
void InspectorControlModel::setInspectable(CInspectableBase *inInspectable)
{
+ // Commit any pending transactions on selection change
+ m_UpdatableEditor.CommitEditor();
+ m_modifiedProperty.first = 0;
+ m_modifiedProperty.second = 0;
+ m_previouslyCommittedValue = {};
+
const auto signalProvider
= g_StudioApp.GetCore()->GetDoc()->GetStudioSystem()->GetFullSystemSignalProvider();
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h
index 5dc510fd..92397acc 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.h
@@ -196,7 +196,6 @@ private:
GroupInspectorControl computeGroup(CInspectableBase* inspectBase, int theIndex);
bool isGroupRebuildRequired(CInspectableBase *inspectable, int theIndex) const;
-
};
#endif // INSPECTORCONTROLMODEL_H