Hi.
I have a (login) window and an (employe) window.
I used signals & slots to send one variable from the first window to the seconde
What I want is when I click the login button the value of the username should be sent to employe window and open it on the same time.
here's what I've done:
login.h
...
signals:
void notifyValueSentToEmp
(const QString username
);
...
...
signals:
void notifyValueSentToEmp(const QString username);
...
To copy to clipboard, switch view to plain text mode
login.cpp
...
void Login::on_pushButton_Login_clicked(){
...
employe e;
emit notifyValueSentToEmp(username);
e.show();
...
}
...
void Login::on_pushButton_Login_clicked(){
...
employe e;
emit notifyValueSentToEmp(username);
e.show();
...
}
To copy to clipboard, switch view to plain text mode
When I use (e.show()) in login.cpp the variable is not sent
employe.h
...
private slots:
void onValueSentToEmp
(const QString usename
);
...
...
private slots:
void onValueSentToEmp(const QString usename);
...
To copy to clipboard, switch view to plain text mode
employe.cpp
...
void employe
::onValueSentToEmp(QString username
){ // Here where I use the sent variable username
}
...
...
void employe::onValueSentToEmp(QString username){
// Here where I use the sent variable username
}
...
To copy to clipboard, switch view to plain text mode
main.cpp
Login l;
employe e;
l.show();
e.show();
Login l;
employe e;
QObject::connect(&l,SIGNAL(notifyValueSentToEmp(QString)),&e,SLOT(onValueSentToEmp(QString)));
l.show();
e.show();
To copy to clipboard, switch view to plain text mode
When I use (e.show()) in the main the value is sent but the second window appears in the same time with first window.
I hope you can help fix this.
thank u
Bookmarks