void ShellWindow::setRole(const Role &role) { if (m_role == role) return; m_role = role; Q_EMIT roleChanged(); }
void KItemListGroupHeader::setRole(const QByteArray& role) { if (m_role != role) { const QByteArray previous = m_role; m_role = role; update(); roleChanged(role, previous); } }
/*! Sets the \a role. */ void CcfQmlBaseSoldier::setRole(const QString &role) { bool wasChaged = false; if (role != mRole) wasChaged = true; mRole = role; if (wasChaged) emit roleChanged(); }
QDeclarativeContactRelationshipModel::QDeclarativeContactRelationshipModel(QObject *parent) :QAbstractListModel(parent), d(new QDeclarativeContactRelationshipModelPrivate) { QHash<int, QByteArray> roleNames; roleNames = QAbstractItemModel::roleNames(); roleNames.insert(RelationshipRole, "relationship"); setRoleNames(roleNames); connect(this, SIGNAL(managerChanged()), SLOT(fetchAgain())); connect(this, SIGNAL(participantIdChanged()), SLOT(fetchAgain())); connect(this, SIGNAL(relationshipTypeChanged()), SLOT(fetchAgain())); connect(this, SIGNAL(roleChanged()), SLOT(fetchAgain())); }
void PingPong::startServer() { setMessage(QStringLiteral("Starting the server")); //! [Starting the server] m_serverInfo = new QBluetoothServer(QBluetoothServiceInfo::RfcommProtocol, this); connect(m_serverInfo, SIGNAL(newConnection()), this, SLOT(clientConnected())); connect(m_serverInfo, SIGNAL(error(QBluetoothServer::Error)), this, SLOT(serverError(QBluetoothServer::Error))); const QBluetoothUuid uuid(serviceUuid); m_serverInfo->listen(uuid, QStringLiteral("PingPong server")); //! [Starting the server] setMessage(QStringLiteral("Server started, waiting for the client. You are the left player.")); // m_role is set to 1 if it is a server m_role = 1; Q_EMIT roleChanged(); }
void PingPong::startClient() { //! [Searching for the service] discoveryAgent = new QBluetoothServiceDiscoveryAgent(QBluetoothAddress()); connect(discoveryAgent, SIGNAL(serviceDiscovered(QBluetoothServiceInfo)), this, SLOT(addService(QBluetoothServiceInfo))); connect(discoveryAgent, SIGNAL(finished()), this, SLOT(done())); connect(discoveryAgent, SIGNAL(error(QBluetoothServiceDiscoveryAgent::Error)), this, SLOT(serviceScanError(QBluetoothServiceDiscoveryAgent::Error))); discoveryAgent->setUuidFilter(QBluetoothUuid(serviceUuid)); discoveryAgent->start(QBluetoothServiceDiscoveryAgent::FullDiscovery); //! [Searching for the service] setMessage(QStringLiteral("Starting server discovery. You are the right player")); // m_role is set to 2 if it is a client m_role = 2; Q_EMIT roleChanged(); }