• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Q_ARG函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Q_ARG函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_ARG函数的具体用法?C++ Q_ARG怎么用?C++ Q_ARG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Q_ARG函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: QmlBridge_SendToGo

char* QmlBridge_SendToGo(void* ptr, char* data)
{
	QString returnArg;
	QMetaObject::invokeMethod(static_cast<QmlBridge*>(ptr), "sendToGo", Q_RETURN_ARG(QString, returnArg), Q_ARG(QString, QString(data)));
	return returnArg.toUtf8().data();
}
开发者ID:Jpboyee,项目名称:qt,代码行数:6,代码来源:moc.cpp


示例2: Q_ARG

void ZealDocsetsRegistry::runQuery(const QString& query)
{
    lastQuery += 1;
    QMetaObject::invokeMethod(this, "_runQuery", Qt::QueuedConnection, Q_ARG(QString, query), Q_ARG(int, lastQuery));
}
开发者ID:Janak-Nirmal,项目名称:zeal,代码行数:5,代码来源:zealdocsetsregistry.cpp


示例3: setTitle

 void setTitle(const QString &title)
 {
     const auto text = QString("<b>%1</b>").arg(title.toHtmlEscaped());
     //cannot call setText in calling thread, forward to the label slot
     QMetaObject::invokeMethod(_label, "setText", Qt::QueuedConnection, Q_ARG(QString, text));
 }
开发者ID:m0x72,项目名称:pothos,代码行数:6,代码来源:DropDown.cpp


示例4: dispatch

 void dispatch(QString type, QJSValue message) {
     for (int i = 0 ; i < 3;i++) {
         QMetaObject::invokeMethod(this,"dispatched",Q_ARG(QString, type), Q_ARG(QJSValue, message));
     }
 }
开发者ID:benlau,项目名称:quickflux,代码行数:5,代码来源:quickfluxunittests.cpp


示例5: write

	void write(const QVariant &vrequest)
	{
		ZhttpRequestPacket request;
		if(!request.fromVariant(vrequest))
		{
			QVariantHash vhash = vrequest.toHash();
			if(vhash["type"].toByteArray() != "cancel")
			{
				QMetaObject::invokeMethod(this, "respondError", Qt::QueuedConnection, Q_ARG(QByteArray, "bad-request"));
			}
			else
			{
				cleanup();
				QMetaObject::invokeMethod(q, "finished", Qt::QueuedConnection);
			}

			return;
		}

		// cancel session if a wrong sequenced packet is received
		if(inSeq == -1 || request.seq == -1 || request.seq != inSeq + 1)
		{
			if(request.type != ZhttpRequestPacket::Cancel)
			{
				QMetaObject::invokeMethod(this, "respondCancel", Qt::QueuedConnection);
			}
			else
			{
				cleanup();
				QMetaObject::invokeMethod(q, "finished", Qt::QueuedConnection);
			}

			return;
		}

		if(request.type == ZhttpRequestPacket::Cancel)
		{
			cleanup();
			QMetaObject::invokeMethod(q, "finished", Qt::QueuedConnection);
			return;
		}

		inSeq = request.seq;

		refreshTimeout();

		// all we care about from follow-up writes are body and credits

		if(request.credits != -1)
			outCredits += request.credits;

		if(transport == HttpTransport)
		{
			if(request.type == ZhttpRequestPacket::Data)
			{
				if(bodySent)
				{
					QMetaObject::invokeMethod(this, "respondError", Qt::QueuedConnection, Q_ARG(QByteArray, "bad-request"));
					return;
				}

				refreshActivityTimeout();

				if(!request.body.isEmpty())
					hreq->writeBody(request.body);

				// the 'more' flag only has significance if body field present
				if(!request.more)
				{
					bodySent = true;
					hreq->endBody();
				}
			}
		}
		else // WebSocketTransport
		{
			if(request.type == ZhttpRequestPacket::Data || request.type == ZhttpRequestPacket::Close || request.type == ZhttpRequestPacket::Ping || request.type == ZhttpRequestPacket::Pong)
			{
				refreshActivityTimeout();

				if(request.type == ZhttpRequestPacket::Data)
				{
					WebSocket::Frame::Type ftype;
					if(wsSendingMessage)
						ftype = WebSocket::Frame::Continuation;
					else if(request.contentType == "binary")
						ftype = WebSocket::Frame::Binary;
					else
						ftype = WebSocket::Frame::Text;

					wsSendingMessage = request.more;

					wsPendingWrites += request.body.size();
					ws->writeFrame(WebSocket::Frame(ftype, request.body, request.more));
				}
				else if(request.type == ZhttpRequestPacket::Ping)
				{
					wsPendingWrites += 0;
					ws->writeFrame(WebSocket::Frame(WebSocket::Frame::Ping, QByteArray(), false));
				}
//.........这里部分代码省略.........
开发者ID:HunterChen,项目名称:zurl,代码行数:101,代码来源:worker.cpp


示例6: Q_ARG

                              Q_ARG(int, status));
}

static void NotifyTransactionChanged(WalletModel *walletmodel, CWallet *wallet, const uint256 &hash, ChangeType status)
{
    Q_UNUSED(wallet);
    Q_UNUSED(hash);
    Q_UNUSED(status);
    QMetaObject::invokeMethod(walletmodel, "updateTransaction", Qt::QueuedConnection);
}

static void ShowProgress(WalletModel *walletmodel, const std::string &title, int nProgress)
{
    // emits signal "showProgress"
    QMetaObject::invokeMethod(walletmodel, "showProgress", Qt::QueuedConnection,
                              Q_ARG(QString, QString::fromStdString(title)),
                              Q_ARG(int, nProgress));
}

static void NotifyWatchonlyChanged(WalletModel *walletmodel, bool fHaveWatchonly)
{
    QMetaObject::invokeMethod(walletmodel, "updateWatchOnlyFlag", Qt::QueuedConnection,
                              Q_ARG(bool, fHaveWatchonly));
}

void WalletModel::subscribeToCoreSignals()
{
    // Connect signals to wallet
    wallet->NotifyStatusChanged.connect(boost::bind(&NotifyKeyStoreStatusChanged, this, _1));
    wallet->NotifyAddressBookChanged.connect(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5, _6));
    wallet->NotifyTransactionChanged.connect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3));
开发者ID:CryptAxe,项目名称:bitcoin,代码行数:31,代码来源:walletmodel.cpp


示例7: Q_ARG

void EAPDaemonAdapter::Login(const QVariantMap &userinfo)
{
    // handle method call com.qh3client.EAPDaemon.Login
    QMetaObject::invokeMethod(parent(), "Login", Q_ARG(QVariantMap, userinfo));
}
开发者ID:kxion,项目名称:qh3clinet,代码行数:5,代码来源:eapdaemonadapter.cpp


示例8: main

int main(int argc, char *argv[])
{
	QCoreApplication app(argc, argv);
	app.setOrganizationName("Cockatrice");
	app.setApplicationName("Servatrice");
	
	QStringList args = app.arguments();
	bool testRandom = args.contains("--test-random");
	bool testHashFunction = args.contains("--test-hash");
	bool logToConsole = args.contains("--log-to-console");
	QString configPath;
	int hasConfigPath=args.indexOf("--config");
	if(hasConfigPath > -1 && args.count() > hasConfigPath + 1)
		configPath = args.at(hasConfigPath + 1);
	
	qRegisterMetaType<QList<int> >("QList<int>");

#if QT_VERSION < 0x050000
	// gone in Qt5, all source files _MUST_ be utf8-encoded
	QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
#endif

	configPath = SettingsCache::guessConfigurationPath(configPath);
	qWarning() << "Using configuration file: " << configPath;
	settingsCache = new SettingsCache(configPath);
	
	loggerThread = new QThread;
	loggerThread->setObjectName("logger");
	logger = new ServerLogger(logToConsole);
	logger->moveToThread(loggerThread);
	
	loggerThread->start();
	QMetaObject::invokeMethod(logger, "startLog", Qt::BlockingQueuedConnection, Q_ARG(QString, settingsCache->value("server/logfile", QString("server.log")).toString()));

#if QT_VERSION < 0x050000
	if (logToConsole)
		qInstallMsgHandler(myMessageOutput);
	else
		qInstallMsgHandler(myMessageOutput2);
#else
	if (logToConsole)
		qInstallMessageHandler(myMessageOutput);
	else
		qInstallMessageHandler(myMessageOutput2);
#endif

#ifdef Q_OS_UNIX	
	struct sigaction hup;
	hup.sa_handler = ServerLogger::hupSignalHandler;
	sigemptyset(&hup.sa_mask);
	hup.sa_flags = 0;
	hup.sa_flags |= SA_RESTART;
	sigaction(SIGHUP, &hup, 0);
	
	struct sigaction segv;
	segv.sa_handler = sigSegvHandler;
	segv.sa_flags = SA_RESETHAND;
	sigemptyset(&segv.sa_mask);
	sigaction(SIGSEGV, &segv, 0);
	sigaction(SIGABRT, &segv, 0);
	
	signal(SIGPIPE, SIG_IGN);
#endif
	rng = new RNG_SFMT;
	
	std::cerr << "Servatrice " << VERSION_STRING << " starting." << std::endl;
	std::cerr << "-------------------------" << std::endl;
	
	PasswordHasher::initialize();
	
	if (testRandom)
		testRNG();
	if (testHashFunction)
		testHash();
	
	Servatrice *server = new Servatrice();
	QObject::connect(server, SIGNAL(destroyed()), &app, SLOT(quit()), Qt::QueuedConnection);
	int retval = 0;
	if (server->initServer()) {
		std::cerr << "-------------------------" << std::endl;
		std::cerr << "Server initialized." << std::endl;

#if QT_VERSION < 0x050000		
		qInstallMsgHandler(myMessageOutput);
#else
		qInstallMessageHandler(myMessageOutput);
#endif
		retval = app.exec();
		
		std::cerr << "Server quit." << std::endl;
		std::cerr << "-------------------------" << std::endl;
	}
	
	delete rng;
	delete settingsCache;
	
	logger->deleteLater();
	loggerThread->wait();
	delete loggerThread;

//.........这里部分代码省略.........
开发者ID:Grim-the-Reaper,项目名称:Cockatrice,代码行数:101,代码来源:main.cpp


示例9: Q_ARG

// Asynchronously load the new scene given by sceneName
void SceneManager::setScene( const char* sceneName )
{
    QMetaObject::invokeMethod(this, "onLoadNewScene", Qt::QueuedConnection, Q_ARG(QString, QString(sceneName)));
}
开发者ID:rkojcev,项目名称:OppositeRenderer,代码行数:5,代码来源:SceneManager.cpp


示例10: getParamInfo

void SocketController::getVlanSettings()
{
    if (!connectionLost)
    {
        vlanSubtab->setProperty("init", true);
        vlanTabId->setProperty("init", true);
        //QString vlanType =  "portBased";//"802.1q";//
        QString vlanType = getParamInfo("VlanType");

        if(vlanType == emptyString)
        {
            logOutSignal();
            return;
        }

        vlanTypeComboBox->setProperty("currentIndex",
                                      findIndexByValue(vlanTypeList, vlanTypeCount,
                                                       vlanType));

        if(vlanType != "noVlan")
        {
            //portCount = 8;
            QString portCountStr = getParamInfo("PortCount");

            if(portCountStr == emptyString)
            {
                logOutSignal();
                return;
            }

            portCount = portCountStr.toInt();

            QVariant retValue;
            QMetaObject::invokeMethod(vlanCurrentModel, "init",
                                      Q_RETURN_ARG(QVariant, retValue),
                                      Q_ARG(QVariant, portCount),
                                      Q_ARG(QVariant, vlanCount));

            portRepeater->setProperty("model", portCount);

            QMetaObject::invokeMethod(vlanCurrentModel, "deleteAllChecks",
                                      Q_RETURN_ARG(QVariant, retValue));

            VlanSettingsParser* parser = new VlanSettingsParser();


            QString portVlanData = getParamInfo("VlanSettings");
            // QString portVlanData = "1 1\n2 1\n3 1\n1 3\n4 2\n5 2\n6 2\n7 3\n8 3\n";//

            if(portVlanData == emptyString)
            {
                logOutSignal();
                return;
            }

            QList<QPair<int, int>> portVlanDataResult = parser->parsePortVlanData(portVlanData);

            for (int i = 0; i < portVlanDataResult.count(); i++)
            {
                QPair<int, int> portVlanPair = portVlanDataResult.at(i);
                QMetaObject::invokeMethod(vlanCurrentModel, "addPortVlanEnabled",
                                          Q_RETURN_ARG(QVariant, retValue),
                                          Q_ARG(QVariant, portVlanPair.first),
                                          Q_ARG(QVariant, portVlanPair.second));
            }

            //QString portPvidData = "1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7\n8 8\n"; //
            QString portPvidData = getParamInfo("PortsPvid");

            if(portPvidData == emptyString)
            {
                logOutSignal();
                return;
            }

            QMap<int, int> portPvidDataResult = parser->parsePortPvidData(portPvidData);

            for(int port = 1; port <= portCount; port++)
            {
                QMetaObject::invokeMethod(vlanCurrentModel, "setPortPvid",
                                          Q_RETURN_ARG(QVariant, retValue),
                                          Q_ARG(QVariant, port),
                                          Q_ARG(QVariant, portPvidDataResult[port]));
            }

            if (vlanType == "802.1q")
            {
                //QString portTaggingData = "1 On\n2 Off\n3 On\n4 On\n5 On\n6 On\n7 On\n8 On\n";//
                QString portTaggingData = getParamInfo("PortsTaggingStatus");

                if(portTaggingData == emptyString)
                {

                    logOutSignal();
                    return;
                }

                QMap<int, QString> portTaggingDataResult = parser->parsePortTaggingData(portTaggingData);

                for(int port = 1; port <= portCount; port++)
//.........这里部分代码省略.........
开发者ID:DaryaKolyadko,项目名称:RouterClient_QML,代码行数:101,代码来源:socketcontroller.cpp


示例11: qfLogFuncFrame

bool EventPlugin::createEvent(const QString &event_name, const QVariantMap &event_params)
{
	qfLogFuncFrame();
	closeEvent();

	qff::MainWindow *fwk = qff::MainWindow::frameWork();
	EventPlugin::ConnectionType connection_type = connectionType();
	QStringList existing_event_ids;
	if(connection_type == ConnectionType::SingleFile)
		existing_event_ids = existingFileEventNames();
	else
		existing_event_ids = existingSqlEventNames();
	QString event_id = event_name;
	QVariantMap new_params = event_params;
	do {
		qfd::Dialog dlg(fwk);
		dlg.setButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
		EventDialogWidget *event_w = new EventDialogWidget();
		event_w->setEventId(event_id);
		event_w->loadParams(new_params);
		dlg.setCentralWidget(event_w);
		if(!dlg.exec())
			return false;

		event_id = event_w->eventId();
		new_params = event_w->saveParams();
		if(event_id.isEmpty()) {
			qf::qmlwidgets::dialogs::MessageBox::showError(fwk, tr("Event ID cannot be empty."));
			continue;
		}
		if(existing_event_ids.contains(event_id)) {
			qf::qmlwidgets::dialogs::MessageBox::showError(fwk, tr("Event ID %1 exists already.").arg(event_id));
			continue;
		}
		break;
	} while(true);

	bool ok = false;
	Event::EventConfig event_config;
	//ConnectionSettings connection_settings;
	event_config.setValue("event", new_params);
	int stage_count = event_params.value("stageCount").toInt();
	if(stage_count == 0)
		stage_count = event_config.stageCount();
	qfInfo() << "createEvent, stage_count:" << stage_count;
	QF_ASSERT(stage_count > 0, "Stage count have to be greater than 0", return false);

	qfInfo() << "will create:" << event_id;
	qfs::Connection conn = qfs::Connection::forName();
	//QF_ASSERT(conn.isOpen(), "Connection is not open", return false);
	if(connection_type == ConnectionType::SingleFile) {
		QString event_fn = eventNameToFileName(event_id);
		conn.close();
		conn.setDatabaseName(event_fn);
		conn.open();
	}
	if(conn.isOpen()) {
		QVariantMap create_options;
		create_options["schemaName"] = event_id;
		create_options["driverName"] = conn.driverName();

		QVariant ret_val;
		QMetaObject::invokeMethod(this, "createDbSqlScript", Qt::DirectConnection,
								  Q_RETURN_ARG(QVariant, ret_val),
								  Q_ARG(QVariant, create_options));
		QStringList create_script = ret_val.toStringList();

		qfInfo().nospace() << create_script.join(";\n") << ';';
		qfs::Query q(conn);
		do {
			qfs::Transaction transaction(conn);
			ok = run_sql_script(q, create_script);
			if(!ok)
				break;
			qfDebug() << "creating stages:" << stage_count;
			QString stage_table_name = "stages";
			if(connection_type == ConnectionType::SqlServer)
				stage_table_name = event_id + '.' + stage_table_name;
			q.prepare("INSERT INTO " + stage_table_name + " (id) VALUES (:id)");
			for(int i=0; i<stage_count; i++) {
				q.bindValue(":id", i+1);
				ok = q.exec();
				if(!ok) {
					break;
				}
			}
			if(!ok)
				break;
			conn.setCurrentSchema(event_id);
			event_config.save();
			transaction.commit();
		} while(false);
		if(!ok) {
			qfd::MessageBox::showError(fwk, tr("Create Database Error: %1").arg(q.lastError().text()));
		}
	}
	else {
		qfd::MessageBox::showError(fwk, tr("Cannot create event, database is not open: %1").arg(conn.lastError().text()));
	}
	if(ok) {
//.........这里部分代码省略.........
开发者ID:mezkov,项目名称:quickbox,代码行数:101,代码来源:eventplugin.cpp


示例12: Q_ARG

void LogicManager::restartWithNewProfile(QString uid)
{
	QMetaObject::invokeMethod(this, "onRestartWithNewProfile",
							  Qt::QueuedConnection,
							  Q_ARG(QString, uid));
}
开发者ID:c0ns0le,项目名称:CustusX,代码行数:6,代码来源:cxLogicManager.cpp


示例13: switch

bool
SourceDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index )
{
    QMouseEvent* mEvent = 0;
    switch ( event->type() )
    {
//        case QEvent::MouseTrackingChange:
        case QEvent::MouseButtonDblClick:
        case QEvent::MouseButtonPress:
        case QEvent::MouseButtonRelease:
        case QEvent::MouseMove:
            mEvent = static_cast< QMouseEvent* >( event );
        default:
            break;
    }

    bool hoveringTrack = false;
    if ( m_trackRects.contains( index ) && mEvent )
    {
        const QRect trackRect = m_trackRects[ index ];
        hoveringTrack = trackRect.contains( mEvent->pos() );

        if ( hoveringTrack )
        {
            if ( m_trackHovered != index )
            {
                m_trackHovered = index;
                QMetaObject::invokeMethod( m_parent, "update", Qt::QueuedConnection, Q_ARG( QModelIndex, index ) );
            }
        }
    }
    if ( !hoveringTrack )
    {
        if ( m_trackHovered.isValid() )
            QMetaObject::invokeMethod( m_parent, "update", Qt::QueuedConnection, Q_ARG( QModelIndex, m_trackHovered ) );

        m_trackHovered = QPersistentModelIndex();
    }

    bool lockRectContainsClick = false, headphonesRectContainsClick = false;
    if ( m_headphoneRects.contains( index ) && mEvent )
    {
        const QRect headphoneRect = m_headphoneRects[ index ];
        headphonesRectContainsClick = headphoneRect.contains( mEvent->pos() );
    }
    if ( m_lockRects.contains( index ) && mEvent )
    {
        const QRect lockRect = m_lockRects[ index ];
        lockRectContainsClick = lockRect.contains( mEvent->pos() );
    }

    if ( event->type() == QEvent::MouseMove )
    {
        if ( hoveringTrack || lockRectContainsClick || headphonesRectContainsClick )
            m_parent->setCursor( Qt::PointingHandCursor );
        else
            m_parent->setCursor( Qt::ArrowCursor );
    }

    if ( event->type() == QEvent::MouseButtonRelease || event->type() == QEvent::MouseButtonPress )
    {
        SourcesModel::RowType type = static_cast< SourcesModel::RowType >( index.data( SourcesModel::SourceTreeItemTypeRole ).toInt() );
        if ( type == SourcesModel::TemporaryPage || type == SourcesModel::DeletablePage || type == SourcesModel::RemovablePage )
        {
            SourceTreeItem* gpi = index.data( SourcesModel::SourceTreeItemRole ).value< SourceTreeItem* >();
            Q_ASSERT( gpi );

            QStyleOptionViewItemV4 o = option;
            initStyleOption( &o, index );
            const int padding = m_margin / 8;
            const QRect r( o.rect.right() - padding - m_iconHeight, padding + o.rect.y(), m_iconHeight, m_iconHeight );

            if ( r.contains( mEvent->pos() ) )
            {
                if ( event->type() == QEvent::MouseButtonRelease && mEvent->button() == Qt::LeftButton )
                {
                    gpi->removeFromList();

                    // Send a new mouse event to the view, since if the mouse is now over another item's delete area we want it to show up
                    QMouseEvent* ev = new QMouseEvent( QEvent::MouseMove, m_parent->viewport()->mapFromGlobal( QCursor::pos() ), Qt::NoButton, Qt::NoButton, Qt::NoModifier );
                    QApplication::postEvent( m_parent->viewport(), ev );
                }

                return true;
            }
        }
        else if ( type == SourcesModel::Source )
        {
            SourceItem* colItem = qobject_cast< SourceItem* >( index.data( SourcesModel::SourceTreeItemRole ).value< SourceTreeItem* >() );
            Q_ASSERT( colItem );

            if ( hoveringTrack && colItem->source() && colItem->source()->currentTrack() )
            {
                if ( event->type() == QEvent::MouseButtonRelease && mEvent->button() == Qt::LeftButton )
                {
                    ViewManager::instance()->show( colItem->source()->currentTrack() );
                    return true;
                }
                else if ( event->type() == QEvent::MouseButtonPress && mEvent->button() == Qt::RightButton )
                {
//.........这里部分代码省略.........
开发者ID:AshotN,项目名称:tomahawk,代码行数:101,代码来源:SourceDelegate.cpp


示例14: Q_UNUSED

void QxtMDNSPrivate::avahiRecordBrowserCallback(AvahiRecordBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *name, uint16_t clazz, uint16_t type, const void *rdata, size_t size, AvahiLookupResultFlags flags, void *userdata)
{
	///@TODO Support IPv6
	Q_UNUSED(interface);
	Q_UNUSED(protocol);
	Q_UNUSED(name);
	Q_UNUSED(clazz);
	Q_UNUSED(type);
	Q_UNUSED(size);
	Q_UNUSED(flags);
	QxtMDNSPrivate* self = static_cast<QxtMDNSPrivate*>(userdata);
	self->recordbrowser = b;
// 	qDebug() << "Return thing" << md->name << name << size;
	switch (event)
	{
		case AVAHI_BROWSER_NEW:
		{
			//Found an entry!
			uint32_t ip = qFromBigEndian(*static_cast<const uint32_t*>(rdata));
			if (self->sent)
			{
				QHostInfo info(self->info.lookupId());
				info.setAddresses(QList<QHostAddress>() << QHostAddress(ip));
				QMetaObject::invokeMethod(self->receiver, self->member, Q_ARG(QHostInfo, info));
			}
			else
			{
				self->addresses << QHostAddress(ip);
			}
			break;
		}
		case AVAHI_BROWSER_REMOVE:
		{
			uint32_t ip = qFromBigEndian(*static_cast<const uint32_t*>(rdata));
			self->addresses.removeAll(QHostAddress(ip));
			break;
		}
		case AVAHI_BROWSER_CACHE_EXHAUSTED:
			break;
		case AVAHI_BROWSER_ALL_FOR_NOW:
			if (self->addresses.count() == 0)
			{
				self->info.setError(QHostInfo::HostNotFound);
				self->info.setErrorString("The host was not found.");
			}
			else
			{
				self->info.setAddresses(self->addresses);
				self->addresses.clear();
			}
			QMetaObject::invokeMethod(self->receiver, self->member, Q_ARG(QHostInfo, self->info));
			self->sent = true;
			break;
		case AVAHI_BROWSER_FAILURE:

			if (self->sent)
			{
				QHostInfo info(self->info.lookupId());
				info.setError(QHostInfo::UnknownError);
				info.setErrorString(avahi_strerror(avahi_client_errno(self->client)));
				info.setAddresses(self->addresses);
				QMetaObject::invokeMethod(self->receiver, self->member, Q_ARG(QHostInfo, info));
			}
			else
			{
				self->info.setError(QHostInfo::UnknownError);
				self->info.setErrorString(avahi_strerror(avahi_client_errno(self->client)));
				self->info.setAddresses(self->addresses);
				self->addresses.clear();
				QMetaObject::invokeMethod(self->receiver, self->member, Q_ARG(QHostInfo, self->info));
				self->sent = true;
			}
			break;
	}
}
开发者ID:develnk,项目名称:qxtweb-qt5,代码行数:75,代码来源:qxtmdns_avahi.cpp


示例15: Q_ARG

void PresentationDisplayTask::showHidePanel(bool show)
{
    QVariant showHide = QVariant::fromValue(show);

    QMetaObject::invokeMethod(m_panel, "showHidePresentation", Q_ARG(QVariant, showHide));
}
开发者ID:abom,项目名称:watchntouch,代码行数:6,代码来源:presentationdisplaytask.cpp


示例16: Q_RETURN_ARG

void Game::placeTokenSlot(QVariant r, QVariant c, QVariant crd){
    int row = r.toInt();
    int col = c.toInt();
    int card = crd.toInt();
    Player* currentPlayer =  players[currentTurn];
    if(currentPlayer->hasCard(card) && !board.occupied(row, col)){
        QVariant returnVal;
        QVariant arg = "has card";
        QMetaObject::invokeMethod(qmlRoot, "placeToken", Q_RETURN_ARG(QVariant, returnVal), Q_ARG(QVariant, row), Q_ARG(QVariant, col));
        currentPlayer->performTurn(row, col, card);
        board.setToken(row, col, currentPlayer->team);
        currentTurn++;
    }
}
开发者ID:aaronjohnleonard,项目名称:sequence,代码行数:14,代码来源:game.cpp


示例17: unsubscribeFromCoreSignals

SplashScreen::~SplashScreen()
{
    unsubscribeFromCoreSignals();
}

void SplashScreen::slotFinish(QWidget *mainWin)
{
    Q_UNUSED(mainWin);
    hide();
}

static void InitMessage(SplashScreen *splash, const std::string &message)
{
    QMetaObject::invokeMethod(splash, "showMessage",
        Qt::QueuedConnection,
        Q_ARG(QString, QString::fromStdString(message)),
        Q_ARG(int, Qt::AlignBottom|Qt::AlignHCenter),
        Q_ARG(QColor, QColor(55,55,55)));
}

static void ShowProgress(SplashScreen *splash, const std::string &title, int nProgress)
{
    InitMessage(splash, title + strprintf("%d", nProgress) + "%");
}

#ifdef ENABLE_WALLET
static void ConnectWallet(SplashScreen *splash, CWallet* wallet)
{
    wallet->ShowProgress.connect(boost::bind(ShowProgress, splash, _1, _2));
}
#endif
开发者ID:coinclone,项目名称:viacoin,代码行数:31,代码来源:splashscreen.cpp


示例18: Q_ARG

void ExperimentManager_Dialog::LogMessage(QString sMessage)
{
	QMetaObject::invokeMethod(MainAppInfo::getMainWindow(), MainAppInfo::getMainWindowLogSlotName().toLatin1(), Qt::DirectConnection, Q_ARG(QString, sMessage));
}
开发者ID:nemesissnake,项目名称:StimulGL,代码行数:4,代码来源:ExperimentManager_dialog.cpp


示例19: ASSERT

void CWebAPI::OnRequestCompleted()
{
	CHttpSocket* pRequest = (CHttpSocket*)sender();
	ASSERT(pRequest->GetState() == CHttpSocket::eHandling);
	QString Path = pRequest->GetPath();
	TArguments Cookies = GetArguments(pRequest->GetHeader("Cookie"));
	TArguments Arguments = GetArguments(pRequest->GetQuery().mid(1),'&');

	switch(pRequest->GetType())
	{
		case CHttpSocket::eDELETE:
			pRequest->RespondWithError(501);
		case CHttpSocket::eHEAD:
		case CHttpSocket::eOPTIONS:
			pRequest->SendResponse();
			return;
	}

	if(Path.compare("/WebAPI/") == 0)
		pRequest->RespondWithError(403);

	else if(Path.left(14).compare("/WebAPI/Icons/") == 0)
	{
		int Size;
		if(Arguments["Size"] == "Small")
			Size = 16;
		else // if(Arguments["Size"] == "Large")
			Size = 32;
		QString Ext = Split2(Path.mid(14), ".").first;
		QString IconPath = theCore->Cfg()->GetSettingsDir() + "/Cache/Icons/" + Ext + QString::number(Size) + ".png";
		if(!QFile::exists(IconPath))
		{
			if(theLoader)
				QMetaObject::invokeMethod(theLoader, "CreateFileIcon", Qt::BlockingQueuedConnection, Q_ARG(QString, Ext));
			else
				IconPath = ":/Icon" + QString::number(Size) + ".png";
		}
		pRequest->SetCaching(HR2S(48));
		pRequest->RespondWithFile(IconPath);
	}
	else if(Path.left(11).compare("/WebAPI/FS/") == 0)
	{
		StrPair CmdExt = Split2(Path.mid(11),".");

		QVariantMap Result;

		if(CmdExt.first.compare("dir", Qt::CaseInsensitive) == 0)
		{
			QVariantList Entrys;
			QString DirPath = Arguments["Path"];
			QDir Dir(DirPath);
			foreach (const QString& Name, Dir.entryList())
			{
				if (Name.compare(".") == 0 || Name.compare("..") == 0)
					continue;

				QVariantMap Entry;
				QFileInfo Info(DirPath + "/" + Name);
				Entry["Name"] = Info.fileName();
				Entry["Created"] = Info.created();
				Entry["Modifyed"] = Info.lastModified();
				if (Info.isDir())
					Entry["Size"] = "dir";
				else
					Entry["Size"] = Info.size();
				Entrys.append(Entry);
			}
			Result["List"] = Entrys;
		}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:69,代码来源:WebAPI.cpp


示例20: main

int main(int argc, char *argv[])
{
    QOptions options(get_common_options());
    options.add("QMLPlayer options")
            ("scale", 1.0, "scale of graphics context. 0: auto")
            ;
    options.parse(argc, argv);
    if (options.value("help").toBool()) {
        options.print();
        return 0;
    }

    QGuiApplication app(argc, argv);
    set_opengl_backend(options.option("gl").value().toString(), app.arguments().first());
    load_qm(QStringList() << "QMLPlayer", options.value("language").toString());
    QtQuick2ApplicationViewer viewer;
    viewer.engine()->rootContext()->setContextProperty("PlayerConfig", &Config::instance());
    qDebug(">>>>>>>>devicePixelRatio: %f", qApp->devicePixelRatio());
    QScreen *sc = app.primaryScreen();
    qDebug() << "dpi phy: " << sc->physicalDotsPerInch() << ", logical: " << sc->logicalDotsPerInch() << ", dpr: " << sc->devicePixelRatio()
                << "; vis rect:" << sc->virtualGeometry();
    // define a global var for js and qml
    viewer.engine()->rootContext()->setContextProperty("screenPixelDensity", qApp->primaryScreen()->physicalDotsPerInch()*qApp->primaryScreen()->devicePixelRatio());
    qreal r = sc->physicalDotsPerInch()/sc->logicalDotsPerInch();
    if (std::isinf(r) || std::isnan(r))
#if defined(Q_OS_ANDROID)
        r = 2.0;
#else
        r = 1.0;
#endif
    float sr = options.value("scale").toFloat();
    if (qFuzzyIsNull(sr))
        sr = r;
    viewer.engine()->rootContext()->setContextProperty("scaleRatio", sr);
    QString qml = "qml/QMLPlayer/main.qml";
    if (QFile(qApp->applicationDirPath() + "/" + qml).exists())
        qml.prepend(qApp->applicationDirPath() + "/");
    else
        qml.prepend("qrc:///");
    viewer.setMainQmlFile(qml);
    viewer.showExpanded();
    QOption op = options.option("width");
    if (op.isSet())
        viewer.setWidth(op.value().toInt());
    op = options.option("height");
    if (op.isSet())
        viewer.setHeight(op.value().toInt());
    op = options.option("x");
    if (op.isSet())
        viewer.setX(op.value().toInt());
    op = options.option("y");
    if (op.isSet())
        viewer.setY(op.value().toInt());
    if (options.value("fullscreen").toBool())
        viewer.showFullScreen();

    viewer.setTitle("QMLPlayer based on QtAV. [email protected]");
    /*
     * find root item, then root.init(argv). so we can deal with argv in qml
     */
#if 1
    QString json = app.arguments().join("\",\"");
    json.prepend("[\"").append("\"]");
    json.replace("\\", "/"); //FIXME
    QMetaObject::invokeMethod(viewer.rootObject(), "init", Q_ARG(QVariant, json));
//#else
    if (app.arguments().size() > 1) {
        qDebug("arguments > 1");
        QObject *player = viewer.rootObject()->findChild<QObject*>("player");
        QString file = options.value("file").toString();
        if (file.isEmpty()) {
            if (argc > 1 && !app.arguments().last().startsWith('-') && !app.arguments().at(argc-2).startsWith('-'))
                file = app.arguments().last();
        }
        if (player && !file.isEmpty()) {
            if (QFile(file).exists())
                file.prepend("file:"); //qml use url and will add qrc: if no scheme
            file.replace("\\", "/"); //qurl
            QMetaObject::invokeMethod(player, "play", Q_ARG(QUrl, QUrl(file)));
        }
    }
#endif
    QObject::connect(viewer.rootObject(), SIGNAL(requestFullScreen()), &viewer, SLOT(showFullScreen()));
    QObject::connect(viewer.rootObject(), SIGNAL(requestNormalSize()), &viewer, SLOT(showNormal()));
    ScreenSaver::instance().disable(); //restore in dtor
    return app.exec();
}
开发者ID:jun-zhang,项目名称:QtAV,代码行数:87,代码来源:main.cpp



注:本文中的Q_ARG函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Q_ASSERT函数代码示例发布时间:2022-05-30
下一篇:
C++ Q_ACTION_CAST函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap