本文整理汇总了C++中QByteArrayLiteral函数的典型用法代码示例。如果您正苦于以下问题:C++ QByteArrayLiteral函数的具体用法?C++ QByteArrayLiteral怎么用?C++ QByteArrayLiteral使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QByteArrayLiteral函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: QCOMPARE
void TestMessage::sendAndListen()
{
int recvId1= 0;
QByteArray recvPayload1;
auto listener1 = [&recvId1, &recvPayload1](int id, const QByteArray &payload) {
recvId1 = id;
recvPayload1 = payload;
};
int recvId2= 0;
QByteArray recvPayload2;
auto listener2 = [&recvId2, &recvPayload2](int id, const QByteArray &payload) {
recvId2 = id;
recvPayload2 = payload;
};
sapi::message::addMessageListener("topic1", listener1);
sapi::message::addMessageListener("topic1", listener2);
sapi::message::sendMessage("topic1", "p1");
sapi::message::sendMessage("topic2", "p2");
QCOMPARE(recvId1, 0);
QCOMPARE(recvPayload1, QByteArrayLiteral("p1"));
QCOMPARE(recvId2, 0);
QCOMPARE(recvPayload2, QByteArrayLiteral("p1"));
}
开发者ID:ArchangelSDY,项目名称:Silica,代码行数:27,代码来源:Message_Tests.cpp
示例2: QCOMPARE
void tst_QPauseAnimationJob::pauseAndPropertyAnimations()
{
EnableConsistentTiming enabled;
TestablePauseAnimation pause;
pause.setDuration(200);
TestableGenericAnimation animation;
pause.start();
QTest::qWait(100);
animation.start();
QCOMPARE(animation.state(), QAbstractAnimationJob::Running);
QTRY_COMPARE(animation.state(), QAbstractAnimationJob::Running);
QVERIFY(pause.state() == QAbstractAnimationJob::Running);
QVERIFY2(pause.m_updateCurrentTimeCount >= 2,
QByteArrayLiteral("pause.m_updateCurrentTimeCount=") + QByteArray::number(pause.m_updateCurrentTimeCount));
QTRY_COMPARE(animation.state(), QAbstractAnimationJob::Stopped);
QCOMPARE(pause.state(), QAbstractAnimationJob::Stopped);
QVERIFY2(pause.m_updateCurrentTimeCount > 3,
QByteArrayLiteral("pause.m_updateCurrentTimeCount=") + QByteArray::number(pause.m_updateCurrentTimeCount));
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:26,代码来源:tst_qpauseanimationjob.cpp
示例3: switch
void RenderMaterial::sceneChangeEvent(const QSceneChangePtr &e)
{
QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
switch (e->type()) {
case NodeUpdated: {
if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
m_enabled = propertyChange->value().toBool();
break;
}
// Check for shader parameter
case NodeAdded: {
if (propertyChange->propertyName() == QByteArrayLiteral("parameter"))
m_parameterPack.appendParameter(propertyChange->value().value<QNodeId>());
else if (propertyChange->propertyName() == QByteArrayLiteral("effect"))
m_effectUuid = propertyChange->value().value<QNodeId>();
break;
}
case NodeRemoved: {
if (propertyChange->propertyName() == QByteArrayLiteral("parameter"))
m_parameterPack.removeParameter(propertyChange->value().value<QNodeId>());
else if (propertyChange->propertyName() == QByteArrayLiteral("effect"))
m_effectUuid = QNodeId();
break;
}
default:
break;
}
}
开发者ID:Sagaragrawal,项目名称:2gisqt5android,代码行数:30,代码来源:rendermaterial.cpp
示例4: compareMetaData
void compareMetaData(QByteArray data, const QString &expected, int otherFlags = 0)
{
QString decoded;
// needs to be in in one map, with the entry called "v"
data = "\xa1\x61v" + data;
{
CborParser parser;
CborValue first;
CborError err = cbor_parser_init(reinterpret_cast<const quint8 *>(data.constData()), data.length(), 0, &parser, &first);
QVERIFY2(!err, QByteArrayLiteral(": Got error \"") + cbor_error_string(err) + "\"");
err = parseOne(&first, &decoded, CborConvertAddMetadata | otherFlags);
QVERIFY2(!err, QByteArrayLiteral(": Got error \"") + cbor_error_string(err) +
"\"; decoded stream:\n" + decoded.toLatin1());
// check that we consumed everything
QCOMPARE((void*)first.ptr, (void*)data.constEnd());
}
QVERIFY(decoded.startsWith("{\"v\":"));
QVERIFY(decoded.endsWith('}'));
// qDebug() << "was" << decoded;
// extract just the metadata
static const char needle[] = "\"v$cbor\":{";
int pos = decoded.indexOf(needle);
QCOMPARE(pos == -1, expected.isEmpty());
if (pos != -1) {
decoded.chop(2);
decoded = std::move(decoded).mid(pos + strlen(needle));
QCOMPARE(decoded, expected);
}
}
开发者ID:Subh1994,项目名称:iotivity,代码行数:35,代码来源:tst_tojson.cpp
示例5: switch
void ChannelMapper::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
switch (e->type()) {
case Qt3DCore::PropertyValueAdded: {
const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeAddedChange>(e);
if (change->propertyName() == QByteArrayLiteral("mappings")) {
m_mappingIds.push_back(change->addedNodeId());
setDirty(Handler::ChannelMappingsDirty);
m_isDirty = true;
}
break;
}
case Qt3DCore::PropertyValueRemoved: {
const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeRemovedChange>(e);
if (change->propertyName() == QByteArrayLiteral("mappings")) {
m_mappingIds.removeOne(change->removedNodeId());
setDirty(Handler::ChannelMappingsDirty);
m_isDirty = true;
}
break;
}
default:
break;
}
QBackendNode::sceneChangeEvent(e);
}
开发者ID:RSATom,项目名称:Qt,代码行数:28,代码来源:channelmapper.cpp
示例6: QByteArrayLiteral
QHash<int, QByteArray> ScreenModel::roleNames() const {
// set role names
QHash<int, QByteArray> roleNames;
roleNames[NameRole] = QByteArrayLiteral("name");
roleNames[GeometryRole] = QByteArrayLiteral("geometry");
return roleNames;
}
开发者ID:xgnata,项目名称:sddm,代码行数:7,代码来源:ScreenModel.cpp
示例7: main
int main(int argc, char *argv[])
{
// Disable ptrace except for gdb
disablePtrace();
// Setup the environment
qputenv("QT_QPA_PLATFORM", QByteArrayLiteral("wayland"));
qputenv("QT_WAYLAND_USE_BYPASSWINDOWMANAGERHINT", QByteArrayLiteral("1"));
// Application
QGuiApplication app(argc, argv);
app.setApplicationName(QStringLiteral("Liri Shell Helper"));
app.setApplicationVersion(QStringLiteral(LIRI_VERSION_STRING));
app.setOrganizationName(QStringLiteral("Liri"));
app.setOrganizationDomain(QStringLiteral("liri.io"));
app.setFallbackSessionManagementEnabled(false);
app.setQuitOnLastWindowClosed(false);
// Print version information
qDebug("== Liri Shell Helper v%s (Green Island v%s) ==\n"
"** http://liri.io\n"
"** Bug reports to: https://github.com/lirios/shell/issues\n"
"** Build: %s-%s",
LIRI_VERSION_STRING, GREENISLAND_VERSION_STRING,
LIRI_VERSION_STRING, GIT_REV);
// Create shell helper
new ShellHelperApplication();
return app.exec();
}
开发者ID:qmlos,项目名称:shell,代码行数:31,代码来源:main.cpp
示例8: protocolsAtom
void X11WindowedBackend::createWindow()
{
Xcb::Atom protocolsAtom(QByteArrayLiteral("WM_PROTOCOLS"), false, m_connection);
Xcb::Atom deleteWindowAtom(QByteArrayLiteral("WM_DELETE_WINDOW"), false, m_connection);
for (int i = 0; i < initialOutputCount(); ++i) {
Output o;
o.window = xcb_generate_id(m_connection);
uint32_t mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;
const uint32_t values[] = {
m_screen->black_pixel,
XCB_EVENT_MASK_KEY_PRESS |
XCB_EVENT_MASK_KEY_RELEASE |
XCB_EVENT_MASK_BUTTON_PRESS |
XCB_EVENT_MASK_BUTTON_RELEASE |
XCB_EVENT_MASK_POINTER_MOTION |
XCB_EVENT_MASK_ENTER_WINDOW |
XCB_EVENT_MASK_LEAVE_WINDOW |
XCB_EVENT_MASK_STRUCTURE_NOTIFY |
XCB_EVENT_MASK_EXPOSURE
};
o.size = initialWindowSize();
if (!m_windows.isEmpty()) {
const auto &p = m_windows.last();
o.internalPosition = QPoint(p.internalPosition.x() + p.size.width(), 0);
}
xcb_create_window(m_connection, XCB_COPY_FROM_PARENT, o.window, m_screen->root,
0, 0, o.size.width(), o.size.height(),
0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, mask, values);
o.winInfo = new NETWinInfo(m_connection, o.window, m_screen->root, NET::WMWindowType, NET::Properties2());
o.winInfo->setWindowType(NET::Normal);
o.winInfo->setPid(QCoreApplication::applicationPid());
QIcon windowIcon = QIcon::fromTheme(QStringLiteral("kwin"));
auto addIcon = [&o, &windowIcon] (const QSize &size) {
if (windowIcon.actualSize(size) != size) {
return;
}
NETIcon icon;
icon.data = windowIcon.pixmap(size).toImage().bits();
icon.size.width = size.width();
icon.size.height = size.height();
o.winInfo->setIcon(icon, false);
};
addIcon(QSize(16, 16));
addIcon(QSize(32, 32));
addIcon(QSize(48, 48));
xcb_map_window(m_connection, o.window);
m_protocols = protocolsAtom;
m_deleteWindowProtocol = deleteWindowAtom;
xcb_change_property(m_connection, XCB_PROP_MODE_REPLACE, o.window, m_protocols, XCB_ATOM_ATOM, 32, 1, &m_deleteWindowProtocol);
m_windows << o;
}
updateWindowTitle();
xcb_flush(m_connection);
}
开发者ID:shadeslayer,项目名称:kwin,代码行数:60,代码来源:x11windowed_backend.cpp
示例9: switch
void PhysicsGeometry::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e){
Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
QByteArray propertyName = propertyChange->propertyName();
switch (e->type()) {
case Qt3DCore::NodeAdded: {
if (propertyName == QByteArrayLiteral("attribute")) {
m_attributes.push_back(propertyChange->value().value<Qt3DCore::QNodeId>());
}
break;
}
case Qt3DCore::NodeRemoved: {
if (propertyName == QByteArrayLiteral("attribute")) {
m_attributes.removeOne(propertyChange->value().value<Qt3DCore::QNodeId>());
}
break;
}
case Qt3DCore::NodeUpdated:
if (propertyName == QByteArrayLiteral("enabled")){
m_enabled = propertyChange->value().value<bool>();
}
else if (propertyName == QByteArrayLiteral("verticesPerPatch")) {
m_verticesPerPatch = propertyChange->value().value<int>();
break;
}
default:
break;
}
}
开发者ID:chili-epfl,项目名称:qtphysics-unofficial,代码行数:28,代码来源:physicsgeometry.cpp
示例10: qWarning
bool QQnxButtonEventNotifier::parsePPS(const QByteArray &ppsData, QHash<QByteArray, QByteArray> *messageFields) const
{
// tokenize pps data into lines
QList<QByteArray> lines = ppsData.split('\n');
// validate pps object
if (lines.size() == 0 || !lines.at(0).contains(QByteArrayLiteral("@status"))) {
qWarning("QQNX: unrecognized pps object, data=%s", ppsData.constData());
return false;
}
// parse pps object attributes and extract values
for (int i = 1; i < lines.size(); i++) {
// tokenize current attribute
const QByteArray &attr = lines.at(i);
qButtonDebug() << Q_FUNC_INFO << "attr=" << attr;
int doubleColon = attr.indexOf(QByteArrayLiteral("::"));
if (doubleColon == -1) {
// abort - malformed attribute
continue;
}
QByteArray key = attr.left(doubleColon);
QByteArray value = attr.mid(doubleColon + 2);
messageFields->insert(key, value);
}
return true;
}
开发者ID:crobertd,项目名称:qtbase,代码行数:31,代码来源:qqnxbuttoneventnotifier.cpp
示例11: if
void TextureImage::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
if (e->type() == NodeUpdated) {
if (propertyChange->propertyName() == QByteArrayLiteral("layer")) {
m_layer = propertyChange->value().toInt();
m_dirty = true;
} else if (propertyChange->propertyName() == QByteArrayLiteral("mipmapLevel")) {
m_mipmapLevel = propertyChange->value().toInt();
m_dirty = true;
} else if (propertyChange->propertyName() == QByteArrayLiteral("cubeMapFace")) {
m_face = static_cast<QAbstractTextureProvider::CubeMapFace>(propertyChange->value().toInt());
m_dirty = true;
} else if (propertyChange->propertyName() == QByteArrayLiteral("dataFunctor")) {
m_functor = propertyChange->value().value<QTextureDataFunctorPtr>();
m_dirty = true;
}
}
if (m_dirty) {// Notify the Texture that we were updated and request it to schedule an update job
Texture *txt = m_textureManager->data(m_textureProvider);
if (txt != Q_NULLPTR)
txt->addToPendingTextureJobs();
}
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:25,代码来源:textureimage.cpp
示例12: material
MaterialPtr NormalMapScene::createTextureMaterial( const QString& diffuseFileName,
const QString& normalFileName )
{
// Create a material and set the shaders
MaterialPtr material( new Material );
#if !defined(Q_OS_MAC)
material->setShaders( ":/shaders/normalmap.vert",
":/shaders/normalmap.frag" );
#else
material->setShaders( ":/shaders/normalmap_2_1.vert",
":/shaders/normalmap_2_1.frag" );
#endif
// Create a diffuse texture
TexturePtr texture0( new Texture( Texture::Texture2D ) );
texture0->create();
texture0->bind();
texture0->setImage( QImage( diffuseFileName ) );
texture0->generateMipMaps();
// Create a normal map
TexturePtr texture1( new Texture( Texture::Texture2D ) );
texture1->create();
texture1->bind();
texture1->setImage( QImage( normalFileName ) );
texture1->generateMipMaps();
#if !defined(Q_OS_MAC)
// Create a sampler. This can be shared by many textures
SamplerPtr sampler( new Sampler );
sampler->create();
sampler->setWrapMode( Sampler::DirectionS, GL_CLAMP_TO_EDGE );
sampler->setWrapMode( Sampler::DirectionT, GL_CLAMP_TO_EDGE );
sampler->setMinificationFilter( GL_LINEAR_MIPMAP_LINEAR );
sampler->setMagnificationFilter( GL_LINEAR );
// Associate the textures with the first 2 texture units
material->setTextureUnitConfiguration( 0, texture0, sampler, QByteArrayLiteral( "texture0" ) );
material->setTextureUnitConfiguration( 1, texture1, sampler, QByteArrayLiteral( "texture1" ) );
#else
texture0->bind();
texture0->setWrapMode( Texture::DirectionS, GL_CLAMP_TO_EDGE );
texture0->setWrapMode( Texture::DirectionT, GL_CLAMP_TO_EDGE );
texture0->setMinificationFilter( GL_LINEAR_MIPMAP_LINEAR );
texture0->setMagnificationFilter( GL_LINEAR );
texture1->bind();
texture1->setWrapMode( Texture::DirectionS, GL_CLAMP_TO_EDGE );
texture1->setWrapMode( Texture::DirectionT, GL_CLAMP_TO_EDGE );
texture1->setMinificationFilter( GL_LINEAR_MIPMAP_LINEAR );
texture1->setMagnificationFilter( GL_LINEAR );
// Associate the textures with the first 2 texture units
material->setTextureUnitConfiguration( 0, texture0, QByteArrayLiteral( "texture0" ) );
material->setTextureUnitConfiguration( 1, texture1, QByteArrayLiteral( "texture1" ) );
#endif
return material;
}
开发者ID:QtOpenGL,项目名称:opengl-demos,代码行数:59,代码来源:normalmapscene.cpp
示例13: deserializeInitDynamicPacket
void deserializeInitDynamicPacket(QDataStream &in, QMetaObjectBuilder &builder, QVariantList &values)
{
quint32 numSignals = 0;
quint32 numMethods = 0;
quint32 numProperties = 0;
in >> numSignals;
in >> numMethods;
int curIndex = 0;
for (quint32 i = 0; i < numSignals; ++i) {
QByteArray signature;
in >> signature;
++curIndex;
builder.addSignal(signature);
}
for (quint32 i = 0; i < numMethods; ++i) {
QByteArray signature, returnType;
in >> signature;
in >> returnType;
++curIndex;
const bool isVoid = returnType.isEmpty() || returnType == QByteArrayLiteral("void");
if (isVoid)
builder.addMethod(signature);
else
builder.addMethod(signature, QByteArrayLiteral("QRemoteObjectPendingCall"));
}
in >> numProperties;
const quint32 initialListSize = values.size();
if (static_cast<quint32>(values.size()) < numProperties)
values.reserve(numProperties);
else if (static_cast<quint32>(values.size()) > numProperties)
for (quint32 i = numProperties; i < initialListSize; ++i)
values.removeLast();
for (quint32 i = 0; i < numProperties; ++i) {
QByteArray name;
QByteArray typeName;
QByteArray signalName;
in >> name;
in >> typeName;
in >> signalName;
if (signalName.isEmpty())
builder.addProperty(name, typeName);
else
builder.addProperty(name, typeName, builder.indexOfSignal(signalName));
QVariant value;
in >> value;
if (i < initialListSize)
values[i] = value;
else
values.append(value);
}
}
开发者ID:NNemec,项目名称:qtremoteobjects,代码行数:58,代码来源:qremoteobjectpacket.cpp
示例14: QByteArrayLiteral
void NetworkUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo& info) {
if (m_sendDNT) {
info.setHttpHeader(QByteArrayLiteral("DNT"), QByteArrayLiteral("1"));
}
// NOTE: Here we can add custom headers for each webengine request, for example "User-Agent".
foreach (UrlInterceptor* interceptor, m_interceptors) {
interceptor->interceptRequest(info);
}
开发者ID:martinrotter,项目名称:rssguard,代码行数:10,代码来源:networkurlinterceptor.cpp
示例15: if
void ClearBuffer::sceneChangeEvent(const QSceneChangePtr &e)
{
if (e->type() == NodeUpdated) {
QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
if (propertyChange->propertyName() == QByteArrayLiteral("buffers"))
m_type = static_cast<QClearBuffer::BufferType>(propertyChange->value().toInt());
else if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
setEnabled(propertyChange->value().toBool());
}
}
开发者ID:James-intern,项目名称:Qt,代码行数:10,代码来源:clearbuffer.cpp
示例16: QWidget
//////////////////////////////////////////////////////////////////////////
// TransparentScrollButton
//////////////////////////////////////////////////////////////////////////
TransparentScrollButton::TransparentScrollButton(QWidget *parent)
: QWidget(parent)
, transparentAnimation_(new TransparentAnimation(L::minOpacity, L::maxOpacity, this))
, isHovered_(false)
{
maxSizeAnimation_ = new QPropertyAnimation(this, QByteArrayLiteral("maximumWidth"), this);
minSizeAnimation_ = new QPropertyAnimation(this, QByteArrayLiteral("minimumWidth"), this);
connect(transparentAnimation_, &TransparentAnimation::fadeOutStarted, this, &TransparentScrollButton::fadeOutStarted);
}
开发者ID:mailru,项目名称:icqdesktop,代码行数:13,代码来源:TransparentScrollBar.cpp
示例17: if
void Parameter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
if (e->type() == NodeUpdated) {
if (propertyChange->propertyName() == QByteArrayLiteral("name"))
m_name = propertyChange->value().toString();
else if (propertyChange->propertyName() == QByteArrayLiteral("value"))
m_value = toBackendValue(propertyChange->value());
}
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:11,代码来源:parameter.cpp
示例18: QByteArrayLiteral
QHash<int, QByteArray> UserModel::roleNames() const {
// set role names
QHash<int, QByteArray> roleNames;
roleNames[NameRole] = QByteArrayLiteral("name");
roleNames[RealNameRole] = QByteArrayLiteral("realName");
roleNames[HomeDirRole] = QByteArrayLiteral("homeDir");
roleNames[IconRole] = QByteArrayLiteral("icon");
roleNames[NeedsPasswordRole] = QByteArrayLiteral("needsPassword");
return roleNames;
}
开发者ID:MartinBriza,项目名称:sddm,代码行数:11,代码来源:UserModel.cpp
示例19: isGPUTestBlacklisted
static bool isGPUTestBlacklisted(const char *slot, const char *data = 0)
{
const QByteArray disableKey = QByteArrayLiteral("disable_") + QByteArray(slot);
if (gpuFeatures->find(disableKey) != gpuFeatures->end()) {
QByteArray msg = QByteArrayLiteral("Skipped due to GPU blacklist: ") + disableKey;
if (data)
msg += ':' + QByteArray(data);
QTest::qSkip(msg.constData(), __FILE__, __LINE__);
return true;
}
return false;
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:12,代码来源:qtestblacklist.cpp
示例20: if
void AdditiveClipBlend::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
if (e->type() == Qt3DCore::PropertyUpdated) {
Qt3DCore::QPropertyUpdatedChangePtr change = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
if (change->propertyName() == QByteArrayLiteral("additiveFactor"))
m_additiveFactor = change->value().toFloat();
else if (change->propertyName() == QByteArrayLiteral("baseClip"))
m_baseClipId = change->value().value<Qt3DCore::QNodeId>();
else if (change->propertyName() == QByteArrayLiteral("additiveClip"))
m_additiveClipId = change->value().value<Qt3DCore::QNodeId>();
}
}
开发者ID:RSATom,项目名称:Qt,代码行数:12,代码来源:additiveclipblend.cpp
注:本文中的QByteArrayLiteral函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论