SCnEditorScene::SCnEditorScene(QObject *parent) : QGraphicsScene(parent), mLevelOffset(30), mLevelDistance(10) { SCnFieldItem *pitem = new SCnFieldGlobalIdtf(this); pitem->setValue("test"); appendField(pitem); for (quint32 i = 0; i < 5; i++) { SCnFieldItem *item = new SCnFieldGlobalIdtf(pitem); item->setValue(QString("test %1").arg(i)); item->setParentItem(pitem); for (quint32 j = 0; j < 5; j++) { SCnFieldItem *jitem = new SCnFieldGlobalIdtf(item); jitem->setValue(QString("test %1_%2").arg(i).arg(j)); jitem->setParentItem(item); } } inputDialog = new SCnInputDialog(); connect(inputDialog, SIGNAL(textRecieved(QString)), this, SLOT(setTextForSelectedField(QString))); }
UnicodeString & DigitFormatter::formatExponent( const VisibleDigits &digits, const DigitFormatterIntOptions &options, int32_t signField, int32_t intField, FieldPositionHandler &handler, UnicodeString &appendTo) const { UBool neg = digits.isNegative(); if (neg || options.fAlwaysShowSign) { appendField( signField, neg ? fNegativeSign : fPositiveSign, handler, appendTo); } int32_t begin = appendTo.length(); DigitGrouping grouping; DigitFormatterOptions expOptions; FieldPosition fpos(FieldPosition::DONT_CARE); FieldPositionOnlyHandler noHandler(fpos); format( digits, grouping, expOptions, noHandler, appendTo); handler.addAttribute(intField, begin, appendTo.length()); return appendTo; }
ref <headerField> header::getField(const string& fieldName) { const string name = utility::stringUtils::toLower(fieldName); // Find the first field that matches the specified name std::vector <ref <headerField> >::const_iterator pos = m_fields.begin(); const std::vector <ref <headerField> >::const_iterator end = m_fields.end(); while (pos != end && utility::stringUtils::toLower((*pos)->getName()) != name) ++pos; // If no field with this name can be found, create a new one if (pos == end) { ref <headerField> field = headerFieldFactory::getInstance()->create(fieldName); appendField(field); // Return a reference to the new field return (field); } // Else, return a reference to the existing field else { return (*pos); } }
_LSList::_LSList(llist_t* L, persistence per):_m_fields(NULL), _m_per(per) { char *base_name = tpie_tempnam("LSList"); _m_fields = new std::vector<off_t>; _m_fields->push_back(0); _m_baseStream = new AMI_stream<s32>(base_name); _m_baseStream->persist(per); for (s32 i=0; i<L->numFields; ++i) { appendField(&(L->data[L->index[i]]),L->index[i+1]-L->index[i]); } }
void QtVCardWidget::addField() { QAction* action = nullptr; if ((action = dynamic_cast<QAction*>(sender()))) { std::shared_ptr<QtVCardFieldInfo> fieldInfo = actionFieldInfo[action]; QWidget* newField = fieldInfo->createFieldInstance(this, ui->cardFields, true); QtVCardGeneralField* newGeneralField = dynamic_cast<QtVCardGeneralField*>(newField); if (newGeneralField) { newGeneralField->initialize(); appendField(newGeneralField); relayoutToolButton(); } } }
// assumes curPos is the start of a field // field will be inserted previous to the current one void CSVFile::insertField (const char *field) { if (curPos >= lineLength) { curPos = lineLength; appendField (field); return; } int size = strlen (field); if (size + lineLength + 1 >= LARGE) return; lineLength += size + 1; char temp[LARGE]; strcpy (temp, dataLine+curPos); memcpy (dataLine+curPos, field, size); curPos += size; dataLine[curPos++] = COMMA; strcpy (dataLine+curPos, temp); }
SCnEditorScene::SCnEditorScene(QObject *parent) : QGraphicsScene(parent), mLevelOffset(30), mLevelDistance(10) { SCnFieldItem *pitem = new SCnFieldGlobalIdtf(this); pitem->setValue("test"); appendField(pitem); for (quint32 i = 0; i < 10; i++) { SCnFieldItem *item = new SCnFieldGlobalIdtf(pitem); item->setValue(QString("test %1").arg(i)); item->setParentItem(pitem); for (quint32 j = 0; j < 10; j++) { SCnFieldItem *jitem = new SCnFieldGlobalIdtf(pitem); jitem->setValue(QString("test %1_%2").arg(i).arg(j)); jitem->setParentItem(item); } } }
void QtVCardWidget::setVCard(VCard::ref vcard) { clearFields(); this->vcard = std::make_shared<VCard>(*vcard); ui->photoAndName->setFormattedName(P2QSTRING(vcard->getFullName())); ui->photoAndName->setNickname(P2QSTRING(vcard->getNickname())); ui->photoAndName->setPrefix(P2QSTRING(vcard->getPrefix())); ui->photoAndName->setGivenName(P2QSTRING(vcard->getGivenName())); ui->photoAndName->setMiddleName(P2QSTRING(vcard->getMiddleName())); ui->photoAndName->setFamilyName(P2QSTRING(vcard->getFamilyName())); ui->photoAndName->setSuffix(P2QSTRING(vcard->getSuffix())); ui->photoAndName->setAvatar(vcard->getPhoto(), vcard->getPhotoType()); for (const auto& address : vcard->getEMailAddresses()) { if (address.isInternet) { QtVCardInternetEMailField* internetEmailField = new QtVCardInternetEMailField(this, ui->cardFields); internetEmailField->initialize(); internetEmailField->setInternetEMailAddress(address); appendField(internetEmailField); } } for (const auto& telephone : vcard->getTelephones()) { QtVCardTelephoneField* telField = new QtVCardTelephoneField(this, ui->cardFields); telField->initialize(); telField->setTelephone(telephone); appendField(telField); } for (const auto& address : vcard->getAddresses()) { QtVCardAddressField* addressField = new QtVCardAddressField(this, ui->cardFields); addressField->initialize(); addressField->setAddress(address); appendField(addressField); } for (const auto& label : vcard->getAddressLabels()) { QtVCardAddressLabelField* addressLabelField = new QtVCardAddressLabelField(this, ui->cardFields); addressLabelField->initialize(); addressLabelField->setAddressLabel(label); appendField(addressLabelField); } if (!vcard->getBirthday().is_not_a_date_time()) { QtVCardBirthdayField* bdayField = new QtVCardBirthdayField(this, ui->cardFields); bdayField->initialize(); bdayField->setBirthday(vcard->getBirthday()); appendField(bdayField); } for (const auto& jid : vcard->getJIDs()) { QtVCardJIDField* jidField = new QtVCardJIDField(this, ui->cardFields); jidField->initialize(); jidField->setJID(jid); appendField(jidField); } if (!vcard->getDescription().empty()) { QtVCardDescriptionField* descField = new QtVCardDescriptionField(this, ui->cardFields); descField->initialize(); descField->setDescription(vcard->getDescription()); appendField(descField); } for (const auto& org : vcard->getOrganizations()) { QtVCardOrganizationField* orgField = new QtVCardOrganizationField(this, ui->cardFields); orgField->initialize(); orgField->setOrganization(org); appendField(orgField); } for (const auto& role : vcard->getRoles()) { QtVCardRoleField* roleField = new QtVCardRoleField(this, ui->cardFields); roleField->initialize(); roleField->setRole(role); appendField(roleField); } for (const auto& title : vcard->getTitles()) { QtVCardTitleField* titleField = new QtVCardTitleField(this, ui->cardFields); titleField->initialize(); titleField->setTitle(title); appendField(titleField); } for (const auto& url : vcard->getURLs()) { QtVCardURLField* urlField = new QtVCardURLField(this, ui->cardFields); urlField->initialize(); urlField->setURL(url); appendField(urlField); } relayoutToolButton(); setEditable(editable); }
bool QgsSymbol::writeXML( QDomNode & item, QDomDocument & document, const QgsVectorLayer *vl ) const { bool returnval = false; returnval = true; // no error checking yet QDomElement symbol = document.createElement( "symbol" ); item.appendChild( symbol ); appendText( symbol, document, "lowervalue", mLowerValue ); appendText( symbol, document, "uppervalue", mUpperValue ); appendText( symbol, document, "label", mLabel ); QString name = pointSymbolName(); if ( name.startsWith( "svg:" ) ) { name = name.mid( 4 ); QFileInfo fi( name ); if ( fi.exists() ) { name = fi.canonicalFilePath(); QStringList svgPaths = QgsApplication::svgPaths(); for ( int i = 0; i < svgPaths.size(); i++ ) { QString dir = QFileInfo( svgPaths[i] ).canonicalFilePath(); if ( !dir.isEmpty() && name.startsWith( dir ) ) { name = name.mid( dir.size() ); break; } } } name = "svg:" + name; } appendText( symbol, document, "pointsymbol", name ); appendText( symbol, document, "pointsize", QString::number( pointSize() ) ); appendText( symbol, document, "pointsizeunits", pointSizeUnits() ? "mapunits" : "pixels" ); if ( vl ) { appendField( symbol, document, *vl, "rotationclassificationfieldname", mRotationClassificationField ); appendField( symbol, document, *vl, "scaleclassificationfieldname", mScaleClassificationField ); appendField( symbol, document, *vl, "symbolfieldname", mSymbolField ); } QDomElement outlinecolor = document.createElement( "outlinecolor" ); outlinecolor.setAttribute( "red", QString::number( mPen.color().red() ) ); outlinecolor.setAttribute( "green", QString::number( mPen.color().green() ) ); outlinecolor.setAttribute( "blue", QString::number( mPen.color().blue() ) ); symbol.appendChild( outlinecolor ); appendText( symbol, document, "outlinestyle", QgsSymbologyUtils::penStyle2QString( mPen.style() ) ); appendText( symbol, document, "outlinewidth", QString::number( mPen.widthF() ) ); QDomElement fillcolor = document.createElement( "fillcolor" ); fillcolor.setAttribute( "red", QString::number( mBrush.color().red() ) ); fillcolor.setAttribute( "green", QString::number( mBrush.color().green() ) ); fillcolor.setAttribute( "blue", QString::number( mBrush.color().blue() ) ); symbol.appendChild( fillcolor ); appendText( symbol, document, "fillpattern", QgsSymbologyUtils::brushStyle2QString( mBrush.style() ) ); appendText( symbol, document, "texturepath", QgsProject::instance()->writePath( mTextureFilePath ) ); return returnval; }
UnicodeString &DigitFormatter::format( const VisibleDigits &digits, const DigitGrouping &grouping, const DigitFormatterOptions &options, FieldPositionHandler &handler, UnicodeString &appendTo) const { if (digits.isNaN()) { return formatNaN(handler, appendTo); } if (digits.isInfinite()) { return formatInfinity(handler, appendTo); } const DigitInterval &interval = digits.getInterval(); int32_t digitsLeftOfDecimal = interval.getMostSignificantExclusive(); int32_t lastDigitPos = interval.getLeastSignificantInclusive(); int32_t intBegin = appendTo.length(); int32_t fracBegin; // Emit "0" instead of empty string. if (digitsLeftOfDecimal == 0 && lastDigitPos == 0) { appendTo.append(fLocalizedDigits[0]); handler.addAttribute(UNUM_INTEGER_FIELD, intBegin, appendTo.length()); if (options.fAlwaysShowDecimal) { appendField( UNUM_DECIMAL_SEPARATOR_FIELD, fDecimal, handler, appendTo); } return appendTo; } { UnicodeStringAppender appender(appendTo); for (int32_t i = interval.getMostSignificantExclusive() - 1; i >= interval.getLeastSignificantInclusive(); --i) { if (i == -1) { appender.flush(); appendField( UNUM_DECIMAL_SEPARATOR_FIELD, fDecimal, handler, appendTo); fracBegin = appendTo.length(); } appender.append(fLocalizedDigits[digits.getDigitByExponent(i)]); if (grouping.isSeparatorAt(digitsLeftOfDecimal, i)) { appender.flush(); appendField( UNUM_GROUPING_SEPARATOR_FIELD, fGroupingSeparator, handler, appendTo); } if (i == 0) { appender.flush(); if (digitsLeftOfDecimal > 0) { handler.addAttribute(UNUM_INTEGER_FIELD, intBegin, appendTo.length()); } } } if (options.fAlwaysShowDecimal && lastDigitPos == 0) { appender.flush(); appendField( UNUM_DECIMAL_SEPARATOR_FIELD, fDecimal, handler, appendTo); } } // lastDigitPos is never > 0 so we are guaranteed that kIntegerField // is already added. if (lastDigitPos < 0) { handler.addAttribute(UNUM_FRACTION_FIELD, fracBegin, appendTo.length()); } return appendTo; }