LVRS Document Viewer
components/control/AbstractButton.svx
Path: components/control/AbstractButton.svx
AbstractButton
Location: qml/components/control/buttons/AbstractButton.qml
AbstractButton is the base control for the LVRS button family.
Purpose
- Provide shared tone enum and color policy.
- Unify enabled/disabled interaction gating.
- Centralize padding/radius/implicit-size baseline for derived buttons.
Tone Enum
AbstractButton.ButtonTone
PrimaryDefaultBorderlessDestructiveDisabled
Core API
toneeffectiveEnabled(enabled && tone !== Disabled)textColor,textColorDisabledbackgroundColor,backgroundColorHover,backgroundColorPressed,backgroundColorDisabledhorizontalPadding,verticalPadding,cornerRadius
Interaction Contract
- Hover/focus are disabled when
effectiveEnabled == false. - Disabled state installs a blocking
MouseAreato prevent accidental event propagation. DefaultandBorderlesspressed state usesTheme.accentBlueMuted.Defaulttone base fill isTheme.panelBackground12, disabled fill isTheme.panelBackground04.
Usage
import LVRS 1.0 as LV
LV.AbstractButton {
text: "Action"
tone: LV.AbstractButton.Default
}
How It Works
- Tone-specific text/background colors are derived by readonly computed properties.
- Derived button components override sizing/layout while inheriting interaction and tone policy.
contentItemdefaults toLV.Label(bodystyle) centered both axes.
Advanced Example: Tone Override with Custom Colors
import LVRS 1.0 as LV
LV.AbstractButton {
text: "Dangerous"
tone: LV.AbstractButton.Destructive
backgroundColorPressed: "#B83333"
}
Debug Tip
When a button appears non-interactive, inspect effectiveEnabled rather than enabled only.