[Qt-interest] lineEdit returnPressed() signal doesn't seem to work

Alexei Vinidiktov alexei.vinidiktov at gmail.com
Tue Apr 28 15:14:36 CEST 2009


Hello,

I have a basic question.

I've tried to connect the returnPressed() signal of a lineEdit control
to a slot, but the signal doesn't seem to be emitted. When I run the
compiled program and press the Enter key, nothing happens.

The lineEdit's name is lineEdit1. The whole ui is done in the Qt
Creator's visual designer.

I've added a slot void on_lineEdit1_returnPressed() to the slots
definitions and implemented it like this:

void MainWindow::on_lineEdit1_returnPressed()
{
    loadPage(ui->lineEdit1->text());
}

I've also tried adding connect(ui->lineEdit1, SIGNAL(returnPressed()),
this, SLOT(on_lineEdit1_returnPressed())); to the MainWindow's
constructor, but it didn't work either.

I don't use a validator for the linEdit control. Do I have to use one
for the returnPressed signal to be emitted?

Qt 4.5.1 on Windows XP with Qt Creator 1.1

Thanks.

-- 
Alexei Vinidiktov



More information about the Qt-interest-old mailing list