Results 1 to 4 of 4

Thread: focusNextChild Segmentatiion Fault

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2008
    Location
    Brasil - São Paulo - Marília
    Posts
    28
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    3

    Default Re: focusNextChild Segmentatiion Fault

    Installing the eventFilter in my own class give me the possibily to handle all kinds of events in one central location. And the Qt documentation doesn't point this as bad habit, nor recomend against it.

    Qt Creator use this kind of eventFilter control (src/plugins/coreplugin/locator/locatorwidget.cpp), see line 262.
    Qt Code:
    1. // We set click focus since otherwise you will always get two popups
    2. m_fileLineEdit->setButtonFocusPolicy(Utils::FancyLineEdit::Left, Qt::ClickFocus);
    3. m_fileLineEdit->setAttribute(Qt::WA_MacShowFocusRect, false);
    4. m_fileLineEdit->installEventFilter(this);
    5. this->installEventFilter(this);
    To copy to clipboard, switch view to plain text mode 

    The error persists calling QObject::eventFilter or QDialog::eventFilter.

    Oddly enough this same code runs correctly under Qt 5.3.1 in windows. It's seems that it could be related to the linux version of Qt.

    I track the error to a QPaintEvent using gdb.

    Anyway thanks for the help.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: focusNextChild Segmentatiion Fault

    Quote Originally Posted by croscato View Post
    Installing the eventFilter in my own class give me the possibily to handle all kinds of events in one central location.
    In such case you should reimplement event() for the object. All events pass through there before reaching their respective event handlers. Installing an event filter on yourself is not a good solution. And in your particular case you are handling one type of event so there is no reason not to put it in keyPressEvent().

    Maybe you should state what exactly you are trying to do?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. segmentation fault!!
    By Yayati.Ekbote in forum Qt Programming
    Replies: 4
    Last Post: 24th March 2010, 15:10
  2. Seg Fault
    By giusepped in forum Qt Programming
    Replies: 8
    Last Post: 23rd October 2008, 08:12
  3. segmentation fault
    By uchennaanyanwu in forum Newbie
    Replies: 3
    Last Post: 31st July 2008, 16:52
  4. segmentation fault
    By dreamer in forum Qt Programming
    Replies: 6
    Last Post: 9th May 2008, 07:48
  5. Seg fault, but why?
    By Lykurg in forum Newbie
    Replies: 5
    Last Post: 8th March 2007, 22:49

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.