1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: MIT
3
4#include "main_window.h"
5
6void init_virtual_keyboard(slint::ComponentHandle<MainWindow> app)
7{
8 app->global<VirtualKeyboardHandler>().on_key_pressed([=](auto key) {
9 app->window().dispatch_key_press_event(key);
10 app->window().dispatch_key_release_event(key);
11 });
12}
13
14int main()
15{
16 auto main_window = MainWindow::create();
17 init_virtual_keyboard(main_window);
18 main_window->run();
19}
20

source code of slint/examples/virtual_keyboard/cpp/main.cpp