Commit 94c940c5 authored by Marco Bubke's avatar Marco Bubke
Browse files

Polish the output of the feedback for item in Bauhaus

parent 832d1470
......@@ -116,13 +116,18 @@ void FormEditorGraphicsView::drawForeground(QPainter *painter, const QRectF &/*r
return;
painter->save();
QFont font;
font.setPixelSize(12);
painter->setFont(font);
if (m_beginX != m_feedbackNode.instanceValue("x"))
painter->setPen(Qt::green);
else
painter->setPen(Qt::black);
painter->drawText(mapToScene(QPoint(2.0, 12.0)), QString("x: \t\t%1").arg(m_feedbackNode.instanceValue("x").toString()));
painter->drawText(mapToScene(QPoint(2.0, 12.0)), QString("x:"));
painter->drawText(mapToScene(QPoint(14.0, 12.0)), m_feedbackNode.instanceValue("x").toString());
if (m_beginY != m_feedbackNode.instanceValue("y"))
......@@ -130,7 +135,8 @@ void FormEditorGraphicsView::drawForeground(QPainter *painter, const QRectF &/*r
else
painter->setPen(Qt::black);
painter->drawText(mapToScene(QPoint(2.0, 24.0)), QString("y: \t\t%1").arg(m_feedbackNode.instanceValue("y").toString()));
painter->drawText(mapToScene(QPoint(50.0, 12.0)), QString("y:"));
painter->drawText(mapToScene(QPoint(60.0, 12.0)), m_feedbackNode.instanceValue("y").toString());
if (m_beginWidth != m_feedbackNode.instanceValue("width"))
......@@ -138,7 +144,8 @@ void FormEditorGraphicsView::drawForeground(QPainter *painter, const QRectF &/*r
else
painter->setPen(Qt::black);
painter->drawText(mapToScene(QPoint(2.0, 36.0)), QString("width: \t\t%1").arg(m_feedbackNode.instanceValue("width").toString()));
painter->drawText(mapToScene(QPoint(2.0, 24.0)), QString("w:"));
painter->drawText(mapToScene(QPoint(14.0, 24.0)), m_feedbackNode.instanceValue("width").toString());
if (m_beginHeight != m_feedbackNode.instanceValue("height"))
......@@ -146,56 +153,59 @@ void FormEditorGraphicsView::drawForeground(QPainter *painter, const QRectF &/*r
else
painter->setPen(Qt::black);
painter->drawText(mapToScene(QPoint(2.0, 48.0)), QString("height:\t\t%1").arg(m_feedbackNode.instanceValue("height").toString()));
painter->drawText(mapToScene(QPoint(50.0, 24.0)), QString("h:"));
painter->drawText(mapToScene(QPoint(60.0, 24.0)),m_feedbackNode.instanceValue("height").toString());
if (m_parentNode == m_feedbackNode.instanceParent()) {
if (m_feedbackNode.canReparent()) {
painter->setPen(Qt::black);
painter->drawText(mapToScene(QPoint(2.0, 60.0)), QString("Can reparent."));
} else {
if (!m_feedbackNode.canReparent()) {
painter->setPen(Qt::red);
painter->drawText(mapToScene(QPoint(2.0, 60.0)), QString("Cannot reparent."));
painter->drawText(mapToScene(QPoint(2.0, 36.0)), QString("Cannot reparent."));
}
} else {
painter->setPen(Qt::yellow);
if (m_feedbackNode.instanceParent().id().isEmpty())
painter->drawText(mapToScene(QPoint(2.0, 60.0)), QString("Parent has changed."));
painter->drawText(mapToScene(QPoint(2.0, 36.0)), QString("Parent has changed."));
else
painter->drawText(mapToScene(QPoint(2.0, 60.0)), QString("Parent has changed to %1.").arg(m_feedbackNode.instanceParent().id()));
painter->drawText(mapToScene(QPoint(2.0, 36.0)), QString("Parent has changed to %1.").arg(m_feedbackNode.instanceParent().id()));
}
if (m_beginTopMargin != m_feedbackNode.instanceValue("anchors.leftMargin"))
painter->setPen(Qt::green);
else
painter->setPen(Qt::black);
painter->drawText(mapToScene(QPoint(2.0, 72.0)), QString("leftMargin: \t\t%1").arg(m_feedbackNode.instanceValue("anchors.leftMargin").toString()));
if (m_feedbackNode.instanceHasAnchors()) {
if (m_beginTopMargin != m_feedbackNode.instanceValue("anchors.leftMargin"))
painter->setPen(Qt::green);
else
painter->setPen(Qt::black);
if (m_beginRightMargin != m_feedbackNode.instanceValue("anchors.rightMargin"))
painter->setPen(Qt::green);
else
painter->setPen(Qt::black);
painter->drawText(mapToScene(QPoint(2.0, 48.0)), QString("l:"));
painter->drawText(mapToScene(QPoint(14.0, 48.0)), m_feedbackNode.instanceValue("anchors.leftMargin").toString());
painter->drawText(mapToScene(QPoint(2.0, 84.0)), QString("rightMargin: \t\t%1").arg(m_feedbackNode.instanceValue("anchors.rightMargin").toString()));
if (m_beginRightMargin != m_feedbackNode.instanceValue("anchors.rightMargin"))
painter->setPen(Qt::green);
else
painter->setPen(Qt::black);
painter->drawText(mapToScene(QPoint(50.0, 48.0)), QString("r:"));
painter->drawText(mapToScene(QPoint(60.0, 48.0)), m_feedbackNode.instanceValue("anchors.rightMargin").toString());
if (m_beginTopMargin != m_feedbackNode.instanceValue("anchors.topMargin"))
painter->setPen(Qt::green);
else
painter->setPen(Qt::black);
painter->drawText(mapToScene(QPoint(2.0, 96.0)), QString("topMargin: \t\t%1").arg(m_feedbackNode.instanceValue("anchors.topMargin").toString()));
if (m_beginTopMargin != m_feedbackNode.instanceValue("anchors.topMargin"))
painter->setPen(Qt::green);
else
painter->setPen(Qt::black);
painter->drawText(mapToScene(QPoint(2.0, 60.0)), QString("t:"));
painter->drawText(mapToScene(QPoint(14.0, 60.0)), m_feedbackNode.instanceValue("anchors.topMargin").toString());
if (m_beginBottomMargin != m_feedbackNode.instanceValue("anchors.bottomMargin"))
painter->setPen(Qt::green);
else
painter->setPen(Qt::black);
if (m_beginBottomMargin != m_feedbackNode.instanceValue("anchors.bottomMargin"))
painter->setPen(Qt::green);
else
painter->setPen(Qt::black);
painter->drawText(mapToScene(QPoint(2.0, 108.0)), QString("bottomMargin: \t%1").arg(m_feedbackNode.instanceValue("anchors.bottomMargin").toString()));
painter->drawText(mapToScene(QPoint(50.0, 60.0)), QString("b:"));
painter->drawText(mapToScene(QPoint(60.0, 60.0)), m_feedbackNode.instanceValue("anchors.bottomMargin").toString());
}
painter->restore();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment