Can anyone guide me,
i have created my MainWindow and in its constructor i call a Dialog window named LoginWindow which inherits QDialog, this Dialog is modal and made of two lineEdits and three Buttons my problem is that i want when user clicks the "validerButton", i can transfer the texts typed by the user in the LineEdits to my MainWindow from where i called this Dialog.
this is my MainWindow s constructor
	
	MainWindow::MainWindow()
{
	createActions();
	createMenus();
	createToolBars();
	createStatusBar();
 
	readSettings();
 
	//this is where my problem starts
	login = new Loginwindow(this);
 
	login->show();
	//i tried this but i get a segmentation error
	connect (login->validerButton, SIGNAL(clicked()), this, SLOT(getNames()));
}
 
void MainWindow::getNames()
{
	text = login->getNumetudLineEdit();
}
        MainWindow::MainWindow()
{
	createActions();
	createMenus();
	createToolBars();
	createStatusBar();
	
	readSettings();
	//this is where my problem starts
	login = new Loginwindow(this);
	login->show();
	//i tried this but i get a segmentation error
	connect (login->validerButton, SIGNAL(clicked()), this, SLOT(getNames()));
}
void MainWindow::getNames()
{
	QString text;
	text = login->getNumetudLineEdit();
}
To copy to clipboard, switch view to plain text mode 
  
i send u also my LoginWindow
	
	{
	//construction des labels et des lignes edit
 
	NumetudLabel 
= new QLabel(tr
("&Numero Etudiant:"));
	NumetudLabel->setBuddy(NumetudLineEdit);
 
	CodesecretLabel 
= new QLabel(tr
("&Code Secret:"));
	CodesecretLabel->setBuddy(CodesecretLineEdit);
 
 
	inscriptionButton 
= new QPushButton(tr
("&S'inscrire"));
	inscriptionButton->setDefault(true);
 
	//disposition des layouts
	topLeftLayout->addWidget(NumetudLabel);
	topLeftLayout->addWidget(NumetudLineEdit);
	topLeftLayout->addWidget(CodesecretLabel);
	topLeftLayout->addWidget(CodesecretLineEdit);
 
	rightLayout->addWidget(validerButton);
	rightLayout->addWidget(inscriptionButton);
 	rightLayout->addWidget(inviteButton);
	rightLayout->addStretch();
 
	//QVBoxLayout *leftLayout = new QVBoxLayout;
	//leftLayout->addLayout(topLeftLayout);
 
	mainLayout->addLayout(topLeftLayout);
	mainLayout->addLayout(rightLayout);
	this->setLayout(mainLayout);
 
	this->setWindowTitle(tr("Login"));
	this->setModal(true);
	this->setSizeGripEnabled(false);
	//setFixedHeight(sizeHint().height());
 
	//les signaux et slots
	connect(validerButton, SIGNAL(clicked()), this, SLOT(Valider()));
}
        Loginwindow::Loginwindow(QWidget * parent) : QDialog (parent)
{
	//construction des labels et des lignes edit
	NumetudLabel = new QLabel(tr("&Numero Etudiant:"));
	NumetudLineEdit = new QLineEdit;
	NumetudLabel->setBuddy(NumetudLineEdit);
	CodesecretLabel = new QLabel(tr("&Code Secret:"));
 	CodesecretLineEdit = new QLineEdit;
	CodesecretLabel->setBuddy(CodesecretLineEdit);
	QPushButton * inscriptionButton;
	QPushButton * inviteButton;
	QPushButton * validerButton;
	inscriptionButton = new QPushButton(tr("&S'inscrire"));
	inscriptionButton->setDefault(true);
        inviteButton = new QPushButton(tr("&Invité"));
	validerButton = new QPushButton(tr("&Valider"));
	//disposition des layouts
	topLeftLayout = new QVBoxLayout;
	topLeftLayout->addWidget(NumetudLabel);
	topLeftLayout->addWidget(NumetudLineEdit);
	topLeftLayout->addWidget(CodesecretLabel);
	topLeftLayout->addWidget(CodesecretLineEdit);
	rightLayout = new QVBoxLayout;
	rightLayout->addWidget(validerButton);
	rightLayout->addWidget(inscriptionButton);
 	rightLayout->addWidget(inviteButton);
	rightLayout->addStretch();
	
	//QVBoxLayout *leftLayout = new QVBoxLayout;
	//leftLayout->addLayout(topLeftLayout);
 
 	mainLayout = new QHBoxLayout;
	mainLayout->addLayout(topLeftLayout);
	mainLayout->addLayout(rightLayout);
	this->setLayout(mainLayout);
	
	this->setWindowTitle(tr("Login"));
	this->setModal(true);
	this->setSizeGripEnabled(false);
	//setFixedHeight(sizeHint().height());
	//les signaux et slots
	connect(validerButton, SIGNAL(clicked()), this, SLOT(Valider()));
}
To copy to clipboard, switch view to plain text mode 
  
Pls help me, it would be nice of u
				
			
Bookmarks