当前位置: 首页>>代码示例>>C++>>正文


C++ dataChanged函数代码示例

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


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

示例1: QWidget

FormLibraryEditor::FormLibraryEditor(QWidget* parent, Qt::WindowFlags flags)
	: QWidget(parent, flags)
	, ui(new Ui::FormLibraryEditor)
	, ui_user_pwd(new Ui::DialogUserPassword)
	, cwall(QSqlDatabase::database("cwall"))
	, modelDiffucalty(new QSqlTableModel(this, cwall))
	, modelRanges(new QSqlTableModel(this, cwall))
	, modelCompetitionTypes(new QSqlTableModel(this, cwall))
	, modelAgeGroups(new QSqlTableModel(this, cwall))
	, modelTeams(new QSqlTableModel(this, cwall))
	, modelCompetitors(new QSqlRelationalTableModel(this, cwall))
	, modelUser(new QSqlTableModel(this, cwall))
{
	ui->setupUi(this);

	setMinimumWidth(600);
	QAction *actionSeparator = new QAction(this);
	actionSeparator->setSeparator(true);
	QAction *actionSeparator1 = new QAction(this);
	actionSeparator1->setSeparator(true);

	modelDiffucalty->setTable("lib_climbdifficalty");
	ui->listViewDiffucalties->setModel(modelDiffucalty);
	ui->listViewDiffucalties->setModelColumn(modelDiffucalty->fieldIndex("label"));
	modelDiffucalty->sort(modelDiffucalty->fieldIndex("id"), Qt::AscendingOrder);
	modelDiffucalty->select();
	modelDiffucalty->setEditStrategy(QSqlTableModel::OnManualSubmit);
	ui->actionDifficultyCommit->setDisabled(true);
	if (User::current()->isSuperuser() & DialogConfigure::cfg()->registration()) {
		ui->listViewDiffucalties->setContextMenuPolicy(Qt::ActionsContextMenu);
		ui->listViewDiffucalties->addAction(ui->actionDifficultyUpdate);
		ui->listViewDiffucalties->addAction(ui->actionDifficultyCommit);
		ui->listViewDiffucalties->addAction(actionSeparator);
		ui->listViewDiffucalties->addAction(ui->actionDifficultyAdd);
		ui->listViewDiffucalties->addAction(ui->actionDifficultyDelete);
		connect(ui->listViewDiffucalties, SIGNAL(pressed(QModelIndex)), this, SLOT(currentDiffChanged(QModelIndex)));
		connect(ui->listViewDiffucalties, SIGNAL(activated(QModelIndex)), this, SLOT(currentDiffChanged(QModelIndex)));
		connect(modelDiffucalty, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(modelChange()));
	} else {
		ui->listViewDiffucalties->setEditTriggers(QAbstractItemView::NoEditTriggers);
	}

	modelRanges->setTable("lib_sportrange");
	ui->listViewSportRanges->setModel(modelRanges);
	ui->listViewSportRanges->setModelColumn(modelRanges->fieldIndex("label"));
	modelRanges->sort(modelRanges->fieldIndex("id"), Qt::AscendingOrder);
	modelRanges->select();
	ui->listViewSportRanges->setEditTriggers(QAbstractItemView::NoEditTriggers);

	modelCompetitionTypes->setTable("lib_competitiontype");
	ui->tableViewCompetitionTypes->setModel(modelCompetitionTypes);
	modelCompetitionTypes->select();
	ui->tableViewCompetitionTypes->hideColumn(modelCompetitionTypes->fieldIndex("prefix"));
	ui->tableViewCompetitionTypes->hideColumn(modelCompetitionTypes->fieldIndex("id"));
	modelCompetitionTypes->setEditStrategy(QSqlTableModel::OnManualSubmit);
	if (User::current()->isSuperuser() & DialogConfigure::cfg()->registration()) {
		ui->tableViewCompetitionTypes->addAction(ui->actionCTypeCommit);
		ui->tableViewCompetitionTypes->addAction(ui->actionCTypeUpdate);
		ui->actionCTypeCommit->setDisabled(true);
		connect(modelCompetitionTypes, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(modelChange()));
	} else {
		ui->tableViewCompetitionTypes->setEditTriggers(QAbstractItemView::NoEditTriggers);
	}

	modelAgeGroups->setTable("lib_agegroup");
	ui->tableViewAgeGroups->setModel(modelAgeGroups);
	modelAgeGroups->select();
	ui->tableViewAgeGroups->hideColumn(modelAgeGroups->fieldIndex("id"));
	modelAgeGroups->sort(modelAgeGroups->fieldIndex("id"), Qt::AscendingOrder);
	modelAgeGroups->setEditStrategy(QSqlTableModel::OnManualSubmit);
	if (DialogConfigure::cfg()->registration()) {
		ui->tableViewAgeGroups->addAction(ui->actionAgeGroupUpdate);
		ui->tableViewAgeGroups->addAction(ui->actionAgeGroupCommit);
		ui->tableViewAgeGroups->addAction(actionSeparator);
		ui->tableViewAgeGroups->addAction(ui->actionAgeGroupAdd);
		ui->tableViewAgeGroups->addAction(ui->actionAgeGroupDelete);
		ui->actionAgeGroupCommit->setDisabled(true);
		ui->actionAgeGroupDelete->setDisabled(true);
		connect(modelAgeGroups, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(modelChange()));
		connect(ui->tableViewAgeGroups, SIGNAL(activated(QModelIndex)), this, SLOT(currentAgrpChanged(QModelIndex)));
		connect(ui->tableViewAgeGroups, SIGNAL(pressed(QModelIndex)), this, SLOT(currentAgrpChanged(QModelIndex)));
	} else {
		ui->tableViewAgeGroups->setEditTriggers(QAbstractItemView::NoEditTriggers);
	}

	modelTeams->setTable("lib_team");
	ui->tableViewTeams->setModel(modelTeams);
	ui->tableViewTeams->hideColumn(modelTeams->fieldIndex("gid"));
	modelTeams->sort(modelTeams->fieldIndex("gid"), Qt::AscendingOrder);
	modelTeams->select();
	ui->tableViewTeams->addAction(ui->actionTeamCommit);
	ui->tableViewTeams->addAction(ui->actionTeamUpdate);
	ui->tableViewTeams->addAction(actionSeparator);
	ui->tableViewTeams->addAction(ui->actionTeamAdd);
	ui->tableViewTeams->addAction(ui->actionTeamDelete);
	modelTeams->setEditStrategy(QSqlTableModel::OnManualSubmit);
	ui->actionTeamCommit->setDisabled(true);
	ui->actionTeamDelete->setDisabled(true);
	connect(modelTeams, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(modelChange()));
	connect(ui->tableViewTeams, SIGNAL(activated(QModelIndex)), this, SLOT(currentTeamChanged(QModelIndex)));
//.........这里部分代码省略.........
开发者ID:pitikov,项目名称:cwall.qt4,代码行数:101,代码来源:formlibraryeditor.cpp

示例2: dataChanged

void EntryAttachmentsModel::attachmentChange(const QString& key)
{
    int row = m_entryAttachments->keys().indexOf(key);
    Q_EMIT dataChanged(index(row, 0), index(row, columnCount()-1));
}
开发者ID:nandhp,项目名称:keepassx,代码行数:5,代码来源:EntryAttachmentsModel.cpp

示例3: CharCommand

void QHexEditPrivate::insert(int index, char ch)
{
    QUndoCommand *charCommand = new CharCommand(&_xData, CharCommand::insert, index, ch);
    _undoStack->push(charCommand);
    emit dataChanged();
}
开发者ID:djandruczyk,项目名称:emstune,代码行数:6,代码来源:qhexedit_p.cpp

示例4: Q_ASSERT

void PrettyMailboxModel::xtConnectStatusChanged(QModelIndex index)
{
    Q_ASSERT(index.model() == this);
    emit dataChanged(index, index);
}
开发者ID:RonnyPfannschmidt,项目名称:trojita,代码行数:5,代码来源:PrettyMailboxModel.cpp

示例5: index

void HistoryModel::entryUpdated(int offset)
{
    QModelIndex idx = index(offset, 0);
    emit dataChanged(idx, idx);
}
开发者ID:Afreeca,项目名称:qt,代码行数:5,代码来源:history.cpp

示例6: index

void BookmarksModel::entryChanged(BookmarkNode *item)
{
    QModelIndex idx = index(item);
    emit dataChanged(idx, idx);
}
开发者ID:AtlantisCD9,项目名称:Qt,代码行数:5,代码来源:bookmarks.cpp

示例7: dataChanged

void QgsGraduatedSymbolRendererV2Model::updateLabels()
{
  emit dataChanged( createIndex( 0, 2 ), createIndex( mRenderer->ranges().size(), 2 ) );
}
开发者ID:nicanor-b,项目名称:QGIS,代码行数:4,代码来源:qgsgraduatedsymbolrendererv2widget.cpp

示例8: switch


//.........这里部分代码省略.........
            settings.setValue("fUseUPnP", value.toBool());
            MapPort(value.toBool());
            break;
        case MinimizeOnClose:
            fMinimizeOnClose = value.toBool();
            settings.setValue("fMinimizeOnClose", fMinimizeOnClose);
            break;

        // default proxy
        case ProxyUse:
            if (settings.value("fUseProxy") != value) {
                settings.setValue("fUseProxy", value.toBool());
                setRestartRequired(true);
            }
            break;
        case ProxyIP: {
            // contains current IP at index 0 and current port at index 1
            QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts);
            // if that key doesn't exist or has a changed IP
            if (!settings.contains("addrProxy") || strlIpPort.at(0) != value.toString()) {
                // construct new value from new IP and current port
                QString strNewValue = value.toString() + ":" + strlIpPort.at(1);
                settings.setValue("addrProxy", strNewValue);
                setRestartRequired(true);
            }
        }
        break;
        case ProxyPort: {
            // contains current IP at index 0 and current port at index 1
            QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts);
            // if that key doesn't exist or has a changed port
            if (!settings.contains("addrProxy") || strlIpPort.at(1) != value.toString()) {
                // construct new value from current IP and new port
                QString strNewValue = strlIpPort.at(0) + ":" + value.toString();
                settings.setValue("addrProxy", strNewValue);
                setRestartRequired(true);
            }
        }
        break;
#ifdef ENABLE_WALLET
        case SpendZeroConfChange:
            if (settings.value("bSpendZeroConfChange") != value) {
                settings.setValue("bSpendZeroConfChange", value);
                setRestartRequired(true);
            }
            break;
#endif
        case DisplayUnit:
            setDisplayUnit(value);
            break;
        case ThirdPartyTxUrls:
            if (strThirdPartyTxUrls != value.toString()) {
                strThirdPartyTxUrls = value.toString();
                settings.setValue("strThirdPartyTxUrls", strThirdPartyTxUrls);
                setRestartRequired(true);
            }
            break;
        case Language:
            if (settings.value("language") != value) {
                settings.setValue("language", value);
                setRestartRequired(true);
            }
            break;
        case CoinControlFeatures:
            fCoinControlFeatures = value.toBool();
            settings.setValue("fCoinControlFeatures", fCoinControlFeatures);
            emit coinControlFeaturesChanged(fCoinControlFeatures);
            break;
        case DatabaseCache:
            if (settings.value("nDatabaseCache") != value) {
                settings.setValue("nDatabaseCache", value);
                setRestartRequired(true);
            }
            break;
        case ThreadsScriptVerif:
            if (settings.value("nThreadsScriptVerif") != value) {
                settings.setValue("nThreadsScriptVerif", value);
                setRestartRequired(true);
            }
            break;
        case Listen:
            if (settings.value("fListen") != value) {
                settings.setValue("fListen", value);
                setRestartRequired(true);
            }
            break;
        case MiningIntensity:
            if (settings.value("nMiningIntensity") != value.toInt()) {
                settings.setValue("nMiningIntensity", value.toInt());
                setRestartRequired(true);
            }
        default:
            break;
        }
    }

    emit dataChanged(index, index);

    return successful;
}
开发者ID:MaxGuevara,项目名称:quark,代码行数:101,代码来源:optionsmodel.cpp

示例9: dataChanged

void LinearCurveSegmentModel::on_endChanged()
{
    emit dataChanged();
}
开发者ID:gitter-badger,项目名称:i-score,代码行数:4,代码来源:LinearCurveSegmentModel.cpp

示例10: organicKnob

void organicInstrumentView::modelChanged()
{
    organicInstrument * oi = castModel<organicInstrument>();

    const float y=91.0f;
    const float rowHeight = 26.0f;
    const float x=53.0f;
    const float colWidth = 24.0f;

    m_numOscillators = oi->m_numOscillators;

    m_fx1Knob->setModel( &oi->m_fx1Model );
    m_volKnob->setModel( &oi->m_volModel );

    if( m_oscKnobs != NULL )
    {
        delete[] m_oscKnobs;
    }

    m_oscKnobs = new OscillatorKnobs[ m_numOscillators ];

    // Create knobs, now that we know how many to make
    for( int i = 0; i < m_numOscillators; ++i )
    {
        // setup harmonic knob
        knob * harmKnob = new organicKnob( this );
        harmKnob->move( x + i * colWidth, y - rowHeight );
        harmKnob->setObjectName( "harmKnob" );
        connect( &oi->m_osc[i]->m_harmModel, SIGNAL( dataChanged() ),
                 this, SLOT( updateKnobHint() ) );

        // setup waveform-knob
        knob * oscKnob = new organicKnob( this );
        oscKnob->move( x + i * colWidth, y );
        connect( &oi->m_osc[i]->m_oscModel, SIGNAL( dataChanged() ),
                 this, SLOT( updateKnobHint() ) );

        oscKnob->setHintText( tr( "Osc %1 waveform:" ).arg( i + 1 ) + " ", QString() );

        // setup volume-knob
        knob * volKnob = new knob( knobStyled, this );
        volKnob->setVolumeKnob( true );
        volKnob->move( x + i * colWidth, y + rowHeight*1 );
        volKnob->setFixedSize( 21, 21 );
        volKnob->setHintText( tr( "Osc %1 volume:" ).arg(
                                  i + 1 ) + " ", "%" );

        // setup panning-knob
        knob * panKnob = new organicKnob( this );
        panKnob->move( x + i  * colWidth, y + rowHeight*2 );
        panKnob->setHintText( tr("Osc %1 panning:").arg(
                                  i + 1 ) + " ", "" );

        // setup knob for fine-detuning
        knob * detuneKnob = new organicKnob( this );
        detuneKnob->move( x + i * colWidth, y + rowHeight*3 );
        detuneKnob->setHintText( tr( "Osc %1 stereo detuning" ).arg( i + 1 )
                                 + " ", " " +
                                 tr( "cents" ) );

        m_oscKnobs[i] = OscillatorKnobs( harmKnob, volKnob, oscKnob, panKnob, detuneKnob );

        // Attach to models
        m_oscKnobs[i].m_harmKnob->setModel( &oi->m_osc[i]->m_harmModel );
        m_oscKnobs[i].m_volKnob->setModel( &oi->m_osc[i]->m_volModel );
        m_oscKnobs[i].m_oscKnob->setModel( &oi->m_osc[i]->m_oscModel );
        m_oscKnobs[i].m_panKnob->setModel( &oi->m_osc[i]->m_panModel );
        m_oscKnobs[i].m_detuneKnob->setModel( &oi->m_osc[i]->m_detuneModel );
    }
    updateKnobHint();
}
开发者ID:hhalmet,项目名称:lmms,代码行数:71,代码来源:organic.cpp

示例11: Instrument

organicInstrument::organicInstrument( InstrumentTrack * _instrument_track ) :
    Instrument( _instrument_track, &organic_plugin_descriptor ),
    m_modulationAlgo( Oscillator::SignalMix, Oscillator::SignalMix, Oscillator::SignalMix),
    m_fx1Model( 0.0f, 0.0f, 0.99f, 0.01f , this, tr( "Distortion" ) ),
    m_volModel( 100.0f, 0.0f, 200.0f, 1.0f, this, tr( "Volume" ) )
{
    m_numOscillators = 8;

    m_osc = new OscillatorObject*[ m_numOscillators ];
    for (int i=0; i < m_numOscillators; i++)
    {
        m_osc[i] = new OscillatorObject( this, i );
        m_osc[i]->m_numOscillators = m_numOscillators;

        // Connect events
        connect( &m_osc[i]->m_oscModel, SIGNAL( dataChanged() ),
                 m_osc[i], SLOT ( oscButtonChanged() ) );
        connect( &m_osc[i]->m_harmModel, SIGNAL( dataChanged() ),
                 m_osc[i], SLOT( updateDetuning() ) );
        connect( &m_osc[i]->m_volModel, SIGNAL( dataChanged() ),
                 m_osc[i], SLOT( updateVolume() ) );
        connect( &m_osc[i]->m_panModel, SIGNAL( dataChanged() ),
                 m_osc[i], SLOT( updateVolume() ) );
        connect( &m_osc[i]->m_detuneModel, SIGNAL( dataChanged() ),
                 m_osc[i], SLOT( updateDetuning() ) );

        m_osc[i]->updateVolume();

    }

    /*	m_osc[0]->m_harmonic = log2f( 0.5f );	// one octave below
    	m_osc[1]->m_harmonic = log2f( 0.75f );	// a fifth below
    	m_osc[2]->m_harmonic = log2f( 1.0f );	// base freq
    	m_osc[3]->m_harmonic = log2f( 2.0f );	// first overtone
    	m_osc[4]->m_harmonic = log2f( 3.0f );	// second overtone
    	m_osc[5]->m_harmonic = log2f( 4.0f );	// .
    	m_osc[6]->m_harmonic = log2f( 5.0f );	// .
    	m_osc[7]->m_harmonic = log2f( 6.0f );	// .*/

    if( s_harmonics == NULL )
    {
        s_harmonics = new float[ NUM_HARMONICS ];
        s_harmonics[0] = log2f( 0.5f );
        s_harmonics[1] = log2f( 0.75f );
        s_harmonics[2] = log2f( 1.0f );
        s_harmonics[3] = log2f( 2.0f );
        s_harmonics[4] = log2f( 3.0f );
        s_harmonics[5] = log2f( 4.0f );
        s_harmonics[6] = log2f( 5.0f );
        s_harmonics[7] = log2f( 6.0f );
        s_harmonics[8] = log2f( 7.0f );
        s_harmonics[9] = log2f( 8.0f );
        s_harmonics[10] = log2f( 9.0f );
        s_harmonics[11] = log2f( 10.0f );
        s_harmonics[12] = log2f( 11.0f );
        s_harmonics[13] = log2f( 12.0f );
        s_harmonics[14] = log2f( 13.0f );
        s_harmonics[15] = log2f( 14.0f );
        s_harmonics[16] = log2f( 15.0f );
        s_harmonics[17] = log2f( 16.0f );
    }

    for (int i=0; i < m_numOscillators; i++) {
        m_osc[i]->updateVolume();
        m_osc[i]->updateDetuning();
    }


    connect( engine::mixer(), SIGNAL( sampleRateChanged() ),
             this, SLOT( updateAllDetuning() ) );
}
开发者ID:hhalmet,项目名称:lmms,代码行数:71,代码来源:organic.cpp

示例12: Model

EnvelopeAndLfoParameters::EnvelopeAndLfoParameters(
					float _value_for_zero_amount,
							Model * _parent ) :
	Model( _parent ),
	m_used( false ),
	m_predelayModel( 0.0, 0.0, 2.0, 0.001, this, tr( "Predelay" ) ),
	m_attackModel( 0.0, 0.0, 2.0, 0.001, this, tr( "Attack" ) ),
	m_holdModel( 0.5, 0.0, 2.0, 0.001, this, tr( "Hold" ) ),
	m_decayModel( 0.5, 0.0, 2.0, 0.001, this, tr( "Decay" ) ),
	m_sustainModel( 0.5, 0.0, 1.0, 0.001, this, tr( "Sustain" ) ),
	m_releaseModel( 0.1, 0.0, 2.0, 0.001, this, tr( "Release" ) ),
	m_amountModel( 0.0, -1.0, 1.0, 0.005, this, tr( "Modulation" ) ),
	m_valueForZeroAmount( _value_for_zero_amount ),
	m_pahdFrames( 0 ),
	m_rFrames( 0 ),
	m_pahdEnv( NULL ),
	m_rEnv( NULL ),
	m_pahdBufSize( 0 ),
	m_rBufSize( 0 ),
	m_lfoPredelayModel( 0.0, 0.0, 1.0, 0.001, this, tr( "LFO Predelay" ) ),
	m_lfoAttackModel( 0.0, 0.0, 1.0, 0.001, this, tr( "LFO Attack" ) ),
	m_lfoSpeedModel( 0.1, 0.001, 1.0, 0.0001,
				SECS_PER_LFO_OSCILLATION * 1000.0, this,
							tr( "LFO speed" ) ),
	m_lfoAmountModel( 0.0, -1.0, 1.0, 0.005, this, tr( "LFO Modulation" ) ),
	m_lfoWaveModel( SineWave, 0, NumLfoShapes, this, tr( "LFO Wave Shape" ) ),
	m_x100Model( false, this, tr( "Freq x 100" ) ),
	m_controlEnvAmountModel( false, this, tr( "Modulate Env-Amount" ) ),
	m_lfoFrame( 0 ),
	m_lfoAmountIsZero( false ),
	m_lfoShapeData( NULL )
{
	m_amountModel.setCenterValue( 0 );
	m_lfoAmountModel.setCenterValue( 0 );

	if( s_lfoInstances == NULL )
	{
		s_lfoInstances = new LfoInstances();
	}

	instances()->add( this );

	connect( &m_predelayModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_attackModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_holdModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_decayModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_sustainModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_releaseModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_amountModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );

	connect( &m_lfoPredelayModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_lfoAttackModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_lfoSpeedModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_lfoAmountModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_lfoWaveModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_x100Model, SIGNAL( dataChanged() ),
				this, SLOT( updateSampleVars() ) );

	connect( engine::mixer(), SIGNAL( sampleRateChanged() ),
				this, SLOT( updateSampleVars() ) );


	m_lfoShapeData =
		new sample_t[engine::mixer()->framesPerPeriod()];

	updateSampleVars();
}
开发者ID:CallisteHanriat,项目名称:lmms,代码行数:79,代码来源:EnvelopeAndLfoParameters.cpp

示例13: expKnobVal


//.........这里部分代码省略.........

	if( static_cast<int>( floorf( m_amount * 1000.0f ) ) == 0 )
	{
		m_rFrames = 0;
	}

	// if the buffers are too small, make bigger ones - so we only alloc new memory when necessary
	if( m_pahdBufSize < m_pahdFrames )
	{
		sample_t * tmp = m_pahdEnv;
		m_pahdEnv = new sample_t[m_pahdFrames];
		delete tmp;
		m_pahdBufSize = m_pahdFrames;
	}
	if( m_rBufSize < m_rFrames )
	{
		sample_t * tmp = m_rEnv;
		m_rEnv = new sample_t[m_rFrames];
		delete tmp;
		m_rBufSize = m_rFrames;
	}

	const float aa = m_amountAdd;
	for( f_cnt_t i = 0; i < predelay_frames; ++i )
	{
		m_pahdEnv[i] = aa;
	}

	f_cnt_t add = predelay_frames;

	const float afI = ( 1.0f / attack_frames ) * m_amount;
	for( f_cnt_t i = 0; i < attack_frames; ++i )
	{
		m_pahdEnv[add+i] = i * afI + aa;
	}

	add += attack_frames;
	const float amsum = m_amount + m_amountAdd;
	for( f_cnt_t i = 0; i < hold_frames; ++i )
	{
		m_pahdEnv[add + i] = amsum;
	}

	add += hold_frames;
	const float dfI = ( 1.0 / decay_frames ) * ( m_sustainLevel -1 ) * m_amount;
	for( f_cnt_t i = 0; i < decay_frames; ++i )
	{
/*
		m_pahdEnv[add + i] = ( m_sustainLevel + ( 1.0f -
						(float)i / decay_frames ) *
						( 1.0f - m_sustainLevel ) ) *
							m_amount + m_amountAdd;
*/
		m_pahdEnv[add + i] = amsum + i*dfI;
	}

	const float rfI = ( 1.0f / m_rFrames ) * m_amount;
	for( f_cnt_t i = 0; i < m_rFrames; ++i )
	{
		m_rEnv[i] = (float)( m_rFrames - i ) * rfI;
	}

	// save this calculation in real-time-part
	m_sustainLevel = m_sustainLevel * m_amount + m_amountAdd;


	const float frames_per_lfo_oscillation = SECS_PER_LFO_OSCILLATION *
				engine::mixer()->processingSampleRate();
	m_lfoPredelayFrames = static_cast<f_cnt_t>( frames_per_lfo_oscillation *
				expKnobVal( m_lfoPredelayModel.value() ) );
	m_lfoAttackFrames = static_cast<f_cnt_t>( frames_per_lfo_oscillation *
				expKnobVal( m_lfoAttackModel.value() ) );
	m_lfoOscillationFrames = static_cast<f_cnt_t>(
						frames_per_lfo_oscillation *
						m_lfoSpeedModel.value() );
	if( m_x100Model.value() )
	{
		m_lfoOscillationFrames /= 100;
	}
	m_lfoAmount = m_lfoAmountModel.value() * 0.5f;

	m_used = true;
	if( static_cast<int>( floorf( m_lfoAmount * 1000.0f ) ) == 0 )
	{
		m_lfoAmountIsZero = true;
		if( static_cast<int>( floorf( m_amount * 1000.0f ) ) == 0 )
		{
			m_used = false;
		}
	}
	else
	{
		m_lfoAmountIsZero = false;
	}

	m_bad_lfoShapeData = true;

	emit dataChanged();

}
开发者ID:CallisteHanriat,项目名称:lmms,代码行数:101,代码来源:EnvelopeAndLfoParameters.cpp

示例14: switch

bool SoilProfile::setData(const QModelIndex &index, const QVariant &value, int role)
{
    if(index.parent()!=QModelIndex() || m_readOnly)
        return false;

    if (role == Qt::EditRole) {
        switch (index.column()) {
        case ThicknessColumn:
            if (index.row() < (rowCount() - 1)) {
                // Soil layers
                bool success;
                const double d = value.toDouble(&success);

                if (!success)
                    return false;

                m_soilLayers.at(index.row())->setThickness(d);
                updateDepths();
                emit dataChanged(this->index(index.row(), DepthColumn),
                                 this->index(rowCount(), DepthColumn));
                break;
            } else {
                // Rock layer
                return false;
            }
        case SoilTypeColumn:
            // Check if it is the final layer and if the SoilType can be identified
            if (index.row() < (rowCount() - 1)) {
                 if (SoilType* st = m_soilTypeCatalog->soilTypeOf(value)) {
                    m_soilLayers.at(index.row())->setSoilType(st);
                    break;
                }
            } else {
                return false;
            }
        case VelocityColumn:
        case StdevColumn:
                {
                    bool success;
                    const double d = value.toDouble(&success);

                    if (!success)
                        return false;

                    if (index.column() == VelocityColumn)
                        velocityLayer(index.row())->setAvg(d);
                    else if (index.column() == StdevColumn)
                        velocityLayer(index.row())->setStdev(d);
                    break;
                }
        case MinColumn:
        case MaxColumn:
                {
                    bool success;
                    const double d = value.toDouble(&success);

                    if (!success)
                        return false;

                    if (index.column() == MinColumn)
                        velocityLayer(index.row())->setMin(d);
                    else if(index.column() == MaxColumn)
                        velocityLayer(index.row())->setMax(d);
                    break;
                }
        case DepthColumn:
        case VariedColumn:
        default:
            return false;
        }
    } else if(role == Qt::CheckStateRole) {
        switch (index.column()) {
        case MinColumn:
            velocityLayer(index.row())->setHasMin(value.toBool());
            break;
        case MaxColumn:
            velocityLayer(index.row())->setHasMax(value.toBool());
            break;
        case VariedColumn:
            velocityLayer(index.row())->setIsVaried(value.toBool());
            break;
        }
    }

    emit dataChanged(index, index);
    return true;
}
开发者ID:arkottke,项目名称:strata,代码行数:87,代码来源:SoilProfile.cpp

示例15: dataChanged

void IxModel::raiseEvent_dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight, const QVector<int> & roles /* = QVector<int>() */) { Q_EMIT dataChanged(topLeft, bottomRight, roles); }
开发者ID:arBmind,项目名称:QxORM-1.32,代码行数:1,代码来源:IxModel.cpp


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