mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 06:11:16 +00:00
Improve timer docs
Use the term interval instead of duration to emphasize that it's not a single shot. (The single-shot docs still use duration)
This commit is contained in:
parent
2a44afebb2
commit
774be9ba76
2 changed files with 31 additions and 27 deletions
|
@ -44,15 +44,15 @@ namespace sixtyfps {
|
|||
|
||||
// these macro are defined in the generated sixtyfps_internal.h
|
||||
#if defined(DOXYGEN)
|
||||
/// This macro expands to the to the numeric value of the major version of SixtyFPS you're developing against.
|
||||
/// For example if you're using version 1.5.2, this macro will expand to 1.
|
||||
#define SIXTYFPS_VERSION_MAJOR SIXTYFPS_VERSION_MAJOR
|
||||
/// This macro expands to the to the numeric value of the minor version of SixtyFPS you're developing against.
|
||||
/// For example if you're using version 1.5.2, this macro will expand to 5.
|
||||
#define SIXTYFPS_VERSION_MINOR SIXTYFPS_VERSION_MINOR
|
||||
/// This macro expands to the to the numeric value of the patch version of SixtyFPS you're developing against.
|
||||
/// For example if you're using version 1.5.2, this macro will expand to 2.
|
||||
#define SIXTYFPS_VERSION_PATCH SIXTYFPS_VERSION_PATCH
|
||||
/// This macro expands to the to the numeric value of the major version of SixtyFPS you're
|
||||
/// developing against. For example if you're using version 1.5.2, this macro will expand to 1.
|
||||
# define SIXTYFPS_VERSION_MAJOR SIXTYFPS_VERSION_MAJOR
|
||||
/// This macro expands to the to the numeric value of the minor version of SixtyFPS you're
|
||||
/// developing against. For example if you're using version 1.5.2, this macro will expand to 5.
|
||||
# define SIXTYFPS_VERSION_MINOR SIXTYFPS_VERSION_MINOR
|
||||
/// This macro expands to the to the numeric value of the patch version of SixtyFPS you're
|
||||
/// developing against. For example if you're using version 1.5.2, this macro will expand to 2.
|
||||
# define SIXTYFPS_VERSION_PATCH SIXTYFPS_VERSION_PATCH
|
||||
#endif
|
||||
|
||||
// Bring opaque structure in scope
|
||||
|
@ -348,12 +348,12 @@ private:
|
|||
/// Use the static single_shot function to make a single shot timer
|
||||
struct Timer
|
||||
{
|
||||
/// Construct a timer which will repeat the callback every `duration` milliseconds until
|
||||
/// Construct a timer which will repeat the callback every `interval` milliseconds until
|
||||
/// the destructor of the timer is called.
|
||||
template<typename F>
|
||||
Timer(std::chrono::milliseconds duration, F callback)
|
||||
Timer(std::chrono::milliseconds interval, F callback)
|
||||
: id(cbindgen_private::sixtyfps_timer_start(
|
||||
duration.count(), [](void *data) { (*reinterpret_cast<F *>(data))(); },
|
||||
interval.count(), [](void *data) { (*reinterpret_cast<F *>(data))(); },
|
||||
new F(std::move(callback)), [](void *data) { delete reinterpret_cast<F *>(data); }))
|
||||
{
|
||||
}
|
||||
|
@ -421,7 +421,8 @@ inline bool operator!=(const LayoutInfo &a, const LayoutInfo &b)
|
|||
|
||||
namespace private_api {
|
||||
/// Access the layout cache of an item within a repeater
|
||||
inline float layout_cache_access(const SharedVector<float> &cache, int offset, int repeater_index) {
|
||||
inline float layout_cache_access(const SharedVector<float> &cache, int offset, int repeater_index)
|
||||
{
|
||||
size_t idx = size_t(cache[offset]) + repeater_index * 2;
|
||||
return idx < cache.size() ? cache[idx] : 0;
|
||||
}
|
||||
|
@ -464,7 +465,8 @@ public:
|
|||
/// The default implementation will print a warning to stderr.
|
||||
///
|
||||
/// If the model can update the data, it should also call `row_changed`
|
||||
virtual void set_row_data(int, const ModelData &) {
|
||||
virtual void set_row_data(int, const ModelData &)
|
||||
{
|
||||
std::cerr << "Model::set_row_data was called on a read-only model" << std::endl;
|
||||
};
|
||||
|
||||
|
@ -770,11 +772,9 @@ inline bool operator!=(const StandardListViewItem &a, const StandardListViewItem
|
|||
|
||||
namespace private_api {
|
||||
// Code generated by SixtyFPS <= 0.1.5 uses this enum with VersionCheckHelper
|
||||
enum class [[deprecated]] VersionCheck {
|
||||
Major = SIXTYFPS_VERSION_MAJOR,
|
||||
Minor = SIXTYFPS_VERSION_MINOR,
|
||||
Patch = SIXTYFPS_VERSION_PATCH
|
||||
};
|
||||
enum class [[deprecated]] VersionCheck { Major = SIXTYFPS_VERSION_MAJOR,
|
||||
Minor = SIXTYFPS_VERSION_MINOR,
|
||||
Patch = SIXTYFPS_VERSION_PATCH };
|
||||
template<int Major, int Minor, int Patch>
|
||||
struct VersionCheckHelper
|
||||
{
|
||||
|
@ -879,8 +879,10 @@ void invoke_from_event_loop(Functor f)
|
|||
/// ...
|
||||
/// }
|
||||
/// ```
|
||||
template<typename Functor, typename = std::enable_if_t<!std::is_void_v<std::invoke_result_t<Functor>>>>
|
||||
auto blocking_invoke_from_event_loop(Functor f) -> std::invoke_result_t<Functor> {
|
||||
template<typename Functor,
|
||||
typename = std::enable_if_t<!std::is_void_v<std::invoke_result_t<Functor>>>>
|
||||
auto blocking_invoke_from_event_loop(Functor f) -> std::invoke_result_t<Functor>
|
||||
{
|
||||
std::optional<std::invoke_result_t<Functor>> result;
|
||||
std::mutex mtx;
|
||||
std::condition_variable cv;
|
||||
|
@ -895,8 +897,10 @@ auto blocking_invoke_from_event_loop(Functor f) -> std::invoke_result_t<Functor>
|
|||
return std::move(*result);
|
||||
}
|
||||
|
||||
template<typename Functor, typename = std::enable_if_t<std::is_void_v<std::invoke_result_t<Functor>>>>
|
||||
auto blocking_invoke_from_event_loop(Functor f) -> void {
|
||||
template<typename Functor,
|
||||
typename = std::enable_if_t<std::is_void_v<std::invoke_result_t<Functor>>>>
|
||||
auto blocking_invoke_from_event_loop(Functor f) -> void
|
||||
{
|
||||
std::mutex mtx;
|
||||
std::condition_variable cv;
|
||||
bool ok = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue