created src subdir.
This commit is contained in:
149
deprecated/xqitemtype.h
Normal file
149
deprecated/xqitemtype.h
Normal file
@@ -0,0 +1,149 @@
|
||||
/***************************************************************************
|
||||
|
||||
source::worx xtree
|
||||
Copyright © 2024 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>
|
||||
|
||||
|
||||
///
|
||||
/// 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
|
||||
{
|
||||
//?? needed?
|
||||
Q_OBJECT
|
||||
//das haut so nicht hin
|
||||
//Q_PROPERTY(XQItem::RenderStyle renderStyle renderStyle getDate WRITE setrenderStyle )
|
||||
|
||||
public:
|
||||
|
||||
|
||||
XQItemType();
|
||||
XQItemType( const XQItemType& other);
|
||||
|
||||
virtual ~XQItemType();
|
||||
|
||||
//XQItemType( RenderStyle aRenderStyle, EditorType aEditorType, Qt::ItemFlags aItemFlags, UnitType aUnitType, const QString& aContentFormat );
|
||||
|
||||
// ContentFormat als enum?? Warum, für predefined types: int, double ?
|
||||
// key for custom edit?
|
||||
// key for custom format?
|
||||
|
||||
///
|
||||
/// Setter für die XQItemFactory. Setzen das Attribute
|
||||
/// _ohne_ den itemTypeCache zu beeinflussen
|
||||
///
|
||||
|
||||
void setAttribute(XQItem::RenderStyle renderStyle );
|
||||
void setAttribute(XQItem::EditorType editorType );
|
||||
void setAttribute(Qt::ItemFlags itemFlags );
|
||||
void setAttribute(XQItem::UnitType unitType);
|
||||
void setAttribute(const QString& contentFormat);
|
||||
void setAttribute(QStandardItemModel* fixedChoices);
|
||||
void setAttribute(const QIcon& typeIcon);
|
||||
|
||||
QString unitTypeStr() const;
|
||||
|
||||
// FIX! Das gehört hier nicht her!
|
||||
QString formatToSI(const QString& rawText ) const;
|
||||
QString unFormatFromSI(const QString& valueText ) const;
|
||||
|
||||
/// data() access for property system
|
||||
XQItem::RenderStyle renderStyle() const;
|
||||
XQItem::EditorType editorType() const;
|
||||
Qt::ItemFlags itemFlags() const;
|
||||
XQItem::UnitType unitType() const;
|
||||
const QString& contentFormat() const;
|
||||
QStandardItemModel* fixedChoices() const;
|
||||
|
||||
template<typename T>
|
||||
XQItemType* replaceAttribute(T attribute)
|
||||
{
|
||||
// eine kopie meiner selbst erzeugen
|
||||
XQItemType* myClone = new XQItemType(*this);
|
||||
return myClone;
|
||||
}
|
||||
|
||||
XQItemType* replaceRenderStyle(XQItem::RenderStyle renderStyle );
|
||||
XQItemType* replaceEditorType(XQItem::EditorType editorType);
|
||||
XQItemType* replaceItemFlags(Qt::ItemFlags itemFlags);
|
||||
XQItemType* replaceUnitType(XQItem::UnitType unitType);
|
||||
XQItemType* replaceContentFormat(const QString& contentFormat);
|
||||
XQItemType* replaceFixedChoices( QStandardItemModel* fixedChoices);
|
||||
|
||||
QString makeItemTypeKey();
|
||||
|
||||
static QString makeItemTypeKey(
|
||||
XQItem::RenderStyle aRenderStyle,
|
||||
XQItem::EditorType aEditorType,
|
||||
Qt::ItemFlags aItemFlags,
|
||||
XQItem::UnitType aUnitType,
|
||||
const QString& aContentFormat,
|
||||
QStandardItemModel* aFixedChoices,
|
||||
const QIcon aIcon
|
||||
);
|
||||
|
||||
protected:
|
||||
|
||||
static XQItemTypeMap s_ItemTypeMap;
|
||||
|
||||
XQItem::RenderStyle _renderStyle{XQItem::NoRenderStyle};
|
||||
XQItem::EditorType _editorType{XQItem::NoEditorType};
|
||||
Qt::ItemFlags _itemFlags;
|
||||
XQItem::UnitType _unitType{XQItem::NoUnitType};
|
||||
QString _contentFormat;
|
||||
QStandardItemModel* _fixedChoices{};
|
||||
QIcon _typeIcon;
|
||||
|
||||
QString _itemTypeKey;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
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);
|
||||
|
||||
};
|
||||
|
||||
|
||||
Q_DECLARE_METATYPE(XQItemType*);
|
||||
|
||||
/*
|
||||
//??
|
||||
done by Q_ENUM
|
||||
Q_DECLARE_METATYPE(XQItemType::RenderStyle);
|
||||
Q_DECLARE_METATYPE(XQItemType::UnitType);
|
||||
Q_DECLARE_METATYPE(XQItemType);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#endif // XQITEMTYPE_H
|
Reference in New Issue
Block a user