[Interest] OverflowError when setting datat on QStandardItem

Frank Rueter | OHUfx frank at ohufx.com
Sat Apr 29 06:58:04 CEST 2017


Looks like explicitly casting to long() seems to work. e.g.:
     i.setData(long(13003676769), QtCore.Qt.UserRole+1)



On 29/04/17 3:41 PM, Frank Rueter | OHUfx wrote:
> Hi,
>
> I am traversing a directory collecting file sizes in bytes and 
> assigning them as custom data to QStandardItems.
> Unfortunately I get an OverflowError when trying to set too large a 
> number it would seem:
>
>     i = QtGui.QStandardItem()
>     i.setData(13003676769, QtCore.Qt.UserRole+1)
>
>      File "/path/to/module.py", line 38, in <module>
>       i.setData(13003676769, QtCore.Qt.UserRole+1)
>
>     OverflowError:
>
>
> I guess I could convert to KB, MB, GB etc, or even a string, but those 
> all seem like band aids. Can somebody please help me understand why I 
> am seeing this error and what the prescribed way of dealing with it is?
> I couldn't find anything useful online.
>
> This is Qt 4.8.7
>
> Thanks,
> frank
>
> -- 
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170429/121cdb00/attachment.html>


More information about the Interest mailing list