예제 #1
0
void QtTreeViewDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const 
{
	//VOXOX - JRT - 2009.08.10 - TODO: move this and drawGroup to QtContact class
	if (!index.parent().isValid()) 
	{
		drawGroup(painter, option, index);
	} 
	else 
	{
		//VOXOX - JRT - 2009.08.10 
		QtContact* qtContact = getItemData( index );

		if ( qtContact )
		{
//			if ( qtContact->isOpen() )
//			{
//				QWidget * parent = const_cast<QWidget*>(_parent);
////				QtContactWidget * widget = new QtContactWidget( qtContact->getId().toStdString(), qtContact->getKey().toStdString(), _cWengoPhone, _qtContactManager, parent);	//VOXOX - JRT - 2009.08.10 - multiple groups.
//				QtContactWidget * widget = new QtContactWidget( qtContact->getId().toStdString(), qtContact->getKey().toStdString(), _cWengoPhone, parent);	//VOXOX - JRT - 2009.10.15 
////				setSizeHint( 0, QSize(-1, getHeight() ) );
//			}
//			else
			{
			qtContact->paint( painter, option );
		}
	}
		else
		{
			int xxx = 1;
		}
	}
}
예제 #2
0
TibiaSprite LibraryFile::getSprite( qint32 index, qint32 frame )
{
	QMutexLocker locker( &mutex );

	TibiaSprite sprite;
	quint32 address = m_spriteHash.value( index );
	if( address == 0 )
	{
		getItemData( index );
	}
	if( address != 0 )
	{
		QDataStream in( this );
		in.setByteOrder( QDataStream::LittleEndian );
		TibiaFile::seek( address + frame * sizeof( quint32 ) );
		quint32 offset;
		in >> offset;

		if( offset == 0x00000000 ) // Return a blank image
			return sprite;

		TibiaFile::seek( offset );
		sprite.setDummy( false );
		TibiaFile::readSprite( in, sprite, 0, 0 );
	}
예제 #3
0
QWidget * QtTreeViewDelegate::createEditor(QWidget * parent, const QStyleOptionViewItem &, const QModelIndex & index) const
{
	QtContact* qtContact = getItemData( index );		//VOXOX - JRT - 2009.08.10 
//	QtContactWidget * widget = new QtContactWidget( qtContact->getId().toStdString(), qtContact->getKey().toStdString(), _cWengoPhone, _qtContactManager, parent);	//VOXOX - JRT - 2009.08.10 - multiple groups.
	QtContactWidget * widget = new QtContactWidget( qtContact->getId().toStdString(), qtContact->getKey().toStdString(), _cWengoPhone, parent);		//VOXOX - JRT - 2009.10.15 
	return widget;
}
예제 #4
0
파일: QtSkillModel.cpp 프로젝트: Kev/evexin
QVariant QtSkillModel::data(const QModelIndex& index, int role) const {
	if (!index.isValid()) return QVariant();
	boost::shared_ptr<SkillItem> item = getItem(index);
	if (!item) return QVariant();

	SkillLevel::ref skillLevel = boost::dynamic_pointer_cast<SkillLevel>(item);
	return skillLevel ? getLevelData(skillLevel, role) : getItemData(item, role);
	
}
QVariant ClangCodeCompletionModel::data(const QModelIndex& index, const int role) const
{
    if (!index.isValid())
        return QVariant{};                                  // Return nothing for invalid index

    if (index.internalId() == Level::GROUP)
        return getGroupData(index, role);

    // Ok, only leaf nodes here...
    return getItemData(index, role);
}
예제 #6
0
파일: QtSkillModel.cpp 프로젝트: Kev/evexin
QVariant QtSkillModel::getLevelData(SkillLevel::ref level, int role) const {
	switch (role) {
		case Qt::DisplayRole: {
			std::string name = level->getName();
			return P2QSTRING(name);
		}
		case SkillLevelRole: return level->getLevel();
		case SkillTrainingTimeRole: return character_ ? SkillTime::minutesToTrain(character_, level) : 0;
		default: return getItemData(level, role);
	}
}
예제 #7
0
void ListBox::setItemText(int index, const TCHAR *str)
{
  int si = getSelectedIndex();
  int top = getTopIndex();
  LRESULT lresult = SendMessage(m_hwnd, LB_GETTOPINDEX, NULL, NULL);
  UINT topIndex = (UINT)lresult;
  _ASSERT(topIndex == lresult);
  LPARAM data = getItemData(index);
  removeString(index);
  insertString(index, str, data);
  if (si == index) {
    setSelectedIndex(si);
  }
  setTopIndex(top);
}
예제 #8
0
void AbstractItemEditor::updateBrowser()
{
    BoolBlocker block(m_updatingBrowser);
    foreach (QtVariantProperty *prop, m_properties) {
        int role = m_propertyToRole.value(prop);
        QVariant val = getItemData(role);
        if (!val.isValid()) {
            if (role == ItemFlagsShadowRole)
                val = qVariantFromValue((int)QListWidgetItem().flags());
            else
                val = QVariant((int)prop->value().userType(), (void *)0);
            prop->setModified(false);
        } else {
            prop->setModified(true);
        }
        prop->setValue(val);
    }
예제 #9
0
void IntPropChioce::outputData()
{
	if ( !mData )
		return;

	int pos = getSelection();
	if ( pos == -1 )
		return;

	int  value = (int)getItemData( pos );
	switch( mDataSize )
	{
	case 1: *((int8*)mData)  = value; break;
	case 2: *((int16*)mData) = value; break;
	case 4: *((int32*)mData)   = value; break;
	}
}
예제 #10
0
void AbstractItemEditor::propertyChanged(QtProperty *property)
{
    if (m_updatingBrowser)
        return;


    BoolBlocker block(m_updatingBrowser);
    QtVariantProperty *prop = m_propertyManager->variantProperty(property);
    int role;
    if ((role = m_propertyToRole.value(prop, -1)) == -1)
        // Subproperty
        return;

    if ((role == ItemFlagsShadowRole && prop->value().toInt() == (int)QListWidgetItem().flags())
            || (role == Qt::DecorationPropertyRole && !qVariantValue<PropertySheetIconValue>(prop->value()).mask())
            || (role == Qt::FontRole && !qVariantValue<QFont>(prop->value()).resolve())) {
        prop->setModified(false);
        setItemData(role, QVariant());
    } else {
        prop->setModified(true);
        setItemData(role, prop->value());
    }

    switch (role) {
    case Qt::DecorationPropertyRole:
        setItemData(Qt::DecorationRole, qVariantFromValue(iconCache()->icon(qVariantValue<PropertySheetIconValue>(prop->value()))));
        break;
    case Qt::DisplayPropertyRole:
        setItemData(Qt::EditRole, qVariantFromValue(qVariantValue<PropertySheetStringValue>(prop->value()).value()));
        break;
    case Qt::ToolTipPropertyRole:
        setItemData(Qt::ToolTipRole, qVariantFromValue(qVariantValue<PropertySheetStringValue>(prop->value()).value()));
        break;
    case Qt::StatusTipPropertyRole:
        setItemData(Qt::StatusTipRole, qVariantFromValue(qVariantValue<PropertySheetStringValue>(prop->value()).value()));
        break;
    case Qt::WhatsThisPropertyRole:
        setItemData(Qt::WhatsThisRole, qVariantFromValue(qVariantValue<PropertySheetStringValue>(prop->value()).value()));
        break;
    default:
        break;
    }

    prop->setValue(getItemData(role));
}
예제 #11
0
QSize QtTreeViewDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const 
{
	QSize orig = QItemDelegate::sizeHint(option, index);
	QtContact* qtContact = getItemData( index );			//VOXOX - JRT - 2009.08.10 - Multiple groups

	if (qtContact) 
	{
		return QSize(orig.width(), qtContact->getHeight() );
	} 
	else 
	{
		if (!index.parent().isValid()) 
		{
			return (QSize(orig.width(), GROUP_WIDGET_FRAME_HEIGHT));
		}
	}

	return orig;
}
예제 #12
0
void IntPropChioce::inputData()
{
	if ( !mData )
		return;

	int value;
	switch( mDataSize )
	{
	case 1: value = *((int8*)mData);  break;
	case 2: value = *((int16*)mData); break;
	case 4: value = *((int32*)mData);   break;
	}
	for( int i = 0 ; i < getItemNum() ; ++i )
	{
		if ( value == (int)getItemData( i ) )
		{
			setSelection( i );
			break;
		}
	}
}