git-svn-id: svn://db.shs.com.ru/libs@400 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2018-06-08 11:36:49 +00:00
parent a89c41741c
commit ed4ba15d2a
3 changed files with 30 additions and 6 deletions

View File

@@ -32,6 +32,7 @@ void BlockView::_init() {
match_bus = bus_from = 0;
mm_ci = 0;
hpin = 0;
ghost_ = 0;
grid_step = 10.;
grid_points = 1;
grid_pen = QPen(Qt::lightGray, 1, Qt::NoPen);
@@ -319,6 +320,9 @@ bool BlockView::eventFilter(QObject * o, QEvent * e) {
break;
case QEvent::GraphicsSceneMouseMove:
//qDebug() << "move" << (mm_ci != 0 ? mm_ci : 0);
/*if (ghost_) {
ghost_->setPos(quantize(me->scenePos(), grid_step));
}*/
if (mm_ci)
if (mm_ci->data(1008).toBool())
break;
@@ -732,6 +736,22 @@ void BlockView::emitActionEvent(BlockItemBase::Action action, QList<QGraphicsIte
}
void BlockView::setGhost(BlockItem * item) {
clearGhost();
if (!item) return;
ghost_ = item;
ghost_->setOpacity(0.5);
addItem(item);
}
void BlockView::clearGhost() {
if (!ghost_) return;
delete ghost_;
ghost_ = 0;
}
void BlockView::drawThumb() {
if (!minimap) return;
QPainter p(&widget_thumb);