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

This commit is contained in:
2018-06-21 08:08:35 +00:00
parent 068e6e3c5e
commit 691ab5ae98
2 changed files with 14 additions and 0 deletions

View File

@@ -68,6 +68,7 @@ void BlockView::_init() {
nav_anim.setPropertyName("_nav");
nav_anim.setEasingCurve(QEasingCurve::InQuad);
nav_anim.setDuration(200);
connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(checkPaste()));
connect(&nav_anim, SIGNAL(finished()), this, SLOT(_navFinished()));
connect(scene_, SIGNAL(sceneRectChanged(QRectF)), this, SLOT(adjustThumb()));
connect(scene_, SIGNAL(selectionChanged()), this, SLOT(sceneSelectionChanged()));
@@ -87,6 +88,7 @@ void BlockView::_init() {
sel_rect.setPen(pen);
sc.setAlphaF(0.2);
sel_rect.setBrush(QBrush(sc));
checkPaste(true);
/*AlignedTextItem * ti = new AlignedTextItem("This is text!");
ti->setFlag(QGraphicsItem::ItemIsSelectable, true);
@@ -1655,6 +1657,16 @@ void BlockView::pinHoverInOut(BlockItemPin * pin) {
}
void BlockView::checkPaste(bool queued) {
const QMimeData * mime = QApplication::clipboard()->mimeData();
bool ret = false;
if (mime)
ret = mime->hasFormat(_BlockView_Mime_);
if (queued) QMetaObject::invokeMethod(this, "pasteEnabledChanged", Qt::QueuedConnection, Q_ARG(bool, ret));
else emit pasteEnabledChanged(ret);
}
void BlockView::newBranchTrace(BlockBusItem * item, QPointF to) {
trace(item->press_pos, to, &tmp_bus);

View File

@@ -203,6 +203,7 @@ protected slots:
void startBusPointMove(int bus_type);
void endBusPointMove();
void pinHoverInOut(BlockItemPin * pin);
void checkPaste(bool queued = false);
public slots:
void setGridPen(const QPen & pen) {grid_pen = pen; _updateBack();}
@@ -244,6 +245,7 @@ signals:
void blockRemoved(BlockItem * item);
void connectionsChanged();
void copyEnabledChanged(bool);
void pasteEnabledChanged(bool);
};