git-svn-id: svn://db.shs.com.ru/libs@380 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -10,6 +10,18 @@ namespace CDUtils {
|
||||
class CDType;
|
||||
class CDSection;
|
||||
class Interface;
|
||||
|
||||
enum Column {
|
||||
cID ,
|
||||
cName_Cmd ,
|
||||
cType ,
|
||||
cXMode ,
|
||||
cXAvg ,
|
||||
cExpression,
|
||||
cValue ,
|
||||
cComment ,
|
||||
cLastColumn,
|
||||
};
|
||||
}
|
||||
|
||||
namespace QAD {
|
||||
@@ -23,17 +35,21 @@ class CDItem {
|
||||
friend class CDItemModel;
|
||||
public:
|
||||
enum CDItemType{ItemCDType, ItemCDSection};
|
||||
CDItem(CDUtils::Interface * interface, int index, CDItemType type, CDItem * parent);
|
||||
CDItem(CDUtils::Interface * interface, int _index, CDItemType type, CDItem * parent);
|
||||
~CDItem();
|
||||
QVariant data(int column, int role) const;
|
||||
QVariant value(CDUtils::CDType t, int role) const;
|
||||
bool setData(int column, const QVariant & value);
|
||||
|
||||
private:
|
||||
CDItemType itemType() const {return type_;}
|
||||
PIDeque<int> buildPath() const;
|
||||
QString stringType(const PIString & t) const;
|
||||
int index() const {return index_;}
|
||||
|
||||
CDUtils::Interface * interface;
|
||||
|
||||
private:
|
||||
QString stringType(const PIString & t) const;
|
||||
QAD::Enum xModeEnum(int v) const;
|
||||
|
||||
CDItem * parent_;
|
||||
int index_;
|
||||
CDItemType type_;
|
||||
@@ -47,16 +63,19 @@ class CDDelegate : public QStyledItemDelegate
|
||||
public:
|
||||
CDDelegate(QObject *parent = 0);
|
||||
|
||||
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const;
|
||||
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
void setEditorData(QWidget *editor, const QModelIndex &index) const;
|
||||
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
|
||||
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class CDItemModel : public QAbstractItemModel {
|
||||
Q_OBJECT
|
||||
friend class CDView;
|
||||
public:
|
||||
explicit CDItemModel(int type_, QObject *parent = 0);
|
||||
~CDItemModel();
|
||||
@@ -69,6 +88,8 @@ public:
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
||||
QMimeData * mimeData(const QModelIndexList & indexes) const;
|
||||
CDItem * getItem(const QModelIndex & index) const;
|
||||
|
||||
void buildItem(CDItem * it, CDUtils::CDSection &r);
|
||||
|
||||
@@ -78,7 +99,6 @@ public slots:
|
||||
|
||||
private:
|
||||
void internalRebuild();
|
||||
CDItem * getItem(const QModelIndex & index) const;
|
||||
|
||||
CDUtils::Interface * interface;
|
||||
CDItem * root;
|
||||
|
||||
Reference in New Issue
Block a user