Spinbox doesn't allow blanks?

18 views
Skip to first unread message

Jaimie

unread,
Jun 30, 2020, 7:29:01 PM6/30/20
to pyqtgraph
I have implemented a pyqtgraph parameter tree in my application.  Most of the parameters are SimpleParameter's with float or int type.  pyqtgraph takes care of generating the tree items which are WidgetParameterItems with a pyqtgraph spinbox.  I would like to default the values to '' and allow users to enter nothing - i.e., an empty spinbox.  Currently when you delete the spinbox contents (or set default = ''), it defaults to zero.  This is proving difficult for me to change.  

At first, I tried providing a different evalFunc to the spinbox, but that was not enough.

So, far I've overridden the following spinbox functions:  interpret, setValue, emitChanged, and value.  Also overidden parameterTypes.SimpleParameter._interpretValue.

It now seems to be working as I expect (allowing users delete spinbox contents and set value to '')

I'm wondering if there is a better way altogether - my approach seems messy and not supportable long term.  I love the functionality that pyqtrgraph parameter tree items provides (spinbox functionality, data validation, si prefixes and units).  Does anyone have any suggestions on a better way to do this?

Also, this seems like a reasonable feature request (allowing blanks in parameter tree items of type int/float).  I imagine others would have encountered this need?  Am I missing something?

Thanks!

P.S.  I love pyqtgraph!  Thanks for creating and maintaining this library!




Reply all
Reply to author
Forward
0 new messages