diff --git a/qad/blockview/drawtools.cpp b/qad/blockview/drawtools.cpp index a1ea4e7..1591f81 100644 --- a/qad/blockview/drawtools.cpp +++ b/qad/blockview/drawtools.cpp @@ -287,6 +287,7 @@ actions_Z_up(this), actions_Z_top(this), actions_Z_down(this), actions_Z_bottom( foreach (QToolButton * b, buttons_align) connect(b, SIGNAL(clicked(bool)), this, SLOT(alignClicked())); connect(ui->buttonImage, SIGNAL(clicked(bool)), this, SLOT(buttonImage_clicked())); + connect(ui->buttonImagePaste, SIGNAL(clicked(bool)), this, SLOT(buttonImagePaste_clicked())); connect(ui->buttonFont, SIGNAL(clicked(bool)), this, SLOT(buttonFont_clicked())); connect(ui->buttonTextEdit, SIGNAL(clicked(bool)), this, SLOT(buttonTextEdit_clicked())); connect(ui->spinWidth, SIGNAL(valueChanged(double)), this, SLOT(propertyChanged())); @@ -800,6 +801,20 @@ void DrawTools::buttonImage_clicked() { } +void DrawTools::buttonImagePaste_clicked() { + QGraphicsPixmapItem * pi = qgraphicsitem_cast(cur_item); + if (!pi) return; + QPixmap pm = QApplication::clipboard()->pixmap(); + if (pm.isNull()) return; + QRectF obr = pi->boundingRect(); + pi->setPixmap(pm); + QRectF nbr = pi->boundingRect(); + QSizeF ds = (obr.size() - nbr.size()) / 2.; + pi->setPos(pi->pos() + QPointF(ds.width(), ds.height())); + changeFinished(); +} + + void DrawTools::buttonFont_clicked() { if (!cur_item) return; QGraphicsSimpleTextItem * ti = qgraphicsitem_cast(cur_item); diff --git a/qad/blockview/drawtools.h b/qad/blockview/drawtools.h index 8f40f5d..b0a8cd3 100644 --- a/qad/blockview/drawtools.h +++ b/qad/blockview/drawtools.h @@ -105,6 +105,7 @@ private slots: void moveZDownAvailable(bool yes) {actions_Z_down.setEnabled(yes); actions_Z_bottom.setEnabled(yes);} void buttonImage_clicked(); + void buttonImagePaste_clicked(); void buttonFont_clicked(); void buttonTextEdit_clicked(); diff --git a/qad/blockview/drawtools.ui b/qad/blockview/drawtools.ui index 63b7002..61c7f45 100644 --- a/qad/blockview/drawtools.ui +++ b/qad/blockview/drawtools.ui @@ -29,7 +29,7 @@ - 0 + 2 @@ -596,6 +596,23 @@ + + + + + 0 + 0 + + + + Paste image ... + + + + :/icons/view-preview.png:/icons/view-preview.png + + + @@ -680,10 +697,10 @@ - + true - + true @@ -716,10 +733,10 @@ - + true - + true