本文整理汇总了C++中QStringRef::toLatin1方法的典型用法代码示例。如果您正苦于以下问题:C++ QStringRef::toLatin1方法的具体用法?C++ QStringRef::toLatin1怎么用?C++ QStringRef::toLatin1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStringRef
的用法示例。
在下文中一共展示了QStringRef::toLatin1方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendTurnChangeMessage
void Server::sendTurnChangeMessage(QStringRef name){
for (int i = 0; i < nickContainer->size(); ++i){
if (nickContainer->at(i) == name){
clientContainer->at(i)->write("/Turn::" + name.toLatin1());
}
}
}
示例2: sendChallengeAccepted
void Server::sendChallengeAccepted(QStringRef source){
for (int i = 0; i < nickContainer->size(); ++i){
if (nickContainer->at(i) == source){
clientContainer->at(i)->write("/ChallengeAccepted::" + source.toLatin1());
}
}
}
示例3: AbstractMultipartSource
Image::Image(QQmlEngine *engine, const QString &filename) :
AbstractMultipartSource(),
m_engine(engine)
{
m_self = engine->newQObject(this);
engine->setObjectOwnership(this, QQmlEngine::JavaScriptOwnership);
if (filename.startsWith(QStringLiteral("data:"))) {
int comma = filename.indexOf(QChar(','));
QStringRef data = filename.midRef(comma+1);
QBuffer *buffer = new QBuffer(this);
buffer->setData(QByteArray::fromBase64(data.toLatin1()));
m_reader = new QImageReader(buffer);
} else {
m_reader = new QImageReader(filename);
}
}
示例4: handleText
bool handleText(const QStringRef &text)
{
data->pack = QByteArray::fromBase64(text.toLatin1());
return true;
}
示例5: attribute
void GeogebraTransformer::attribute( const QXmlName& name, const QStringRef& value )
{
if( name.localName( m_np ) == QLatin1String( "label" ) )
{
const QByteArray objectLabel = value.toLatin1();
bool isDoubleValue;
const double dblval = value.toString().toDouble( &isDoubleValue );
switch( m_currentState )
{
case GeogebraTransformer::ReadingObject:
m_currentObjectLabel = value.toLatin1();
// There must be a better place for this
m_currentState = GeogebraTransformer::ReadingArguments;
break;
case GeogebraTransformer::ReadingArguments:
if( isDoubleValue )
{
/* This is to handle the circle-point-radius, dilate (and similar) type of Geogebra objects.
* <command name="Circle">
* <input a0="A" a1="3"/>
* <output a0="c"/>
*
* Notice the attribute 'a1' of the 'input' element. The value - '3' is the radius of the circle.
* First, we try to convert that value to Double. If the conversion suceeds, we stack a DoubleImp (Calcer)
* in the m_currentArgStack and break. Otherwise, we check the m_objectMap for that label entry.
*/
DoubleImp * doubleImp = new DoubleImp( dblval );
m_currentArgStack.push_back( new ObjectConstCalcer( doubleImp ) );
}
else if( m_objectMap.contains( objectLabel ) )
{
m_currentArgStack.push_back( m_objectMap[objectLabel] );
}
else
{
//TODO Figure out error reporting
}
break;
default:
break;
}
}
else if ( name.localName( m_np ) == QLatin1String( "value" ) )
{
Q_ASSERT( m_currentState == ReadingDouble );
DoubleImp * doubleImp = new DoubleImp( value.toString().toDouble() );
m_currentArgStack.push_back( new ObjectConstCalcer( doubleImp ) );
}
else if ( name.localName( m_np ) == QLatin1String( "Name" ) )
{
m_sections[m_nsections - 1].setName( value.toString() );
}
else if ( name.localName( m_np ) == QLatin1String( "Description" ) )
{
m_sections[m_nsections - 1].setDescription( value.toString() );
}
else if ( name.localName( m_np ) == QLatin1String( "Input" ) )
{
m_inputObjectLabels.insert( value.toLatin1() );
}
else if ( name.localName( m_np ) == QLatin1String( "Output" ) )
{
m_outputObjectLabels.insert( value.toLatin1() );
}
else if( name.localName( m_np ) == QLatin1String( "show" ) )
{
m_show = ( ( value.toString()=="true" ) ? true:false );
}
else if( name.localName( m_np ) == QLatin1String( "thickness" ) )
{
m_thickness = value.toString().toInt();
}
else if( name.localName( m_np ) == QLatin1String( "thickness_point" ) )
{
m_thickness = value.toString().toInt();
m_thickness += 6;
}
else if( name.localName( m_np ) == QLatin1String( "type" ) )
{
int penType = value.toString().toInt() ;
switch( penType )
{
case SOLIDLINE:
m_type = Qt::SolidLine;
break;
case DASHDOTDOTLINE:
m_type = Qt::DashDotDotLine;
break;
case DASHLINE:
m_type = Qt::DashLine;
break;
case DOTLINE:
m_type = Qt::DotLine;
break;
case DASHDOTLINE:
m_type = Qt::DashDotLine;
//.........这里部分代码省略.........
示例6: FromString
QByteArray FromString(const QStringRef &Hash) noexcept
{
return QByteArray::fromHex(Hash.toLatin1());
}