Files
xtree.ng/src/items/xqitemtype.h
2025-08-22 22:57:06 +02:00

69 lines
1.6 KiB
C++

/***************************************************************************
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*>;
class XQItemType : public XQItem// public QObject
{
// Q_OBJECT
// wäre dann auch eine möglichkeit:
// Q_PROPERTY(XQItem::RenderStyle renderStyle renderStyle getDate WRITE setrenderStyle )
public:
XQItemType();
XQItemType( const XQItemType& other);
virtual ~XQItemType();
QVariant data( int role ) const override;
void setData(const QVariant& value, int role ) override;
QVariant formatText( const XQItem& item ) const;
QString formatToSI(const QString& rawText, XQItem::UnitType unitType ) const;
QString unFormatFromSI(const QString& valueText ) const;
int roleForAttributeKey( const QString& attrKey );
XQItemType* replaceAttribute(const QVariant& newValue, int role );
QString makeItemTypeKey();
static XQItemType* staticItemType();
protected:
static XQItemTypeMap s_ItemTypeMap;
static size_t s_ItemTypeCount;
};
Q_DECLARE_METATYPE(XQItemType*);
#endif // XQITEMTYPE_H