Provides several convenience callback functions to rust-qt.
Even though Qt's signal and slot mechanism is quite powerful and allows for very dynamic code and programming model, it's not always needed, especially for simple functionality.
In both C++ and Rust, defining signals and slots can become verbose at times, and even Qt itself supports lambda functions on the C++ side.
For example, compare the following 2 programs for readability and writing ergonomics. Both programs do the same thing, the first doesn't use callbacks, it defines slots for the required signals. The second program, uses this crate, and uses callbacks without having to define slots in a separate object, nor does it require the derive SlotNoArgs/SlotOfBool/SlotOfQString boilerplate.
The first program (no callbacks): ```rust // no callbacks use cppcore::{Ptr, Ref, StaticUpcast}; use qtcore::{qs, slot, QBox, QObject, QString, SlotNoArgs, SlotOfBool, SlotOfQString}; use qt_widgets::{ QApplication, QCheckBox, QHBoxLayout, QLineEdit, QPushButton, QVBoxLayout, QWidget, }; use std::rc::Rc;
struct Form {
win: QBox
impl StaticUpcast
impl Form { fn new() -> Rc