Results 1 to 2 of 2

Thread: how to setFocus to button, in widget from QMainWindow

  1. #1
    Join Date
    May 2010
    Posts
    13
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default how to setFocus to button, in widget from QMainWindow

    In widget:
    1. ...
    2. void setup()
    3. {
    4. button->setFocus();
    5. }
    6. ...



    in QMainWindow
    1. ...
    2. widget->setup();
    3. setCentralWidget(widget);
    4. ...


    but focus are not on button, only if I press tab..
    How can I do that focus will be on button?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: how to setFocus to button, in widget from QMainWindow

    Try
    Qt Code:
    1. setCentralWidget(widget);
    2. widget->setup();
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. How to add close button to each tab widget Qtabwidget?
    By kishore7771 in forum Qt Programming
    Replies: 3
    Last Post: 4th April 2010, 08:42
  2. Replies: 5
    Last Post: 30th July 2009, 12:37
  3. Custom widget: a button within a button
    By Gnurou in forum Qt Programming
    Replies: 7
    Last Post: 18th June 2009, 09:03
  4. SetFocus/Actiwation widget
    By visor_ua in forum Qt Programming
    Replies: 0
    Last Post: 29th October 2008, 14:04
  5. Close Button on Modal Widget?
    By vishal.chauhan in forum Qt Programming
    Replies: 5
    Last Post: 18th February 2008, 11:38

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
  •  
Qt is a trademark of The Qt Company.