The mainwindow header looks like:
Qt Code:
  1. class MainWindow : public QMainWindow
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. explicit MainWindow(QWidget *parent = 0);
  7. bool eventFilter(QObject *obj, QEvent *event);
  8. ~MainWindow();
  9.  
  10. private:
  11. Ui::MainWindow *ui;
  12. connection *con;
  13. };
To copy to clipboard, switch view to plain text mode 

Mainwindow source looks like:


Qt Code:
  1. MainWindow::MainWindow(QWidget *parent) :
  2. QMainWindow(parent),
  3. ui(new Ui::MainWindow)
  4. {
  5. ui->setupUi(this);
  6.  
  7. ui->lineEdit->installEventFilter(this);
  8. QObjectList o_list = ui->lineEdit->children();
  9. for(int i = 0; i < o_list.length(); i++)
  10. {
  11. QLineEdit *cast = qobject_cast<QLineEdit*>(o_list[i]);
  12. if(cast)
  13. cast->installEventFilter(this);
  14. }
  15.  
  16. }
  17.  
  18.  
  19.  
  20. bool MainWindow::eventFilter(QObject *obj, QEvent *event)
  21. {
  22. if(event->type() == QEvent::MouseButtonPress)
  23. {
  24. con->show();
  25. }
  26. return false;
  27. }
  28.  
  29.  
  30. MainWindow::~MainWindow()
  31. {
  32. delete ui;
  33. }
To copy to clipboard, switch view to plain text mode 

the Ui window contains a lineedit each.the connection window contains a textbox and the mainwindow contains another.The objective is to transfer the string/data from the widget window to main window using connect or any other method.