git-svn-id: svn://db.shs.com.ru/libs@418 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -89,7 +89,7 @@ void BlockView::_init() {
|
|||||||
sc.setAlphaF(0.2);
|
sc.setAlphaF(0.2);
|
||||||
sel_rect.setBrush(QBrush(sc));
|
sel_rect.setBrush(QBrush(sc));
|
||||||
checkPaste(true);
|
checkPaste(true);
|
||||||
|
|
||||||
/*AlignedTextItem * ti = new AlignedTextItem("This is text!");
|
/*AlignedTextItem * ti = new AlignedTextItem("This is text!");
|
||||||
ti->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
ti->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||||
ti->setFlag(QGraphicsItem::ItemIsMovable, true);
|
ti->setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||||
@@ -101,7 +101,7 @@ void BlockView::_init() {
|
|||||||
addItem(t__);
|
addItem(t__);
|
||||||
addItem(new QGraphicsLineItem(0, -50, 0, 50));
|
addItem(new QGraphicsLineItem(0, -50, 0, 50));
|
||||||
addItem(new QGraphicsLineItem(-50, 0, 50, 0));
|
addItem(new QGraphicsLineItem(-50, 0, 50, 0));
|
||||||
|
|
||||||
for (int i = 0; i < 5; ++i) {
|
for (int i = 0; i < 5; ++i) {
|
||||||
BlockItem * it = new BlockItem();
|
BlockItem * it = new BlockItem();
|
||||||
it->setPos(i*150, i*20);
|
it->setPos(i*150, i*20);
|
||||||
@@ -114,7 +114,7 @@ void BlockView::_init() {
|
|||||||
it->setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable);
|
it->setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable);
|
||||||
it->setData(1001, true);
|
it->setData(1001, true);
|
||||||
scene_->addItem(it);
|
scene_->addItem(it);
|
||||||
|
|
||||||
BlockBusItem * bus = new BlockBusItem();
|
BlockBusItem * bus = new BlockBusItem();
|
||||||
bus->setImages(QImage("icons/bus_twin.png"), QImage("icons/bus_end_rj45.png"));
|
bus->setImages(QImage("icons/bus_twin.png"), QImage("icons/bus_end_rj45.png"));
|
||||||
bus->setEndpointsNumber(3);
|
bus->setEndpointsNumber(3);
|
||||||
@@ -651,6 +651,12 @@ void BlockView::wheelEvent(QWheelEvent * e) {
|
|||||||
void BlockView::mousePressEvent(QMouseEvent * event) {
|
void BlockView::mousePressEvent(QMouseEvent * event) {
|
||||||
press_point = event->pos();
|
press_point = event->pos();
|
||||||
QGraphicsView::mousePressEvent(event);
|
QGraphicsView::mousePressEvent(event);
|
||||||
|
if (event->buttons().testFlag(Qt::MidButton)) setCursor(Qt::ClosedHandCursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BlockView::mouseReleaseEvent(QMouseEvent * event) {
|
||||||
|
unsetCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -827,7 +833,7 @@ void BlockView::drawThumb() {
|
|||||||
QRectF vr(QPointF(horizontalScrollBar()->value() - horizontalScrollBar()->minimum(),
|
QRectF vr(QPointF(horizontalScrollBar()->value() - horizontalScrollBar()->minimum(),
|
||||||
verticalScrollBar()->value() - verticalScrollBar()->minimum()) * thumb_scl, vs * thumb_scl);
|
verticalScrollBar()->value() - verticalScrollBar()->minimum()) * thumb_scl, vs * thumb_scl);
|
||||||
vr.adjust(0, 0, -1, -1);
|
vr.adjust(0, 0, -1, -1);
|
||||||
|
|
||||||
p.setBrush(Qt::lightGray);
|
p.setBrush(Qt::lightGray);
|
||||||
p.setOpacity(0.5 * _talpha);
|
p.setOpacity(0.5 * _talpha);
|
||||||
p.drawRect(wr);
|
p.drawRect(wr);
|
||||||
@@ -1289,7 +1295,7 @@ void BlockView::matchBus() {
|
|||||||
foreach (BlockItem * b_, blockl)
|
foreach (BlockItem * b_, blockl)
|
||||||
foreach (BlockItemPin * p_, b_->pins())
|
foreach (BlockItemPin * p_, b_->pins())
|
||||||
if (p_->scenePos() == point) {
|
if (p_->scenePos() == point) {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1943,7 +1949,7 @@ void BlockView::removeSelected() {
|
|||||||
if (i->connectedBlocks().isEmpty())
|
if (i->connectedBlocks().isEmpty())
|
||||||
if (!dbuses.contains(i))
|
if (!dbuses.contains(i))
|
||||||
delete i;
|
delete i;
|
||||||
|
|
||||||
blockSignals(false);
|
blockSignals(false);
|
||||||
foreach (QGraphicsItem * i, ai)
|
foreach (QGraphicsItem * i, ai)
|
||||||
emit blockRemoved((BlockItem*)i);
|
emit blockRemoved((BlockItem*)i);
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ protected:
|
|||||||
void timerEvent(QTimerEvent * e);
|
void timerEvent(QTimerEvent * e);
|
||||||
void wheelEvent(QWheelEvent * e);
|
void wheelEvent(QWheelEvent * e);
|
||||||
void mousePressEvent(QMouseEvent * event);
|
void mousePressEvent(QMouseEvent * event);
|
||||||
|
void mouseReleaseEvent(QMouseEvent * event);
|
||||||
void mouseMoveEvent(QMouseEvent * event);
|
void mouseMoveEvent(QMouseEvent * event);
|
||||||
void keyPressEvent(QKeyEvent * event);
|
void keyPressEvent(QKeyEvent * event);
|
||||||
void keyReleaseEvent(QKeyEvent * e);
|
void keyReleaseEvent(QKeyEvent * e);
|
||||||
|
|||||||
Reference in New Issue
Block a user