cannot find main.moc
Quote Originally Posted by Ethan View Post
Let me know if you dont understand any line of the code. I used qdebug(), then you can see when pressing a Qpushbutton the string data is captured and can be seen with Qt Creator (in application output).

-E

Qt Code:
  1. #include <QtGui>
  2.  
  3. class ExampleForNeutrino: public QWidget
  4. {
  5. Q_OBJECT
  6. public:
  7.  
  8. ExampleForNeutrino(QWidget *p = 0): QWidget(p)
  9. {
  10. textUser = new QLineEdit(tr("Insert text"));
  11. captureText = new QPushButton(tr("CaptureText"));
  12. connect(captureText,SIGNAL(clicked()),this, SLOT(storeText()));
  13.  
  14. QVBoxLayout *layout = new QVBoxLayout();
  15. layout->addWidget(textUser);
  16. layout->addWidget(captureText);
  17. setLayout(layout);
  18.  
  19. }
  20.  
  21. public slots:
  22. void storeText()
  23. {
  24. QByteArray str = textUser->text().toAscii();
  25. qDebug() << "Text captured by neutrino: " << str;
  26. }
  27.  
  28. private:
  29. QLineEdit *textUser;
  30. QPushButton *captureText;
  31. };
  32.  
  33. int main(int argc, char *argv[])
  34. {
  35.  
  36. QApplication a(argc, argv);
  37.  
  38. ExampleForNeutrino e;
  39. e.show();
  40. return a.exec();
  41. }
  42. #include "main.moc"
To copy to clipboard, switch view to plain text mode