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


C++ ObjectItem类代码示例

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


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

示例1: getItemFromIndex

bool CObjectModel::isLayer(const QModelIndex &index) const
{
	if ( !index.isValid() ) { return false ; }
	ObjectItem *p = getItemFromIndex(index) ;
	return p->parent() == m_pRoot ? false : true ;
//	return index.parent().internalPointer() != m_pRoot ? true : false ;
}
开发者ID:moximoxi,项目名称:AnimationCreator,代码行数:7,代码来源:objectmodel.cpp

示例2: slot_setColorFromPicker

void AnimationForm::slot_setColorFromPicker(QRgb rgba)
{
	CObjectModel *pModel = m_pEditData->getObjectModel() ;
	QModelIndex index = m_pEditData->getSelIndex() ;
	if ( !pModel->isLayer(index) ) { return ; }

	int frame = m_pEditData->getSelectFrame() ;
	ObjectItem *pItem = pModel->getItemFromIndex(index) ;
	FrameData *pData = pItem->getFrameDataPtr(frame) ;
	if ( !pData ) {
		pData = pModel->getFrameDataFromPrevFrame(index, frame, true) ;
		if ( !pData ) { return ; }
		FrameData *pNext = pModel->getFrameDataFromNextFrame(index, frame) ;
		FrameData data = pData->getInterpolation(pNext, frame) ;
		data.rgba[0] = qRed(rgba) ;
		data.rgba[1] = qGreen(rgba) ;
		data.rgba[2] = qBlue(rgba) ;
		slot_addNewFrameData(index, frame, data);
	}
	else {
		pData->rgba[0] = qRed(rgba) ;
		pData->rgba[1] = qGreen(rgba) ;
		pData->rgba[2] = qBlue(rgba) ;

		addCommandEdit(*pData);
	}
}
开发者ID:moximoxi,项目名称:AnimationCreator,代码行数:27,代码来源:animationform.cpp

示例3: slot_setUI

// 選択オブジェクト変更
void AnimationForm::slot_changeSelectObject(QModelIndex index)
{
//	m_pEditData->setSelIndex(index) ;

	if ( !index.isValid() ) { return ; }

	CObjectModel *pModel = m_pEditData->getObjectModel() ;

	if ( pModel->isLayer(index) ) {
		bool valid ;
		ObjectItem *pItem = pModel->getItemFromIndex(index) ;
		FrameData data = pItem->getDisplayFrameData(m_pEditData->getSelectFrame(), &valid) ;
		if ( valid ) {
			slot_setUI(data) ;
		}
		emit sig_changeSelectLayer(index) ;
	}

	ObjectItem *pObj = pModel->getObject(index) ;
	if ( pObj ) {
		ui->spinBox_loop->setValue(pObj->getLoop());
		ui->spinBox_fps->setValue(pObj->getFps()) ;
	}

	m_pDataMarker->repaint();
	m_pGlWidget->update();
}
开发者ID:moximoxi,项目名称:AnimationCreator,代码行数:28,代码来源:animationform.cpp

示例4: qDebug

bool CObjectModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
{
	if ( action == Qt::IgnoreAction ) { return true ; }
	if ( !data->hasFormat("AnimationCreator/object.item.list") ) { return false ; }
	if ( column > 0 ) { return false ; }

	qDebug() << "dropMimeData row:" << row << " col:" << column ;
	qDebug() << " parent:" << parent << " action:" << action ;

	QByteArray encodeData = data->data("AnimationCreator/object.item.list") ;
	QDataStream stream(&encodeData, QIODevice::ReadOnly) ;

	while ( !stream.atEnd() ) {
		quint64 val ;
		ObjectItem *p ;
		stream >> val ;
		p = reinterpret_cast<ObjectItem *>(val) ;

		if ( p->parent() == m_pRoot ) {	// オブジェクト
			if ( !parent.isValid() ) {
				emit sig_copyIndex(row, p, parent, action) ;
			}
		}
		else {							// レイヤ
			if ( parent.isValid() ) {
				emit sig_copyIndex(row, p, parent, action) ;
			}
		}
	}

	return true ;
}
开发者ID:moximoxi,项目名称:AnimationCreator,代码行数:32,代码来源:objectmodel.cpp

示例5: slot_playAnimation

// アニメ再生
void AnimationForm::slot_playAnimation( void )
{
	if ( !m_pEditData->getPauseAnime() ) {	// ポーズ中じゃなかったら0フレームから再生
		ui->label_frame->setValue(0);
		m_pEditData->setCurrLoopNum(0);
	}

	m_pEditData->setPlayAnime(true) ;

	// 最大フレーム設定
	ObjectItem *p = m_pEditData->getObjectModel()->getObject(m_pEditData->getSelIndex()) ;
	if ( p ) {
		m_nMaxFrameNum = p->getMaxFrameNum() ;
	}

	m_pEditData->setPauseAnime(false);
	disconnect(ui->pushButton_play, SIGNAL(clicked()), this, SLOT(slot_playAnimation())) ;
	connect(ui->pushButton_play, SIGNAL(clicked()), this, SLOT(slot_pauseAnimation())) ;

	QIcon icon;
	icon.addFile(QString::fromUtf8(":/root/Resources/images/Button Pause_32.png"), QSize(), QIcon::Normal, QIcon::Off);
	ui->pushButton_play->setIcon(icon);

	m_pTimer->start();	// タイマースタート
	m_pGlWidget->update();
}
开发者ID:moximoxi,项目名称:AnimationCreator,代码行数:27,代码来源:animationform.cpp

示例6: flat

void CObjectModel::flat()
{
	for ( int i = 0 ; i < m_pRoot->childCount() ; i ++ ) {
		ObjectItem *pObj = m_pRoot->child(i) ;
		pObj->flat() ;
	}
	updateIndex() ;
}
开发者ID:moximoxi,项目名称:AnimationCreator,代码行数:8,代码来源:objectmodel.cpp

示例7: parent

QModelIndex CObjectModel::parent(const QModelIndex &child) const
{
	if ( !child.isValid() ) { return QModelIndex() ; }
	ObjectItem *c = static_cast<ObjectItem *>(child.internalPointer()) ;
	ObjectItem *p = c->parent() ;
	if ( p == m_pRoot || c == m_pRoot ) { return QModelIndex() ; }
	return createIndex(p->row(), 0, p) ;
}
开发者ID:moximoxi,项目名称:AnimationCreator,代码行数:8,代码来源:objectmodel.cpp

示例8: slot_changeLoop

// ループ回数変更
void AnimationForm::slot_changeLoop( int val )
{
	CObjectModel *pModel = m_pEditData->getObjectModel() ;
	QModelIndex index = m_pEditData->getSelIndex() ;
	ObjectItem *pItem = pModel->getObject(index) ;
	if ( !pItem ) { return ; }
	pItem->setLoop(val);
}
开发者ID:moximoxi,项目名称:AnimationCreator,代码行数:9,代码来源:animationform.cpp

示例9:

ObjectItem *CObjectModel::getObject(const QModelIndex &index)
{
	if ( !index.isValid() ) { return NULL ; }
	ObjectItem *p = static_cast<ObjectItem *>(index.internalPointer()) ;
	while ( p->parent() != m_pRoot ) {
		p = p->parent() ;
	}
	return p ;
}
开发者ID:moximoxi,项目名称:AnimationCreator,代码行数:9,代码来源:objectmodel.cpp

示例10: ObjectItem

// Store objects with their propterties as QJsonObjects
// This way, every object can have custom properties, without creating special object classes
// The objects and its properties also may be saved to file in a human readable and modifiable format
bool ObjectContainer::add(ObjectType type, QJsonObject& data)
{
	if (!verifyData(data)) return false;

	ObjectItem* item = new ObjectItem(data["name"].toString());
	item->setData(data);
	m_model.appendRow(item);
	return true;
}
开发者ID:gudajan,项目名称:Windsim,代码行数:12,代码来源:objectContainer.cpp

示例11:

FrameData *ObjectItem::getParentFrameDataPtr(int frame)
{
	ObjectItem *parent = m_pParent ;
	while ( parent ) {
		FrameData *p = parent->getFrameDataPtr(frame) ;
		if ( p ) { return p ; }
		parent = parent->m_pParent ;
	}
	return NULL ;
}
开发者ID:chankame,项目名称:AnimationCreator,代码行数:10,代码来源:objectitem.cpp

示例12: slot_deleteAllFrame

void DataMarkerLabel::slot_deleteAllFrame()
{
    ObjectModel *pModel = m_pEditData->getObjectModel();
    ObjectItem *pItem = pModel->getObject(m_pEditData->getSelIndex());
    if (!pItem)
    {
        return;
    }
    m_pEditData->cmd_deleteAllFrame(pItem->getIndex(), m_value);
}
开发者ID:chocoball,项目名称:AnimationCreator,代码行数:10,代码来源:datamarkerlabel.cpp

示例13: beginRemoveRows

bool CObjectModel::removeRows(int row, int count, const QModelIndex &parent)
{
	beginRemoveRows(parent, row, row+count-1) ;

	ObjectItem *p = getItemFromIndex(parent) ;
	p->removeChild(p->child(row)) ;

	endRemoveRows();
	return true ;
}
开发者ID:moximoxi,项目名称:AnimationCreator,代码行数:10,代码来源:objectmodel.cpp

示例14: mousePressEvent

void DataMarkerLabel::mousePressEvent(QMouseEvent *ev)
{
    m_bMouseMove = false;
    m_bPressLeft = false;
    m_moveMode = kMoveMode_None;
#if 0
	if ( ev->button() != Qt::LeftButton ) {
		ev->ignore();
		return ;
	}
#endif
    m_oldMousePos = ev->pos();
    m_bPressLeft = true;
    m_pressFrame = m_pressCurrentFrame = -1;

    ObjectModel *pModel = m_pEditData->getObjectModel();
    QModelIndex index = m_pEditData->getSelIndex();
    ObjectItem *pItem = pModel->getItemFromIndex(index);

    // 移動予定のフレームデータ取得
    if (ev->y() < height() / 3)
    {
        if (pModel->isLayer(index))
        {
            for (int i = m_frameStart; i <= m_frameEnd; i++)
            {
                if (ev->pos().x() >= getX(i) && ev->pos().x() < getX(i + 1))
                {
                    if (pItem->getFrameDataPtr(i))
                    {
                        m_pressCurrentFrame = m_pressFrame = i;
                        m_moveMode = kMoveMode_Layer;
                    }
                    break;
                }
            }
        }
    }
    else if (pModel->isObject(index) && ev->y() < height() * 2 / 3)
    {
        for (int i = m_frameStart; i <= m_frameEnd; i++)
        {
            if (ev->pos().x() >= getX(i) && ev->pos().x() < getX(i + 1))
            {
                if (pItem->getFrameDataPtr(i, true))
                {
                    m_pressCurrentFrame = m_pressFrame = i;
                    m_moveMode = kMoveMode_Object;
                }
                break;
            }
        }
    }
}
开发者ID:chocoball,项目名称:AnimationCreator,代码行数:54,代码来源:datamarkerlabel.cpp

示例15: insertRows

QModelIndex CObjectModel::insertItem(int row, QString name, const QModelIndex &parent)
{
	insertRows(row, 1, parent) ;

	QModelIndex index = this->index(row, 0, parent) ;
	ObjectItem *p = static_cast<ObjectItem *>(index.internalPointer()) ;
	p->setIndex(index) ;
	setData(index, name, Qt::EditRole) ;
//	qDebug() << "insertItem row:" << row << " name:" << name << " p:" << p ;
	return index ;
}
开发者ID:moximoxi,项目名称:AnimationCreator,代码行数:11,代码来源:objectmodel.cpp


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