Fix number to string conversion in C++

This commit is contained in:
Olivier Goffart 2020-05-27 16:17:12 +02:00
parent 486b2ab8f8
commit 5580b5112f
5 changed files with 90 additions and 59 deletions

View file

@ -11,17 +11,11 @@ int main() {
component.plus_clicked.set_handler([](auto...){
auto &counter = component.counter;
counter.set(counter.get() + 1);
// FIXME: this _13 is an internal detail and should be private anyway. We muse use some
// alias or way to expose the property (same for the _ before signals)
component.counter_label_11.text.set(std::string_view(std::to_string(counter.get())));
std::cout << "PLUS: " << std::string_view(component.counter_label_11.text.get()) << std::endl;
});
component.minus_clicked.set_handler([](auto...){
auto &counter = component.counter;
counter.set(counter.get() - 1);
component.counter_label_11.text.set(std::string_view(std::to_string(counter.get())));
std::cout << "MINUS: " << std::string_view(component.counter_label_11.text.get()) << std::endl;
});
sixtyfps::run(&component);