Revert "rework xqitem::setData, part I"
This reverts commit 20b9ba967d
.
This commit is contained in:
@@ -37,18 +37,18 @@ XQItem::XQItemFlagMap XQItem::s_ItemFlagMap
|
||||
|
||||
XQItem::XQItemDataRoleMap XQItem::s_ItemDataRoleMap
|
||||
{
|
||||
{"ItemTypeRole", ItemTypeRole},
|
||||
{"ContentRole", ContentRole},
|
||||
{"RenderStyleRole", RenderStyleRole},
|
||||
{"EditorTypeRole", EditorTypeRole},
|
||||
{"ItemFlagsRole", FlagsRole},
|
||||
{"UnitTypeRole", UnitTypeRole},
|
||||
{"ContentFormatRole", ContentFormatRole},
|
||||
{"FlagsRoleRole", FlagsRole},
|
||||
{"IconRole", IconRole},
|
||||
{"FixedChoicesRole", FixedChoicesRole},
|
||||
{"DataNodeRole", ContentNodeRole},
|
||||
{"SheetNodeRole", SheetNodeRole}
|
||||
{"ItemType", ItemTypeRole},
|
||||
{"Content", ContentRole},
|
||||
{"RenderStyle", RenderStyleRole},
|
||||
{"EditorType", EditorTypeRole},
|
||||
{"ItemFlags", FlagsRole},
|
||||
{"UnitType", UnitTypeRole},
|
||||
{"ContentFormat", ContentFormatRole},
|
||||
{"FlagsRole", FlagsRole},
|
||||
{"Icon", IconRole},
|
||||
{"FixedChoices", FixedChoicesRole},
|
||||
{"DataNode", ContentNodeRole},
|
||||
{"SheetNode", SheetNodeRole}
|
||||
};
|
||||
|
||||
// No bi-map needed here, qmap.key() is sufficient for the job
|
||||
@@ -388,12 +388,7 @@ bool XQItem::isHeaderStyle()
|
||||
}
|
||||
|
||||
|
||||
QString XQItem::dataRoleName(int role)
|
||||
{
|
||||
if( role < XQItem::NoRole && model() )
|
||||
return model()->roleNames()[role];
|
||||
return XQItem::fetchItemDataRoleName(role);
|
||||
}
|
||||
|
||||
|
||||
QVariant XQItem::data(int role ) const
|
||||
{
|
||||
@@ -475,8 +470,7 @@ QVariant XQItem::data(int role ) const
|
||||
|
||||
void XQItem::setData(const QVariant& value, int role )
|
||||
{
|
||||
|
||||
//qDebug() << " -- item set data: " << value.toString() << " for: " << role << ": " << dataRoleName(role);
|
||||
//replaceAttribute( XQItem* item, XQItem::ItemDataRole role, const QVariant& newValue)
|
||||
|
||||
//emitDataChanged()
|
||||
switch(role)
|
||||
@@ -495,34 +489,19 @@ void XQItem::setData(const QVariant& value, int role )
|
||||
itemType().replaceAttribute( this, value, role );
|
||||
break;
|
||||
|
||||
case ContentNodeRole:
|
||||
case SheetNodeRole:
|
||||
|
||||
case TypeKeyRole:
|
||||
case Qt::DisplayRole :
|
||||
case Qt::EditRole :
|
||||
// return the raw, unformatted data
|
||||
case ContentRole:
|
||||
{
|
||||
//qDebug() << " -- item set data xxx: " << value.toString() << " for: " << role;
|
||||
break;
|
||||
|
||||
QString* contentPtr = QStandardItem::data( XQItem::ContentRole ).value<QString*>();
|
||||
if(contentPtr)
|
||||
{
|
||||
|
||||
contentPtr->operator=( value.toString() );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// what to do here?
|
||||
case ContentNodeRole:
|
||||
case SheetNodeRole:
|
||||
case TypeKeyRole:
|
||||
default:
|
||||
break;
|
||||
QStandardItem::setData( value,role);
|
||||
|
||||
}
|
||||
|
||||
QStandardItem::setData( value,role);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -555,8 +534,6 @@ int XQItem::fetchItemDataRole( const QString& dataRoleKey )
|
||||
|
||||
QString XQItem::fetchItemDataRoleName( int dataRole )
|
||||
{
|
||||
//if( dataRole < XQItem::NoRole)
|
||||
// return this->model()->
|
||||
return s_ItemDataRoleMap.key(dataRole);
|
||||
}
|
||||
|
||||
|
@@ -225,7 +225,6 @@ public:
|
||||
bool isHeaderStyle();
|
||||
// ...
|
||||
|
||||
QString dataRoleName(int role);
|
||||
QVariant data(int role = Qt::DisplayRole ) const override;
|
||||
void setData(const QVariant &value, int role ) override;
|
||||
|
||||
|
@@ -40,7 +40,6 @@ public:
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
|
||||
void setEditorData(QWidget *editor, const QModelIndex &index) const override;
|
||||
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
|
||||
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
|
@@ -105,7 +105,6 @@ void XQCommand::saveNodes( const QModelIndexList& list )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//! erzeugt einen string aus dem command-type, fürs debuggen.
|
||||
|
||||
QString XQCommand::toString()
|
||||
|
@@ -27,9 +27,6 @@ struct XQNodeBackup
|
||||
XQNodePtr contentNode;
|
||||
};
|
||||
|
||||
//!
|
||||
//! \brief The XQNodeStore class
|
||||
//!
|
||||
class XQNodeStore : public QVector<XQNodeBackup>
|
||||
{
|
||||
|
||||
@@ -40,9 +37,8 @@ public:
|
||||
|
||||
};
|
||||
|
||||
//! Das command enthält immer auch die betroffenen items
|
||||
//! ist also auch ein node store
|
||||
|
||||
// Das command enthält immer auch die betroffenen items
|
||||
// ist also auch eine SavedNodeList
|
||||
class XQCommand : public QUndoCommand, public XQNodeStore
|
||||
{
|
||||
|
||||
|
Reference in New Issue
Block a user