Results 1 to 5 of 5

Thread: Text mark on Scene

  1. #1
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Text mark on Scene

    Hi,

    I need to add a text mark on to a graphics scene, just like Words, or the attached picture.

    Does anyone know if there is a free such QGraphicsItem around?

    Thanks!
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Text mark on Scene

    No - you will have to make one your self, based on the basic graphic items available.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Text mark on Scene

    Quote Originally Posted by lni View Post
    Hi,

    I need to add a text mark on to a graphics scene, just like Words, or the attached picture.

    Does anyone know if there is a free such QGraphicsItem around?

    Thanks!
    This is very basic and useful Item, I wonder why Qt doesn't provide this item. I do hope somewhere I can just download it..

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Text mark on Scene

    What is so basic or common a bout it?
    Where except in your application and maybe comics applications you might see something like that?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Text mark on Scene

    Not a GraphicsItem, but you could show a QWhatsThis at the appropriate position. It's like a hint, but stays visible, until the user clicks somewhere.

    Otherwise, really just implement this yourself. Inherit from QGraphicsItem. Introduce text and size attributes and a position for the starting point of the text mark. Whenever an updated is required (due to attribute changes or on first show) create a QPainterPath for your bubble, using arcTo and lineTo. Return that as shape of your item and its boundingRect as boundingrect.. You can draw the path and the text in the paintEvent of your item using the QPainter.

    HIH

    Joh

Similar Threads

  1. QCalenderWidget mark dates RED
    By ad3d in forum Qt Programming
    Replies: 1
    Last Post: 11th April 2011, 10:59
  2. Mark Thread as SOLVED
    By amoswood in forum Newbie
    Replies: 2
    Last Post: 9th June 2010, 19:37
  3. how can i mark points on top of a Image?
    By montamer in forum Qt Programming
    Replies: 2
    Last Post: 2nd April 2010, 12:53
  4. How to interactively adding text to scene
    By lni in forum Qt Programming
    Replies: 4
    Last Post: 13th February 2010, 17:04
  5. QTextEdit and mark Text
    By J-jayz-Z in forum Qt Programming
    Replies: 12
    Last Post: 28th September 2007, 00:14

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.