version 2.22.0
blockview small code clean add PIValueTree to BLockItem, BlockItemPin and BlockBusItem add QAD::CursorOverrider::restore() fix QCodeEdit escape key while block selection
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "qad_blockview_export.h"
|
||||
|
||||
#include <QElapsedTimer>
|
||||
#include <pivaluetree.h>
|
||||
|
||||
|
||||
class QAD_BLOCKVIEW_EXPORT BlockItem
|
||||
@@ -58,10 +59,7 @@ public:
|
||||
BlockItemPin * pinByText(const QString & t) const;
|
||||
BlockItemPin * pinAtBus(BlockBusItem * bus) const;
|
||||
QColor color() const { return col; }
|
||||
void setColor(QColor c) {
|
||||
col = c;
|
||||
_resize(size());
|
||||
}
|
||||
void setColor(QColor c);
|
||||
QSizeF size() const { return g_main.rect().size(); }
|
||||
QRectF sceneRect() const;
|
||||
qreal width() const { return size().width(); }
|
||||
@@ -69,12 +67,9 @@ public:
|
||||
int pinsMargin() const { return pins_margin; }
|
||||
void setSize(QSizeF s) { _resize(s); }
|
||||
void setSize(qreal w, qreal h) { setSize(QSizeF(w, h)); }
|
||||
void setWidth(qreal w) { setSize(QSizeF(w, size().height())); }
|
||||
void setHeight(qreal h) { setSize(QSizeF(size().width(), h)); }
|
||||
void setPinsMargin(int marg) {
|
||||
if (marg > 1 && marg < 256) pins_margin = marg;
|
||||
arrangePins();
|
||||
}
|
||||
void setWidth(qreal w);
|
||||
void setHeight(qreal h);
|
||||
void setPinsMargin(int marg);
|
||||
|
||||
QByteArray saveModel();
|
||||
void loadModel(const QByteArray & data);
|
||||
@@ -93,6 +88,8 @@ public:
|
||||
QStringList getBindNames() const;
|
||||
QStringList getBindProps() const;
|
||||
|
||||
PIValueTree & values() { return value_tree; }
|
||||
|
||||
enum {
|
||||
Type = UserType + 1
|
||||
};
|
||||
@@ -128,6 +125,7 @@ private:
|
||||
|
||||
QPropertyAnimation anim_thick, anim_sel;
|
||||
QElapsedTimer t_sel;
|
||||
PIValueTree value_tree;
|
||||
bool is_hovered = false, is_blockeditor = false;
|
||||
|
||||
signals:
|
||||
@@ -136,25 +134,8 @@ signals:
|
||||
};
|
||||
|
||||
|
||||
inline QDataStream & operator<<(QDataStream & s, const BlockItemPin * p) {
|
||||
ChunkStream cs;
|
||||
cs << cs.chunk(1, int(p->alignment())) << cs.chunk(2, p->busType()) << cs.chunk(3, p->text()) << cs.chunk(4, p->toolTip());
|
||||
s << cs.data();
|
||||
return s;
|
||||
}
|
||||
inline QDataStream & operator>>(QDataStream & s, BlockItemPin *& p) {
|
||||
ChunkStream cs(s);
|
||||
p = new BlockItemPin();
|
||||
while (!cs.atEnd()) {
|
||||
switch (cs.read()) {
|
||||
case 1: p->setAlignment((Qt::Alignment)cs.getData<int>()); break;
|
||||
case 2: p->setBusType(cs.getData<int>()); break;
|
||||
case 3: p->setText(cs.getData<QString>()); break;
|
||||
case 4: p->setToolTip(cs.getData<QString>()); break;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
QDataStream & operator<<(QDataStream & s, const BlockItemPin * p);
|
||||
QDataStream & operator>>(QDataStream & s, BlockItemPin *& p);
|
||||
|
||||
|
||||
inline QDataStream & operator<<(QDataStream & s, const BlockItem * b) {
|
||||
|
||||
Reference in New Issue
Block a user