Quote Originally Posted by wenn32 View Post
Qt Code:
  1. #include <QApplication>
  2. #include <QWidget>
  3. #include <QLineEdit>
  4.  
  5. class NewSlot : public QWidget
  6. {
  7. Q_OBJECT
  8.  
  9. private slots:
  10. void open()
  11. {
  12. /* code to write to a file */
  13. // i know this part.
  14. }
  15. };
  16.  
  17.  
  18.  
  19. int main(int argc, char* argv[])
  20. {
  21. QApplication app(argc, argv);
  22. QWidget window;
  23. QLineEdit password("",&window);
  24.  
  25.  
  26. password.move(480,750);
  27. password.resize(370,30);
  28. password.setEchoMode(QLineEdit::Password);
  29. window.setWindowState(Qt::WindowFullScreen);
  30.  
  31.  
  32. QObject::connect(&password,SIGNAL(returnPressed()),&password,SLOT(write_to_file()));
  33. window.show();
  34. return app.exec();
  35. }
To copy to clipboard, switch view to plain text mode 

ok can i normally create a object of the class NewSlot and call in connect() and by the way how do i get the data of the password(QLineedit) field


Thank you very much for helping me!

Why not making your class the one which holds the password LineEdit, instead of the QWidget object ??
this will give your slot easy access to get the text