Add a C++ version of the Virtual Keyboard example

This commit is contained in:
Simon Hausmann 2023-04-13 18:43:12 +02:00 committed by Simon Hausmann
parent 4a39cdbc86
commit 4d502a9f96
8 changed files with 71 additions and 15 deletions

View file

@ -0,0 +1,17 @@
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
#include "main_window.h"
void init_virtual_keyboard(slint::ComponentHandle<MainWindow> app)
{
app->global<VirtualKeyboardHandler>().on_key_pressed(
[=](auto key) { app->window().dispatch_key_press_event(key); });
}
int main()
{
auto main_window = MainWindow::create();
init_virtual_keyboard(main_window);
main_window->run();
}