-
Notifications
You must be signed in to change notification settings - Fork 93
Open
Description
Writing anything inside a macro is annoying because some lsp functions such as suggestions dont work
currently the best solution i have come up with is
instead of:
#[derive(QObject, Default)]
struct Greeter {
// Specify the base class with the qt_base_class macro
base: qt_base_class!(trait QObject),
// Declare `name` as a property usable from Qt
name: qt_property!(QString; NOTIFY name_changed),
// Declare a signal
name_changed: qt_signal!(),
// And even a slot
compute_greetings: qt_method!(fn compute_greetings(&self, verb: String) -> QString {
format!("{} {}", verb, self.name.to_string()).into()
})
}this:
#[derive(QObject, Default)]
struct Greeter {
// Specify the base class with the qt_base_class macro
base: qt_base_class!(trait QObject),
// Declare `name` as a property usable from Qt
name: qt_property!(QString; NOTIFY name_changed),
// Declare a signal
name_changed: qt_signal!(),
// And even a slot
compute_greetings: qt_method!(fn compute_greetings(&self, verb: String) -> QString {self.r_compute_greetings(verb) })
}
impl Greeter {
fn r_compute_greetings(&self, verb: String) -> QString {
format!("{} {}", verb, self.name.to_string()).into()
}
}of course it doesnt matter that much for short functions like this, they might aswell only be done in the macro but for longer ones it gets really annoying
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels