timeBox::timeBox(QWidget *parent, const char *name, bool tt) : QLineEdit(parent,name) { if (tt) { setMaxLength(9); setMaximumWidth(90); } else { setMaxLength(12); setMaximumWidth(120); } timet = tt; }
IPLineEdit::IPLineEdit( QWidget *parent, const char *name ) : KRestrictedLine(parent) { setValidChars(QString("0123456789.")); setObjectName(name); setMaxLength(3 * 4 + 1 * 3); }
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))); } }
ZLQtApplicationWindow::LineEditParameter::LineEditParameter(QToolBar *toolbar, ZLQtApplicationWindow &window, const ZLToolbar::TextFieldItem &textFieldItem) : QLineEdit(toolbar), myWindow(window), myActionId(textFieldItem.actionId()) { setAlignment(Qt::AlignHCenter); setFocusPolicy(ClickFocus); setMaxLength(textFieldItem.maxWidth()); setMaximumWidth(textFieldItem.maxWidth() * 12 + 12); QToolTip::add(this, QString::fromUtf8(textFieldItem.tooltip().c_str())); myWindow.addVisualParameter(textFieldItem.parameterId(), this); }
dmsBox::dmsBox(QWidget *parent, bool dg) : KLineEdit(parent), EmptyFlag(true) { setMaxLength(14); setMaximumWidth(160); setDegType( dg ); connect( this, SIGNAL( textChanged( const QString & ) ), this, SLOT( slotTextChanged( const QString & ) ) ); }
QLineEdit *ListEditorWidget::createLineEdit(const QString &field) { auto retVal = RecordEditorWidget::createLineEdit(field); if (field == "name") { retVal->setMaxLength(64); } return retVal; }
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)); }
UserNameLineEdit::UserNameLineEdit(QWidget *parent) :QLineEdit(parent) { static QString userNamePattern("[a-zA-Z0-9 _-]{0,16}"); //allowing lower and upper case letters, numbers, _ and - symbols, blank space, at least 1 character and max 16 characters. QRegularExpressionValidator *validator = new QRegularExpressionValidator(QRegularExpression(userNamePattern), this); setValidator(validator); setMaxLength(16); //this maxLength need be changed if we decide support non ASCII user names connect(this, SIGNAL(editingFinished()), this, SLOT(updateText())); }
KInfobarEdit::KInfobarEdit(QWidget *parent/* = 0*/) : QLineEdit(parent) { QRegExp regx("[0-9]+$"); validator = NULL; QValidator *validator = new QRegExpValidator(regx, this); setValidator( validator ); setMaxLength(3); }
void EasySelectorWidget::setMinLength(int minLength) { Q_D(EasySelectorWidget); d->minLength = minLength; if (d->maxLength < d->minLength) { setMaxLength(d->minLength); } else { redrawBackground(); update(); } }
DoubleInput::DoubleInput(QWidget *parent): QLineEdit(parent) { v=0.0; QString t; setText(t.setNum(v)); setMaxLength(12); int w = fontMetrics().width("99999999",-1); setMaximumWidth(w); validator= new QDoubleValidator(-DBL_MAX,DBL_MAX,8,this); // FIXME connect(this,SIGNAL(returnPressed()),this,SLOT(handleValueChange())); }
void EasySelectorWidget::setLength(int length) { Q_D(EasySelectorWidget); d->length = length; if (d->length != d->oldLength) { emit valuesChanged(d->length, d->complexity); d->oldLength = d->length; } if (d->length > d->maxLength) setMaxLength(d->length); update(); }
SyntaxLineEdit::SyntaxLineEdit(QWidget *parent) : QLineEdit(parent), completer_(NULL), completion_model_(NULL) { // Try to matche QLineEdit's placeholder text color (which sets the // alpha channel to 50%, which doesn't work in style sheets). // Setting the foreground color lets us avoid yet another background // color preference and should hopefully make things easier to // distinguish for color blind folk. busy_fg_ = ColorUtils::alphaBlend(palette().text(), palette().base(), 0.5); setSyntaxState(); setMaxLength(std::numeric_limits<quint32>::max()); }
PagesEdit::PagesEdit( MiniBar * parent ) : QLineEdit( parent ), m_miniBar( parent ), m_eatClick( false ) { // customize look setFrameShadow( QFrame::Raised ); focusOutEvent( 0 ); // use an integer validator m_validator = new QIntValidator( 1, 1, this ); setValidator( m_validator ); // customize text properties setAlignment( Qt::AlignCenter ); setMaxLength( 4 ); }
void KReportDesignerItemBarcode::init(QGraphicsScene *scene, KReportDesigner *d) { if (scene) scene->addItem(this); connect(m_set, SIGNAL(propertyChanged(KPropertySet&,KProperty&)), this, SLOT(slotPropertyChanged(KPropertySet&,KProperty&))); KReportDesignerItemRectBase::init(&m_pos, &m_size, m_set, d); setMaxLength(5); setZValue(Z); updateRenderText(m_itemValue->value().toString().isEmpty() ? m_format->value().toString() : QString(), m_itemValue->value().toString(), QString()); }
/** * Initializes the widget for a html display. */ void BarCodeLineEdit::init(const QStringList &argumentNames, const QStringList &argumentValues) { setFrame(false); QPalette pale = palette(); pale.setColor(QPalette::Disabled, QPalette::Base, Qt::white); setPalette(pale); setMaxLength(105); QRegExp rx("[^\\*]+\\*?[^\\*]*"); QValidator *validator = new QRegExpValidator(rx, this); setValidator(validator); }
//평수 void EstimateUserInfo::setSizeInputBox() { auto editbox = EditBox::create(Size(300, 30), ui::Scale9Sprite::create()); editbox->setPosition(ratioPosition(50, 52.5f)); editbox->setPlaceHolder("공사할 공간의 면적(평수)"); editbox->setMaxLength(100); editbox->setPlaceholderFontColor(Color3B::GRAY); editbox->setFontColor(Color3B::BLACK); editbox->setPlaceholderFontSize(10); editbox->setReturnType(EditBox::KeyboardReturnType::DONE); editbox->setInputMode(EditBox::InputMode::NUMERIC); this->addChild(editbox); editbox->setDelegate(this); }
NormalTextFieldWidget::NormalTextFieldWidget(QMutex* mutex, Poppler::FormFieldText* formField, QWidget* parent) : QLineEdit(parent), m_mutex(mutex), m_formField(formField) { LOCK_FORM_FIELD setText(m_formField->text()); setMaxLength(m_formField->maximumLength()); setAlignment(m_formField->textAlignment()); setEchoMode(m_formField->isPassword() ? QLineEdit::Password : QLineEdit::Normal); connect(this, SIGNAL(textChanged(QString)), SLOT(on_textChanged(QString))); connect(this, SIGNAL(textChanged(QString)), SIGNAL(wasModified())); connect(this, SIGNAL(returnPressed()), SLOT(hide())); }
//주소 void EstimateUserInfo::setAddressInputBox() { auto editbox = EditBox::create(Size(300, 30), ui::Scale9Sprite::create()); // "images/UIButtons/UI_TopMenuBG-hd.png" editbox->setPosition(ratioPosition(50, 63)); editbox->setPlaceHolder("상세주소입력"); //처음 보여주는 문자열 editbox->setMaxLength(100); //최대로 입력받을수 잇는 문자의 길이 editbox->setPlaceholderFontColor(Color3B::GRAY); //문자열 색변경 editbox->setFontColor(Color3B::BLACK); //입력한 문자열 색변경 //키보드 오른쪽하단 enter키를 search로 변경 editbox->setReturnType(EditBox::KeyboardReturnType::DONE); this->addChild(editbox); editbox->setDelegate(this); }
AREXPORT void ArNetPacket::duplicatePacket(ArNetPacket *packet) { myLength = packet->myLength; // if (myMaxLength < myLength) // setMaxLength(packet->myLength); if (myMaxLength < myLength + packet->myFooterLength) setMaxLength(packet->myLength + packet->myFooterLength); myReadLength = packet->myReadLength; myHeaderLength = packet->myHeaderLength; myFooterLength = packet->myFooterLength; myCommand = packet->myCommand; myAddedFooter = packet->myAddedFooter; memcpy(myBuf, packet->getBuf(), packet->myLength + packet->myFooterLength); myArbitraryString = packet->myArbitraryString; }
void UI::initEditBox(){ auto visibleSize=Director::getInstance()->getVisibleSize(); auto eb=EditBox::create(cocos2d::Size(800,200) ,"editBG.png"); eb->setPlaceHolder("请输入内容"); eb->setPlaceholderFont("font/Marker Felt.ttf", 40); eb->setPlaceholderFontColor(Color3B::YELLOW); eb->setFont("font/Marker Felt.ttf", 20); eb->setColor(Color3B::BLACK); //eb->setInputFlag(cocos2d::ui::EditBox::InputFlag::PASSWORD); eb->setInputMode(cocos2d::ui::EditBox::InputMode::ANY); eb->setReturnType(cocos2d::ui::EditBox::KeyboardReturnType::DONE); //设置代理 eb->setDelegate(this); eb->setMaxLength(20); eb->setPosition(visibleSize/2); addChild(eb); }
PlaceEdit::PlaceEdit(PlaceEdit *_parent, int _index, QString placeholder_text, QWidget *qparent) : QLineEdit(qparent) { qDebug() << "creating place edit"; setMaxLength (40); setPlaceholderText (placeholder_text); model = new PlaceModel (_index, this); completer = new QCompleter (model, this); completer->setCaseSensitivity (Qt::CaseInsensitive); // TODO put in mask // TODO prevent slashes completer->setModel (model); setCompleter (completer); setValidator (new LineValidator (this)); /* // delay or otherwise act as if the user hit return after 500ms timer = new QTimer (this); timer->setSingleShot(true); timer->setInterval(500); connect(timer, SIGNAL(timeout()), SLOT(handle_check_username())); connect(username, SIGNAL(textEdited(QString)), username_timer, SLOT(start())); connect (this, SIGNAL (textChanged (QString)), model, SLOT (handle_text_changed (QString))); */ if (_parent != NULL) { connect (_parent->get_model(), SIGNAL(value_changed(QString)), model, SLOT(handle_parent_text_changed(QString))); connect (_parent->get_model(), SIGNAL(value_changed(QString)), this, SLOT(handle_parent_text_changed(QString))); } }
void HelloWorld::testEditBox() { auto sp = Scale9Sprite::create("textField.png"); //设置大小 sp->setPreferredSize(Size(255, 40)); sp->setAnchorPoint(Point(0.5, 0.5)); auto editBox=EditBox::create(Size(255, 40), sp); editBox->setPlaceHolder("请输入内容"); editBox->setFontColor(Color3B(255, 0, 255)); editBox->setPosition(Point(240, 60)); editBox->setInputMode(EditBox::InputMode::ANY); editBox->setMaxLength(10); editBox->setReturnType(EditBox::KeyboardReturnType::DONE); editBox->setDelegate(this); editBox->setInputFlag(EditBox::InputFlag::PASSWORD); this->addChild(editBox); }
void TextField::copySpecialProperties(Widget *widget) { TextField* textField = dynamic_cast<TextField*>(widget); if (textField) { setText(textField->_textFieldRenderer->getString()); setPlaceHolder(textField->getStringValue()); setFontSize(textField->_textFieldRenderer->getFontSize()); setFontName(textField->_textFieldRenderer->getFontName().c_str()); setMaxLengthEnabled(textField->isMaxLengthEnabled()); setMaxLength(textField->getMaxLength()); setPasswordEnabled(textField->isPasswordEnabled()); setPasswordStyleText(textField->_passwordStyleText.c_str()); setAttachWithIME(textField->getAttachWithIME()); setDetachWithIME(textField->getDetachWithIME()); setInsertText(textField->getInsertText()); setDeleteBackward(textField->getDeleteBackward()); } }
void UITextEdit::onStyleApply(const std::string& styleName, const OTMLNodePtr& styleNode) { UIWidget::onStyleApply(styleName, styleNode); for(const OTMLNodePtr& node : styleNode->children()) { if(node->tag() == "text") { setText(node->value()); setCursorPos(m_text.length()); } else if(node->tag() == "text-hidden") setTextHidden(node->value<bool>()); else if(node->tag() == "text-margin") setTextHorizontalMargin(node->value<int>()); else if(node->tag() == "shift-navigation") setShiftNavigation(node->value<bool>()); else if(node->tag() == "multiline") setMultiline(node->value<bool>()); else if(node->tag() == "max-length") setMaxLength(node->value<int>()); } }
//요청사항 void EstimateUserInfo::setRequestInputBox() { auto editbox = EditBox::create(Size(300, 30), ui::Scale9Sprite::create()); editbox->setPosition(ratioPosition(50, 42)); editbox->setPlaceHolder("세부 요청사항을 작성해주세요."); editbox->setMaxLength(100); editbox->setPlaceholderFontColor(Color3B::GRAY); editbox->setFontColor(Color3B::BLACK); editbox->setReturnType(EditBox::KeyboardReturnType::DONE); editbox->setPlaceholderFontSize(20); editbox->setTag(TAG_REQUEST_BOX); editbox->setDelegate(this); this->addChild(editbox); _lbRequest = setLabelSystemTTFUnAdd("", 20, ratioPosition(50, 44)); _lbRequest->setAnchorPoint(Vec2(0.5f, 1.0f)); _lbRequest->setAlignment(TextHAlignment::LEFT, TextVAlignment::TOP); _lbRequest->setDimensions(300, 100); _lbRequest->setColor(Color3B::BLACK); addChild(_lbRequest); }
EntryField::EntryField( Window *parent, int properties, int x, int y, int width, int height) : Window( parent, xlatProperties( properties|FILTERDIALOGARROWS ), x, y, width, height ), selectedText(NULL) { isBordered = properties & BORDER; properties ^= BORDER; internalEntryField = new Window( this, (char*)WC_ENTRYFIELD, "", (xlatProperties(properties|CLIPSIBLINGS) ^ WS_TABSTOP) | ES_AUTOSCROLL, 0, 0, width, height ); // if( parent->type == DIALOG ) internalEntryField->setFont( graphics->getDialogFontName(), graphics->getDialogFontSize() ); internalEntryField->setDialogFilter(FILTERDIALOGARROWS|PASSDIALOGKEYS); type = ENTRYFIELD; internalEntryField->size( 0, 0 ); internalEntryField->setVisible(TRUE); parent->addControl( this ); setMaxLength( 32 ); }
//======================================================// UpDownLineEdit::UpDownLineEdit(QWidget *parent, const char *name, QString possible_value) : QLineEdit(parent, name), possible_val(possible_value) { buttonUp = new QPushButton(parent, "buttonUp"); //QPixmap pm ("./image/arrow_up.png"); QPixmap pm = QPixmap::fromMimeSource("arrow_up.png"); buttonUp->setPixmap( pm); buttonDown = new QPushButton(parent, "buttonDown"); //pm = QPixmap("./image/arrow_down.png"); pm = QPixmap::fromMimeSource("arrow_down.png"); buttonDown->setPixmap( pm); setPosition(0, 0); setMaxLength(1); setReadOnly(true); setAlignment(Qt::AlignHCenter); QFont f = font(); f.setPointSize(12); f.setBold(false); setFont(f); buttonUp->setFocusPolicy(QWidget::NoFocus); buttonDown->setFocusPolicy(QWidget::NoFocus); QSizePolicy sp (QSizePolicy::Fixed, QSizePolicy::Fixed); setSizePolicy(sp); buttonUp->setSizePolicy(sp); buttonDown->setSizePolicy(sp); buttonUp->setFlat(true); buttonDown->setFlat(true); connect ( buttonUp, SIGNAL(clicked()), SLOT(GoUp()) ); connect ( buttonDown, SIGNAL(clicked()), SLOT(GoDown()) ); index = 0; //puts("UpDownCreate"); }
void AbstractParam::readParameters(const YAML::Node &yamlNode) { for ( YAML::const_iterator it = yamlNode.begin(); it != yamlNode.end(); ++it ) { std::string key = READ_NODE_AS_STRING(it->first); if (key == Keys::Description) setDescription(READ_NODE_AS_STRING(it->second)); else if (key == Keys::Default) setDefaultValue(READ_NODE_AS_STRING(it->second)); else if (key == Keys::DisplayName) setDisplayName(READ_NODE_AS_STRING(it->second)); else if (key == Keys::Example) setExample(READ_NODE_AS_STRING(it->second)); else if (key == Keys::Maximum) setMaximum(READ_NODE_AS_LONG(it->second)); else if (key == Keys::Minimum) setMinimum(READ_NODE_AS_LONG(it->second)); else if (key == Keys::MaxLength) setMaxLength(READ_NODE_AS_INT(it->second)); else if (key == Keys::MinLength) setMinLength(READ_NODE_AS_INT(it->second)); else if (key == Keys::Pattern) setPattern(READ_NODE_AS_STRING(it->second)); else if (key == Keys::Repeat) setRepeat(READ_NODE_AS_BOOL(it->second)); else if (key == Keys::Required) setRequired(READ_NODE_AS_BOOL(it->second)); else if (key == Keys::Type) setType(READ_NODE_AS_STRING(it->second)); else if (key == Keys::Enum) { YAML::Node enumNode = it->second; for ( YAML::const_iterator tt = enumNode.begin(); tt != enumNode.end(); ++tt ) setEnumeration(READ_NODE_AS_STRING(*tt)); } } }
void TextField::copySpecialProperties(Widget *widget) { TextField* textField = dynamic_cast<TextField*>(widget); if (textField) { setString(textField->_textFieldRenderer->getString()); setPlaceHolder(textField->getString()); setFontSize(textField->_fontSize); setFontName(textField->_fontName); setMaxLengthEnabled(textField->isMaxLengthEnabled()); setMaxLength(textField->getMaxLength()); setPasswordEnabled(textField->isPasswordEnabled()); setPasswordStyleText(textField->_passwordStyleText.c_str()); setAttachWithIME(textField->getAttachWithIME()); setDetachWithIME(textField->getDetachWithIME()); setInsertText(textField->getInsertText()); setDeleteBackward(textField->getDeleteBackward()); _eventCallback = textField->_eventCallback; _textFieldEventListener = textField->_textFieldEventListener; _textFieldEventSelector = textField->_textFieldEventSelector; } }