本文整理汇总了C++中Q_RETURN_ARG函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_RETURN_ARG函数的具体用法?C++ Q_RETURN_ARG怎么用?C++ Q_RETURN_ARG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Q_RETURN_ARG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEST_FILE
void TestSimpleQmlLoad::loadSignal3()
{
QQmlEngine *engine = new QQmlEngine;
const QString TEST_FILE(":/testqml/testsignal3.qml");
QQmlComponent* component = load(engine, TEST_FILE);
QVERIFY(component);
SignalTester st;
engine->rootContext()->setContextProperty("st", &st);
QObject *myObject = component->create();
QVERIFY(myObject != NULL);
st.sendSig();
QVariant ret;
QMetaObject::invokeMethod(myObject, "getSubWidth1", Q_RETURN_ARG(QVariant, ret));
QVERIFY(ret.toInt() == 10);
st.sendSig();
QMetaObject::invokeMethod(myObject, "getSubWidth1", Q_RETURN_ARG(QVariant, ret));
QVERIFY(ret.toInt() == 20);
delete component;
delete engine;
}
示例2: QObject
AudioLayer::AudioLayer(QQmlApplicationEngine *engine, QObject *parent):
QObject(parent),
m_engine(nullptr)
{
this->m_inputState = AkElement::ElementStateNull;
this->setQmlEngine(engine);
this->m_pipeline = AkElement::create("Bin", "pipeline");
if (this->m_pipeline) {
QFile jsonFile(":/Webcamoid/share/audiopipeline.json");
jsonFile.open(QFile::ReadOnly);
QString description(jsonFile.readAll());
jsonFile.close();
this->m_pipeline->setProperty("description", description);
QMetaObject::invokeMethod(this->m_pipeline.data(),
"element",
Q_RETURN_ARG(AkElementPtr, this->m_audioOut),
Q_ARG(QString, "audioOut"));
QMetaObject::invokeMethod(this->m_pipeline.data(),
"element",
Q_RETURN_ARG(AkElementPtr, this->m_audioIn),
Q_ARG(QString, "audioIn"));
QMetaObject::invokeMethod(this->m_pipeline.data(),
"element",
Q_RETURN_ARG(AkElementPtr, this->m_audioGenerator),
Q_ARG(QString, "audioGenerator"));
QMetaObject::invokeMethod(this->m_pipeline.data(),
"element",
Q_RETURN_ARG(AkElementPtr, this->m_audioSwitch),
Q_ARG(QString, "audioSwitch"));
}
if (this->m_audioOut) {
QString device = this->m_audioOut->property("defaultOutput").toString();
this->m_audioOut->setProperty("device", device);
this->m_outputDeviceCaps = this->m_audioOut->property("caps").value<AkCaps>();
QObject::connect(this->m_audioOut.data(),
SIGNAL(deviceChanged(const QString &)),
this,
SIGNAL(audioOutputChanged(const QString &)));
QObject::connect(this->m_audioOut.data(),
SIGNAL(capsChanged(const AkCaps &)),
this,
SLOT(setOutputDeviceCaps(const AkCaps &)));
QObject::connect(this->m_audioOut.data(),
SIGNAL(outputsChanged(const QStringList &)),
this,
SIGNAL(outputsChanged(const QStringList &)));
QObject::connect(this->m_audioOut.data(),
SIGNAL(stateChanged(AkElement::ElementState)),
this,
SIGNAL(outputStateChanged(AkElement::ElementState)));
}
示例3: error
void FileIO::read()
{
if (m_source.isEmpty()){
emit error("source is empty");
return;
} else if (m_target == 0){
emit error("target is not set");
return;
}
QFile file(m_source);
if ( file.open(QIODevice::ReadOnly) ) {
QString line;
QTextStream t( &file );
QVariant length = m_target->property("length");
QVariant returnedValue;
if(length>0){
QMetaObject::invokeMethod(m_target, "remove",
Q_RETURN_ARG(QVariant, returnedValue),
Q_ARG(QVariant, QVariant(0)),
Q_ARG(QVariant, length));
m_lineOffsets.clear();
m_lineOffsets.push_back(1);
}
do {
line = t.readLine();
line.replace("\t"," ");
m_lineOffsets.push_back(line.length()+1);
line.replace("<","<").replace(">",">").replace(" "," ");
QMetaObject::invokeMethod(m_target, "append",
Q_RETURN_ARG(QVariant, returnedValue),
Q_ARG(QVariant, QVariant(line)));
} while (!t.atEnd());
file.close();
QVariant doc = m_target->property("textDocument");
if (doc.canConvert<QQuickTextDocument*>()) {
QQuickTextDocument *qqdoc = doc.value<QQuickTextDocument*>();
if (qqdoc)
m_doc = qqdoc->textDocument();
m_highlighter = new Highlighter(m_doc);
m_highlighter->setStyle(12);
}
} else {
emit error("Unable to open the file");
return;
}
}
示例4: getParamInfo
void SocketController::getPortStatusCountersList()
{
if (!connectionLost)
{
QMetaObject::invokeMethod(portStatusCountersModel, "clear");
QVariant retValue;
//QString data = "1 0 0 0 0 0 0 \n2 0 0 0 0 0 0 \n3 0 0 0 0 0 0 \n4 0 0 0 0 0 0 \n5 0 0 0 0 0 0 \n6 0 0 0 0 0 0 \n7 0 0 0 0 0 0 \n8 0 0 0 0 0 0 \n";
QString data = getParamInfo("PortStatusCountersList");
if(data == emptyString)
{
logOutSignal();
return;
}
PortStatusCountersParser* parser = new PortStatusCountersParser();
PortStatusCountParseResult result;
result = parser->parsePortStatusCountData(data);
int portsCount = result.params[0].length();
for(int i = 0; i < portsCount; i++)
{
QMetaObject::invokeMethod(portStatusCountersModel, "addPortStatusCounter",
Q_RETURN_ARG(QVariant, retValue),
Q_ARG(QVariant, result.params[result.columnIndexes["port"]].at(i)),
Q_ARG(QVariant, result.params[result.columnIndexes["rx_packets_count"]].at(i)),
Q_ARG(QVariant, result.params[result.columnIndexes["rx_bytes_count"]].at(i)),
Q_ARG(QVariant, result.params[result.columnIndexes["error_count"]].at(i)),
Q_ARG(QVariant, result.params[result.columnIndexes["tx_packets_count"]].at(i)),
Q_ARG(QVariant, result.params[result.columnIndexes["tx_bytes_count"]].at(i)),
Q_ARG(QVariant, result.params[result.columnIndexes["collisions"]].at(i)));
}
}
}
示例5: Q_RETURN_ARG
QScriptValue WindowScriptingInterface::s3Browse(const QString& nameFilter) {
QScriptValue retVal;
QMetaObject::invokeMethod(this, "showS3Browse", Qt::BlockingQueuedConnection,
Q_RETURN_ARG(QScriptValue, retVal),
Q_ARG(const QString&, nameFilter));
return retVal;
}
示例6: Q_RETURN_ARG
QStringList SharingAdaptor::GetServicesForType(const QString &type)
{
// handle method call com.meego.ux.sharing.GetServicesForType
QStringList services;
QMetaObject::invokeMethod(parent(), "GetServicesForType", Q_RETURN_ARG(QStringList, services), Q_ARG(QString, type));
return services;
}
示例7: Q_RETURN_ARG
AnimationPointer AnimationCache::getAnimation(const QUrl& url) {
if (QThread::currentThread() != thread()) {
AnimationPointer result;
QMetaObject::invokeMethod(this, "getAnimation", Qt::BlockingQueuedConnection,
Q_RETURN_ARG(AnimationPointer, result), Q_ARG(const QUrl&, url));
return result;
}
示例8: Q_ASSERT
void VrMenu::addMenu(QMenu* menu) {
Q_ASSERT(!MenuUserData::hasData(menu->menuAction()));
QObject* parent = menu->parent();
QObject* qmlParent = nullptr;
QMenu* parentMenu = dynamic_cast<QMenu*>(parent);
if (parentMenu) {
MenuUserData* userData = MenuUserData::forObject(parentMenu->menuAction());
if (!userData) {
return;
}
qmlParent = findMenuObject(userData->uuid.toString());
} else if (dynamic_cast<QMenuBar*>(parent)) {
qmlParent = _rootMenu;
} else {
Q_ASSERT(false);
}
QVariant returnedValue;
bool invokeResult = QMetaObject::invokeMethod(qmlParent, "addMenu", Qt::DirectConnection,
Q_RETURN_ARG(QVariant, returnedValue),
Q_ARG(QVariant, QVariant::fromValue(menu->title())));
Q_ASSERT(invokeResult);
Q_UNUSED(invokeResult); // FIXME - apparently we haven't upgraded the Qt on our unix Jenkins environments to 5.5.x
QObject* result = returnedValue.value<QObject*>();
Q_ASSERT(result);
if (!result) {
qWarning() << "Unable to create QML menu for widget menu: " << menu->title();
return;
}
// Bind the QML and Widget together
new MenuUserData(menu->menuAction(), result);
}
示例9: Q_RETURN_ARG
QString DemoIfAdaptor::SayBye()
{
// handle method call com.nokia.Demo.SayBye
QString strret;
QMetaObject::invokeMethod(parent(), "SayBye", Q_RETURN_ARG(QString, strret));
return strret;
}
示例10: Q_RETURN_ARG
QDBusObjectPath IBusFactoryAdaptor::CreateEngine(const QString &engine_name)
{
// handle method call org.freedesktop.IBus.EngineFactory.CreateEngine
QDBusObjectPath out0;
QMetaObject::invokeMethod(parent(), "CreateEngine", Q_RETURN_ARG(QDBusObjectPath, out0), Q_ARG(QString, engine_name));
return out0;
}
示例11: Q_RETURN_ARG
QString EAPDaemonAdapter::LoginUser()
{
// handle method call com.qh3client.EAPDaemon.LoginUser
QString out0;
QMetaObject::invokeMethod(parent(), "LoginUser", Q_RETURN_ARG(QString, out0));
return out0;
}
示例12: Q_RETURN_ARG
int PresentationDisplayTask::getPanelHeight()
{
QVariant ret_arg = QVariant::fromValue(0);
QMetaObject::invokeMethod(m_panel, "getPresentationPanelHeight", Q_RETURN_ARG(QVariant, ret_arg));
return ret_arg.toInt();
}
示例13: Q_RETURN_ARG
ConflictInfo ConflictAdaptor::AskRetry(const QString &in0, const QString &in1, const QString &in2)
{
// handle method call com.deepin.dde.Desktop.conflict.AskRetry
ConflictInfo out0;
QMetaObject::invokeMethod(parent(), "AskRetry", Q_RETURN_ARG(ConflictInfo, out0), Q_ARG(QString, in0), Q_ARG(QString, in1), Q_ARG(QString, in2));
return out0;
}
示例14: Q_RETURN_ARG
SharedSoundPointer SoundCache::getSound(const QUrl& url) {
if (QThread::currentThread() != thread()) {
SharedSoundPointer result;
QMetaObject::invokeMethod(this, "getSound", Qt::BlockingQueuedConnection,
Q_RETURN_ARG(SharedSoundPointer, result), Q_ARG(const QUrl&, url));
return result;
}
示例15: endRecording
void Eyrie::process() {
if(recbin == NULL) {
return;
}
if(GST_BUFFER_SIZE(buf) == 0) {
endRecording();
QVariant ret;
QMetaObject::invokeMethod(parent(), "setStatus", Q_RETURN_ARG(QVariant, ret), Q_ARG(QVariant, "Sorry, the recording failed."));
return;
}
mutex->lock();
const float *pcm = (const float *) GST_BUFFER_DATA(buf);
Codegen *codegen = new Codegen(pcm, GST_BUFFER_SIZE(buf) / sizeof(float), 0);
mutex->unlock();
std::string code = codegen->getCodeString();
QNetworkAccessManager *networkManager = new QNetworkAccessManager();
QUrl url("http://developer.echonest.com/api/v4/song/identify");
QByteArray params;
params.append("api_key=RIUKSNTIPKUMPHPEO");
params.append("&query=[{\"metadata\":{\"version\":4.12},\"code\":\""); params.append(code.c_str()); params.append("\"}]");
QNetworkRequest request;
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded;charset=UTF-8");
request.setUrl(url);
connect(networkManager, SIGNAL(finished(QNetworkReply *)), this, SLOT(parseResponse(QNetworkReply *)));
networkManager->post(request, params);
}