这篇教程C++ stateChanged函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中stateChanged函数的典型用法代码示例。如果您正苦于以下问题:C++ stateChanged函数的具体用法?C++ stateChanged怎么用?C++ stateChanged使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了stateChanged函数的21个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: startQT_BEGIN_NAMESPACE/*! /class QAudioOutput /brief The QAudioOutput class provides an interface for sending audio data to an audio output device. /inmodule QtMultimedia /ingroup multimedia /since 4.6 You can construct an audio output with the system's /l{QAudioDeviceInfo::defaultOutputDevice()}{default audio output device}. It is also possible to create QAudioOutput with a specific QAudioDeviceInfo. When you create the audio output, you should also send in the QAudioFormat to be used for the playback (see the QAudioFormat class description for details). To play a file: Starting to play an audio stream is simply a matter of calling start() with a QIODevice. QAudioOutput will then fetch the data it needs from the io device. So playing back an audio file is as simple as: /snippet doc/src/snippets/audio/main.cpp 9 /dots 4 /snippet doc/src/snippets/audio/main.cpp 4 The file will start playing assuming that the audio system and output device support it. If you run out of luck, check what's up with the error() function. After the file has finished playing, we need to stop the device: /snippet doc/src/snippets/audio/main.cpp 5 At any given time, the QAudioOutput will be in one of four states: active, suspended, stopped, or idle. These states are described by the QAudio::State enum. State changes are reported through the stateChanged() signal. You can use this signal to, for instance, update the GUI of the application; the mundane example here being changing the state of a /c { play/pause } button. You request a state change directly with suspend(), stop(), reset(), resume(), and start(). While the stream is playing, you can set a notify interval in milliseconds with setNotifyInterval(). This interval specifies the time between two emissions of the notify() signal. This is relative to the position in the stream, i.e., if the QAudioOutput is in the SuspendedState or the IdleState, the notify() signal is not emitted. A typical use-case would be to update a /l{QSlider}{slider} that allows seeking in the stream. If you want the time since playback started regardless of which states the audio output has been in, elapsedUSecs() is the function for you. If an error occurs, you can fetch the /l{QAudio::Error}{error type} with the error() function. Please see the QAudio::Error enum for a description of the possible errors that are reported. When an error is encountered, the state changes to QAudio::StoppedState. You can check for errors by connecting to the stateChanged() signal: /snippet doc/src/snippets/audio/main.cpp 8 /sa QAudioInput, QAudioDeviceInfo*//*! Construct a new audio output and attach it to /a parent. The default audio output device is used with the output /a format parameters.*/QAudioOutput::QAudioOutput(const QAudioFormat &format, QObject *parent): QObject(parent){ d = QAudioDeviceFactory::createDefaultOutputDevice(format); connect(d, SIGNAL(notify()), SIGNAL(notify())); connect(d, SIGNAL(stateChanged(QAudio::State)), SIGNAL(stateChanged(QAudio::State)));}
开发者ID:llxwj,项目名称:r7oss,代码行数:80,
示例2: stateChangedvoid ToggleButton::setState(bool _state){ state = _state; emit stateChanged(); update();}
开发者ID:BeardAnnihilator,项目名称:Cockatrice,代码行数:6,
示例3: bytesFreebool QAudioOutputPrivate::deviceReady(){ if(pullMode) { int l = 0; int chunks = bytesAvailable/period_size; if(chunks==0) { bytesAvailable = bytesFree(); return false; }#ifdef DEBUG_AUDIO qDebug()<<"deviceReady() avail="<<bytesAvailable<<" bytes, period size="<<period_size<<" bytes"; qDebug()<<"deviceReady() no. of chunks that can fit ="<<chunks<<", chunks in bytes ="<<period_size*chunks;#endif int input = period_frames*chunks; if(input > (int)buffer_frames) input = buffer_frames; l = audioSource->read(audioBuffer,snd_pcm_frames_to_bytes(handle, input)); if(l > 0) { // Got some data to output if(deviceState != QAudio::ActiveState) return true; qint64 bytesWritten = write(audioBuffer,l); if (bytesWritten != l) audioSource->seek(audioSource->pos()-(l-bytesWritten)); bytesAvailable = bytesFree(); } else if(l == 0) { // Did not get any data to output bytesAvailable = bytesFree(); if(bytesAvailable > snd_pcm_frames_to_bytes(handle, buffer_frames-period_frames)) { // Underrun if (deviceState != QAudio::IdleState) { errorState = QAudio::UnderrunError; deviceState = QAudio::IdleState; emit stateChanged(deviceState); } } } else if(l < 0) { close(); deviceState = QAudio::StoppedState; errorState = QAudio::IOError; emit stateChanged(deviceState); } } else { bytesAvailable = bytesFree(); if(bytesAvailable > snd_pcm_frames_to_bytes(handle, buffer_frames-period_frames)) { // Underrun if (deviceState != QAudio::IdleState) { errorState = QAudio::UnderrunError; deviceState = QAudio::IdleState; emit stateChanged(deviceState); } } } if(deviceState != QAudio::ActiveState) return true; if(intervalTime && (timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) { emit notify(); elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime; timeStamp.restart(); } return true;}
开发者ID:Marforius,项目名称:qt,代码行数:66,
示例4: disconnectvoid QtScrollerFilter::remove(QObject *target){ disconnect(QtScroller::scroller(target), SIGNAL(stateChanged(QtScroller::State)), this, SLOT(stateChanged(QtScroller::State))); target->removeEventFilter(this);}
开发者ID:nhinze,项目名称:rhodes,代码行数:6,
示例5: QWidgetFindDocWidget::FindDocWidget(LiteApi::IApplication *app, QWidget *parent) : QWidget(parent), m_liteApp(app){ m_findEdit = new SearchEdit; m_findEdit->setPlaceholderText(tr("Search")); m_chaseWidget = new ChaseWidget; m_chaseWidget->setMinimumSize(QSize(16,16)); m_chaseWidget->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); QToolButton *findBtn = new QToolButton; findBtn->setPopupMode(QToolButton::InstantPopup); findBtn->setText(tr("Find")); QHBoxLayout *findLayout = new QHBoxLayout; findLayout->setMargin(2); findLayout->addWidget(m_findEdit); findLayout->addWidget(findBtn); findLayout->addWidget(m_chaseWidget); m_browser = m_liteApp->htmlWidgetManager()->createByName(this,"QTextBrowser"); QStringList paths; paths << m_liteApp->resourcePath()+"/packages/go/godoc"; m_browser->setSearchPaths(paths); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->setMargin(1); mainLayout->setSpacing(1); mainLayout->addLayout(findLayout); mainLayout->addWidget(m_browser->widget()); QAction *findAll = new QAction(tr("Find All"),this); QAction *findConst = new QAction(tr("Find const"),this); findConst->setData("const"); QAction *findFunc = new QAction(tr("Find func"),this); findFunc->setData("func"); QAction *findInterface = new QAction(tr("Find interface"),this); findInterface->setData("interface"); QAction *findPkg = new QAction(tr("Find pkg"),this); findPkg->setData("pkg"); QAction *findStruct = new QAction(tr("Find struct"),this); findStruct->setData("struct"); QAction *findType = new QAction(tr("Find type"),this); findType->setData("type"); QAction *findVar = new QAction(tr("Find var"),this); findVar->setData("var"); m_useRegexpCheckAct = new QAction(tr("Use Regexp"),this); m_useRegexpCheckAct->setCheckable(true); m_matchCaseCheckAct = new QAction(tr("Match Case"),this); m_matchCaseCheckAct->setCheckable(true); m_matchWordCheckAct = new QAction(tr("Match Word"),this); m_matchWordCheckAct->setCheckable(true); m_useRegexpCheckAct->setChecked(m_liteApp->settings()->value(GODOCFIND_USEREGEXP,false).toBool()); m_matchCaseCheckAct->setChecked(m_liteApp->settings()->value(GODOCFIND_MATCHCASE,true).toBool()); m_matchWordCheckAct->setChecked(m_liteApp->settings()->value(GODOCFIND_MATCHWORD,false).toBool()); QMenu *menu = new QMenu(findBtn); menu->addActions(QList<QAction*>() << findAll //<< findPkg ); menu->addSeparator(); menu->addActions(QList<QAction*>() << findInterface << findStruct << findType << findFunc << findConst << findVar ); menu->addSeparator(); menu->addAction(m_matchWordCheckAct); menu->addAction(m_matchCaseCheckAct); menu->addAction(m_useRegexpCheckAct); findBtn->setMenu(menu); QAction *helpAct = new QAction(tr("Help"),this); menu->addSeparator(); menu->addAction(helpAct); connect(helpAct,SIGNAL(triggered()),this,SLOT(showHelp())); this->setLayout(mainLayout); connect(findAll,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findConst,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findFunc,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findInterface,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findPkg,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findStruct,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findType,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findVar,SIGNAL(triggered()),this,SLOT(findDoc())); m_process = new ProcessEx(this); connect(m_process,SIGNAL(stateChanged(QProcess::ProcessState)),this,SLOT(stateChanged(QProcess::ProcessState))); connect(m_process,SIGNAL(extOutput(QByteArray,bool)),this,SLOT(extOutput(QByteArray,bool))); connect(m_process,SIGNAL(extFinish(bool,int,QString)),this,SLOT(extFinish(bool,int,QString))); connect(m_findEdit,SIGNAL(returnPressed()),findAll,SIGNAL(triggered())); connect(m_findEdit,SIGNAL(rightButtonClicked()),this,SLOT(abortFind()));//.........这里部分代码省略.........
开发者ID:visualfc,项目名称:liteide,代码行数:101,
示例6: audioFile// for playing a valid audio file given by the slot// if this function is called by a slot for the first time, audio will be played// if a slot called this function twice in sequence, the currently played// audio will be stoppedvoid Player::play(Slot *givenSlot) { QString filepath = givenSlot->getPath(); QFile audioFile(filepath); // in order to stop playback for the audio file given by the // same slot after calling this function in sequence DURING playback if(givenSlot == lastSlot) stop(); else { stop(); lastSlot = givenSlot; // some basic checks: // 1. check audio file (*.wav ending AND subsistence) if(!filepath.endsWith(".wav", Qt::CaseInsensitive)) { // if the given file is not valid, you don't have to call this // function twice in order to play a (new set) valid file if(lastSlot != NULL) lastSlot = NULL; throw QString("The given audio file is no *.wav!"); } if(!audioFile.exists()) throw QString("The given audio file does not exist!"); // 2. check if format is supported by the audio device if(!device.isFormatSupported(format)) throw QString("Raw audio format not supported by back-end, cannot play audio."); // if audio is currently playing - stop it stop(); // prepare audio playback player = new QAudioOutput(device, format); player->setNotifyInterval(500); connect(player, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State))); //connect(player, SIGNAL(notify()), this, SLOT(displayCurrentDuration())); // read audio data if(audioFile.open(QIODevice::ReadOnly)) { // read out wav info // ######### IMPLEMENTATION ######### audioFile.seek(44); // skip wav header audioData = audioFile.readAll(); audioFile.close(); audioBuffer.setBuffer(&audioData); audioBuffer.open(QIODevice::ReadOnly); // prepare/open buffer for playback lastSlot->setStatus(SlotStatus::PLAYING); // start playback thread player->start(&audioBuffer); qDebug() << ">> Audio has been started."; } }}
开发者ID:neuronalbit,项目名称:the-soundwall,代码行数:67,
示例7: stateChanged// qtopiamedia signal handlingvoid MediaObject::mediaError(QString const& errorString){ d->errorString = errorString; emit stateChanged(Phonon::ErrorState, qtopiaStateToPhononState(d->state));}
开发者ID:Camelek,项目名称:qtmoko,代码行数:7,
示例8: stateChangedvoid Server::setStarting() { this->state = this->STARTING; this->setIcon(QIcon(":/images/start.png")); emit stateChanged(this->state);}
开发者ID:RusselSarker,项目名称:vladiconnect,代码行数:5,
示例9: stateChangedvoid MainWindow::welcomeScreen(){ stateChanged("playing", KXMLGUIClient::StateReverse);}
开发者ID:jsj2008,项目名称:kdegames,代码行数:4,
示例10: incomingCallvoid DialerControl::callStateChanged( const QPhoneCall& call ){ // Set value space appropriately // XXX Optimize for redundancy! if(hasIncomingCall()) { QPhoneCall icall = incomingCall(); QString number = icall.number(); QString name; QUniqueId contact = icall.contact(); QContactModel *m = ServerContactModel::instance(); if(!contact.isNull()) { QContact cnt = m->contact(contact); if (!cnt.uid().isNull()) name = cnt.label(); } else if(!number.isEmpty()) { QContact cnt = m->matchPhoneNumber(number); if (!cnt.uid().isNull()) name = cnt.label(); } else { number = tr("Unknown", "Unknown caller"); } phoneValueSpace.setAttribute("Incoming/Number", QVariant(number.trimmed())); phoneValueSpace.setAttribute("Incoming/Name", QVariant(name)); if(!aaTid && mProfiles->activeProfile().autoAnswer()) aaTid = startTimer(auto_answer_gap); } else { if(aaTid) killTimer(aaTid); phoneValueSpace.removeAttribute("Incoming"); } // emit useful signals if( call.state() == QPhoneCall::Connected ) { emit callConnected( call ); // update cached call info. updateCachedCall( call ); } else if( call.state() == QPhoneCall::Hold ) { emit callPutOnHold( call ); } else if( call.dialing() ) { emit callDialing( call ); } else if( call.incoming() ) { // Turn off screen saver so the incoming call will be visible. QtopiaPowerManager::setActive(false); emit callIncoming( call ); } else if ( call.dropped() ) { emit callDropped( call ); } doActiveCalls(); // Disable screen saver if in a call if (hasIncomingCall() || hasActiveCalls() || hasCallsOnHold()) QtopiaApplication::setPowerConstraint(QtopiaApplication::DisableLightOff); else QtopiaApplication::setPowerConstraint(QtopiaApplication::Enable); emit stateChanged();}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:68,
示例11: _QWidgetSecLabels::SecLabels(QWidget *parent) : _QWidget(parent){ useSecLabel = new QCheckBox("Use Security Label", this); typeLabel = new QLabel("Type:", this); type = new QComboBox(this); type->addItems(QStringList()<<"None"<<"Dynamic"<<"Static"); typeLayout = new QHBoxLayout(this); typeLayout->addWidget(typeLabel); typeLayout->addWidget(type); typeWdg = new QWidget(this); typeWdg->setLayout(typeLayout); modelLabel = new QLabel("Model:", this); model = new QComboBox(this); model->addItems(QStringList()<<"SELinux"<<"AppArmor"<<"DAC"); labelTypeLabel = new QComboBox(this); labelTypeLabel->addItems(QStringList()<<"Label"<<"BaseLabel"<<"ImageLabel"); label = new QLineEdit(this); relabelLabel = new QLabel("Relabel:", this); relabel = new QComboBox(this); relabel->addItems(QStringList()<<"Default"<<"Yes"<<"No"); baseLayout = new QGridLayout(); baseLayout->addWidget(modelLabel, 0, 0); baseLayout->addWidget(model, 0, 1); baseLayout->addWidget(labelTypeLabel, 1, 0); baseLayout->addWidget(label, 1, 1); baseLayout->addWidget(relabelLabel, 2, 0); baseLayout->addWidget(relabel, 2, 1); baseWdg = new QWidget(this); baseWdg->setLayout(baseLayout); baseWdg->setVisible(false); add = new QPushButton(QIcon::fromTheme("list-add"), "", this); del = new QPushButton(QIcon::fromTheme("list-remove"), "", this); list = new QListWidget(this); listLayout = new QGridLayout(); listLayout->addWidget(add, 0, 0); listLayout->addWidget(del, 0, 3); listLayout->addWidget(list, 1, 0, 2, 4); listWdg = new QWidget(this); listWdg->setLayout(listLayout); usedStateChanged(false); commonLayout = new QVBoxLayout(this); commonLayout->addWidget(useSecLabel); commonLayout->addWidget(typeWdg); commonLayout->addWidget(baseWdg); commonLayout->addWidget(listWdg); commonLayout->addStretch(-1); setLayout(commonLayout); connect(useSecLabel, SIGNAL(toggled(bool)), this, SLOT(usedStateChanged(bool))); connect(type, SIGNAL(currentIndexChanged(QString)), this, SLOT(securityTypeChanged(QString))); connect(model, SIGNAL(currentIndexChanged(QString)), this, SLOT(modelTypeChanged(QString))); connect(add, SIGNAL(clicked()), this, SLOT(addSecLabel())); connect(del, SIGNAL(clicked()), this, SLOT(delSecLabel())); // dataChanged connections connect(model, SIGNAL(currentIndexChanged(int)), this, SLOT(stateChanged())); connect(label, SIGNAL(textEdited(QString)), this, SLOT(stateChanged())); connect(labelTypeLabel, SIGNAL(currentIndexChanged(int)), this, SLOT(stateChanged())); connect(relabel, SIGNAL(currentIndexChanged(int)), this, SLOT(stateChanged())); connect(type, SIGNAL(currentIndexChanged(int)), this, SLOT(stateChanged())); connect(useSecLabel, SIGNAL(toggled(bool)), this, SLOT(stateChanged()));}
开发者ID:Dravigon,项目名称:qt-virt-manager,代码行数:74,
示例12: stateChanged void TransferJob::handleStateChanged (QXmppTransferJob::State state) { emit stateChanged (static_cast<TransferState> (state)); }
开发者ID:Apkawa,项目名称:leechcraft,代码行数:4,
示例13: itvoid SipPhoneProxy::localStatusUpdate( void ){ QString subject; //QIcon icon; SipCallIterator it( _pSipClient->getCallList() ); if( _pSipRegister == 0 ) { return; } if( _setSubscribeOffline && _pSipRegister->getRegisterState() == SipRegister::Connected ) { _setSubscribeOffline = false; _isOnline = false; //QIcon icon; //icon.setPixmap(SHARE_DIR "/icons/offline.png", QIcon::Automatic ); ////buttonOffOnline->setIconSet( icon ); ////buttonUpdate->setEnabled( false ); ////buttonOffOnline->setEnabled( false ); SipCall* current = NULL; it.toFront(); while(it.hasNext()) { current = it.next(); if( current->getCallType() == SipCall::outSubscribeCall ) { if( current->getCallStatus() == SipCall::callInProgress ) { SipCallMemberIterator mIt = current->getMemberList(); mIt.toFront(); SipCallMember *member = mIt.next(); if( member ) { member->requestClearSubscribe(); } } } } } else { if( _pSipRegister->getRegisterState() == SipRegister::NotConnected ) { _isOnline = false; //QIcon icon1; //icon1.setPixmap(SHARE_DIR "/icons/offline.png", QIcon::Automatic ); //buttonOffOnline->setIconSet( icon1 ); //buttonUpdate->setEnabled( false ); //buttonOffOnline->setEnabled( false ); } else if( _pSipRegister->getRegisterState() == SipRegister::Connected ) { if( _buttonSetOffline ) { //buttonOffOnline->setEnabled( true ); } else { _isOnline = true; //QIcon icon2; //icon2.setPixmap(SHARE_DIR "/icons/online.png", QIcon::Automatic ); //buttonOffOnline->setIconSet( icon2 ); //buttonUpdate->setEnabled( true ); //buttonOffOnline->setEnabled( true ); SipCall* current = NULL; it.toFront(); while(it.hasNext()) { current = it.next(); if( current->getCallType() == SipCall::outSubscribeCall ) { if( current->getCallStatus() != SipCall::callDead ) { SipCallMemberIterator mIt = current->getMemberList(); mIt.toFront(); SipCallMember *member = mIt.next(); if( member ) { member->requestSubscribe( _subscribeExpiresTime ); } } } } } } } emit ( stateChanged() );}
开发者ID:avgx,项目名称:Contacts,代码行数:89,
示例14: Q_UNUSEDvoid Activity::activityStateChanged(KActivities::Info::State state){ Q_UNUSED(state) emit stateChanged();}
开发者ID:mgottschlag,项目名称:kwin-tiling,代码行数:5,
示例15: QWidgetPlayer::Player(QWidget *parent) : QWidget(parent) , videoWidget(0) , coverLabel(0) , slider(0) , colorDialog(0){//! [create-objs] player = new QMediaPlayer; playlist = new QMediaPlaylist(player);//! [create-objs] connect(player, SIGNAL(durationChanged(qint64)), SLOT(durationChanged(qint64))); connect(player, SIGNAL(positionChanged(qint64)), SLOT(positionChanged(qint64))); connect(player, SIGNAL(metaDataChanged()), SLOT(metaDataChanged())); connect(playlist, SIGNAL(playlistPositionChanged(int)), SLOT(playlistPositionChanged(int))); connect(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(statusChanged(QMediaPlayer::MediaStatus))); connect(player, SIGNAL(bufferStatusChanged(int)), this, SLOT(bufferingProgress(int))); videoWidget = new VideoWidget(player); playlistModel = new PlaylistModel(this); playlistModel->setPlaylist(playlist); playlistView = new QListView; playlistView->setModel(playlistModel); playlistView->setCurrentIndex(playlistModel->index(playlist->currentPosition(), 0)); connect(playlistView, SIGNAL(activated(QModelIndex)), this, SLOT(jump(QModelIndex))); slider = new QSlider(Qt::Horizontal); slider->setRange(0, player->duration() / 1000); connect(slider, SIGNAL(sliderMoved(int)), this, SLOT(seek(int))); QPushButton *openButton = new QPushButton(tr("Open")); connect(openButton, SIGNAL(clicked()), this, SLOT(open())); PlayerControls *controls = new PlayerControls; controls->setState(player->state()); controls->setVolume(player->volume()); controls->setMuted(controls->isMuted()); connect(controls, SIGNAL(play()), player, SLOT(play())); connect(controls, SIGNAL(pause()), player, SLOT(pause())); connect(controls, SIGNAL(stop()), player, SLOT(stop())); connect(controls, SIGNAL(next()), playlist, SLOT(next())); connect(controls, SIGNAL(previous()), playlist, SLOT(previous())); connect(controls, SIGNAL(changeVolume(int)), player, SLOT(setVolume(int))); connect(controls, SIGNAL(changeMuting(bool)), player, SLOT(setMuted(bool))); connect(controls, SIGNAL(changeRate(qreal)), player, SLOT(setPlaybackRate(qreal))); connect(player, SIGNAL(stateChanged(QMediaPlayer::State)), controls, SLOT(setState(QMediaPlayer::State))); connect(player, SIGNAL(volumeChanged(int)), controls, SLOT(setVolume(int))); connect(player, SIGNAL(mutingChanged(bool)), controls, SLOT(setMuted(bool))); QPushButton *fullScreenButton = new QPushButton(tr("FullScreen")); fullScreenButton->setCheckable(true); if (videoWidget != 0) { connect(fullScreenButton, SIGNAL(clicked(bool)), videoWidget, SLOT(setFullScreen(bool))); connect(videoWidget, SIGNAL(fullScreenChanged(bool)), fullScreenButton, SLOT(setChecked(bool))); } else { fullScreenButton->setEnabled(false); } QPushButton *colorButton = new QPushButton(tr("Color Options...")); if (videoWidget) connect(colorButton, SIGNAL(clicked()), this, SLOT(showColorDialog())); else colorButton->setEnabled(false); QBoxLayout *displayLayout = new QHBoxLayout; if (videoWidget) displayLayout->addWidget(videoWidget, 2); else displayLayout->addWidget(coverLabel, 2); displayLayout->addWidget(playlistView); QBoxLayout *controlLayout = new QHBoxLayout; controlLayout->setMargin(0); controlLayout->addWidget(openButton); controlLayout->addStretch(1); controlLayout->addWidget(controls); controlLayout->addStretch(1); controlLayout->addWidget(fullScreenButton); controlLayout->addWidget(colorButton); QBoxLayout *layout = new QVBoxLayout; layout->addLayout(displayLayout); layout->addWidget(slider); layout->addLayout(controlLayout); setLayout(layout); metaDataChanged();//.........这里部分代码省略.........
开发者ID:kaltsi,项目名称:qt-mobility,代码行数:101,
示例16: stateChangedvoid QPhoneHandler::setState(const QString &state){ m_state = state; emit stateChanged();}
开发者ID:Bjoe,项目名称:qphone,代码行数:5,
示例17: QMainWindow//--------------------------------------------------------------------------------------// Mwars::Mwars()// the Constructor//--------------------------------------------------------------------------------------Mwars::Mwars(QWidget *parent) : QMainWindow(parent), ui(new Ui::mwarsForm) { ui->setupUi(this); // Ui:mwarsForm ui //*********** two timers QTimer *keepServerAliveTimer = new QTimer(this); // instantiate timer QTimer *testTimer = new QTimer(this); // a. TCP stream to scanner server // clientSocket: client socket sends stream to scanner. clientSocket already exists // Q_SIGNALS signals emitted by socket unimplemented: void hostFound() void connected() connect( &clientSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(clientSocketError(QAbstractSocket::SocketError)) ); connect( &clientSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(clientSocketState(QAbstractSocket::SocketState)) ); connect( &clientSocket, SIGNAL(readyRead()),this, SLOT(OnReadyRead()) ); connect( &clientSocket, SIGNAL(disconnected()), this, SLOT(disconnectedz()) ); // b. UDP stream from opencv / camera listenSocket = new QUdpSocket ( this ); listenSocket->bind(9988 ); connect( listenSocket, SIGNAL(readyRead()),this, SLOT(OnReadyRead()) ); //signals from within code connect( this, SIGNAL(connectScanner()), this, SLOT(connectToScanner())); // Constructor connect( keepServerAliveTimer, SIGNAL(timeout()), this, SLOT(keepServerAlive()));// connect( testTimer, SIGNAL(timeout()), this, SLOT(testSignal())); // signals from ui connect( ui->xSlider, SIGNAL(valueChanged(int)), this, SLOT(sendScanCmd())); connect( ui->ySlider, SIGNAL(valueChanged(int)), this, SLOT(sendScanCmd())); connect( ui->spinboxXCamTrim, SIGNAL(valueChanged(int)), this, SLOT(sendScanCmd())); connect( ui->spinboxYCamTrim, SIGNAL(valueChanged(int)), this, SLOT(sendScanCmd())); //connect( ui->pbLaserToggle, SIGNAL(clicked()), this, SLOT(laserToggle())); connect( ui->pushButtonLaserDisableToggle, SIGNAL(clicked()), this, SLOT(laserDisableToggle())); connect( ui->pushButtonScannerToggle, SIGNAL(clicked()), this, SLOT(scannerToggle())); connect( ui->pushButtonConnect, SIGNAL(clicked()), this, SLOT(connectToScanner())); connect( ui->radioButtonVerboseOn, SIGNAL(clicked()), this, SLOT(verboseOn())); connect( ui->radioButtonVerboseOff, SIGNAL(clicked()), this, SLOT(verboseOff())); connect( ui->pushButtonResetScanner, SIGNAL(clicked()), this, SLOT(resetScanner())); connect( ui->pushButtonCameraDataToggle, SIGNAL(clicked()), this, SLOT(cameraDataToggle())); connect( ui->pushButtonTestDataToggle, SIGNAL(clicked()), this, SLOT(testDataToggle())); //connect( ui->pbAlignBS, SIGNAL(clicked()), this, SLOT(alignBoresight())); connect( ui->pbCalibrateToggle, SIGNAL(clicked()), this, SLOT(calibrateToggle())); connect( ui->pbCalSetULHC, SIGNAL(clicked()), this, SLOT(calSetULHC())); connect( ui->pbCalSetLRHC, SIGNAL(clicked()), this, SLOT(calSetLRHC())); connect( ui->pbCalFullFrame, SIGNAL(clicked()), this, SLOT(calFullFrame())); connect( ui->pbCalHalfFrame, SIGNAL(clicked()), this, SLOT(calHalfFrame())); connect( ui->spinboxXCamTrim, SIGNAL(valueChanged(int)), this, SLOT(xCamTrim())); connect( ui->spinboxYCamTrim, SIGNAL(valueChanged(int)), this, SLOT(yCamTrim())); connect( ui->pbCamTrimOffset, SIGNAL(clicked()), this, SLOT(camTrimOffset())); connect( ui->sbXCamOffset, SIGNAL(valueChanged(int)), this, SLOT(xCamOffset())); connect( ui->sbYCamOffset, SIGNAL(valueChanged(int)), this, SLOT(yCamOffset())); connect( ui->pbCamOffset, SIGNAL(clicked()), this, SLOT(camScanOffset())); connect( ui->pbCalLaserBsight, SIGNAL(clicked()), this, SLOT(alignBoresight())); //connect( this, SIGNAL (testSignal()), this, SLOT (testSignal())); // temporary stuff to test parallax offset g_xLenWallFOV_mm = (1310 * 2); // measured width, x axis, of FOV at target distance = range (mm) g_yLenWallFOV_mm = (975 * 2); g_xSF_pixelTomm = (float)g_xLenWallFOV_mm / CAMERA_X_PIXELS; g_ySF_pixelTomm = (float)g_yLenWallFOV_mm / CAMERA_Y_PIXELS; range_mm = 2750; // measured range cam to target (mm) //overwritten when cam file is read g_xScanFOVOrigin_su = DAC_X_MIN; // scanner origin corresponding to x_camFOVOrigin (scan units) g_xScanFOVMax_su = DAC_X_MAX; // scanner max x corresponding to x_camFOVMax (scan units) // read camera to scanner calibration file. This reads the calibration parameters // and sets main slider and spin box values readXMLFile(); ui->spinboxXCamTrim->setRange(-5000, +5000); ui->spinboxYCamTrim->setRange(-5000, +5000); ui->radioButtonVerboseOff->setChecked(true); clearStateWidets(); // clear Server State widget text#ifdef FORCE_ENABLE_WIDGETS enableWidgets();#else disableWidgets(); // control widgets get enabled when connected#endif verbose = false; // verbose OFF laserOnFlag = false;//.........这里部分代码省略.........
开发者ID:OliverBJ01,项目名称:scannerConsole,代码行数:101,
示例18: espeak_Initializevoid EspeakTTSWorker::run() { // int freq = cst_wave_sample_rate(w); int freq = espeak_Initialize(AUDIO_OUTPUT_RETRIEVAL, buflength, NULL, 0);// espeak_EVENT_TYPE freq = espeak_EVENT_TYPE-> espeakEVENT_SAMPLERATE = 8 // internal use, set sample rate // int numchannels = cst_wave_num_channels(w); // can not find alternative in espeak int numchannels = 1; //mono setting //int samplesize_bytes = sizeof(typeof(*(w->samples))); // search in struct . sample (short * sample ) int samplesize_bytes = sizeof(typeof(sounddata)); int samplesize = samplesize_bytes * 8; //size in bits //short* buf = (short*)(cst_wave_samples(w)); // sounddata // short* buf = (short*)(sounddata); short* buf = waves; // int numsamples = cst_wave_num_samples(w); qDebug() <<"Number of Samples :"<<counter<<endl;// numsamples: is the number of entries in wav. SynthCallback(short *wav, int numsamples, espeak_EVENT *events);//Qt Functions need to change the passed parameter to be from Espeak m_format.setFrequency(freq); //done m_format.setChannels(numchannels); m_format.setSampleSize(samplesize); //bits per sample//not changed m_format.setCodec("audio/pcm"); m_format.setByteOrder(QAudioFormat::LittleEndian); m_format.setSampleType(QAudioFormat::SignedInt); if (!info->isFormatSupported(m_format)) { std::cerr << "Default format not supported - trying to use nearest"; m_format = info->nearestFormat(m_format); } QAudioOutput m_audioOutput(m_format, 0);// connect(m_audioOutput,SIGNAL(stateChanged(QAudio::State)),this,SLOT(finishedPlaying(QAudio::State))); int sizeinbytes = counter * samplesize_bytes; b.open(QIODevice::ReadWrite); // b for Qbuffer b.write((char*)buf, sizeinbytes); b.seek(0); m_audioOutput.start(&b); //hold until sound is done QEventLoop loop; QObject::connect(&m_audioOutput, SIGNAL(stateChanged(QAudio::State)), &loop, SLOT(quit())); do { loop.exec(); } while(m_audioOutput.state() == QAudio::ActiveState);}
开发者ID:FEE-MNF,项目名称:Ringeader,代码行数:63,
示例19: endedvoid MainWindow::slot_recording_finished( TrackRecorder::TmpFilePtr tmp_file, quint64 start_offset, quint64 end_offset ) { // Show TrackSettings window, set file to edit // QAudio output ... std::cout << "Recording ended (" << tmp_file->fileName().toStdString() << ")." << std::endl; std::cout << "Start: " << start_offset << " End: " << end_offset << std::endl; FILE *tmp = tmpfile(); FILE *fp = fopen( tmp_file->fileName().toStdString().c_str(), "rb" ); fseek( fp, start_offset, SEEK_CUR ); unsigned short int sample; while( !feof( fp ) ) { fread( &sample, sizeof( unsigned short int ), 1, fp ); fwrite( &sample, sizeof( unsigned short int ), 1, tmp ); if( ftell(fp) != -1 && (unsigned int)ftell( fp ) == end_offset ) { break; } } fclose( fp ); remove( tmp_file->fileName().toStdString().c_str() ); rewind( tmp ); fp = fopen( tmp_file->fileName().toStdString().c_str(), "wb" ); while( !feof( tmp ) ) { fread( &sample, sizeof( unsigned short int ), 1, tmp ); fwrite( &sample, sizeof( unsigned short int ), 1, fp ); } fclose( fp ); fclose( tmp ); f.setFileName( tmp_file->fileName() ); f.open( QIODevice::ReadOnly ); QAudioFormat format; // Set up the format, eg. format.setSampleRate( 44100 ); format.setChannelCount( 1 ); format.setSampleSize( 16 ); format.setCodec( "audio/pcm" ); format.setByteOrder( QAudioFormat::LittleEndian ); format.setSampleType( QAudioFormat::UnSignedInt ); QAudioDeviceInfo info( QAudioDeviceInfo::defaultOutputDevice() ); if( !info.isFormatSupported(format) ) { std::cout << "Raw audio format not supported by backend, cannot play audio." << std::endl; return; } audio = new QAudioOutput( format, this ); connect( audio, SIGNAL( stateChanged(QAudio::State) ), this, SLOT( slot_handle_audio_state(QAudio::State) ) ); audio->start( &f );}
开发者ID:eriser,项目名称:Looper,代码行数:62,
示例20: stateChangedvoid QDeclarativeBluetoothSocket::socket_state(QBluetoothSocket::SocketState state){ d->m_state = static_cast<QDeclarativeBluetoothSocket::SocketState>(state); emit stateChanged();}
开发者ID:kobolabs,项目名称:qtconnectivity,代码行数:6,
示例21: LOG_DEBUG/*------------------------------------------------------------------------------| OpenMAXILPlayerControl::onStateChanged+-----------------------------------------------------------------------------*/void OpenMAXILPlayerControl::onStateChanged(OMX_MediaProcessor::OMX_MediaProcessorState state){ LOG_DEBUG(LOG_TAG, "State changed..."); emit stateChanged(convertState(state));}
开发者ID:bgbadchrs,项目名称:pi,代码行数:8,
注:本文中的stateChanged函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ stateGetPositionEnu_f函数代码示例 C++ stateChange函数代码示例 |