ChangeInfoDialog::ChangeInfoDialog(SqlTableModel *sqlModel, int index, QWidget *parent) : QDialog(parent) { setupUi(this); this->sqlModel = sqlModel; // 设置输入过滤器 setRegExp(); idEdit->setText(sqlModel->record(index).value(stu_id).toString()); nameEdit->setText(sqlModel->record(index).value(stu_name).toString()); sexComboBox->setCurrentIndex(((sqlModel->record(index).value(stu_sex).toString()) == "男") ? 0 : 1); classEdit->setText(sqlModel->record(index).value(stu_class).toString()); birthdayEdit->setText(sqlModel->record(index).value(stu_birthday).toString()); qqEdit->setText(sqlModel->record(index).value(stu_qq).toString()); phone1Edit->setText(sqlModel->record(index).value(stu_phone1).toString()); phone2Edit->setText(sqlModel->record(index).value(stu_phone2).toString()); mailEdit->setText(sqlModel->record(index).value(stu_mail).toString()); blogEdit->setText(sqlModel->record(index).value(stu_blog).toString()); wheretogoEdit->setText(sqlModel->record(index).value(stu_where_to_go).toString()); otherinfoEdit->setText(sqlModel->record(index).value(stu_other_info).toString()); // 固定对话框大小,不允许调整 this->setFixedSize(this->width(),this->height()); }
void CAction::setAction(CAction P_action) { if (P_action.getActionType() == CAction::E_AT_ASSIGN_FROM_SAMPLE) { assert(P_action.getDistribution() != NULL); } int L_i; setActionType ( P_action.getActionType() ); setLookingPlace ( P_action.getLookingPlace() ); setVarId ( P_action.getVarId() ); setVarInId ( P_action.getVarInId() ); setDoubleValue ( P_action.getDoubleValue() ); setDistribution ( P_action.getDistribution() ); setScenario ( P_action.M_scenario ); setNbSubVarId ( P_action.getNbSubVarId() ); for (L_i = 0; L_i < P_action.getNbSubVarId() ; L_i++ ) { setSubVarId (P_action.getSubVarId(L_i)); } setLookingChar ( P_action.getLookingChar() ); setCheckIt ( P_action.getCheckIt() ); setCheckItInverse ( P_action.getCheckItInverse() ); setCaseIndep ( P_action.getCaseIndep() ); setOccurence ( P_action.getOccurence() ); setHeadersOnly ( P_action.getHeadersOnly() ); for (L_i = 0; L_i < MAX_ACTION_MESSAGE; L_i++) { setMessage(P_action.M_message_str[L_i], L_i); } setRegExp ( P_action.M_regularExpression); setIntCmd ( P_action.M_IntCmd ); #ifdef PCAPPLAY setPcapArgs ( P_action.M_pcapArgs ); #endif }
void PaymentSumValidator::SetRegExp() { //QRegExp rx("^0?\\.[0-9]{0,2}$|^[1-9][0-9]*(\\.)?[0-9]{0,2}$|^0$"); QRegExp rx("^0?[\\.\\,]{1}[0-9]{0,2}$|^[1-9][0-9]*([\\.\\,]{1})?[0-9]{0,2}$|^0$"); //QValidator dx = new QDoubleValidator(0,99999999.99, 2, this); setRegExp(rx); }
//------------------------------------------------------------------------- DcMidiTrigger::DcMidiTrigger( QString pattern,const QObject *receiver, const char *member ) { reset(); setRegExp(pattern); _signal = new DcSignal(receiver,member,this); }
int QRegExpValidator::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QValidator::qt_metacall(_c, _id, _a); if (_id < 0) return _id; #ifndef QT_NO_PROPERTIES if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QRegExp*>(_v) = regExp(); break; } _id -= 1; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setRegExp(*reinterpret_cast< QRegExp*>(_v)); break; } _id -= 1; } else if (_c == QMetaObject::ResetProperty) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 1; } #endif // QT_NO_PROPERTIES return _id; }
EWAShowPolicy::EWAShowPolicy( bool bFinded, const QRegExp& rx, bool bUsed, QObject *pParent ) :QObject( pParent ) { setShowIfChanged( bFinded ); setRegExp( rx ); setUsed( bUsed ); }
EWAShowPolicy& EWAShowPolicy::operator=( const EWAShowPolicy *pOther ) { setShowIfChanged( pOther->showIfChanged() ); setRegExp( pOther->getRegExp() ); setUsed( pOther->isUsed() ); return *this; }
DatabaseOption::DatabaseOption() : Option(i18n("Database..."), i18n("Add information from the database"), SmallIcon("server-database")) { addToken("[db:||key||]", i18n("Add database information")); QRegExp reg("\\[db(:(.*))\\]"); reg.setMinimal(true); setRegExp(reg); registerKeysCollection(); }
ChangeInfoDialog::ChangeInfoDialog(QWidget *parent) : QDialog(parent) { setupUi(this); // 设置输入过滤器 setRegExp(); // 固定对话框大小,不允许调整 this->setFixedSize(this->width(),this->height()); }
RangeModifier::RangeModifier() : Modifier(i18n("Range..."), i18n("Add only a specific range of a renaming option"), SmallIcon("measure")) { addToken("{range:||from||,||to||}", i18n("Extract a specific range (if '||to||' is omitted, go to the end of string)")); QRegExp reg("\\{range(:(\\d+)(,((-1|\\d+))?)?)\\}"); reg.setMinimal(true); setRegExp(reg); }
PrimerValidator::PrimerValidator(QObject *parent, bool allowExtended) : QRegExpValidator(parent) { const DNAAlphabet* alphabet = AppContext::getDNAAlphabetRegistry()->findById( allowExtended ? BaseDNAAlphabetIds::NUCL_DNA_EXTENDED() : BaseDNAAlphabetIds::NUCL_DNA_DEFAULT()); QByteArray alphabetChars = alphabet->getAlphabetChars(true); // Gaps are not allowed alphabetChars.remove(alphabetChars.indexOf('-'), 1); setRegExp(QRegExp(QString("[%1]+").arg(alphabetChars.constData()))); }
RemoveDoublesModifier::RemoveDoublesModifier() : Modifier(i18n("Remove Doubles"), i18n("Remove duplicate words"), "edit-copy") { addToken("{removedoubles}", description()); QRegExp reg("\\{removedoubles\\}"); reg.setMinimal(true); setRegExp(reg); }
ReplaceModifier::ReplaceModifier() : Modifier(i18nc("Replace text", "Replace..."), i18n("Replace text in a renaming option"), SmallIcon("document-edit")) { addToken("{replace:\"||old||\", \"||new||\",||options||}", i18n("Replace text (||options||: ||r|| = regular expression, ||i|| = ignore case)")); QRegExp reg("\\{replace(:\"(.*)\",\"(.*)\"(,(r|ri|ir|i))?)\\}"); reg.setMinimal(true); setRegExp(reg); }
ParameterValueValidator::ParameterValueValidator(const QString& unit, QObject *parent) : QRegExpValidator(parent), _unit(unit) { QLocale locale; /*This regex allows some flexibility when using fractions. if not, the user would be unable to change a value from * 1/4W to 1W because it would be invalid when the 4 is deleted. */ QString exp=QString("^-?\\d+/?\\d*([kKMGTPEZYmunpfazy\\x{03BC}]|\\%1)?\\d*[kKMGTPEZYmunpfazy\\x{03BC}]?").arg(locale.decimalPoint()); if(unit.isEmpty()) { exp.append('$'); } else { exp.append(unit).append("?$"); } QRegExp regExp(exp, Qt::CaseSensitive, QRegExp::RegExp2); setRegExp(regExp); }
CaseModifier::CaseModifier() : Modifier(i18n("Change Case"), i18n("change the case of a renaming option")) { setUseTokenMenu(true); addToken(QLatin1String("{upper}"), i18n("Convert to uppercase"), i18n("Uppercase")); addToken(QLatin1String("{lower}"), i18n("Convert to lowercase"), i18n("Lowercase")); addToken(QLatin1String("{firstupper}"), i18n("Convert the first letter of each word to uppercase"), i18n("First Letter of Each Word Uppercase")); QRegExp reg(QLatin1String("\\{(firstupper|lower|upper)\\}")); reg.setMinimal(true); setRegExp(reg); }
UrlFilter::UrlFilter() { setRegExp( CompleteUrlRegExp ); }
//------------------------------------------------------------------------- DcMidiTrigger::DcMidiTrigger( DcMidiData& pattern ) { reset(); _signal = 0; setRegExp(pattern.toString()); }
//------------------------------------------------------------------------- DcMidiTrigger::DcMidiTrigger( QString pattern ) { reset(); _signal = 0; setRegExp(pattern); }
//----------------------------------------------------------------------------- // Function: setUnmodifiablePath() //----------------------------------------------------------------------------- void LibraryPathValidator::setUnmodifiablePath( const QString& path ) { QRegExp regExp(path + QString("*"), Qt::CaseInsensitive, QRegExp::Wildcard); setRegExp(regExp); }