[PyQt] Object lifetime issues with dialogs, called from QStyledItemDelegate editors
Barry Scott
barry at barrys-emacs.org
Sun Apr 9 10:07:45 BST 2017
This has nothing to do with the problem...
I'm curious, why post on stackoverflow when you have this list with the author of the code to ask?
I see the same pattern for projects I'm the maintainer of.
Barry
> On 8 Apr 2017, at 21:06, Hans-Peter Jansen <hpj at urpla.net> wrote:
>
> Hi,
>
> I'm suffering from strange behavior related to object lifetime issues, when
> modal dialogs are called from QStyledItemDelegate editors, and posted these
> issues here:
>
> http://stackoverflow.com/questions/43298605/strange-behavior-of-qcolordialog-when-called-from-qstyleditemdelegate-subclass
>
> http://stackoverflow.com/questions/43299616/calling-qcolordialog-triggered-from-qstyleditemdelegate-editor-results-in-crash
>
> When executing the itemdelegate.py script, double clicking on a color item
> displays the standard QColorDialog. The dialog will close immediately, if the
> dialog is moved(!). OTOH, selecting an arbitrary color beforehand, the dialog
> behaves correctly..
>
> The mplexitemdelegate.py script crashes, when closing the QColorDialog, after
> being called from a QTableView subclass, triggered from a signal.
>
> When started, various editors for different types appear in the second column.
> The color editors open a QComboBox with various predefined colors. The last
> item triggers a signal in the QTableView, that calls QColorDialog.getColor().
>
> Earlier versions attempted to open the QColorDialog from the
> QStyledItemDelegate editor directly, similar to the code in the first issue,
> with the same result (segfault), unlike that issue, where the QColorDialog
> behaves strangely.
>
> One could observe, that opening the dialog triggers a window context change,
> which probably results in destructing the delegate editor of the table view.
> Therefore I implemented the selectColorDialog signal, that operates completely
> independent from the delegate editor. The gdb backtrace points to some
> QAccessible methods, triggered from the QComboBox, but I cannot see the
> relation here.
>
> Other attempts to cope with this issue used subclassed QComboBoxes with
> subclassed QLineEdits, catching and ignoring any leave, hide and close events
> during the lifetime of the color dialog, but they failed in similar ways.
> Also executing other dialogs from within this setting show the same behavior,
> that I would like to understand.
>
> Any idea anybody, what's going wrong here? It might be a Qt5 issue, though.
>
> Thanks in advance,
> Pete
>
> Environment:
> Python: 3.4.5
> Sip: 4.19.2
> Qt5: 5.8.0
> PyQt5: 5.8.2
> Linux: openSUSE/KDE4<mplexitemdelegates.py><itemdelegate.py>_______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
More information about the PyQt
mailing list