Results 1 to 3 of 3

Thread: QGraphicsTextItem and text cursor position via QPoint

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default QGraphicsTextItem and text cursor position via QPoint

    Hi,

    I have a customized QGraphicsTextItem. By default the item is not editable. If one would like to change the content he has to double click the item:
    Qt Code:
    1. void MyWordItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent */*event*/)
    2. {
    3. setTextInteractionFlags(Qt::TextEditorInteraction);
    4. }
    To copy to clipboard, switch view to plain text mode 
    Now every time the blinking cursor is at the position 0, but I want the text cursor to be near the mouse double click position. (Like the result if one click the mouse button a third time.) Looking through QTextCursor, QTextDocument for a function like setTextCursorPos(QPoint) faild (I would like to use event->pos()). Even in the sources I don't figure out how the trolls do it in the mouse press reimp...

    Passing the event to QGraphicsTextItem::mouseDoubleClickEvent(event); or QGraphicsTextItem::mousePressEvent(event); ends in a total selection of the content.


    Any suggestions?
    Thanks

  2. The following user says thank you to Lykurg for this useful post:

    mhennings (6th December 2012)

Similar Threads

  1. Rich text in QGraphicsTextItem
    By maverick_pol in forum Qt Programming
    Replies: 3
    Last Post: 29th September 2008, 20:08
  2. Replies: 9
    Last Post: 22nd February 2008, 16:22
  3. [Solved] Selecting text with mouse in a QGraphicsTextItem
    By pherthyl in forum Qt Programming
    Replies: 2
    Last Post: 11th August 2007, 19:10
  4. Editable text in QGraphicsView
    By wysota in forum Qt Programming
    Replies: 8
    Last Post: 24th February 2007, 15:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.