[PyQt] How to exclude the Lineedits in QSpinbox
mani kandan
mankand007 at gmail.com
Mon Jun 25 14:08:46 BST 2012
I have a function to check if the selected type of children of a widget
have been filled or not. Here is the code:
def fillCompleted(self, parent, combo=True, spin=True, dspin=True,
line=True):
'''Checks if all fields in a parent widget have been filled'''
filledCompletely = True
if combo:
for x in parent.findChildren(QComboBox):
if x.currentIndex() == 0:
filledCompletely = False
print 'combo'
if spin:
for x in parent.findChildren(QSpinBox):
if x.cleanText() == "":
filledCompletely = False
print 'spin'
if dspin:
for x in parent.findChildren(QDoubleSpinBox):
if x.cleanText() == "":
filledCompletely = False
print 'dspin'
if line:
for x in parent.findChildren(QLineEdit):
if x.text() == "":
filledCompletely = False
if not filledCompletely:
QMessageBox.warning(self,
"Data Incomplete",
"Please fill all the fields!")
return 0
return 1
I called this function with
if self.fillCompleted(self.purItmSel.currentWidget(),
spin=False,
dspin=False):
As you can see, I told it to exclude spinboxes and doublespinboxes from
checking.
However, while checking, it considers the lineedits in these spin/double
spin boxes as lineedit, and validate them too.
How do I classify between the acual lineedits, and lineedits of the
spin/double spinboxes?
Thanks!
--
by,
Yours Sincerely
The One and Only
Manikandan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20120625/a55be550/attachment.html>
More information about the PyQt
mailing list