Results 1 to 3 of 3

Thread: QGraphicsTextItem is not editable

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2009
    Location
    Valencia (Spain)
    Posts
    245
    Thanks
    38
    Thanked 19 Times in 19 Posts
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default QGraphicsTextItem is not editable

    Hi,

    I'm trying to have a QGraphicsTextItem on my scene, movable and editable. The desired behavior is: double click (select text and edit it), drag and drop. Like a normal text in any application, but being able to move it around.

    I though that was possible with the next code, but the text doesn't change (is selected, I can copy and paste but nothing is written from the keyboard) and, when I set the text interaction flag, the item is not movable.

    Qt Code:
    1. QGraphicsTextItem* textItem = new QGraphicsTextItem("test item");
    2. textItem ->setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemIsMovable);
    3. textItem ->setTextInteractionFlags(Qt::TextEditorInteraction);
    4. textItem ->setPos(100, 200);
    5. m_pMyScene->addItem(textItem);
    To copy to clipboard, switch view to plain text mode 

    what could be wrong? thanks!
    Last edited by jano_alex_es; 29th September 2009 at 15:51.

Similar Threads

  1. cursor in qgraphicstextitem
    By Noxxik in forum Qt Programming
    Replies: 0
    Last Post: 15th March 2009, 12:04
  2. QTreeWidget - Making a Column editable.
    By Preeteesh in forum Qt Programming
    Replies: 1
    Last Post: 16th June 2007, 12:02
  3. Editable text in QGraphicsView
    By wysota in forum Qt Programming
    Replies: 8
    Last Post: 24th February 2007, 15:30
  4. QGraphicsTextItem: handling cursor position change
    By Angelo Moriconi in forum Qt Programming
    Replies: 2
    Last Post: 30th January 2007, 10:42
  5. QGraphicsTextItem size
    By Angelo Moriconi in forum Qt Programming
    Replies: 1
    Last Post: 26th January 2007, 08:34

Tags for this Thread

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.