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


C++ LabelWidget::margins方法代码示例

本文整理汇总了C++中LabelWidget::margins方法的典型用法代码示例。如果您正苦于以下问题:C++ LabelWidget::margins方法的具体用法?C++ LabelWidget::margins怎么用?C++ LabelWidget::margins使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LabelWidget的用法示例。


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

示例1: layout

AudioSettingsDialog::AudioSettingsDialog(String const &name)
    : DialogWidget(name, WithHeading), d(new Impl(this))
{
    bool const gameLoaded = DoomsdayApp::isGameLoaded();

    heading().setText(tr("Audio Settings"));
    heading().setImage(style().images().image("audio"));

    GridLayout layout(area().contentRule().left(), area().contentRule().top());
    layout.setGridSize(2, 0);
    layout.setColumnAlignment(0, ui::AlignRight);

    if (gameLoaded)
    {
        auto *sfxVolLabel   = LabelWidget::newWithText(tr("SFX Volume:"     ), &area());
        auto *musicVolLabel = LabelWidget::newWithText(tr("Music Volume:"   ), &area());
        auto *rvbVolLabel   = LabelWidget::newWithText(tr("Reverb Strength:"), &area());

        d->sound3D    ->setText(tr("3D Effects & Reverb"  ));
        d->overlapStop->setText(tr("One Sound per Emitter"));
        d->sound16bit ->setText(tr("16-bit Resampling"    ));

        auto *rateLabel = LabelWidget::newWithText(tr("Resampling:"), &area());

        d->sampleRate->items()
                << new ChoiceItem(tr("1x @ 11025 Hz"), 11025)
                << new ChoiceItem(tr("2x @ 22050 Hz"), 22050)
                << new ChoiceItem(tr("4x @ 44100 Hz"), 44100);

        auto *musSrcLabel = LabelWidget::newWithText(tr("Preferred Music:"), &area());

        d->musicSource->items()
                << new ChoiceItem(tr("MUS lumps"),      AudioSystem::MUSP_MUS)
                << new ChoiceItem(tr("External files"), AudioSystem::MUSP_EXT)
                << new ChoiceItem(tr("CD"),             AudioSystem::MUSP_CD);

        auto *sfLabel = LabelWidget::newWithText(tr("MIDI Sound Font:"), &area());

        // Layout.
        layout << *sfxVolLabel      << *d->sfxVolume
               << *musicVolLabel    << *d->musicVolume
               << *rvbVolLabel      << *d->reverbVolume
               << Const(0)          << *d->sound3D
               << Const(0)          << *d->overlapStop
               << *rateLabel        << *d->sampleRate
               << Const(0)          << *d->sound16bit
               << *musSrcLabel      << *d->musicSource
               << *sfLabel          << *d->musicSoundfont;
    }

    auto *soundPluginLabel = LabelWidget::newWithText(tr("SFX Plugin:"  ), &area());
    auto *musicPluginLabel = LabelWidget::newWithText(tr("Music Plugin:"), &area());
    auto *cdPluginLabel    = LabelWidget::newWithText(tr("CD Plugin:"   ), &area());

    LabelWidget *pluginLabel = LabelWidget::newWithText(_E(D) + tr("Audio Backend"), &area());
    pluginLabel->setFont("separator.label");
    pluginLabel->margins().setTop("gap");
    layout.setCellAlignment(Vector2i(0, layout.gridSize().y), ui::AlignLeft);
    layout.append(*pluginLabel, 2);

    layout << *soundPluginLabel << *d->soundPlugin
           << *musicPluginLabel << *d->musicPlugin
           << *cdPluginLabel    << *d->cdPlugin;

    area().setContentSize(layout.width(), layout.height());

    buttons()
            << new DialogButtonItem(DialogWidget::Default | DialogWidget::Accept, tr("Close"))
            << new DialogButtonItem(DialogWidget::Action, tr("Reset to Defaults"),
                                    new SignalAction(this, SLOT(resetToDefaults())));
    if (gameLoaded)
    {
        buttons() << new DialogButtonItem(DialogWidget::ActionPopup | Id1,
                                          style().images().image("gauge"));
        popupButtonWidget(Id1)->setPopup(*d->devPopup);
    }

    d->fetch();
}
开发者ID:,项目名称:,代码行数:79,代码来源:


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