|
|
#pragma once
|
|
|
|
|
|
#include <QListWidgetItem>
|
|
|
|
|
|
#include "iPlugin_global.h"
|
|
|
|
|
|
class QListWidget;
|
|
|
|
|
|
// 类似QTreeWidget的QListWidget,采用的自定义ListWidgetItem
|
|
|
class I_PLUGIN_EXPORT ZxListWidgetItem : public QListWidgetItem
|
|
|
{
|
|
|
public:
|
|
|
|
|
|
explicit ZxListWidgetItem(QListWidget* pView = 0, int type = Type);
|
|
|
explicit ZxListWidgetItem(const QString &text, QListWidget* pView = 0, int type = Type);
|
|
|
explicit ZxListWidgetItem(const QIcon &icon, const QString &text,
|
|
|
QListWidget* pView = 0, int type = Type);
|
|
|
|
|
|
~ZxListWidgetItem();
|
|
|
|
|
|
// 递进层级,默认为-1,则不考虑缩进,即常规Item(QListWidgetItem)
|
|
|
int getLevel() const;
|
|
|
void setLevel(int n);
|
|
|
|
|
|
// 是否展开
|
|
|
bool isExpanded() const;
|
|
|
void setExpanded(bool b);
|
|
|
|
|
|
// 因为只是模拟的效果,所以需要外部传递是否Group
|
|
|
bool isGroupNode() const;
|
|
|
void setGroupNode(bool b);
|
|
|
|
|
|
// 获取Icons外边界
|
|
|
QRect getIconBounds() const;
|
|
|
void setIconBounds(QRect& rt);
|
|
|
|
|
|
// 鼠标移动至Icons范围内
|
|
|
bool isMouseTrackingIcon() const;
|
|
|
void setMouseTrackingIcon(bool b);
|
|
|
|
|
|
|
|
|
#ifdef _SCAN_OLD_CODES_
|
|
|
|
|
|
void addChild(ZxListWidgetItem* child);
|
|
|
void insertChild(int index, ZxListWidgetItem* child);
|
|
|
ZxListWidgetItem* takeChild(int index);
|
|
|
void removeChild(ZxListWidgetItem* child);
|
|
|
ZxListWidgetItem* child(int index) const;
|
|
|
int childCount() const;
|
|
|
int indexOfChild(ZxListWidgetItem* child) const;
|
|
|
|
|
|
ZxListWidgetItem* parent() const;
|
|
|
void updateChildrenLevel(int parentLevel);
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
#ifdef _SCAN_OLD_CODES_
|
|
|
|
|
|
ZxListWidgetItem* m_pItepP;
|
|
|
QVector<ZxListWidgetItem*> m_vecChildren;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
int m_nLevel; // 层级,递进层级,默认为-1,则不考虑缩进,即常规Item(QListWidgetItem)
|
|
|
bool m_bExpanded; // 是否展开
|
|
|
bool m_bGroupNode;// 因为只是模拟的效果,所以需要外部传递是否Group
|
|
|
|
|
|
QRect m_rtIcons;
|
|
|
bool m_bMouseTrackingIcon; //鼠标移动至Icons范围内
|
|
|
};
|