forked from qt-creator/qt-creator
Remove auto-format-on-file-save dependency from custom formatter widgets
We can use custom formatter not only with auto-formatting on file save, but also tools/qmljs/reformat file action. Hence, command and arguments lineedits of custom formatter should only be enabled/disabled by useCustomFormatter checkbox. useCustomFormatter also should not depend on auto-format-on-file-save checkbox's state. Change-Id: If1a634612f38395fd846166f4cc72593f5150f91 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Xavier BESSON <developer@xavi-b.fr> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -287,8 +287,7 @@ public:
|
|||||||
Utils::globalMacroExpander());
|
Utils::globalMacroExpander());
|
||||||
|
|
||||||
const auto updateFormatCommandState = [&, formatCommandLabel, formatCommandOptionsLabel] {
|
const auto updateFormatCommandState = [&, formatCommandLabel, formatCommandOptionsLabel] {
|
||||||
const bool enabled = useCustomFormatCommand->isChecked()
|
const bool enabled = useCustomFormatCommand->isChecked();
|
||||||
&& autoFormatOnSave->isChecked();
|
|
||||||
formatCommandLabel->setEnabled(enabled);
|
formatCommandLabel->setEnabled(enabled);
|
||||||
formatCommand->setEnabled(enabled);
|
formatCommand->setEnabled(enabled);
|
||||||
formatCommandOptionsLabel->setEnabled(enabled);
|
formatCommandOptionsLabel->setEnabled(enabled);
|
||||||
@@ -298,7 +297,6 @@ public:
|
|||||||
|
|
||||||
connect(autoFormatOnSave, &QCheckBox::toggled, this, [&, updateFormatCommandState]() {
|
connect(autoFormatOnSave, &QCheckBox::toggled, this, [&, updateFormatCommandState]() {
|
||||||
autoFormatOnlyCurrentProject->setEnabled(autoFormatOnSave->isChecked());
|
autoFormatOnlyCurrentProject->setEnabled(autoFormatOnSave->isChecked());
|
||||||
useCustomFormatCommand->setEnabled(autoFormatOnSave->isChecked());
|
|
||||||
updateFormatCommandState();
|
updateFormatCommandState();
|
||||||
});
|
});
|
||||||
connect(useCustomFormatCommand, &QCheckBox::toggled, this, updateFormatCommandState);
|
connect(useCustomFormatCommand, &QCheckBox::toggled, this, updateFormatCommandState);
|
||||||
|
|||||||
Reference in New Issue
Block a user