int main(int ac, char **av)
{
QApplication app(ac, av);
Dialog *dialog = new Dialog();
dialog->show();
return app.exec();
}
namespace Ui {
class Dialog;
}
class Dialog : public QDialog
{
Q_OBJECT
public:
explicit Dialog(QWidget *parent = 0);
~Dialog();
private slots:
void onLineEdit();
void onButtonClicked();
private:
Ui::Dialog *ui;
};
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
connect(ui->lineEdit, SIGNAL(editingFinished()), this, SLOT(onLineEdit()));
connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
}
Dialog::~Dialog()
{
delete ui;
}
void Dialog::onLineEdit() {
qDebug() << QString("line edit finish");
}
void Dialog::onButtonClicked() {
qDebug() << QString("button clicked");
}
Above is the demo code, the functionality is very simple, and the interface is as the picture shows. The GUI interface
In this pic, a groupBox wraps the lineEdit & pushButton. When I input some text into the LineEdit, then move the mouse to another place, but within the groupBox, the LineEdit Won't emit the editingfinished() signal.
This situation means the lineEdit doesn't lose focus. This problem is really strange. Could you tell me what's wrong.
Thanks ahead.