summaryrefslogtreecommitdiffstats
path: root/src/designer/src/lib/shared/qdesigner_propertycommand.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-04-02 16:44:29 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-04-08 13:30:33 +0000
commit186df9e4d18ad2f9a877022cee48ca054b32e6c8 (patch)
tree030c0015e5173da89d7f5f1a68d314be1ae8ce66 /src/designer/src/lib/shared/qdesigner_propertycommand.cpp
parent0155bfd3864a3222d6f31c58a3f65cbed4c1223b (diff)
Qt Designer: Enable reset property for multiselection.
When working with a multiselection in the property editor, the reset button was previously only enabled when the property was modified on the selected/current widget. With this change, reset will always be enabled when the property is modified in one of the widgets of a multiselection. Unmodified widgets will be filtered out when initializing the command. The intended use case is mainly to enable conveniently clearing all minimumSize/maximumSize constraints of a form by doing Ctrl+A to select all and then do reset on the property. Change-Id: Ideab87cab79e9404941d5594653f12c13515c1ae Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
Diffstat (limited to 'src/designer/src/lib/shared/qdesigner_propertycommand.cpp')
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertycommand.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/designer/src/lib/shared/qdesigner_propertycommand.cpp b/src/designer/src/lib/shared/qdesigner_propertycommand.cpp
index 8feb13e42..2103b6cbd 100644
--- a/src/designer/src/lib/shared/qdesigner_propertycommand.cpp
+++ b/src/designer/src/lib/shared/qdesigner_propertycommand.cpp
@@ -1317,7 +1317,19 @@ bool ResetPropertyCommand::init(QObject *object, const QString &apropertyName)
bool ResetPropertyCommand::init(const ObjectList &list, const QString &apropertyName, QObject *referenceObject)
{
- if (!initList(list, apropertyName, referenceObject))
+ ObjectList modifiedList = list; // filter out modified properties
+ for (ObjectList::iterator it = modifiedList.begin(); it != modifiedList.end() ; ) {
+ QDesignerPropertySheetExtension* sheet = propertySheet(*it);
+ Q_ASSERT(sheet);
+ const int index = sheet->indexOf(apropertyName);
+ if (index == -1 || !sheet->isChanged(index))
+ it = modifiedList.erase(it);
+ else
+ ++it;
+ }
+ if (!modifiedList.contains(referenceObject))
+ referenceObject = Q_NULLPTR;
+ if (modifiedList.isEmpty() || !initList(modifiedList, apropertyName, referenceObject))
return false;
if(debugPropertyCommands)