minor cleanups.

This commit is contained in:
2025-08-07 02:36:13 +02:00
parent 97836f19dd
commit e3256c68f0
9 changed files with 20 additions and 186 deletions

View File

@@ -120,10 +120,7 @@ XQItem::XQPrefixExponentMap XQItem::s_PrefixExponentMap
XQItem::XQItem()
: XQItem{XQItemType::staticItemType()}
{
setFlags(Qt::NoItemFlags);
//setText("[dummy]");
//XQItemType::setStaticType( this );
//setItemType(NTItemType::defaultItemType());
}
XQItem::XQItem( XQItemType* itemType )
@@ -146,7 +143,7 @@ XQItem::XQItem(XQItemType* itemType, const QString *content, const XQNodePtr& co
setContentNode(contentNode);
}
/// ------------------ forbidden fruits ------------------
XQItem::XQItem(const XQItem& other)
: QStandardItem( other )
@@ -309,8 +306,6 @@ void XQItem::setRenderStyle(RenderStyle renderStyle )
}
//! firz
XQItem::EditorType XQItem::editorType() const
{
return data( EditorTypeRole ).value<EditorType>();

View File

@@ -24,7 +24,6 @@
using XQItemList = QList<QStandardItem*>;
//class QStyleOptionViewItem;
class XQItemFactory;
class XQItemType;
@@ -38,9 +37,6 @@ class XQItem : public QStandardItem
public:
//friend class XQItemType;
//friend class XQItemFactory;
/// Die data(enum role) Infrastruktur wird sowohl für XQItem als auch
/// für den XQItemType verwendet, deshalb definieren wir hier _alle_
/// notwendigen Roles
@@ -69,11 +65,6 @@ public:
TypeKeyRole,
//TypeNameRole, nicht so wichtig
/*
renderStyleToStringRole,
editorTypeToStringRole,
unitTypeToStringRole,
*/
RoleEnd
};
@@ -94,11 +85,6 @@ public:
CustomRenderStyle,
RenderStyleEnd //!< Not a special editor. Keep at end of this enumeration!
// ...
/*
PickerStyle
LineEditStyle ,
UserDefStyle ,
*/
};
// wie wirds editiert
@@ -146,12 +132,6 @@ public:
XQItem( XQItemType* itemType, const QString* content );
XQItem( XQItemType* itemType, const QString* content, const XQNodePtr& contentNode );
/*
XQItem(const QString& text);
XQItem(const QIcon& icon, const QString& text);
XQItem(int rows, int columns);
*/
XQItem(const XQItem& other);
XQItem(const QStandardItem& other);
@@ -161,13 +141,14 @@ public:
//! -- not used at the moment --
XQItem* clone() const override;
//!
bool isValid() const;
// shortcuts auf XQNodePtr
//! gibt den zu diesem item gehörigen datenknoten
virtual XQNodePtr contentNode() const;
virtual void setContentNode(const XQNodePtr& contentNode );
virtual XQNodePtr sheetNode() const;
@@ -203,6 +184,7 @@ public:
QString renderStyleToString() const;
void setRenderStyle(RenderStyle renderStyle );
//! fitze FATZE!
EditorType editorType() const;
QString editorTypeToString() const;
void setEditorType(EditorType editorType);

View File

@@ -181,32 +181,6 @@ XQItemType* XQItemType::staticItemType()
return &s_DummyItemType;
}
//
// Das ist eigentlich Blödsinn, KISS baby KISS!
// Die ItemTypes sollten statisch bleiben, zusätzliche
// oder geänderte Attribute eines Items landen dann
// halt in G.N. in QStadardItem::data Vector!
//
/*
XQItemType* XQItemType::storeItemType(XQItemType* protoType)
{
// haben wir den prototype schon?
QString itemTypeKey = protoType->makeItemTypeKey();
if(s_ItemTypeMap.contains( itemTypeKey ) )
{
// dann weg damit ...
delete protoType;
// ... und die alte Version zurückgeben
return s_ItemTypeMap[itemTypeKey];
}
// sonst: wir speichern den prototype
s_ItemTypeMap.insert( itemTypeKey, protoType);
s_ItemTypeCount++;
qDebug() << " --- ItemTypes: " << s_ItemTypeCount;
return protoType;
}
*/
QString XQItemType::makeItemTypeKey()
{
@@ -221,34 +195,6 @@ QString XQItemType::makeItemTypeKey()
key = key.arg( icon().name() );
key = key.arg( fixedChoicesToString() );
/*
static const QList<XQItem::ItemDataRole> roleList
{
XQItem::RenderStyleRole,
XQItem::EditorTypeRole,
XQItem::UnitTypeRole,
XQItem::ContentFormatRole,
XQItem::FlagsRole,
XQItem::IconRole,
XQItem::FixedChoicesRole
};
QString key;
for( const auto role : roleList )
{
qDebug() << " --- YYY trying: " << XQItem::fetchItemDataRoleName( role );
QVariant entry = data(role);
if( !entry.isNull() && entry.isValid())
{
// fckin' sonderlocke:
key += role == XQItem::IconRole ? entry.value<QIcon>().name() : entry.toString();
}
key += ":";
}
*/
//qDebug() << " --- YES: KEY: " << key;
return key;
}

View File

@@ -21,22 +21,14 @@
#include <xqitem.h>
///
/// Ist das Unsinn!? Einfach ein QStandardItem mit data() nehmen?
/// Ok, das erspart die die attribs, aber wo ist der fette gewinn?
/// statt _editorType = x hast Du dann halt setData( QVariant::fromValue<>(x) );
/// Aber: Du kannst T abbilden auf QString ... und dann
///
using XQItemTypeMap = QMap<QString, XQItemType*>;
//class XQItemType : public QObject
class XQItemType : public XQItem// public QObject
{
//
//Q_OBJECT
// wäre auch eine möglichkeit !?
//Q_PROPERTY(XQItem::RenderStyle renderStyle renderStyle getDate WRITE setrenderStyle )
// Q_OBJECT
// wäre dann auch eine möglichkeit:
// Q_PROPERTY(XQItem::RenderStyle renderStyle renderStyle getDate WRITE setrenderStyle )
public:
@@ -52,12 +44,10 @@ public:
QString formatToSI(const QString& rawText ) const;
QString unFormatFromSI(const QString& valueText ) const;
void replaceAttribute( XQItem* item, const QVariant& newValue, int role );
QString makeItemTypeKey();
//static XQItemType* storeItemType( XQItemType* protoType );
static XQItemType* staticItemType();
protected:
@@ -65,16 +55,6 @@ protected:
static XQItemTypeMap s_ItemTypeMap;
static size_t s_ItemTypeCount;
/*
static void setItemType( XQItem* item, RenderStyle renderStyle, Qt::ItemFlags flags, UnitType unitType, const QString& format );
static void setStaticType( XQItem* item );
*/
// fix __ch
// static void setItemType( XQItem* item, const QString& renderStyle, const QString& unitType, const QString& itemTypeID );
//static XQItemType* addItemType( const QString& key, RenderStyle renderStyle, UnitType unitType);
//static XQItemType* makeItemType( RenderStyle renderStyle, UnitType unitType);
};