Results 1 to 1 of 1

Thread: some problem with QLineEdit keyPressEvent

  1. #1
    Join Date
    Dec 2009
    Location
    Shenzhen,China
    Posts
    21
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default some problem with QLineEdit keyPressEvent

    hi, guys. i meet some problem with QLineEdit::keyPresssEvent.It will not go to keyPressEvent when i type except ENTER/RETURN, but for other keys, it work fine.
    It sounds very strange, but it just happen.

    Can someone give me some advice?

    This is the code:
    QWidget* CVxTreeWidgetDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
    {
    QWidget* editor = QItemDelegate::createEditor(parent, option, index);
    QLineEdit* lineEdit = dynamic_cast<QLineEdit*>(editor);
    //bool focused = lineEdit->hasFocus(); // notice the focesed is false
    //lineEdit->setFocusPolicy(Qt::StrongFocus);
    //focused = lineEdit->hasFocus(); // notice setFocusPolicy is useless the focesed is false, too
    if (lineEdit)
    {
    connect(lineEdit, SIGNAL(editingFinished()), this, SIGNAL(editingFinishedSignal()));
    connect(lineEdit, SIGNAL(returnPressed()), this, SIGNAL(editingFinishedSignal()));
    }

    return editor;
    }
    Last edited by yxtx1984; 5th November 2010 at 09:14.

Similar Threads

  1. QLineEdit and keyPressEvent(QKeyEvent *)
    By fear in forum Qt Programming
    Replies: 6
    Last Post: 3rd June 2008, 19:31
  2. keyPressEvent problem
    By amulya in forum Qt Programming
    Replies: 4
    Last Post: 22nd January 2008, 13:16
  3. QLineEdit keyPressEvent problem
    By impeteperry in forum Qt Programming
    Replies: 6
    Last Post: 27th November 2007, 16:57
  4. KeyPressEvent and QLineEdit question
    By impeteperry in forum Qt Programming
    Replies: 1
    Last Post: 21st August 2007, 16:18
  5. QLineEdit & keyPressEvent(QKeyEvent *)
    By munna in forum Newbie
    Replies: 7
    Last Post: 29th March 2006, 14:50

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.