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

68 lines
1.5 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-08 21:39:33 +02:00
virtual QVariant formatText( const XQItem& item ) const;
QString formatToSI(const QString& rawText, XQItem::UnitType unitType ) const;
2025-08-05 22:39:41 +02:00
QString unFormatFromSI(const QString& valueText ) const;
void replaceAttribute( XQItem* item, 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