Commit 04c4a1ce authored by Julius Künzel's avatar Julius Künzel
Browse files

Keep title text item editable if even if it is empty

(cherry picked from commit 7f303be5)
parent f6b3e27f
......@@ -209,6 +209,7 @@ void MyTextItem::updateGeometry(int, int, int)
void MyTextItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *w)
{
if ((textInteractionFlags() & static_cast<int>((Qt::TextEditable) != 0)) != 0) {
document()->setDocumentMargin(0);
QGraphicsTextItem::paint(painter, option, w);
} else {
painter->setRenderHint(QPainter::Antialiasing);
......@@ -231,8 +232,9 @@ void MyTextItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
pen.setWidthF(outline);
painter->strokePath(m_path, pen);
}
if (isSelected()) {
QPen pen(Qt::red);
document()->setDocumentMargin(toPlainText().isEmpty() ? 6 : 0);
if (isSelected() || toPlainText().isEmpty()) {
QPen pen(isSelected() ? Qt::red : Qt::blue);
pen.setStyle(Qt::DashLine);
painter->setPen(pen);
painter->drawRect(boundingRect());
......
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