QDoubleValidator

Zabin zabin.farishta at gmail.com
Wed Jan 6 17:47:37 EST 2010


On Jan 7, 10:23 am, Zabin <zabin.faris... at gmail.com> wrote:
> Hey!
>
> I am new PyQt programmer and want to restrict users to allow only
> numeric values into a table and lineedit boxes. I found the
> QDoubleValidator class but am unsure as to how to implement it. (I am
> a little shaky on the concept of parent and how to define them). Any
> help would be much appreciated!

I managed to get it going for the line edit- but am stuck with
checking a cell in a table as cells do not have the set validator
attribute- here's the code i had for the line edit:

 self.ui.Thickness_datum.setValidator(QtGui.QDoubleValidator(-999.0,
999.0, 2, self.ui.Thickness_datum))

for the table i thought it would be:

self.ui.table_process.item(row,2).setValidator(QtGui.QDoubleValidator
(-999.0, 999.0, 2, self.ui.table_process.item(row,2)))

Any help would be appreciated



More information about the Python-list mailing list