BlockView cosmetics, more enums, fixed right-click on bus point/segment move
This commit is contained in:
@@ -15,10 +15,10 @@ _DTSizeItem::_DTSizeItem(): QGraphicsObject() {
|
||||
cur_item = 0;
|
||||
grid = 10.;
|
||||
in_process = can_drag = false;
|
||||
setData(1007, true);
|
||||
setData(bvidItemSelection, true);
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
//qDebug() << &(rects[i]);
|
||||
rects[i].setData(1007, true);
|
||||
rects[i].setData(bvidItemSelection, true);
|
||||
rects[i].setData(bvidDTHandle, true);
|
||||
rects[i].setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
||||
rects[i].setZValue(10.);
|
||||
@@ -26,7 +26,7 @@ _DTSizeItem::_DTSizeItem(): QGraphicsObject() {
|
||||
rects[i].setRect(-5, -5, 10, 10);
|
||||
rects[i].setPen(QPen(Qt::darkBlue));
|
||||
rects[i].setBrush(QBrush(QColor(64, 64, 255, 128)));
|
||||
//rects[i].setData(1100, true);
|
||||
//rects[i].setData(bvidBlockDecor, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ bool DrawTools::eventFilter(QObject * o, QEvent * e) {
|
||||
if (new_type == 1 || new_type == 2)
|
||||
((QAbstractGraphicsShapeItem*)new_item)->setBrush(Qt::white);
|
||||
new_item->setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable);
|
||||
new_item->setData(1100, true);
|
||||
new_item->setData(bvidBlockDecor, true);
|
||||
emit itemCreated(new_item);
|
||||
return true;
|
||||
}
|
||||
@@ -597,7 +597,10 @@ void DrawTools::emitZAvailabe(QGraphicsItem * item) {
|
||||
}
|
||||
QList<QGraphicsItem * > dl;
|
||||
if (item->parentItem() == 0) dl = view->decors();
|
||||
else if (item->parentItem()->data(1006) == "item") dl = ((BlockItem*)(item->parentItem()))->decors_;
|
||||
else {
|
||||
if (item->parentItem()->data(bvidType).toInt() == bvitBlock)
|
||||
dl = ((BlockItem*)(item->parentItem()))->decors_;
|
||||
}
|
||||
if (dl.size() <= 1) {
|
||||
moveZUpAvailable(false);
|
||||
moveZDownAvailable(false);
|
||||
@@ -895,7 +898,7 @@ void DrawTools::buttonTextEdit_clicked() {
|
||||
|
||||
void DrawTools::actionZ_triggered() {
|
||||
if (!cur_item) return;
|
||||
if (cur_item->data(1009) == "decor") {
|
||||
if (cur_item->data(bvidType).toInt() == bvitDecor) {
|
||||
BlockView * view = 0;
|
||||
if (cur_item->scene()) if (!cur_item->scene()->views().isEmpty())
|
||||
view = qobject_cast<BlockView * >(cur_item->scene()->views()[0]);
|
||||
@@ -913,7 +916,7 @@ void DrawTools::actionZ_triggered() {
|
||||
foreach (QGraphicsItem * d, dl) scene->addItem(d);
|
||||
scene->blockSignals(false);
|
||||
}
|
||||
if (cur_item->data(1011).toBool()) {
|
||||
if (cur_item->data(bvidBlockDecor).toBool()) {
|
||||
BlockItem * bi = qgraphicsitem_cast<BlockItem*>(cur_item->parentItem());
|
||||
if (!bi) return;
|
||||
QList<QGraphicsItem*> dl = bi->decors_;
|
||||
|
||||
Reference in New Issue
Block a user