You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QHash>
|
|
|
|
|
#include <QList>
|
|
|
|
|
#include <QRectF>
|
|
|
|
|
|
|
|
|
|
#include "iPlotBase_global.h"
|
|
|
|
|
|
|
|
|
|
class ZxRenderItem;
|
|
|
|
|
class ZxSceneItem;
|
|
|
|
|
class QTimer;
|
|
|
|
|
class QTime;
|
|
|
|
|
|
|
|
|
|
/// @internal
|
|
|
|
|
class ZxSelectionNode
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ZxRenderItem* item;
|
|
|
|
|
ZxSelectionNode* prev;
|
|
|
|
|
ZxSelectionNode* next;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/// @internal
|
|
|
|
|
class ZxSelectionPrivate : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
static ZxSelectionNode* alloc();
|
|
|
|
|
|
|
|
|
|
bool m_bChanged;
|
|
|
|
|
ZxSelectionNode* head;
|
|
|
|
|
ZxSelectionNode* tail;
|
|
|
|
|
QHash<ZxRenderItem*, ZxSelectionNode*> dict;
|
|
|
|
|
|
|
|
|
|
void listAdd(ZxSelectionNode* n);
|
|
|
|
|
void listRemove(ZxSelectionNode* n);
|
|
|
|
|
|
|
|
|
|
void doAdd(ZxRenderItem* w, bool force);
|
|
|
|
|
void doRemove(ZxSelectionNode* n);
|
|
|
|
|
|
|
|
|
|
void setChanged();
|
|
|
|
|
|
|
|
|
|
QTime* m_pLazyChangedTime;
|
|
|
|
|
QTimer* m_pTimer;
|
|
|
|
|
|
|
|
|
|
int m_nRefCount;
|
|
|
|
|
ZxSceneItem* m_pScene;
|
|
|
|
|
|
|
|
|
|
ZxSelectionPrivate(ZxSceneItem* pScene);
|
|
|
|
|
~ZxSelectionPrivate();
|
|
|
|
|
int release();
|
|
|
|
|
int addRef();
|
|
|
|
|
void add(ZxRenderItem* p, bool force = false);
|
|
|
|
|
void remove(ZxRenderItem* p);
|
|
|
|
|
void invert(ZxRenderItem* p, bool force = false);
|
|
|
|
|
void clear();
|
|
|
|
|
bool contains(ZxRenderItem* p) const;
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
|
|
/// 个别图件被加进列表
|
|
|
|
|
void sigItemAdded(ZxRenderItem* p);
|
|
|
|
|
|
|
|
|
|
/// 个别图件被从列表移除
|
|
|
|
|
void sigItemRemoved(ZxRenderItem* p);
|
|
|
|
|
|
|
|
|
|
/// 选中列表被改变(即时)
|
|
|
|
|
void sigSelectionChanged();
|
|
|
|
|
|
|
|
|
|
/// 选中列表被改变(非即时)
|
|
|
|
|
void sigSelectionChangedLazy();
|
|
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
|
|
|
|
|
|
void onTimer();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
ZxSelectionPrivate(const ZxSelectionPrivate& c);
|
|
|
|
|
|
|
|
|
|
friend class ZxSelection;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|