Results 1 to 4 of 4

Thread: tab focus on QPushbutton making QPushbutton work with spacebar but not with enter key

  1. #1
    Join Date
    Sep 2006
    Posts
    21
    Thanks
    2
    Qt products
    Qt3
    Platforms
    Windows

    Default tab focus on QPushbutton making QPushbutton work with spacebar but not with enter key

    Hai

    I have got a problem .could anybody help me.Help is urgent.
    tab focus making QPushbutton work with spacebar click but not with enter key.

    I would like to expand this.
    I have some controls like line edits,combo boxes ,push buttons.I am able to trace the tab focus on the QPushbutton.On click of space bar on the pushbutton i am able to open a dialog.but on click of enter key on the push button i am unable to open the dialog.

    I have tried in this way.
    I have set the Autodefault property value to TRUE in designer.Then i am able to get the dialog on either(space bar or enter) of the click.but the problem here i am facing is...with out the tab focus on the pushbutton also i am able to open up the dialog inspite the tab focus is in some other widget on the same dialog.

    Thanking you
    vinnu

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: tab focus on QPushbutton making QPushbutton work with spacebar but not with enter key

    Enter activates the default button regardless if it has focus or not. You can disable the autoDefault property and install an event filter on the pushbutton that would invoke animateClick() when user presses enter or return.

  3. #3
    Join Date
    Sep 2006
    Posts
    21
    Thanks
    2
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: tab focus on QPushbutton making QPushbutton work with spacebar but not with enter key

    hai

    i didnt get the idea of install an event filter on the push button.could u please ellobrate it.

    thanks
    vinnu

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: tab focus on QPushbutton making QPushbutton work with spacebar but not with enter key


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.