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

This commit is contained in:
2017-10-21 20:42:32 +00:00
parent 3324d9753c
commit 7353ce37ba
3 changed files with 31 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
#include "blockitem.h"
#include <QApplication>
@@ -30,6 +31,7 @@ void BlockItemPin::resizePin(double r) {
void BlockItemPin::_init(bool affect_parent) {
text_item.setFont(AlignedTextItem::sceneFont(QApplication::font()));
QRectF tbr = text_item.boundingRect();
const double r = 7.;
ell_item.setRect(-r, -r, r+r, r+r);
@@ -54,6 +56,13 @@ void BlockItemPin::_reparent() {
if (qgraphicsitem_cast<BlockItem*>(parentItem()) == 0) return;
QPen p = qgraphicsitem_cast<BlockItem*>(parentItem())->g_main.pen();
ell_item.setPen(p);
if (scene()) {
text_item.setFont(AlignedTextItem::sceneFont(scene()->font()));
QRectF tbr = text_item.boundingRect();
text_item.resetTransform();
text_item.setPos(0, -tbr.height() / 2.);
text_item.setTransformOriginPoint(0, tbr.height() / 2.);
}
}