Results 1 to 5 of 5

Thread: QtColorComboBox leads to a crash when used as an editor in a QItemDelegate derivative

  1. #1
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    258
    Thanks
    22
    Thanked 19 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default QtColorComboBox leads to a crash when used as an editor in a QItemDelegate derivative

    Hi,
    I have implemented a minimal example to showcase an issue I've come across when using QtColorComboBox (http://doc.qt.nokia.com/solutions/4/...rcombobox.html). When I use the "more" entry to get a custom color and use the "named color entry" in the following color dialog or select a color and press ok or cancel in the same color dialog, the application crashes. Valgrind tells me of invalid reads and writes in the qtcolorcombobox class. I would really appreciate it if someone helped me to find the cause of these crashes. I've attached the test application to this post. The QtColorComboBox class is included in the thirdparty subdirectory so there are no dependecies (except Qt of course) in order to test the application. The valgrind log is also included in the root directory and is called valgrind.log.

    Thankx in advance
    Attached Files Attached Files
    Last edited by momesana; 6th May 2010 at 03:05.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    258
    Thanks
    22
    Thanked 19 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QtColorComboBox leads to a crash when used as an editor in a QItemDelegate deriva

    Really no ideas?

  3. #3
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: QtColorComboBox leads to a crash when used as an editor in a QItemDelegate deriva

    Might be too late, but I saw this post that reminded me of your problem.

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    258
    Thanks
    22
    Thanked 19 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QtColorComboBox leads to a crash when used as an editor in a QItemDelegate deriva

    Quote Originally Posted by norobro View Post
    Might be too late, but I saw this post that reminded me of your problem.
    Interesting. I think it's a bug in the QtColorComboBox class. I created my own colorcombobox that behaves identically to QtColorComboBox but doesn't exhibit the crash.

  5. #5
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: QtColorComboBox leads to a crash when used as an editor in a QItemDelegate deriva

    After seeing that post I played around with your example a little and ended up adding the following code to the Delegate class to solve the segfault problem:
    Qt Code:
    1. bool eventFilter(QObject *obj, QEvent *event){
    2. Q_UNUSED(obj);
    3. if(event->type()==QEvent::FocusOut) return true;
    4. return false;
    5. }
    To copy to clipboard, switch view to plain text mode 
    How did you handle retaining the custom colors when the delegate goes out of scope?
    Attached Images Attached Images

Similar Threads

  1. QItemDelegate Editor Crash
    By mclark in forum Qt Programming
    Replies: 13
    Last Post: 22nd March 2018, 04:06
  2. implementing sizeHint in a QItemDelegate derivative
    By momesana in forum Qt Programming
    Replies: 2
    Last Post: 5th May 2010, 21:59
  3. Replies: 0
    Last Post: 2nd March 2010, 18:06
  4. Replies: 0
    Last Post: 11th February 2010, 09:33
  5. Replies: 2
    Last Post: 23rd May 2008, 13:22

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.