Hello, I'd like to ask question regarding connecting the QML to cpp, my goal is to send parameter from QML in forms of username and password to cpp, the cpp itself is connected with the GSoap. If the results return true, then the user can move to another page and if wrong username and password were send, nothing will happen; but at the mean time, I'd just show some text at the console screen. This is my code, please give me a clue of what i was lack at.
Qt Code:
  1. //LogInPage
  2. import QtQuick 1.0
  3. import "comp"
  4.  
  5. Rectangle
  6. {
  7. id: mainWindow
  8. width: 360; height: 360
  9. signal dataRequired(string msg,string msg);
  10. function success() {console.log("connection done")}
  11. function fail() {console.log("fail")
  12. Image
  13. {
  14. id: backgroundAbout
  15. source: "comp/pic/background-about.jpg"
  16.  
  17. Text {
  18. id: text1
  19. x: 21
  20. y: 118
  21. width: 80
  22. height: 20
  23. text: "UserName:"
  24. font.family: "OCR A Extended"
  25. font.pixelSize: 24
  26. }
  27.  
  28. Text {
  29. id: text2
  30. x: 218
  31. y: 207
  32. width: 80
  33. height: 20
  34. text: "PassWord:"
  35. font.family: "OCR A Extended"
  36. font.pixelSize: 25
  37. }
  38.  
  39. TextInput
  40. {
  41. id: inputLogin
  42. text: ""
  43. x: 0
  44. y: 0
  45. width: 310
  46. height: 22
  47. selectionColor: "#ffffff"
  48. font.family: "OCR A Std"
  49. }
  50. }
  51.  
  52. Rectangle {
  53. id: rectangle2
  54. x: 13
  55. y: 234
  56. width: 310
  57. height: 22
  58. color: "#eecfcf"
  59. border.color: "#995757"
  60. TextInput {
  61. id: inputPass
  62. text: ""
  63. x: 1
  64. y: 1
  65. width: 310
  66. height: 22
  67. selectionColor: "#ffffff"
  68. font.family: "OCR A Extended"
  69. opacity: 1
  70. }
  71. opacity: 0.2
  72.  
  73. Text {
  74. id: text3
  75. x: 143
  76. y: 301
  77. width: 80
  78. height: 20
  79. text: "LogIn"
  80. font.family: "OCR A Extended"
  81. font.pixelSize: 25
  82. MouseArea
  83. {
  84. id: mouseareaLogIn
  85. anchors.fill: parent
  86. onPressed:
  87. {
  88. myObject.fungsiLogIn(inputLogin.text, inputPass.text}
  89. }
  90. }
  91. }
  92. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. //main.cpp
  2. #include "mainwindow.h"
  3. //#include "ui_mainwindow.h"
  4. #include <qdeclarative.h>
  5. #include <QDeclarativeView>
  6. #include "loginwidget.h"
  7. #include <QDebug>
  8.  
  9. #include <QtCore/QCoreApplication>
  10. #include <QtDeclarative/QDeclarativeEngine>
  11. #include <QtDeclarative/QDeclarativeComponent>
  12. #include <QtDeclarative/QDeclarativeView>
  13. #include <QtDeclarative/QDeclarativeContext>
  14. #include <QtCore/QVariant>
  15. #include <QtCore/QString>
  16. #include <QtCore/QMetaObject>
  17. #include "mainwindow.h"
  18.  
  19.  
  20.  
  21. MainWindow::MainWindow(QWidget *parent) :
  22. QMainWindow(parent)
  23.  
  24. {
  25. // QDeclarativeView view;
  26. this->login= new LoginWidget();
  27. this->view= new QDeclarativeView(this);
  28.  
  29. view->QDeclarativeView::setSource(QUrl::fromLocalFile("LogInPage.qml"));
  30. view->engine()->rootContext()->setContextProperty("myObject",&login);
  31. setCentralWidget(view);
  32. this->show();
  33.  
  34. }
  35.  
  36. MainWindow::~MainWindow()
  37. {
  38.  
  39. }
  40.  
  41. void MainWindow::test(char *username, char *password)
  42. {
  43. qDebug()<<" Passing done";
  44. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. //mainwindow.cpp
  2. #include <QtGUI/QApplication>
  3. #include <QtCore/QCoreApplication>
  4. #include "loginwidget.h"
  5. //#include "loginpage.qml"
  6. #include <qdeclarative.h>
  7. #include <QDeclarativeView>
  8. #include "mainwindow.h"
  9.  
  10. int main(int argc, char *argv[])
  11. {
  12. QApplication app(argc, argv);
  13. MainWindow mainwindow;
  14. mainwindow.show();
  15.  
  16. return app.exec();
  17. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. //loginwidget.cpp
  2. #include "loginwidget.h"
  3. #include "QDebug"
  4. #include "Gsoap/testBinding.nsmap"
  5. #include <QDeclarativeView>
  6.  
  7. LoginWidget::LoginWidget()
  8. {
  9.  
  10. }
  11.  
  12. void LoginWidget::fungsiLogIn(char *username, char *password){
  13. char *output;
  14.  
  15. if ( clientSoap.ns2__functionLogin(*&username,*&password,*&output) == SOAP_OK)
  16. {
  17. if (output)
  18. {
  19. emit sukses();
  20. }
  21. else
  22. {
  23. emit gagal();
  24. }
  25.  
  26. }
To copy to clipboard, switch view to plain text mode 

Thank you for the aid.

Regards,