Hello
I have this basic code:
#![windows_subsystem = "windows"]
use qt_widgets::{
cpp_core::{CppBox, MutPtr},
qt_core::QString,
qt_core::Slot,
QApplication, QLineEdit, QMessageBox, QPushButton, QVBoxLayout, QWidget,
QLabel,
};
fn main() {
QApplication::init(|_app| unsafe {
let mut window = QWidget::new_0a();
window.resize(400, 250);
QApplication::exec()
})
}
Here I'm trying to create a basic QWidget element:
let window = QWidget::new_0a();
However, now window has the type cpp_core::cpp_box::CppBox<qt_widgets::QWidget>
. How can I 'unwrap' CppBox so that I actually have a QWidget element?
Compiling this program gives the following error:
error[E0599]: no method named `resize` found for type `cpp_core::cpp_box::CppBox<qt_widgets::QWidget>` in the current scope
--> src/main.rs:18:16
|
18 | window.resize(400, 250);
| ^^^^^^ help: there is a method with a similar name: `size`
QWidget has a method resize though.
Thanks!