本文整理汇总了C++中LinearLayout::addItem方法的典型用法代码示例。如果您正苦于以下问题:C++ LinearLayout::addItem方法的具体用法?C++ LinearLayout::addItem怎么用?C++ LinearLayout::addItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinearLayout
的用法示例。
在下文中一共展示了LinearLayout::addItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupConfigButtons
void GameMenuScene::setupConfigButtons(LinearLayout* parentLayout)
{
SvgButton* infoButton = new SvgButton("ge_button_information", this);
SvgButton* rewardsButton = new SvgButton("ge_button_rewards", this);
SvgButton* configButton = new SvgButton("ge_button_config", this);
LinearLayout* configButtonLayout = new LinearLayout(Qt::Horizontal);
configButtonLayout->addItem(infoButton, 1.0 / 3.0);
configButtonLayout->addItem(rewardsButton, 1.0 / 3.0);
configButtonLayout->addItem(configButton, 1.0 / 3.0);
parentLayout->addLayout( configButtonLayout, 1.0 / 6.0 );
infoButton->setPaddings(0.15, 0.0, 0.15, 0.4);
rewardsButton->setPaddings(0.15, 0.2, 0.15, 0.2);
configButton->setPaddings(0.15, 0.4, 0.15, 0.0);
infoButton->alignCenter();
rewardsButton->alignCenter();
configButton->alignCenter();
connect(infoButton, SIGNAL(pressed()), this, SLOT(infoButtonPressed()));
connect(rewardsButton, SIGNAL(pressed()), this, SLOT(rewardsButtonPressed()));
connect(configButton, SIGNAL(pressed()), this, SLOT(configButtonPressed()));
// ToDo: implement these buttons, disabled meanwhile
infoButton->setEnabled(false);
rewardsButton->setEnabled(false);
configButton->setEnabled(false);
}
示例2: Scene
GameMenuScene::GameMenuScene(Stage* stage, QGraphicsItem* parent)
: Scene(mapSceneName(sceneGameMenu), stage, parent)
{
setBackground("gm_background");
LinearLayout* leftLayout = new LinearLayout(Qt::Vertical);
Actor* gameTitle = new Actor("ge_game_title", this);
gameTitle->setPaddings(0.1);
leftLayout->addItem(gameTitle, 0.2);
LinearLayout* centralLayout = new LinearLayout(Qt::Horizontal);
leftLayout->addLayout(centralLayout, 0.8);
Actor* robot = new Actor("ge_robot", this);
robot->setPaddings(0.2);
centralLayout->addItem(robot, 0.5);
robot->alignCenter();
centralLayout->addStretch(0.5);
LinearLayout* rightLayout = new LinearLayout(Qt::Vertical);
setupButtons(rightLayout);
LinearLayout* globalLayout = new LinearLayout(Qt::Horizontal);
globalLayout->addLayout(leftLayout, 0.7);
globalLayout->addLayout(rightLayout, 0.3);
setLayout(globalLayout);
// This is the last scene loaded
QSettings settings;
settings.setValue( sk("Application/LastScene"), sceneName );
}