本文整理汇总了C++中TupScene::layerAt方法的典型用法代码示例。如果您正苦于以下问题:C++ TupScene::layerAt方法的具体用法?C++ TupScene::layerAt怎么用?C++ TupScene::layerAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TupScene
的用法示例。
在下文中一共展示了TupScene::layerAt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insertSymbolIntoFrame
bool TupProject::insertSymbolIntoFrame(TupProject::Mode spaceMode, const QString &name, int sceneIndex,
int layerIndex, int frameIndex)
{
#ifdef K_DEBUG
#ifdef Q_OS_WIN
qDebug() << "[TupProject::insertSymbolIntoFrame()]";
#else
T_FUNCINFO;
#endif
#endif
TupFrame *frame = 0;
TupScene *scene = this->sceneAt(sceneIndex);
if (scene) {
if (spaceMode == TupProject::FRAMES_EDITION) {
TupLayer *layer = scene->layerAt(layerIndex);
if (layer)
frame = layer->frameAt(frameIndex);
else
return false;
} else if (spaceMode == TupProject::STATIC_BACKGROUND_EDITION) {
TupBackground *bg = scene->background();
if (bg)
frame = bg->staticFrame();
else
return false;
} else if (spaceMode == TupProject::DYNAMIC_BACKGROUND_EDITION) {
TupBackground *bg = scene->background();
if (bg)
frame = bg->dynamicFrame();
else
return false;
} else {
#ifdef K_DEBUG
QString msg = "TupProject::insertSymbolIntoFrame() - Fatal Error: invalid spaceMode!";
#ifdef Q_OS_WIN
qDebug() << msg;
#else
tError() << msg;
#endif
#endif
return false;
}
if (frame) {
TupLibraryObject *object = k->library->getObject(name);
if (object) {
switch (object->type()) {
case TupLibraryObject::Item:
{
TupGraphicLibraryItem *libraryItem = new TupGraphicLibraryItem(object);
int zLevel = frame->getTopZLevel();
libraryItem->setZValue(zLevel);
frame->addLibraryItem(name, libraryItem);
}
break;
case TupLibraryObject::Image:
{
TupGraphicLibraryItem *libraryItem = new TupGraphicLibraryItem(object);
int imageW = libraryItem->boundingRect().width();
int imageH = libraryItem->boundingRect().height();
if (k->dimension.width() > imageW && k->dimension.height() > imageH)
libraryItem->moveBy((k->dimension.width() - imageW)/2, (k->dimension.height() - imageH)/2);
else
libraryItem->moveBy(0, 0);
int zLevel = frame->getTopZLevel();
libraryItem->setZValue(zLevel);
frame->addItem(name, libraryItem);
}
break;
case TupLibraryObject::Svg:
{
QString path(object->dataPath());
TupSvgItem *svgItem = new TupSvgItem(path, frame);
svgItem->setSymbolName(name);
int svgW = svgItem->boundingRect().width();
int svgH = svgItem->boundingRect().height();
if (k->dimension.width() > svgW && k->dimension.height() > svgH) {
svgItem->moveBy((k->dimension.width() - svgW)/2, (k->dimension.height() - svgH)/2);
} else {
qreal factorW = ((qreal)k->dimension.width())/((qreal)svgW);
qreal factorH = ((qreal)k->dimension.height())/((qreal)svgH);
if (factorW < factorH)
svgItem->setScale(factorW);
else
svgItem->setScale(factorH);
svgItem->moveBy(0, 0);
}
int zLevel = frame->getTopZLevel();
//.........这里部分代码省略.........