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; match_bus = bus_from = 0;
mm_ci = 0; mm_ci = 0;
hpin = 0; hpin = 0;
ghost_ = 0;
grid_step = 10.; grid_step = 10.;
grid_points = 1; grid_points = 1;
grid_pen = QPen(Qt::lightGray, 1, Qt::NoPen); grid_pen = QPen(Qt::lightGray, 1, Qt::NoPen);
@@ -319,6 +320,9 @@ bool BlockView::eventFilter(QObject * o, QEvent * e) {
break; break;
case QEvent::GraphicsSceneMouseMove: case QEvent::GraphicsSceneMouseMove:
//qDebug() << "move" << (mm_ci != 0 ? mm_ci : 0); //qDebug() << "move" << (mm_ci != 0 ? mm_ci : 0);
/*if (ghost_) {
ghost_->setPos(quantize(me->scenePos(), grid_step));
}*/
if (mm_ci) if (mm_ci)
if (mm_ci->data(1008).toBool()) if (mm_ci->data(1008).toBool())
break; 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() { void BlockView::drawThumb() {
if (!minimap) return; if (!minimap) return;
QPainter p(&widget_thumb); QPainter p(&widget_thumb);

View File

@@ -144,6 +144,9 @@ protected:
void scrollFromThumb(); void scrollFromThumb();
void deleteCopyTemp(); void deleteCopyTemp();
void emitActionEvent(BlockItemBase::Action action, QList<QGraphicsItem * > items); void emitActionEvent(BlockItemBase::Action action, QList<QGraphicsItem * > items);
void setGhost(BlockItem * item);
void clearGhost();
BlockItem * ghost() const {return ghost_;}
virtual void loadBus(BlockBusItem * bus) {} virtual void loadBus(BlockBusItem * bus) {}
virtual void copyBlocks(QList<BlockItem * > items, QPointF offset) {} virtual void copyBlocks(QList<BlockItem * > items, QPointF offset) {}
@@ -158,6 +161,7 @@ protected:
QList<BlockBusItem * > copy_buses; QList<BlockBusItem * > copy_buses;
BlockBusItem tmp_bus, * match_bus, * bus_from; BlockBusItem tmp_bus, * match_bus, * bus_from;
BlockItemPin * hpin; BlockItemPin * hpin;
BlockItem * ghost_;
BlockViewWavetrace wavetrace; BlockViewWavetrace wavetrace;
QPoint press_point, screen_point, thumb_press; QPoint press_point, screen_point, thumb_press;
QPointF scene_point, trace_from, last_trace_from, trace_to, copy_dp; QPointF scene_point, trace_from, last_trace_from, trace_to, copy_dp;

View File

@@ -96,9 +96,9 @@ void KDockWidget::clear() {
void KDockWidget::changedGlobal() { void KDockWidget::changedGlobal() {
piCout << "changedGlobal ..." << k_list.size_s() << info_list.size() << lay->count() << lay->rowCount(); //piCout << "changedGlobal ..." << k_list.size_s() << info_list.size() << lay->count() << lay->rowCount();
for (int i = 0; i < k_list.size_s(); ++i) { for (int i = 0; i < k_list.size_s(); ++i) {
piCout << "update" << i << "0"; //piCout << "update" << i << "0";
if (!K.exists(k_list[i])) { if (!K.exists(k_list[i])) {
k_list.remove(i); k_list.remove(i);
info_list.remove(i); info_list.remove(i);
@@ -106,13 +106,13 @@ void KDockWidget::changedGlobal() {
--i; --i;
continue; continue;
} }
piCout << "update" << i << "1"; //piCout << "update" << i << "1";
QLabel * lbl = qobject_cast<QLabel*>(lay->itemAt(i, QFormLayout::LabelRole)->widget()); QLabel * lbl = qobject_cast<QLabel*>(lay->itemAt(i, QFormLayout::LabelRole)->widget());
piCout << "update" << i << "2"; //piCout << "update" << i << "2";
if (lbl) lbl->setText(PI2QString(K[k_list[i]].pathString().join(".")) + ":"); if (lbl) lbl->setText(PI2QString(K[k_list[i]].pathString().join(".")) + ":");
piCout << "update" << i << "3"; //piCout << "update" << i << "3";
} }
piCout << "changedGlobal ok"; //piCout << "changedGlobal ok";
} }