QDoubleValidator

Z

Zabin

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

Zabin

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,183
Messages
2,570,964
Members
47,511
Latest member
svareza

Latest Threads

Top