From c3ba5a0808c98ba74b8798fd7cc4a108cca3d9ca Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 30 Oct 2020 16:28:06 +0100 Subject: [PATCH] Clean up NativeButton Eliminate native_button_enabled --- sixtyfps_compiler/typeregister.rs | 2 +- sixtyfps_compiler/widgets/native/sixtyfps_widgets.60 | 1 - sixtyfps_runtime/rendering_backends/qt/widgets.rs | 6 +++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/sixtyfps_compiler/typeregister.rs b/sixtyfps_compiler/typeregister.rs index b5c473c4f..15a485a97 100644 --- a/sixtyfps_compiler/typeregister.rs +++ b/sixtyfps_compiler/typeregister.rs @@ -408,7 +408,7 @@ impl TypeRegister { ("text", Type::String), ("pressed", Type::Bool), ("clicked", Type::Signal { args: vec![] }), - ("native_button_enabled", Type::Bool), + ("enabled", Type::Bool), ], &[], ); diff --git a/sixtyfps_compiler/widgets/native/sixtyfps_widgets.60 b/sixtyfps_compiler/widgets/native/sixtyfps_widgets.60 index 34d387e35..c56745d18 100644 --- a/sixtyfps_compiler/widgets/native/sixtyfps_widgets.60 +++ b/sixtyfps_compiler/widgets/native/sixtyfps_widgets.60 @@ -12,7 +12,6 @@ LICENSE END */ export Button := NativeButton { property font_size; enabled: true; - native_button_enabled: self.enabled; } export CheckBox := NativeCheckBox { } export SpinBox := NativeSpinBox { property font_size; } diff --git a/sixtyfps_runtime/rendering_backends/qt/widgets.rs b/sixtyfps_runtime/rendering_backends/qt/widgets.rs index 79fecc00d..14b842fbd 100644 --- a/sixtyfps_runtime/rendering_backends/qt/widgets.rs +++ b/sixtyfps_runtime/rendering_backends/qt/widgets.rs @@ -97,7 +97,7 @@ pub struct NativeButton { pub width: Property, pub height: Property, pub text: Property, - pub native_button_enabled: Property, + pub enabled: Property, pub pressed: Property, pub clicked: Signal<()>, pub cached_rendering_data: CachedRenderingData, @@ -120,7 +120,7 @@ impl Item for NativeButton { ) -> HighLevelRenderingPrimitive { let down: bool = Self::FIELD_OFFSETS.pressed.apply_pin(self).get(); let text: qttypes::QString = Self::FIELD_OFFSETS.text.apply_pin(self).get().as_str().into(); - let enabled = Self::FIELD_OFFSETS.native_button_enabled.apply_pin(self).get(); + let enabled = Self::FIELD_OFFSETS.enabled.apply_pin(self).get(); let size: qttypes::QSize = get_size!(self); let dpr = window.scale_factor(); @@ -183,7 +183,7 @@ impl Item for NativeButton { _window: &ComponentWindow, _app_component: ComponentRefPin, ) -> InputEventResult { - let enabled = Self::FIELD_OFFSETS.native_button_enabled.apply_pin(self).get(); + let enabled = Self::FIELD_OFFSETS.enabled.apply_pin(self).get(); if !enabled { return InputEventResult::EventIgnored; }