C++ (Qt)void usbController::on_lineEdit_1_textChanged(){ buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!(lineEdit_1->text().isEmpty()) && !(lineEdit_2->text().isEmpty()) );}
C++ (Qt)void usbController::on_lineEdit_1_textChanged(){ buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!(lineEdit_1->text().isEmpty()));}
C++ (Qt) void usbController::textChanged(){ buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!(lineEdit_1->text().isEmpty()) && !(lineEdit_2->text().isEmpty()) );}
C++ (Qt)#include <QtGui> #include "usbcontroller.h" usbController::usbController(QWidget *parent) : QDialog(parent){ setupUi(this); buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(lineEdit_1, SIGNAL(textChanged(QString)), this, SLOT(Changedtext())); connect(lineEdit_2, SIGNAL(textChanged(QString)), this, SLOT(Changedtext()));} void usbController::Changedtext(){ bool Ok = true; { Ok &= !lineEdit_1->text().isEmpty(); Ok &= !lineEdit_2->text().isEmpty(); if (Ok){ // emit enableNext(); buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); } }}
void usbController::changedText(){ buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!lineEdit_1->text().isEmpty() && !lineEdit_2->text().isEmpty()) }