Hello,

First of all sorry for the ugly syntax/style of my code...
Well so I am creating my small GUI, I have a main window (no problem here), and a secondary window (pops up for connecting to database). to connect to the db i have a connection class (a QPhushButton) wich takes the input of 4 QLineEdits. The problem is : I can create my connection class/Line Edits if i set their parent as the Main window but not if I pass my connectionForm class (which inherit from QWidget since it is a window )
I do not know if I expressed myself well so here is the code :

First the connectionForm constructor :

Qt Code:
  1. connectionForm::connectionForm(QWidget *parent) :QWidget(parent), ui(new Ui::connectionForm)
  2. {
  3. ui->setupUi(this);
  4. QLineEdit hostLine (&this); // error here, end of my post for error message
  5. QLineEdit userLine (&this); // error here, end of my post for error message
  6. QLineEdit passLine (&this); // error here, end of my post for error message
  7. QLineEdit dbLine (&this); // error here, end of my post for error message
  8. connection_class co1 (&this); // error here, end of my post for error message
  9. //The code continues but has no bug
To copy to clipboard, switch view to plain text mode 

Here the connectionForm.h

Qt Code:
  1. #include <QWidget>
  2. #include "connection.h"
  3. namespace Ui {
  4. class connectionForm;
  5. }
  6.  
  7. class connectionForm : public QWidget
  8. {
  9. Q_OBJECT
  10.  
  11. public:
  12. explicit connectionForm(QWidget *parent = 0);
  13. ~connectionForm();
  14.  
  15. private:
  16. void setConnectionGeomConnec(QWidget *co);
  17. void setLineEditGeom(QWidget *leg, int x, int y, int h, int w);
  18.  
  19. Ui::connectionForm *ui;
  20. QLineEdit hostLine;
  21. QLineEdit userLine;
  22. QLineEdit passLine;
  23. QLineEdit dbLine;
  24. connection_class co1 ();
  25. };
To copy to clipboard, switch view to plain text mode 


and finally, the constructor of connection_class .

Qt Code:
  1. connection_class (QWidget *parent, QLineEdit *host,QLineEdit *user,QLineEdit *pass,QLineEdit *dbn);
To copy to clipboard, switch view to plain text mode 
The error message precisely is :

cannot take the adress of a rvalue of type 'connectionForm'
I understand it means that I used a wrong type for initialisation but why ? Since connectionForm inherits from QWidget...