diff options
| author | Yuqian Yang <crupest@crupest.life> | 2025-11-22 21:24:18 +0800 |
|---|---|---|
| committer | Yuqian Yang <crupest@crupest.life> | 2025-11-22 21:24:18 +0800 |
| commit | 8f8b7dfd056dfa23dd1989d3f3dfd3d5d91d0168 (patch) | |
| tree | 435917530667bd4532c9bb70826c5796ca1ffa6a /src/ThemeBuilder/components | |
| parent | 7ce185d5a3fcfad8c8f746f95f3d50a8829faac4 (diff) | |
| download | cru-8f8b7dfd056dfa23dd1989d3f3dfd3d5d91d0168.tar.gz cru-8f8b7dfd056dfa23dd1989d3f3dfd3d5d91d0168.tar.bz2 cru-8f8b7dfd056dfa23dd1989d3f3dfd3d5d91d0168.zip | |
Clean measure requirement codes.
Diffstat (limited to 'src/ThemeBuilder/components')
5 files changed, 9 insertions, 10 deletions
diff --git a/src/ThemeBuilder/components/StyleRuleSetEditor.cpp b/src/ThemeBuilder/components/StyleRuleSetEditor.cpp index 9159e966..f077d31a 100644 --- a/src/ThemeBuilder/components/StyleRuleSetEditor.cpp +++ b/src/ThemeBuilder/components/StyleRuleSetEditor.cpp @@ -24,7 +24,7 @@ StyleRuleSetEditor::StyleRuleSetEditor() { "cru.theme_builder.icon-button.style")); add_button_.SetIconWithSvgPathDataStringResourceKey("icon.plus", {0, 0, 16, 16}); - add_button_.SetPreferredSize({24, 24}); + add_button_.SetSuggestSize({24, 24}); add_button_.SetPadding(ui::Thickness(2)); add_button_.SetIconFillColor(ui::colors::green); diff --git a/src/ThemeBuilder/components/conditions/CompoundConditionEditor.cpp b/src/ThemeBuilder/components/conditions/CompoundConditionEditor.cpp index 8501d7cd..d84f05e2 100644 --- a/src/ThemeBuilder/components/conditions/CompoundConditionEditor.cpp +++ b/src/ThemeBuilder/components/conditions/CompoundConditionEditor.cpp @@ -30,7 +30,7 @@ CompoundConditionEditor::CompoundConditionEditor() { "cru.theme_builder.icon-button.style")); add_child_button_.GetButton()->SetIconWithSvgPathDataStringResourceKey( "icon.plus", {0, 0, 16, 16}); - add_child_button_.GetButton()->SetPreferredSize({24, 24}); + add_child_button_.GetButton()->SetSuggestSize({24, 24}); add_child_button_.GetButton()->SetPadding(ui::Thickness(2)); add_child_button_.GetButton()->SetIconFillColor(ui::colors::green); add_child_button_.SetMenuItems({"And Condition", "Or Condition", diff --git a/src/ThemeBuilder/components/properties/MeasureLengthPropertyEditor.cpp b/src/ThemeBuilder/components/properties/MeasureLengthPropertyEditor.cpp index 001665ae..32723a6d 100644 --- a/src/ThemeBuilder/components/properties/MeasureLengthPropertyEditor.cpp +++ b/src/ThemeBuilder/components/properties/MeasureLengthPropertyEditor.cpp @@ -14,8 +14,7 @@ MeasureLengthPropertyEditor::MeasureLengthPropertyEditor() { auto measure_length_mapper = ui::mapper::MapperRegistry::GetInstance() ->GetMapper<ui::render::MeasureLength>(); try { - auto measure_length = - measure_length_mapper->MapFromString(text); + auto measure_length = measure_length_mapper->MapFromString(text); measure_length_ = measure_length; is_text_valid_ = true; RaiseChangeEvent(); @@ -31,8 +30,8 @@ MeasureLengthPropertyEditor::~MeasureLengthPropertyEditor() {} void MeasureLengthPropertyEditor::SetValue( const ui::render::MeasureLength& value, bool trigger_change) { if (!trigger_change) SuppressNextChangeEvent(); - text_.SetText(measure_length_.IsNotSpecified() - ? "unspecified" - : std::to_string(measure_length_.GetLengthOrUndefined())); + text_.SetText(measure_length_.IsSpecified() + ? std::to_string(measure_length_.GetLengthOrUndefined()) + : "unspecified"); } } // namespace cru::theme_builder::components::properties diff --git a/src/ThemeBuilder/components/stylers/CompoundStylerEditor.cpp b/src/ThemeBuilder/components/stylers/CompoundStylerEditor.cpp index 698cc699..fb144e60 100644 --- a/src/ThemeBuilder/components/stylers/CompoundStylerEditor.cpp +++ b/src/ThemeBuilder/components/stylers/CompoundStylerEditor.cpp @@ -25,7 +25,7 @@ CompoundStylerEditor::CompoundStylerEditor() { "cru.theme_builder.icon-button.style")); add_child_button_.GetButton()->SetIconWithSvgPathDataStringResourceKey( "icon.plus", {0, 0, 16, 16}); - add_child_button_.GetButton()->SetPreferredSize({24, 24}); + add_child_button_.GetButton()->SetSuggestSize({24, 24}); add_child_button_.GetButton()->SetPadding(ui::Thickness(2)); add_child_button_.GetButton()->SetIconFillColor(ui::colors::green); add_child_button_.SetMenuItems({"Compound Styler", "Border Styler", diff --git a/src/ThemeBuilder/components/stylers/PreferredSizeStylerEditor.cpp b/src/ThemeBuilder/components/stylers/PreferredSizeStylerEditor.cpp index 8c7c751f..d230e09c 100644 --- a/src/ThemeBuilder/components/stylers/PreferredSizeStylerEditor.cpp +++ b/src/ThemeBuilder/components/stylers/PreferredSizeStylerEditor.cpp @@ -24,8 +24,8 @@ PreferredSizeStylerEditor::GetValue() { void PreferredSizeStylerEditor::SetValue(ui::style::PreferredSizeStyler* styler, bool trigger_change) { - width_editor_.SetValue(styler->GetPreferredSize().width, false); - height_editor_.SetValue(styler->GetPreferredSize().height, false); + width_editor_.SetValue(styler->GetSuggestSize().width, false); + height_editor_.SetValue(styler->GetSuggestSize().height, false); if (trigger_change) { RaiseChangeEvent(); |
