mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 06:41:14 +00:00
Clean up NativeButton
Eliminate native_button_enabled
This commit is contained in:
parent
cd75556ab1
commit
c3ba5a0808
3 changed files with 4 additions and 5 deletions
|
@ -408,7 +408,7 @@ impl TypeRegister {
|
||||||
("text", Type::String),
|
("text", Type::String),
|
||||||
("pressed", Type::Bool),
|
("pressed", Type::Bool),
|
||||||
("clicked", Type::Signal { args: vec![] }),
|
("clicked", Type::Signal { args: vec![] }),
|
||||||
("native_button_enabled", Type::Bool),
|
("enabled", Type::Bool),
|
||||||
],
|
],
|
||||||
&[],
|
&[],
|
||||||
);
|
);
|
||||||
|
|
|
@ -12,7 +12,6 @@ LICENSE END */
|
||||||
export Button := NativeButton {
|
export Button := NativeButton {
|
||||||
property<length> font_size;
|
property<length> font_size;
|
||||||
enabled: true;
|
enabled: true;
|
||||||
native_button_enabled: self.enabled;
|
|
||||||
}
|
}
|
||||||
export CheckBox := NativeCheckBox { }
|
export CheckBox := NativeCheckBox { }
|
||||||
export SpinBox := NativeSpinBox { property<length> font_size; }
|
export SpinBox := NativeSpinBox { property<length> font_size; }
|
||||||
|
|
|
@ -97,7 +97,7 @@ pub struct NativeButton {
|
||||||
pub width: Property<f32>,
|
pub width: Property<f32>,
|
||||||
pub height: Property<f32>,
|
pub height: Property<f32>,
|
||||||
pub text: Property<SharedString>,
|
pub text: Property<SharedString>,
|
||||||
pub native_button_enabled: Property<bool>,
|
pub enabled: Property<bool>,
|
||||||
pub pressed: Property<bool>,
|
pub pressed: Property<bool>,
|
||||||
pub clicked: Signal<()>,
|
pub clicked: Signal<()>,
|
||||||
pub cached_rendering_data: CachedRenderingData,
|
pub cached_rendering_data: CachedRenderingData,
|
||||||
|
@ -120,7 +120,7 @@ impl Item for NativeButton {
|
||||||
) -> HighLevelRenderingPrimitive {
|
) -> HighLevelRenderingPrimitive {
|
||||||
let down: bool = Self::FIELD_OFFSETS.pressed.apply_pin(self).get();
|
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 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 size: qttypes::QSize = get_size!(self);
|
||||||
let dpr = window.scale_factor();
|
let dpr = window.scale_factor();
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ impl Item for NativeButton {
|
||||||
_window: &ComponentWindow,
|
_window: &ComponentWindow,
|
||||||
_app_component: ComponentRefPin,
|
_app_component: ComponentRefPin,
|
||||||
) -> InputEventResult {
|
) -> 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 {
|
if !enabled {
|
||||||
return InputEventResult::EventIgnored;
|
return InputEventResult::EventIgnored;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue