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

Paul O. Seidon p.oseidon at datec.at
Sun Apr 19 20:15:04 CEST 2015


Hi Chris,

I found the "solution" by "porting" (was completely painless) my code to 
PyQt, which crashed, too. Some PyQt sample code I found elsewhere "inspired" 
me to try the emitlayoutAboutToBeChanged method.

Cheers 
Paul


Christian Tismer wrote:

> 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
> 
> 





More information about the PySide mailing list