Hi,
I have a problem when i want to integrate C++ class in my qml the debugger say that “ravupModuleLogIn 1.0” my module is not installed…
c++ code:
Client::instance(m_application);
QQmlApplicationEngine engine;
m_felgo->setPreservePlatformFonts(true);
m_felgo->initialize(&engine);
m_felgo->setMainQmlFileName(QStringLiteral("qml/Main.qml"));
qmlRegisterType<LogInModule>("ravupModuleLogIn", 1, 0, "logIn");
m_engine->load(QUrl(m_felgo->mainQmlFileName()));
// to start your project as Live Client, comment (remove) the lines "felgo.setMainQmlFileName ..." & "engine.load ...",
// and uncomment the line below
//FelgoLiveClient client (&engine);
if (m_engine->rootObjects().isEmpty())
exit(-1);
qml code:
import QtQuick.Window 2.2
import QtQuick.Controls 2.0
import QtQuick.Controls.Styles 1.4
import Felgo 3.0
import QtQuick 2.0
import QtQuick.Layouts 1.1
import ravupModuleLogIn 1.0
Page {
id: loginPage
Rectangle {
id: headBar
width: parent.width
height: parent.height / 10
anchors.top: parent.top
color: "#ff5722"
}
Image {
id: logo
source: "../../assets/logo.png"
width: parent.width / 2
height: parent.height / 3
anchors.left: parent.left
anchors.leftMargin: (parent.width - width) / 2
anchors.top: headBar.bottom
anchors.bottomMargin: 0
fillMode: Image.PreserveAspectFit
}
GridLayout {
id: content
anchors.top: logo.bottom
anchors.left: parent.left
anchors.leftMargin: (parent.width - width) / 2
columnSpacing: dp(20)
rowSpacing: dp(40)
columns: 2
// email text and field
AppText {
text: qsTr("E-mail")
font.pixelSize: sp(12)
}
AppTextField {
id: txtUsername
Layout.preferredWidth: dp(200)
showClearButton: true
font.pixelSize: sp(14)
borderColor: Theme.tintColor
borderWidth: dp(1)
onTextChanged: logIn.setUsername(txtUsername.text)
}
// password text and field
AppText {
text: qsTr("Password")
font.pixelSize: sp(12)
}
AppTextField {
id: txtPassword
Layout.preferredWidth: dp(200)
showClearButton: true
font.pixelSize: sp(14)
borderColor: Theme.tintColor
borderWidth: dp(1)
echoMode: TextInput.Password
onTextChanged: logIn.setPassword(txtPassword.text)
}
// column for buttons, we use column here to avoid additional spacing between buttons
Column {
Layout.fillWidth: true
Layout.columnSpan: 2
Layout.topMargin: dp(0)
// buttons
AppButton {
text: qsTr("Login")
flat: false
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
loginPage.forceActiveFocus() // move focus away from text fields
// call login action
logIn.login()
}
}
AppButton {
text: qsTr("No account yet? Register now")
flat: true
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
loginPage.forceActiveFocus() // move focus away from text fields
// call your logic action to register here
console.debug("registering...")
}
}
}
}
}