Results 1 to 3 of 3

Thread: how to detect if QGraphicsTextItem is inside viewport

  1. #1
    Join Date
    Aug 2012
    Posts
    13
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default how to detect if QGraphicsTextItem is inside viewport

    I have a fixed size QGraphicsScene and fixed QGraphicsViewport with a single QGraphicsTextItem inside of it. I am trying to autosize the text inside of the viewport which is done by calling fitInView whenever the text changes. However if enough text is typed it will continue off the bottom of the view, what I want to do is have it stop accepting anymore text input if the graphicsitem's bounding rect is not completely inside the viewport. Any ideas?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to detect if QGraphicsTextItem is inside viewport

    Maybe QGraphicsItem::itemChange() can help?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Aug 2012
    Posts
    13
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: how to detect if QGraphicsTextItem is inside viewport

    thanks I think that might do the trick.

Similar Threads

  1. QGraphicsView inside of QAbstractItemView viewport
    By Paladin12 in forum Qt Programming
    Replies: 5
    Last Post: 24th January 2016, 14:15
  2. Replies: 2
    Last Post: 1st January 2012, 23:22
  3. Replies: 0
    Last Post: 11th January 2011, 09:00
  4. Replies: 2
    Last Post: 26th February 2009, 10:12
  5. How find QPoint from a QListWidgetItem inside viewport?
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 12th April 2008, 12:28

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.