Results 1 to 3 of 3

Thread: How to use focusInEvent method of QWidget by inheriting QTabWidget?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    518
    Thanks
    13
    Thanked 77 Times in 75 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to use focusInEvent method of QWidget by inheriting QTabWidget?

    Hi, what happens? I would say that your code should work, although I would call QTabWidget::focusInEvent() instead of QWidget::focusInEvent(). Your code skips the QTabWidget, which might not be what you want.

    Ginsengelf

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,321
    Thanks
    316
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to use focusInEvent method of QWidget by inheriting QTabWidget?

    I don't understand the point of making these virtual protected methods public in a derived class. It isn't like you can manually call them from some other class - they are called from within Qt when focus enters or leaves the widget. If you want to implement some custom behavior for these events, then you can either derive from QTabWidget (and leave the methods protected) or use QTabWidget itself and install an event handler on the instance.

    I agree with Ginsengelf - if your base class is QTabWidget, then you should be calling those event handlers and not the ones for QWidget.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. QTabWidget or QWidget signals
    By mastupristi in forum Qt Programming
    Replies: 2
    Last Post: 8th November 2016, 17:30
  2. How to get the size of a QWidget in QTabWidget
    By xiangxw in forum Qt Programming
    Replies: 1
    Last Post: 4th May 2011, 00:45
  3. Replies: 3
    Last Post: 19th January 2011, 19:43
  4. Replies: 0
    Last Post: 30th March 2010, 14:49
  5. QWidget::testWFlags() - method in Qt 4?
    By Amanda in forum Qt Programming
    Replies: 1
    Last Post: 2nd November 2006, 07:08

Tags for this Thread

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.