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


C++ LinearLayout::addItem方法代码示例

本文整理汇总了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);
}
开发者ID:citic,项目名称:botNeumann,代码行数:29,代码来源:GameMenuScene.cpp

示例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 );
}
开发者ID:citic,项目名称:botNeumann,代码行数:30,代码来源:GameMenuScene.cpp


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