Results 1 to 4 of 4

Thread: how can we put the text in some certain place with QGraphicsScene

  1. #1
    Join Date
    Sep 2008
    Posts
    93
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default how can we put the text in some certain place with QGraphicsScene

    I hope to use the function QGraphicsScene::addText() to put some texts in some specified place. But the default position is: (0,0).

    How can I work around this problem?

    Thanks!

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how can we put the text in some certain place with QGraphicsScene

    QGraphicsTextItem * QGraphicsScene::addText ( const QString & text, const QFont & font = QFont() )
    it returns a graphics text item which is inherited from graphics item. You can set the position using QGraphicsTextItem->setPos(x,y) ...

  3. The following user says thank you to aamer4yu for this useful post:

    learning_qt (28th November 2008)

  4. #3
    Join Date
    Apr 2009
    Location
    China
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: how can we put the text in some certain place with QGraphicsScene

    I try it, but why my QGraphicsTextItem still at the default position is: (0,0).?

  5. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how can we put the text in some certain place with QGraphicsScene

    You can set the position using QGraphicsTextItem->setPos(x,y) .
    Did you try that too ??? setPos function ?

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. Problem pasting text into a QTextEdit
    By Spockmeat in forum Qt Programming
    Replies: 8
    Last Post: 14th March 2009, 14:36
  3. Match the text beetween two string
    By dreamer in forum Qt Programming
    Replies: 4
    Last Post: 20th May 2008, 14:48
  4. Editable text in QGraphicsView
    By wysota in forum Qt Programming
    Replies: 8
    Last Post: 24th February 2007, 15:30
  5. How to place contextmenu in QGraphicsScene?
    By Morea in forum Qt Programming
    Replies: 2
    Last Post: 14th January 2007, 16:04

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.