Results 1 to 2 of 2

Thread: focousinevent not working in QLineEdit

  1. #1
    Join Date
    Feb 2010
    Posts
    20
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default focousinevent not working in QLineEdit

    I have overriddent he focusInevent in my calss .But i am not able to receive any event in my class

    This is my class

    class exportData : public QWidget {
    Q_OBJECT
    public:
    exportData(QWidget *parent = 0);
    ~exportData();

    protected:
    void changeEvent(QEvent *e);
    virtual void focusInEvent( QFocusEvent * e );
    }

    and i implemented the focusInEvent as below


    void exportData::focusInEvent(QFocusEvent *e)
    {

    if(e->type() == QFocusEvent::FocusIn)
    {
    keyBoard->show();
    ui->edtFileName->setFocus();
    }
    else if(e->type() == QFocusEvent::FocusOut)
    {
    keyBoard->hide();
    }

    }

    I have a line edit widget in the main form. What i want to do is call this focusinEvent whenevr i click on that line edit. I don't want to use the keyboard as the application will have to reside on a touch panel system.I wonder why focusInEvent is not being called?

  2. #2
    Join Date
    Aug 2008
    Posts
    134
    Thanks
    10
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: focousinevent not working in QLineEdit

    Then set the focus policy either Qt::ClickFocus or Qt::StrongFocus using setFocusPolicy();

    If this also doesn't work use eventHandler() .

Similar Threads

  1. QLineEdit
    By rick_st3 in forum Newbie
    Replies: 1
    Last Post: 14th June 2008, 09:05
  2. QLineEdit
    By coderbob in forum Qt Programming
    Replies: 6
    Last Post: 27th February 2008, 12:27
  3. About QLineEdit
    By vijay anandh in forum Newbie
    Replies: 2
    Last Post: 19th October 2006, 10:45
  4. QLineEdit
    By therealjag in forum Newbie
    Replies: 1
    Last Post: 23rd February 2006, 17:45
  5. a box around QLineEdit?
    By GreyGeek in forum Qt Tools
    Replies: 13
    Last Post: 8th February 2006, 15:40

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.