mirror of
https://github.com/slint-ui/slint.git
synced 2025-07-12 07:35:18 +00:00
Testing: Add minimum/maximum support (#5192)
This commit is contained in:
parent
25ef8f8711
commit
c37c9d4f26
5 changed files with 108 additions and 2 deletions
|
@ -88,6 +88,57 @@ public:
|
|||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// Returns the accessible-value-maximum of that element, if any.
|
||||
std::optional<float> accessible_value_maximum() const
|
||||
{
|
||||
if (auto item = private_api::upgrade_item_weak(inner)) {
|
||||
SharedString result;
|
||||
if (item->item_tree.vtable()->accessible_string_property(
|
||||
item->item_tree.borrow(), item->index,
|
||||
cbindgen_private::AccessibleStringProperty::ValueMaximum, &result)) {
|
||||
float value = 0.0;
|
||||
if (cbindgen_private::slint_string_to_float(&result, &value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// Returns the accessible-value-minimum of that element, if any.
|
||||
std::optional<float> accessible_value_minimum() const
|
||||
{
|
||||
if (auto item = private_api::upgrade_item_weak(inner)) {
|
||||
SharedString result;
|
||||
if (item->item_tree.vtable()->accessible_string_property(
|
||||
item->item_tree.borrow(), item->index,
|
||||
cbindgen_private::AccessibleStringProperty::ValueMinimum, &result)) {
|
||||
float value = 0.0;
|
||||
if (cbindgen_private::slint_string_to_float(&result, &value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// Returns the accessible-value-step of that element, if any.
|
||||
std::optional<float> accessible_value_step() const
|
||||
{
|
||||
if (auto item = private_api::upgrade_item_weak(inner)) {
|
||||
SharedString result;
|
||||
if (item->item_tree.vtable()->accessible_string_property(
|
||||
item->item_tree.borrow(), item->index,
|
||||
cbindgen_private::AccessibleStringProperty::ValueStep, &result)) {
|
||||
float value = 0.0;
|
||||
if (cbindgen_private::slint_string_to_float(&result, &value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// Returns the accessible-checked of that element, if any.
|
||||
std::optional<bool> accessible_checked() const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue