major 'firzifikation'
This commit is contained in:
@@ -144,7 +144,7 @@ XQItem::XQItem(XQItemType* itemType, const QString *content, const XQNodePtr& co
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
XQItem::XQItem(const XQItem& other)
|
||||
: QStandardItem( other )
|
||||
{
|
||||
@@ -152,17 +152,22 @@ XQItem::XQItem(const XQItem& other)
|
||||
// die data() struktur
|
||||
}
|
||||
|
||||
XQItem& XQItem::operator=(const XQItem& other)
|
||||
{
|
||||
if( this != &other)
|
||||
{
|
||||
// kopiert data()
|
||||
this->QStandardItem::operator=( other );
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
*/
|
||||
|
||||
//! firz
|
||||
|
||||
XQItem::~XQItem()
|
||||
{
|
||||
// fixed choices lebt im item type, also
|
||||
// im parent
|
||||
|
||||
//QAbstractItemModel* model = fixedChoices();
|
||||
//if( model )
|
||||
// delete model;
|
||||
}
|
||||
|
||||
|
||||
@@ -178,12 +183,13 @@ XQItem* XQItem::clone() const
|
||||
}
|
||||
|
||||
|
||||
//! firz
|
||||
//! false für ein ungültiges item. 'ungültig' heisst hier, dass nur ein
|
||||
//! mockup-itemtype gesetzt ist.
|
||||
|
||||
bool XQItem::isValid() const
|
||||
{
|
||||
// fragwürdig
|
||||
return QStandardItem::data( XQItem::ItemTypeRole ).value<XQItemType*>() != nullptr;
|
||||
XQItemType* dummyType = XQItemType::staticItemType();
|
||||
return QStandardItem::data( XQItem::ItemTypeRole ).value<XQItemType*>() != dummyType;
|
||||
}
|
||||
|
||||
|
||||
@@ -429,12 +435,14 @@ QString XQItem::fixedChoicesToString() const
|
||||
}
|
||||
|
||||
//! setzt das auswahl-model für read-only comboboxes
|
||||
|
||||
void XQItem::setfixedChoices( QStandardItemModel* newModel )
|
||||
{
|
||||
setData( QVariant::fromValue(newModel), XQItem::FixedChoicesRole);
|
||||
}
|
||||
|
||||
//! true, wenn 'ich' ein header item bin
|
||||
|
||||
bool XQItem::isHeaderStyle()
|
||||
{
|
||||
return renderStyle() == XQItem::HeaderStyle;
|
||||
@@ -442,6 +450,7 @@ bool XQItem::isHeaderStyle()
|
||||
|
||||
|
||||
//! gibt den namen der datarole zurück
|
||||
|
||||
QString XQItem::dataRoleName(int role)
|
||||
{
|
||||
if( role < XQItem::NoRole && model() )
|
||||
@@ -451,6 +460,7 @@ QString XQItem::dataRoleName(int role)
|
||||
|
||||
//! angespasste variante von qstandarditem::setData. geteilte attribute
|
||||
//! werden vom xqitemtype geholt
|
||||
|
||||
QVariant XQItem::data(int role ) const
|
||||
{
|
||||
//emitDataChanged()
|
||||
|
@@ -125,16 +125,12 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//XQItem(int rows, int columns = 1);
|
||||
XQItem();
|
||||
|
||||
XQItem( XQItemType* itemType );
|
||||
XQItem( XQItemType* itemType, const QString* content );
|
||||
XQItem( XQItemType* itemType, const QString* content, const XQNodePtr& contentNode );
|
||||
|
||||
XQItem(const XQItem& other);
|
||||
XQItem(const QStandardItem& other);
|
||||
|
||||
virtual ~XQItem();
|
||||
|
||||
//! creates not a clone but a new default item, \see QStandardItemModel::setItemPrototype()
|
||||
@@ -184,7 +180,6 @@ public:
|
||||
QString renderStyleToString() const;
|
||||
void setRenderStyle(RenderStyle renderStyle );
|
||||
|
||||
//! fitze FATZE!
|
||||
EditorType editorType() const;
|
||||
QString editorTypeToString() const;
|
||||
void setEditorType(EditorType editorType);
|
||||
@@ -195,9 +190,11 @@ public:
|
||||
|
||||
QString contentFormat() const;
|
||||
void setContentFormat(const QString& contentFormat);
|
||||
|
||||
QStandardItemModel* fixedChoices() const;
|
||||
QString fixedChoicesToString() const;
|
||||
|
||||
QString fixedChoicesToString() const;
|
||||
|
||||
//! setzt das auswahl-model für read-only comboboxes
|
||||
void setfixedChoices( QStandardItemModel* newModel );
|
||||
|
||||
//
|
||||
@@ -205,20 +202,11 @@ public:
|
||||
//
|
||||
|
||||
bool isHeaderStyle();
|
||||
|
||||
//! gibt den namen der datarole zurück
|
||||
QString dataRoleName(int role);
|
||||
|
||||
//! angespasste variante von qstandarditem::data
|
||||
QVariant data(int role = Qt::DisplayRole ) const override;
|
||||
|
||||
//! angespasste variante von qstandarditem::setData
|
||||
void setData(const QVariant &value, int role ) override;
|
||||
|
||||
// Das sind die die items im tree links: icon,text, node pointer
|
||||
//XQItem( const QString& text, XQNodePtr contentNode );
|
||||
//XQItem( const QString& text, XQItemType::RenderStyle renderStyle );
|
||||
|
||||
/*
|
||||
template<class T>
|
||||
void setToVariant(T entry, QtExtUserRoles::NTDataRoles role)
|
||||
@@ -254,6 +242,9 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
XQItem(const XQItem& other) = default;
|
||||
XQItem& operator=(const XQItem& other) = default;
|
||||
|
||||
using XQItemFlagMap = QMap<QString,int>;
|
||||
using XQItemDataRoleMap = QMap<QString,int>;
|
||||
using XQRenderStyleMap = QMap<QString,RenderStyle>;
|
||||
@@ -268,6 +259,9 @@ protected:
|
||||
static XQUnitTypeMap s_UnitTypeMap;
|
||||
static XQPrefixExponentMap s_PrefixExponentMap;
|
||||
|
||||
//! leerer itemtype als mockup für den xqitem default constructor
|
||||
static XQItemType s_DummyItemType;
|
||||
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(XQItem::RenderStyle);
|
||||
|
@@ -69,9 +69,9 @@ XQItemDelegate::XQItemDelegate( XQViewModel& modelView)
|
||||
}
|
||||
|
||||
|
||||
XQTreeTable* XQItemDelegate::treeView() const
|
||||
XQTreeTable* XQItemDelegate::treeTable() const
|
||||
{
|
||||
return _modelView.treeView();
|
||||
return _modelView.treeTable();
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ XQItem& XQItemDelegate::xqItemFromIndex( const QModelIndex& index ) const
|
||||
QWidget* XQItemDelegate::prepareHeaderOption(const QStyleOptionViewItem& option, const QModelIndex& index, QStyleOptionHeader& headerOption) const
|
||||
{
|
||||
// use the header as "parent" for style init
|
||||
QWidget* srcWidget = treeView()->header();
|
||||
QWidget* srcWidget = treeTable()->header();
|
||||
headerOption.initFrom(srcWidget);
|
||||
headerOption.text = index.data(Qt::DisplayRole).toString();
|
||||
headerOption.rect = option.rect;
|
||||
|
@@ -34,7 +34,7 @@ public:
|
||||
|
||||
explicit XQItemDelegate(XQViewModel& modelView);
|
||||
|
||||
XQTreeTable* treeView() const;
|
||||
XQTreeTable* treeTable() const;
|
||||
XQItem& xqItemFromIndex( const QModelIndex& index ) const;
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
|
Reference in New Issue
Block a user