• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setValidator函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setValidator函数的典型用法代码示例。如果您正苦于以下问题:C++ setValidator函数的具体用法?C++ setValidator怎么用?C++ setValidator使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setValidator函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: setValidator

void FractionInput::setAllowRange( bool allowRange )
{
	m_allowRange = allowRange;
	if ( allowRange ) {
		setValidator( &m_rangeValidator );
	} else {
		setValidator( &m_numberValidator );
	}
}
开发者ID:KDE,项目名称:krecipes,代码行数:9,代码来源:fractioninput.cpp


示例2: setValidator

/*
 * Refreshes the validator used in QLineEdit depending on the options choosed by the user
 */
void SearchLineEdit::setRefreshValidator(ValidatorType validatorType)
{
  if (validatorType == ectn_AUR_VALIDATOR)
    setValidator(m_aurValidator);
  else if (validatorType == ectn_FILE_VALIDATOR)
    setValidator(m_fileValidator);
  else if (validatorType == ectn_DEFAULT_VALIDATOR)
    setValidator(m_defaultValidator);

  //If the current string is not valid anymore, let's erase it!
  int pos = 0;
  QString search = text();
  if (this->validator()->validate(search, pos) == QValidator::Invalid)
    setText("");
}
开发者ID:flying-sheep,项目名称:octopi,代码行数:18,代码来源:searchlineedit.cpp


示例3: QLineEdit

      AdjustButton::AdjustButton (QWidget* parent, float change_rate) :
        QLineEdit (parent),
        rate (change_rate),
        min (-std::numeric_limits<float>::max()),
        max (std::numeric_limits<float>::max()),
        is_min (false),
        is_max (false),
        deadzone_y (-1),
        deadzone_value (NAN)
      {
          setValidator (new QDoubleValidator (this));

          setToolTip (tr ("Click & drag to adjust"));
          setAlignment (Qt::AlignRight);

          connect (this, SIGNAL (editingFinished()), SLOT (onSetValue()));
          installEventFilter (this);
          setStyleSheet ((
              "QLineEdit { "
              "padding: 0.1em 20px 0.2em 0.3ex; "
              "background: qlineargradient(x1:0, y1:0, x2:0, y2:0.2, stop:0 gray, stop:1 white) url(:/adjustbutton.svg); "
              "background-position: right; "
              "background-repeat: no-repeat; "
              "font-size: " + str(font().pointSize()) + "pt; "
              "border: 1px solid grey; "
              "border-color: black lightgray white gray; "
              "border-radius: 0.3em }").c_str());

        }
开发者ID:JohnWangDataAnalyst,项目名称:mrtrix3,代码行数:29,代码来源:adjust_button.cpp


示例4: TeacherQueryModel

std::pair<QSqlQueryModel *, RecordEditorWidget *>
TeacherForm::createModelAndEditor() {
    const QVariantMap columnLabels = {
        {"first_name", QObject::tr("First Name")},
        {"last_name", QObject::tr("Last Name")},
        {"email", QObject::tr("Email")},
        {"rfid", QObject::tr("RFID")},
        {"employee_number", QObject::tr("Employee Number")},
        {"office", QObject::tr("Office Number")}};

    TeacherQueryModel *model = new TeacherQueryModel(
        columnLabels, QSqlDatabase::database(DEFAULT_DB_NAME));
    const FieldTypes fieldTypes = {{"first_name", FieldType::LineEdit},
                                   {"last_name", FieldType::LineEdit},
                                   {"email", FieldType::LineEdit},
                                   {"rfid", FieldType::LineEdit},
                                   {"employee_number", FieldType::LineEdit},
                                   {"office", FieldType::LineEdit}};
    auto editor = new TeacherEditorWidget(fieldTypes);
    editor->setupUi(columnLabels, model->record());
    editor->setValidator(new TeacherValidator(editor->fieldTypes(),
                                              editor->fieldEditors(), editor));
    editor->clearData();

    return make_pair<QSqlQueryModel *, RecordEditorWidget *>(model, editor);
}
开发者ID:toptan,项目名称:paso,代码行数:26,代码来源:teacherform.cpp


示例5: changeShellTimeoutDialog

    void changeShellTimeoutDialog()
    {
        auto changeShellTimeoutDialog = new QDialog;
        auto settingsManager = AppRegistry::instance().settingsManager();
        auto currentShellTimeout = new QLabel(QString::number(settingsManager->shellTimeoutSec()));
        auto newShellTimeout = new QLineEdit;
        newShellTimeout->setValidator(new QIntValidator(0, 100000));
        auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Save | QDialogButtonBox::Cancel);
        QObject::connect(buttonBox, SIGNAL(accepted()), changeShellTimeoutDialog, SLOT(accept()));
        QObject::connect(buttonBox, SIGNAL(rejected()), changeShellTimeoutDialog, SLOT(reject()));
        auto lay = new QGridLayout;
        auto firstLabel = new QLabel("Enter new value for Robo 3T shell timeout in seconds:\n");
        lay->addWidget(firstLabel,                      0, 0, 1, 2, Qt::AlignLeft);
        lay->addWidget(new QLabel("Current Value: "),   1, 0);
        lay->addWidget(currentShellTimeout,             1, 1);
        lay->addWidget(new QLabel("New Value: "),       2, 0);
        lay->addWidget(newShellTimeout,                 2, 1);
        lay->addWidget(buttonBox,                       3, 0, 1, 2, Qt::AlignRight);
        changeShellTimeoutDialog->setLayout(lay);
        changeShellTimeoutDialog->setWindowTitle("Robo 3T");

        if (changeShellTimeoutDialog->exec()) {
            settingsManager->setShellTimeoutSec(newShellTimeout->text().toInt());
            settingsManager->save();
            auto subStr = settingsManager->shellTimeoutSec() > 1 ? " seconds." : " second.";
            LOG_MSG("Shell timeout value changed from " + currentShellTimeout->text() + " to " +
                QString::number(settingsManager->shellTimeoutSec()) + subStr, mongo::logger::LogSeverity::Info());

            for (auto server : AppRegistry::instance().app()->getServers())
                server->changeWorkerShellTimeout(std::abs(newShellTimeout->text().toInt()));
        }
    }
开发者ID:adityavs,项目名称:robomongo,代码行数:32,代码来源:ChangeShellTimeoutDialog.cpp


示例6: QLineEdit

PlaceEdit::PlaceEdit(PlaceEdit *_parent, int _index, QString placeholderText, QWidget *qparent)
  : QLineEdit(qparent)
{
  qDebug() << "creating place edit";

  setMaxLength(40);

  setPlaceholderText(placeholderText);

  m_model = new PlaceModel(_index, this);
  m_completer = new QCompleter(m_model, this);
  m_completer->setCaseSensitivity(Qt::CaseInsensitive);

  // TODO put in mask
  // TODO prevent slashes

  m_completer->setModel(m_model);
  setCompleter(m_completer);

  setValidator(new LineValidator(this));

  if (_parent) {
    connect(_parent->model(), SIGNAL(valueChanged(QString)), m_model, SLOT(onParentTextChanged(QString)));
    connect(_parent->model(), SIGNAL(valueChanged(QString)), this, SLOT(onParentTextChanged(QString)));
  }
}
开发者ID:idaohang,项目名称:mole,代码行数:26,代码来源:places.cpp


示例7: QLineEdit

IntegerEdit::IntegerEdit()
    : QLineEdit()
{
    val = new IntegerValidator;
    setValidator(val);
    setToolTip(tr("Enter an integer or bool\n0x... for hex, 0b... for binary"));
}
开发者ID:seyfarth,项目名称:ebe,代码行数:7,代码来源:integeredit.cpp


示例8: NameEditor

 /* Constructor: */
 NameEditor(QWidget *pParent = 0) : QLineEdit(pParent)
 {
     setFrame(false);
     setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
     setValidator(new QRegExpValidator(QRegExp("[^,:]*"), this));
     connect(this, SIGNAL(textEdited(const QString&)), this, SLOT(sltTextEdited(const QString&)));
 }
开发者ID:jeppeter,项目名称:vbox,代码行数:8,代码来源:UIPortForwardingTable.cpp


示例9: QLineEdit

QIPEdit::QIPEdit(QWidget *parent)
	: QLineEdit(parent)
{
	ui.setupUi(this);

	setValidator(new QIPValidator(this));
}
开发者ID:Quenii,项目名称:ADCEVM-minor,代码行数:7,代码来源:qipedit.cpp


示例10: WLineEdit

WDateEdit::WDateEdit(WContainerWidget *parent)
  : WLineEdit(parent)
{
  changed().connect(this, &WDateEdit::setFromLineEdit);

  const char *TEMPLATE = "${calendar}";

  WTemplate *t = new WTemplate(WString::fromUTF8(TEMPLATE));
  popup_ = new WPopupWidget(t, this);
  popup_->setAnchorWidget(this);
  popup_->setTransient(true);

  calendar_ = new WCalendar();
  calendar_->activated().connect(popup_, &WPopupWidget::hide);
  calendar_->activated().connect(this, &WDateEdit::setFocus);
  calendar_->selectionChanged().connect(this, &WDateEdit::setFromCalendar);

  t->bindWidget("calendar", calendar_);

  WApplication::instance()->theme()->apply(this, popup_, DatePickerPopupRole);

  t->escapePressed().connect(popup_, &WTemplate::hide);
  t->escapePressed().connect(this, &WDateEdit::setFocus);

  setValidator(new WDateValidator("dd/MM/yyyy", this));
}
开发者ID:NeilNienaber,项目名称:wt,代码行数:26,代码来源:WDateEdit.C


示例11: QComboBox

// KTimeWidget/QTimeEdit provide nicer editing, but don't provide a combobox.
// Difficult to get all in one...
// But Qt-3.2 will offer QLineEdit::setMask, so a "99:99" mask would help.
KTimeEdit::KTimeEdit(QWidget *parent, QTime qt, const char *name)
    : QComboBox(true, parent, name)
{
    setInsertionPolicy(NoInsertion);
    setValidator(new KOTimeValidator(this));

    mTime = qt;

    //  mNoTimeString = i18n("No Time");
    //  insertItem( mNoTimeString );

    // Fill combo box with selection of times in localized format.
    QTime timeEntry(0, 0, 0);
    do
    {
        insertItem(KGlobal::locale()->formatTime(timeEntry));
        timeEntry = timeEntry.addSecs(60 * 15);
    }
    while(!timeEntry.isNull());
    // Add end of day.
    insertItem(KGlobal::locale()->formatTime(QTime(23, 59, 59)));

    updateText();
    setFocusPolicy(QWidget::StrongFocus);

    connect(this, SIGNAL(activated(int)), this, SLOT(active(int)));
    connect(this, SIGNAL(highlighted(int)), this, SLOT(hilit(int)));
    connect(this, SIGNAL(textChanged(const QString &)), this, SLOT(changedText()));
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:32,代码来源:ktimeedit.cpp


示例12: scroll

QcNumberBox::QcNumberBox()
: scroll( true ),
  lastPos( 0 ),
  editedTextColor( QColor( "red" ) ),
  normalTextColor( palette().color(QPalette::Text) ),
  _validator( new QDoubleValidator( this ) ),
  step( 0.1f ),
  scrollStep( 1.0f ),
  dragDist( 10.f ),
  _value( 0. ),
  _valueType( Number ),
  _minDec(0),
  _maxDec(2)
{
  _validator->setDecimals( _maxDec );
  setValidator( _validator );

  // Do not display thousands separator. It only eats up precious space.
  QLocale loc( locale() );
  loc.setNumberOptions( QLocale::OmitGroupSeparator );
  setLocale( loc );

  setLocked( true );

  connect( this, SIGNAL( editingFinished() ),
           this, SLOT( onEditingFinished() ) );
  connect( this, SIGNAL( valueChanged() ),
           this, SLOT( updateText() ), Qt::QueuedConnection );
  setValue( 0 );
}
开发者ID:ARTisERR0R,项目名称:supercollider,代码行数:30,代码来源:QcNumberBox.cpp


示例13: QLineEdit

DoubleEdit::DoubleEdit(QWidget* parent) 
  : QLineEdit(parent)
{ 
  QDoubleValidator* validator = new QDoubleValidator(-DBL_MAX, DBL_MAX, 3, this);
  setValidator(validator);
  setMaximumWidth(60);
  setValue(0.0);
}
开发者ID:gpkehoe,项目名称:soraCore,代码行数:8,代码来源:DoubleEdit.cpp


示例14: KLineEdit

FractionInput::FractionInput( QWidget *parent, MixedNumber::Format format ) : KLineEdit( parent ),
	m_allowRange(false),
	m_format(format)
{
	//setAlignment( Qt::AlignRight );

	setValidator( &m_numberValidator );
}
开发者ID:KDE,项目名称:krecipes,代码行数:8,代码来源:fractioninput.cpp


示例15: QLineEdit

DateEdit::DateEdit(QWidget *parent)
        : QLineEdit(parent)
{
    setValidator(new DateValidator(this));
#if COMPAT_QT_VERSION >= 0x030200
    setInputMask("00/00/0000;_");
#endif
}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:8,代码来源:datepicker.cpp


示例16: QLineEdit

UnsignedIntegerEdit::UnsignedIntegerEdit(QWidget *parent)
 : QLineEdit(parent)
{
    connect(this, SIGNAL(textChanged(QString)), SLOT(onTextChanged(QString)));

    // Set the validator range to the range of values in a 32 bit unsigned integer (dbus-type 'u').
    // FIXME: Maximum value must be a valid type "int" for the validator to work. What a POS
    setValidator(new QIntValidator(0, 2147483647, this));
}
开发者ID:KDE,项目名称:ktp-accounts-kcm,代码行数:9,代码来源:unsigned-integer-edit.cpp


示例17: QLineEdit

ParameterNameEdit::ParameterNameEdit( BehaviorTreeContext ctx, Parameter* p ) :
  QLineEdit( p->m_Id.m_Text ), m_Context( ctx ), m_Param( p )
{
  setValidator( new PreventDuplicateSymbols( m_Context, this ) );
  setFrame( false );

  QPalette pal = palette();
  pal.setColor( backgroundRole(), Qt::transparent );
  setPalette( pal );
}
开发者ID:AntonioModer,项目名称:calltree,代码行数:10,代码来源:ParameterNameEdit.cpp


示例18: QLineEdit

SegIPEdit::SegIPEdit(QWidget *parent) :
    QLineEdit(parent)
{
    setAlignment(Qt::AlignCenter);
    setMaxLength(3);

    QRegExp rx("(2[0-5]{2}|2[0-4][0-9]|1?[0-9]{1,2})");

    setValidator(new QRegExpValidator(rx, this));
}
开发者ID:johnsonliu999,项目名称:TcpLoadTest,代码行数:10,代码来源:ipedit.cpp


示例19: WAbstractSpinBox

WSpinBox::WSpinBox(WContainerWidget *parent)
  : WAbstractSpinBox(parent),
    value_(-1),
    min_(0),
    max_(99),
    step_(1)
{ 
  setValidator(createValidator());
  setValue(0);
}
开发者ID:Dinesh-Ramakrishnan,项目名称:wt,代码行数:10,代码来源:WSpinBox.C


示例20: setValidator

void KSimBaseIntSpinBox::init()
{
	setValidator(0);
	connect(this,SIGNAL(valueChanged(int)), this, SLOT(slotValueChanged(int)));
	connect(editor(), SIGNAL(textChanged(const QString &)),SLOT(slotTextChanged(const QString &)));
	KSimSpinBox::setMinValue(Private::s_lowerLimit);
	KSimSpinBox::setMaxValue(Private::s_upperLimit);
	setFocusPolicy(QWidget::WheelFocus);
	setAlignRight();
}
开发者ID:BackupTheBerlios,项目名称:ksimus,代码行数:10,代码来源:ksimbaseintspinbox.cpp



注:本文中的setValidator函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setVar函数代码示例发布时间:2022-05-30
下一篇:
C++ setValid函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap