本文整理汇总了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 ;
}
示例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);
}
}
示例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();
}
示例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 ;
}
示例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();
}
示例6: flat
void CObjectModel::flat()
{
for ( int i = 0 ; i < m_pRoot->childCount() ; i ++ ) {
ObjectItem *pObj = m_pRoot->child(i) ;
pObj->flat() ;
}
updateIndex() ;
}
示例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) ;
}
示例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);
}
示例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 ;
}
示例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;
}
示例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 ;
}
示例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);
}
示例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 ;
}
示例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;
}
}
}
}
示例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 ;
}