int main(int argv, char **args)
{
    QApplication app(argv, args);
    app.setApplicationName("effectsnippets");

    QList<Phonon::EffectDescription> effects =
        Phonon::BackendCapabilities::availableAudioEffects();

    Phonon::Effect *effect = new Phonon::Effect(effects.at(3));
    
//![0]
    QList<Phonon::EffectParameter> parameters = effect->parameters();

    foreach(Phonon::EffectParameter parameter, parameters) {
        // Do something with parameter
    }
//![0]

//![1]
    Phonon::EffectWidget *effectWidget = new Phonon::EffectWidget(effect);
//![1]
    
    effectWidget->show();

    return app.exec();
}
示例#2
0
    foreach (Phonon::EffectDescription effect, effects) {
        QTreeWidgetItem *item = new QTreeWidgetItem(effectsTreeWidget);
        item->setText(0, tr("Effect"));
        item->setText(1, effect.name());
        item->setText(2, effect.description());
//! [effects]

//! [effectsParameters]
        Phonon::Effect *instance = new Phonon::Effect(effect, this);
        QList<Phonon::EffectParameter> parameters = instance->parameters();
        for (int i = 0; i < parameters.size(); ++i) {
                Phonon::EffectParameter parameter = parameters.at(i);

            QVariant defaultValue = parameter.defaultValue();
            QVariant minimumValue = parameter.minimumValue();
            QVariant maximumValue = parameter.maximumValue();

            QString valueString = QString("%1 / %2 / %3")
                    .arg(defaultValue.toString()).arg(minimumValue.toString())
                    .arg(maximumValue.toString()); 

            QTreeWidgetItem *parameterItem = new QTreeWidgetItem(item);
            parameterItem->setText(0, tr("Parameter"));
            parameterItem->setText(1, parameter.name());
            parameterItem->setText(2, parameter.description());
            parameterItem->setText(3, QVariant::typeToName(parameter.type()));
            parameterItem->setText(4, valueString);
        }
    }