Files
xtree.old.ng/src/items/xqitemtype.h

69 lines
1.6 KiB
C
Raw Normal View History

2025-08-05 22:39:41 +02:00
/***************************************************************************
source::worx xtree
Copyright © 2024-2025 c.holzheuer
christoph.holzheuer@gmail.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
***************************************************************************/
#ifndef XQITEMTYPE_H
#define XQITEMTYPE_H
#include <QDebug>
#include <QMap>
#include <xqitem.h>
using XQItemTypeMap = QMap<QString, XQItemType*>;
2025-08-07 02:36:13 +02:00
2025-08-05 22:39:41 +02:00
class XQItemType : public XQItem// public QObject
{
2025-08-07 02:36:13 +02:00
// Q_OBJECT
// wäre dann auch eine möglichkeit:
// Q_PROPERTY(XQItem::RenderStyle renderStyle renderStyle getDate WRITE setrenderStyle )
2025-08-05 22:39:41 +02:00
public:
XQItemType();
XQItemType( const XQItemType& other);
virtual ~XQItemType();
QVariant data( int role ) const override;
void setData(const QVariant& value, int role ) override;
2025-08-15 20:31:40 +02:00
QVariant formatText( const XQItem& item ) const;
2025-08-08 21:39:33 +02:00
2025-08-09 11:56:11 +02:00
QString formatToSI(const QString& rawText, XQItem::UnitType unitType ) const;
QString unFormatFromSI(const QString& valueText ) const;
2025-08-05 22:39:41 +02:00
2025-08-15 20:31:40 +02:00
int roleForAttributeKey( const QString& attrKey );
2025-08-09 11:56:11 +02:00
XQItemType* replaceAttribute(const QVariant& newValue, int role );
2025-08-05 22:39:41 +02:00
2025-08-09 11:56:11 +02:00
QString makeItemTypeKey();
2025-08-05 22:39:41 +02:00
static XQItemType* staticItemType();
protected:
static XQItemTypeMap s_ItemTypeMap;
static size_t s_ItemTypeCount;
};
Q_DECLARE_METATYPE(XQItemType*);
#endif // XQITEMTYPE_H