void LightsListWidget::activated(){ QListWidgetItem *currentSelection = currentItem(); Light* currentLight = lightsMap[currentSelection]; switch (currentLightTypeSelection){ case AMBIENT: emit sendR((currentLight->ambientR)*100); emit sendG((currentLight->ambientG)*100); emit sendB((currentLight->ambientB)*100); break; case DIFFUSE: emit sendR((currentLight->diffuseR)*100); emit sendG((currentLight->diffuseG)*100); emit sendB((currentLight->diffuseB)*100); break; case SPECULAR: emit sendR((currentLight->specularR)*100); emit sendG((currentLight->specularG)*100); emit sendB((currentLight->specularB)*100); break; } //also display the current position emit sendX(currentLight->lightPositionX); emit sendY(currentLight->lightPositionY); emit sendZ(currentLight->lightPositionZ); //display the current shine }
int VertexTreeWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QTreeWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: redraw(); break; case 1: updateMesh(); break; case 2: addEdgeBetweenFaces((*reinterpret_cast< Vertex*(*)>(_a[1]))); break; case 3: sendX((*reinterpret_cast< double(*)>(_a[1]))); break; case 4: sendY((*reinterpret_cast< double(*)>(_a[1]))); break; case 5: sendZ((*reinterpret_cast< double(*)>(_a[1]))); break; case 6: enableXYZ((*reinterpret_cast< bool(*)>(_a[1]))); break; case 7: enableRGB((*reinterpret_cast< bool(*)>(_a[1]))); break; case 8: sendVertex((*reinterpret_cast< Vertex*(*)>(_a[1]))); break; case 9: acceptMesh((*reinterpret_cast< Mesh*(*)>(_a[1]))); break; case 10: setX((*reinterpret_cast< double(*)>(_a[1]))); break; case 11: setY((*reinterpret_cast< double(*)>(_a[1]))); break; case 12: setZ((*reinterpret_cast< double(*)>(_a[1]))); break; case 13: deleteVertex(); break; case 14: addVertexToEdge(); break; case 15: addEdgeBetweenFaces(); break; case 16: activated(); break; default: ; } _id -= 17; } return _id; }
//! [0] S2Controller::S2Controller(QWidget *parent): QWidget(parent), networkSession(0) { hostLabel = new QLabel(tr("&Server name:")); portLabel = new QLabel(tr("S&erver port:")); cmdLabel = new QLabel(tr("Command:")); QString ipAddress; ipAddress = QHostAddress(QHostAddress::LocalHost).toString(); int portnumber= 1236; hostLineEdit = new QLineEdit("10.128.48.53"); portLineEdit = new QLineEdit("1236"); portLineEdit->setValidator(new QIntValidator(1, 65535, this)); cmdLineEdit = new QLineEdit; hostLabel->setBuddy(hostLineEdit); portLabel->setBuddy(portLineEdit); statusLabel = new QLabel(tr(" - - - ")); sendCommandButton = new QPushButton(tr("Send Command")); sendCommandButton->setDefault(true); sendCommandButton->setEnabled(true); connectButton = new QPushButton(tr("connect to PrairieView")); connectButton->setEnabled(true); quitButton = new QPushButton(tr("Quit")); getReplyButton = new QPushButton(tr("get reply")); buttonBox = new QGroupBox; QVBoxLayout *vb = new QVBoxLayout; vb->addWidget(sendCommandButton); vb->addWidget(quitButton); vb->addWidget(connectButton); vb->addWidget(getReplyButton); buttonBox->setLayout(vb); tcpSocket = new QTcpSocket(this); connect(hostLineEdit, SIGNAL(textChanged(QString)), this, SLOT(enablesendCommandButton())); connect(portLineEdit, SIGNAL(textChanged(QString)), this, SLOT(enablesendCommandButton())); connect(sendCommandButton, SIGNAL(clicked()), this, SLOT(sendCommand())); connect(connectButton, SIGNAL(clicked()), this, SLOT(initializeS2())); connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(checkForMessage())); connect(this, SIGNAL(messageIsComplete()), this, SLOT(processMessage())); connect(this, SIGNAL(newMessage(QString)), this, SLOT(messageHandler(QString))); connect(this, SIGNAL(newMessage(QString)), this, SLOT(posMonListener(QString))); connect(quitButton, SIGNAL(clicked()), this, SLOT(sendX())); connect(tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(displayError(QAbstractSocket::SocketError))); QGridLayout *mainLayout = new QGridLayout; mainLayout->addWidget(hostLabel, 0, 0); mainLayout->addWidget(hostLineEdit, 0, 1); mainLayout->addWidget(portLabel, 1, 0); mainLayout->addWidget(portLineEdit, 1, 1); mainLayout->addWidget(cmdLabel, 2,0); mainLayout->addWidget(cmdLineEdit,2,1); mainLayout->addWidget(statusLabel, 3, 0, 1, 2); mainLayout->addWidget(buttonBox, 4, 0, 1, 2); setLayout(mainLayout); setWindowTitle(tr("smartScope2 Controller")); portLineEdit->setFocus(); QNetworkConfigurationManager manager; if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) { // Get saved network configuration QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); settings.beginGroup(QLatin1String("QtNetwork")); const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString(); settings.endGroup(); // If the saved network configuration is not currently discovered use the system default QNetworkConfiguration config = manager.configurationFromIdentifier(id); if ((config.state() & QNetworkConfiguration::Discovered) != QNetworkConfiguration::Discovered) { config = manager.defaultConfiguration(); } networkSession = new QNetworkSession(config, this); connect(networkSession, SIGNAL(opened()), this, SLOT(sessionOpened())); sendCommandButton->setEnabled(false); statusLabel->setText(tr("Opening network session.")); networkSession->open(); } //enablesendCommandButton(); //! [5] ii =-1; okToSend= true; cancelPosMon = false; inPosMonMode = false; }