[PySide] Simple app using a timer to update crahes when maximized

Christian Tismer tismer at stackless.com
Sat Apr 18 15:16:18 CEST 2015


Hi,
in the documentation at http://doc.qt.io/qt-4.8/qabstractitemmodel.html
the following is told us:

> When subclassing QAbstractItemModel
> <http://doc.qt.io/qt-4.8/qdeclarativemodels.html#qabstractitemmodel> or QAbstractProxyModel
> <http://doc.qt.io/qt-4.8/qabstractproxymodel.html>, ensure that you
> emitlayoutAboutToBeChanged
> <http://doc.qt.io/qt-4.8/qabstractitemmodel.html#layoutAboutToBeChanged>()
> before changing the order of items or altering the structure of the
> data you expose to views, and emit layoutChanged() after changing the
> layout.

Admittedly, PySide should not just crash, but I'm not sure if that is
a PySide problem.
It would be interesting to run the same example on PyQt and see how
that behaves.

cheers - Chris


On 13.04.15 17:23, Paul O. Seidon wrote:
> Strange, had to add the layoutToBeChanged signal in the timer callback:
>
>     def _on_Qt_TIMEOUT_timer_( self):
>         self.layoutAboutToBeChanged.emit()
>         self.layoutChanged.emit()
>         return
>
> instead of just
>
>     def _on_Qt_TIMEOUT_timer_( self):
>         self.layoutChanged.emit()
>         return
>
> Cheers
> Paul
>
>
> Paul O.  Seidon wrote:
>
>> Dear PySiders,
>>
>>
>> being a wxPython user for years I decided to have a look at Qt using
>> PySide. A simple to-do manager containing to-dos that change their
>> priority over time (depending on the distance of now to the due date)
>> should be suited to get my feet wet.
>>
>> It uses QTableView, QSortFilterProxyModel and QAbstractTableModel.
>>
>> The QAbstractTableModel (actually the subclass) features a QTimer to
>> recalculate the priorities of the to-dos. Here I do
>>
>>     def _on_Qt_TIMEOUT_timer_( self):
>>         self.layoutChanged.emit()
>>         return
>>
>> to tell the view to redisplay the data.
>>
>> Everything works fine so far, but when I minimize, maximize, minimize,
>> maximize, ... the GUI, then suddenly the app crashes upon maximizing the
>> GUI. It does not so, if I don't start the QTimer. And, the smaller the
>> timer interval the sooner it crashes.
>>
>> I guess there happens something in the QTableView when the GUI is max'ed
>> that interferes with the slot called by self.layoutChanged.emit().
>>
>> I'm on Arch Linux, Python 2.7.9.
>>
>> Any idea?
>>
>>
>> Kind regards
>> Paul
>
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside


-- 
Christian Tismer             :^)   tismer at stackless.com
Software Consulting          :     http://www.stackless.com/
Karl-Liebknecht-Str. 121     :     http://www.pydica.net/
14482 Potsdam                :     GPG key -> 0xFB7BEE0E
phone +49 173 24 18 776  fax +49 (30) 700143-0023

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20150418/3f58e55f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 536 bytes
Desc: OpenPGP digital signature
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20150418/3f58e55f/attachment.sig>


More information about the PySide mailing list