You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am new to Rust and I have the above code with which I am trying to create a QWizardPage and add it to a QWizard, I have inserted the proper widget to the page but when I am trying to add the page as component into the wizard I am taking this strange error
cpp_core::cpp_box::CppDeletable is not implemented for LoginPage
use cpp_core::{Ptr, StaticUpcast};
use qt_core::{qs, slot, QBox, QObject, SlotNoArgs};
use qt_widgets::{
QWizard, QApplication, QHBoxLayout, QWizardPage, QVBoxLayout, QLineEdit, QLabel
};
use qt_widgets::q_line_edit::{
EchoMode
};
use std::rc::Rc;
struct LoginPage {
page: QBox<QWizardPage>,
usernamelb: QBox<QLabel>,
username: QBox<QLineEdit>,
passwordlb: QBox<QLabel>,
password: QBox<QLineEdit>
}
impl StaticUpcast<QObject> for LoginPage {
unsafe fn static_upcast(ptr: Ptr<Self>) -> Ptr<QObject> {
ptr.page.as_ptr().static_upcast()
}
}
impl LoginPage {
fn new() -> Rc<LoginPage> {
unsafe {
let page = QWizardPage::new_0a();
let vmainlayout = QVBoxLayout::new_1a(&page);
let usernamelayout = QHBoxLayout::new_1a(&page);
let passwordlayout = QHBoxLayout::new_1a(&page);
vmainlayout.add_layout_1a(&usernamelayout);
vmainlayout.add_layout_1a(&passwordlayout);
let usernamelb = QLabel::new();
usernamelb.set_text(&qs("Username:"));
usernamelayout.add_widget(&usernamelb);
let username = QLineEdit::new();
usernamelayout.add_widget(&username);
let passwordlb = QLabel::new();
passwordlb.set_text(&qs("Password:"));
passwordlayout.add_widget(&passwordlb);
let password = QLineEdit::new();
password.set_echo_mode(EchoMode::Password);
passwordlayout.add_widget(&password);
let this = Rc::new(LoginPage {
page,
usernamelb,
username,
passwordlb,
password
});
this
}
}
}
struct Wizard {
wizard: QBox<QWizard>,
loginPage: QBox<LoginPage>
}
impl StaticUpcast<QObject> for Wizard {
unsafe fn static_upcast(ptr: Ptr<Self>) -> Ptr<QObject> {
ptr.wizard.as_ptr().static_upcast()
}
}
impl Wizard {
fn new() -> Rc<Wizard> {
unsafe {
let wizard = QWizard::new_0a();
let loginPage = LoginPage::new();
let this = Rc::new(Wizard {
wizard,
loginPage
});
this.init();
this
}
}
unsafe fn init(self: &Rc<Self>) {
self.wizard.rejected().connect(&self.slot_on_wizard_rejected());
}
}
fn main() {
QApplication::init(|_| unsafe {
let _wizard = Wizard::new();
_wizard.wizard.show();
QApplication::exec()
})
}
The text was updated successfully, but these errors were encountered:
I am new to Rust and I have the above code with which I am trying to create a
QWizardPage
and add it to aQWizard
, I have inserted the proper widget to the page but when I am trying to add the page as component into the wizard I am taking this strange errorThe text was updated successfully, but these errors were encountered: