[Qt-interest] line edit focus problem

Yuvaraj R yuvaraj at ongobiz.com
Thu Jul 16 12:55:30 CEST 2009


Hi All

I have set the line edit text  as default by "Dial number"

When i pressing the keys in keyboard ,then  i am clearing the  lineedit text
and inserting the pressed key value in line edit..

if i set lineEdit in setfocusby default..

that time any key events is not uptating ..

if diable the forucs for line edit.. key event are updating..

Sample code..

ui.lineEdit.setText("Dial Number")

void MainWindow::keyPressEvent(QKeyEvent *e)
{
   switch(e->key)
     {
        case Key_0 :
                             if(ui.lineEdit.Text == "Dial Number")
                              {
                               ui.lineEdit.clear }
          ui.lineEdit.insert("0");
           break;
      case Key_1 :                               if(ui.lineEdit.Text ==
"Dial Number")
                              {
                               ui.lineEdit.clear }
          ui.lineEdit.insert("1");
}
}

Please help , what's wrong with me


Thanks

Yuvaraj R
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090716/b52d2b26/attachment.html 


More information about the Qt-interest-old mailing list