text is not selected on page load

preferencesAboutTextFull
Claudio Valerio 12 years ago
parent fbd630636b
commit c7b364415b
  1. 1
      src/board/UBBoardView.cpp
  2. 9
      src/domain/UBGraphicsTextItem.cpp
  3. 2
      src/domain/UBGraphicsTextItem.h

@ -1288,6 +1288,7 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
UBDrawingController::drawingController ()->setStylusTool (UBStylusTool::Selector); UBDrawingController::drawingController ()->setStylusTool (UBStylusTool::Selector);
textItem->setTextInteractionFlags(Qt::TextEditorInteraction);
textItem->setSelected (true); textItem->setSelected (true);
textItem->setFocus(); textItem->setFocus();
} }

@ -89,6 +89,8 @@ QVariant UBGraphicsTextItem::itemChange(GraphicsItemChange change, const QVarian
void UBGraphicsTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event) void UBGraphicsTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{ {
setTextInteractionFlags(Qt::TextEditorInteraction);
// scene()->itemAt(pos) returns 0 if pos is not over text, but over text item, but mouse press comes. // scene()->itemAt(pos) returns 0 if pos is not over text, but over text item, but mouse press comes.
// It is a cludge... // It is a cludge...
if (UBStylusTool::Play == UBDrawingController::drawingController()->stylusTool()) if (UBStylusTool::Play == UBDrawingController::drawingController()->stylusTool())
@ -145,7 +147,6 @@ void UBGraphicsTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
if (mMultiClickState == 1) if (mMultiClickState == 1)
{ {
// setTextInteractionFlags(Qt::TextEditorInteraction);
QGraphicsTextItem::mousePressEvent(event); QGraphicsTextItem::mousePressEvent(event);
setFocus(); setFocus();
} }
@ -355,3 +356,9 @@ void UBGraphicsTextItem::documentSizeChanged(const QSizeF & newSize)
{ {
resize(newSize.width(), newSize.height()); resize(newSize.width(), newSize.height());
} }
void UBGraphicsTextItem::setHtml(const QString &text)
{
QGraphicsTextItem::setHtml(text);
setTextInteractionFlags(Qt::NoTextInteraction);
}

@ -90,6 +90,7 @@ class UBGraphicsTextItem : public QGraphicsTextItem, public UBItem, public UBRes
virtual void clearSource(){;} virtual void clearSource(){;}
virtual void setUuid(const QUuid &pUuid); virtual void setUuid(const QUuid &pUuid);
void setHtml(const QString &text);
signals: signals:
void textUndoCommandAdded(UBGraphicsTextItem *textItem); void textUndoCommandAdded(UBGraphicsTextItem *textItem);
@ -107,7 +108,6 @@ class UBGraphicsTextItem : public QGraphicsTextItem, public UBItem, public UBRes
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
private:
qreal mTextHeight; qreal mTextHeight;
int mMultiClickState; int mMultiClickState;

Loading…
Cancel
Save