Results 1 to 8 of 8

Thread: How to create a QStyledItemDelegate made of two QDoubleSpinBox widgets

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to create a QStyledItemDelegate made of two QDoubleSpinBox widgets

    The default behaviour will be looking to commit and close the editor when the widget you provided as the editor loses focus. I expect that widget will lose focus immediately when the focus shifts into one of its child spin boxes. You should look specifically at that event and whether you need to block it from propagating.

    Cannot say I have done a lot of event filtering myself so I will be interested in the other responses.

  2. The following user says thank you to ChrisW67 for this useful post:

    abgeos (19th March 2013)

  3. #2
    Join Date
    Mar 2013
    Posts
    4
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create a QStyledItemDelegate made of two QDoubleSpinBox widgets

    Thanks,

    It is the first time that I work explicitly with the child-parent relationship of widgets as well as with event filtering. So this is not obvious to me.

    I was under the impression that the eventFilter member function of the delegate would have taken care of the out of focus event within a child of the delegate widget (line 45 of the last code snippet in my original post):
    Qt Code:
    1. QWidget *w = QApplication::focusWidget();
    2. while (w) { // don't worry about focus changes internally in the editor
    3. if (w == editor)
    4. return false;
    5. w = w->parentWidget();
    6. }
    To copy to clipboard, switch view to plain text mode 
    It seems that this is not the case. I'll run more tests.

    Thanks
    Last edited by abgeos; 19th March 2013 at 19:35. Reason: spelling corrections

Similar Threads

  1. connect mainwindow with self-made widgets
    By pinkiP in forum Qt Programming
    Replies: 11
    Last Post: 10th July 2012, 10:16
  2. Create an array of Widgets
    By gt.beta2 in forum Qt Tools
    Replies: 4
    Last Post: 25th February 2009, 19:44
  3. Replies: 8
    Last Post: 16th January 2009, 16:10
  4. How to get correct header with custom made widgets?
    By Arthur in forum Qt Programming
    Replies: 3
    Last Post: 26th April 2007, 17:07
  5. How to create pop up widgets in designer.
    By gsQT4 in forum Qt Tools
    Replies: 1
    Last Post: 25th May 2006, 16:40

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.