Results 1 to 4 of 4

Thread: Limiting text inside a QGraphicsItem's item?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2009
    Posts
    38
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Limiting text inside a QGraphicsItem's item?

    hi geeks and helpers,

    I am trying to limit a text inside the borders of shapes, i draw in QGraphicsView. Shapes are basically items (QGraphicsItem). I set text on them by following LOCs each time i draw one.
    Qt Code:
    1. text->setTextInteractionFlags(Qt::TextEditorInteraction);
    2. text->setPos(5,-245);
    3. text->setPlainText(name);
    To copy to clipboard, switch view to plain text mode 

    where 'name' is just a QString that stores name of the shape being drawn.

    Now, if the length of the text gets greater than the width of shape, it flows out of the borders of shape as evident in the attached pics.

    Does Qt provide some quick way out of it?

    Thankyou.
    Attached Images Attached Images

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. QTreeWidget get a text from child item
    By vcp in forum Qt Programming
    Replies: 1
    Last Post: 16th January 2009, 17:36
  3. Editable text in QGraphicsView
    By wysota in forum Qt Programming
    Replies: 8
    Last Post: 24th February 2007, 15:30
  4. Can't change the text display of a QTreeview item.
    By johnny_sparx in forum Qt Programming
    Replies: 3
    Last Post: 2nd June 2006, 01:03
  5. Replies: 1
    Last Post: 17th March 2006, 08:19

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.