How to set validator for all Line edit
-
No nothing exist like this.
-
Hi,
You can use findChildren and use a loop to set the validator.
Also, you might want to consider using a more appropriate widget for integer input like QSpinBox.
-
Hi,
You can use findChildren and use a loop to set the validator.
Also, you might want to consider using a more appropriate widget for integer input like QSpinBox.
-
Hi,
You can use findChildren and use a loop to set the validator.
Also, you might want to consider using a more appropriate widget for integer input like QSpinBox.
-
Hi,
You can use findChildren and use a loop to set the validator.
Also, you might want to consider using a more appropriate widget for integer input like QSpinBox.
-
Yes, it possible if with little bit more programming. Set the object name for each of the lineEdit object. Inside the for loop just do something like.
for (int i=0; i < allPButtons.size(); i++) { if(allPButtons.at(i).objectName.compare("ManiRon")==0) { // set validator }else { allPButtons.at(i)->setValidator(new QIntValidator(0,20,this)); } }
-
Yes, it possible if with little bit more programming. Set the object name for each of the lineEdit object. Inside the for loop just do something like.
for (int i=0; i < allPButtons.size(); i++) { if(allPButtons.at(i).objectName.compare("ManiRon")==0) { // set validator }else { allPButtons.at(i)->setValidator(new QIntValidator(0,20,this)); } }
@dheerendra said in How to set validator for all Line edit:
if(allPButtons.at(i).objectName.compare("ManiRon")==0) {
// set validator
}elseit worked thanks sir
-
Cool. Enjoy Qt programming. Please move the issue to SOLVED state. It helps others as well.
-
One small thing:
@ManiRon said in How to set validator for all Line edit:QList<QLineEdit *> allPButtons
Be more careful with the names of your variables.
allPButtons
suggests a list of QPushButton which is unrelated to your QLineEdit setup. This makes your code hard to read and understand. -
One small thing:
@ManiRon said in How to set validator for all Line edit:QList<QLineEdit *> allPButtons
Be more careful with the names of your variables.
allPButtons
suggests a list of QPushButton which is unrelated to your QLineEdit setup. This makes your code hard to read and understand.