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


C++ ToggleButton::setHorizontalAlignment方法代码示例

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


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

示例1: paint

Container *AnimationRecipe::setUpControllerContainer()
{
    bool connectResult;
    Q_UNUSED(connectResult);

    // The controllerContainer is the bottom part of the animation recipe.
    // It is where the descriptive text and a toggle button for triggering the
    // animations are kept.
    ImagePaint paint(QUrl("asset:///images/background.png"), RepeatPattern::XY);
    Container *controllerContainer = Container::create().layout(new DockLayout())
            .horizontal(HorizontalAlignment::Fill).background(paint)
            .top(UiValues::instance()->intValue(UiValues::UI_PADDING_STANDARD))
            .bottom(UiValues::instance()->intValue(UiValues::UI_PADDING_STANDARD))
            .left(UiValues::instance()->intValue(UiValues::UI_PADDING_STANDARD))
            .right(UiValues::instance()->intValue(UiValues::UI_PADDING_STANDARD));

    // Set up the a Label with a descriptive text.
    Label *actionLabel = new Label();
    actionLabel->setText("More Eggs");
    actionLabel->textStyle()->setBase(SystemDefaults::TextStyles::titleText());

    // Set up the ToggleButton and connect to its onChanged signal. In
    // the slot function onToggleChanged, we trigger the animations.
    ToggleButton *toggle = new ToggleButton();
    toggle->setHorizontalAlignment(HorizontalAlignment::Right);
    connectResult = connect(toggle, SIGNAL(checkedChanged(bool)), this, SLOT(onToggleChanged(bool)));
    Q_ASSERT(connectResult);

    controllerContainer->add(actionLabel);
    controllerContainer->add(toggle);

    return controllerContainer;
}
开发者ID:AlessioCampanelli,项目名称:Cascades-Samples,代码行数:33,代码来源:animationrecipe.cpp

示例2: createCheckboxShowRealFPS

/*************************************************************************
    Creates a checkbox to let the user choose to display randomised or real FPS value
*************************************************************************/
void CustomShapesDrawingSample::createCheckboxShowRealFPS()
{
    WindowManager& winMgr = WindowManager::getSingleton();

    // We create a button and subscribe to its click events
    ToggleButton* checkboxShowRealFPS = static_cast<CEGUI::ToggleButton*>(winMgr.createWindow("WindowsLook/Checkbox"));
    checkboxShowRealFPS->setSize(CEGUI::USize(cegui_reldim(0.25f), cegui_reldim(0.035f)));
    checkboxShowRealFPS->setHorizontalAlignment(HA_CENTRE);
    checkboxShowRealFPS->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_reldim(0.13f)));
    checkboxShowRealFPS->setText("Show randomly generated FPS values");
    checkboxShowRealFPS->subscribeEvent(ToggleButton::EventSelectStateChanged, Event::Subscriber(&CustomShapesDrawingSample::handleToggleButtonShowRandomisedFpsSelectionChanged, this));
    checkboxShowRealFPS->setSelected(true);
    d_root->addChild(checkboxShowRealFPS);
}
开发者ID:arkana-fts,项目名称:cegui,代码行数:17,代码来源:CustomShapesDrawing.cpp

示例3: Container

Container *Intro::setUpExampleUI()
{
    // A small example UI, illustrating some of the core controls.
    // The UI is arranged using a Container with a stack layout.
    Container *exampleUI = new Container();
    StackLayout *exampleUILayout = new StackLayout();

    exampleUI->setLayout(exampleUILayout);

    // A TextArea with text input functionality
    TextArea *exampleTextArea = new TextArea();
    exampleTextArea->textStyle()->setBase(SystemDefaults::TextStyles::bodyText());
    exampleTextArea->setHorizontalAlignment(HorizontalAlignment::Fill);

    // An example of a Slider
    Slider *exampleSlider = new Slider();
    exampleSlider->setValue(0.5f);
    exampleSlider->setHorizontalAlignment(HorizontalAlignment::Left);
    exampleSlider->setVerticalAlignment(VerticalAlignment::Bottom);

    // A ToggleButton
    ToggleButton *exampleToggle = new ToggleButton();
    exampleToggle->setHorizontalAlignment(HorizontalAlignment::Right);

    // A regular Button
    Button *exampleButton = new Button();
    exampleButton->setText("Button");

    // Container for the buttons
    Container *buttonContainer = new Container();
    DockLayout *buttonContainerLayout = new DockLayout();

    buttonContainer->setLayout(buttonContainerLayout);
    buttonContainer->setHorizontalAlignment(HorizontalAlignment::Fill);

    // Adding the buttons to the container.
    buttonContainer->add(exampleToggle);
    buttonContainer->add(exampleButton);

    // Add the Controls to the Container, the layouting is done using
    // layout properties and margins of each control (see code above).
    exampleUI->add(exampleTextArea);
    exampleUI->add(exampleSlider);
    exampleUI->add(buttonContainer);

    return exampleUI;
}
开发者ID:Angtrim,项目名称:Cascades-Samples,代码行数:47,代码来源:intro.cpp

示例4: QObject

CustomDialogAlarm::CustomDialogAlarm(QObject * parent) :
        QObject(parent), mVisible(false)
{
    bool connectResult;
    Q_UNUSED(connectResult);

    mCustomDialog = new Dialog();

    Container *contentContainer = new Container();
    contentContainer->setLayout(new DockLayout());

    // The dialog Container does not automatically fill the entire screen like a Page does, so in order
    // for it to be possible to center the dialog on screen, the width and height must be set.
    contentContainer->setPreferredSize(768, 1280);

    // The background is set to semi-transparent to indicate that it is not possible to interact
    // with the screen behind the dialog.
    contentContainer->setBackground(Color::fromARGB(0x88000000));

    // Dialog Container
    Container *dialogContainer = new Container();
    dialogContainer->setLayout(new DockLayout());
    dialogContainer->setHorizontalAlignment(HorizontalAlignment::Center);
    dialogContainer->setVerticalAlignment(VerticalAlignment::Center);
    dialogContainer->setMaxHeight(397);

    // Dialog background image
    ImageView *dialogBack = ImageView::create(
            "asset:///images/customdialog/customdialog_alarm.png");

    // Dialog content Container
    Container *dialogContent = Container::create().top(5).bottom(23).left(23);
    dialogContent->setHorizontalAlignment(HorizontalAlignment::Fill);
    dialogContent->setVerticalAlignment(VerticalAlignment::Fill);

    // Title label for dialog
    Label *dialogTitle = new Label();
    dialogTitle->setText("FIRE ALARM!");
    dialogTitle->textStyle()->setBase(SystemDefaults::TextStyles::titleText());
    dialogTitle->textStyle()->setColor(Color::fromARGB(0xfffafafa));
    dialogTitle->setLayoutProperties(StackLayoutProperties::create().spaceQuota(1));
    dialogTitle->setHorizontalAlignment(HorizontalAlignment::Center);

    // Text label for dialog
    Label *dialogText = new Label();
    dialogText->setText("BEEP! BEEP! BEEP!");
    dialogText->textStyle()->setBase(SystemDefaults::TextStyles::titleText());
    dialogText->setLayoutProperties(StackLayoutProperties::create().spaceQuota(2.5));

    // Toggle button for alarm
    ToggleButton *toggleAlarm = new ToggleButton();
    toggleAlarm->setLayoutProperties(StackLayoutProperties::create().spaceQuota(1));
    toggleAlarm->setHorizontalAlignment(HorizontalAlignment::Center);

    // Connect to signals
    connectResult = connect(toggleAlarm, SIGNAL(checkedChanged(bool)), this, SLOT(onAlarmSwitch(bool)));
    Q_ASSERT(connectResult);

    connectResult = connect(this, SIGNAL(visibleChanged(bool)), toggleAlarm, SLOT(setChecked(bool)));
    Q_ASSERT(connectResult);

    // Add components to the appropriate Containers
    dialogContent->add(dialogTitle);
    dialogContent->add(dialogText);
    dialogContent->add(toggleAlarm);

    dialogContainer->add(dialogBack);
    dialogContainer->add(dialogContent);
    contentContainer->add(dialogContainer);

    mCustomDialog->setContent(contentContainer);
}
开发者ID:AlessioCampanelli,项目名称:Cascades-Samples,代码行数:72,代码来源:customdialogalarm.cpp


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