Results 1 to 2 of 2

Thread: How do I place an item at the top left-hand corner of the QGraphicsView

  1. #1
    Join Date
    Jul 2012
    Posts
    201
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default How do I place an item at the top left-hand corner of the QGraphicsView

    Hi there, I need to know how to place an item at the top left-hand corner of the the QGraphicsView using the QGraphicsScene. And I would also like to know how to map the item’s width to the width of the QGraphicsView. If you are curious about what I am trying to achieve by this, I am building a custom chat application for my employer and I want to use the QGraphicsView to display online colleagues.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How do I place an item at the top left-hand corner of the QGraphicsView

    Call QGraphicsView::mapToScene(0, 0) and move the item to the resulting position.
    For size you can obviously also map the bottom-right corner of the view and extend the item accordingly.

    You could also look into using QtQuick

    Cheers,
    _

Similar Threads

  1. Replies: 1
    Last Post: 12th May 2013, 21:17
  2. how to set title on the top-left corner of QFrame?
    By weixj2003ld in forum Qt Programming
    Replies: 1
    Last Post: 9th November 2011, 04:58
  3. Replies: 4
    Last Post: 13th February 2011, 20:24
  4. Replies: 10
    Last Post: 29th May 2010, 18:42
  5. QTableWidget - Using top left corner cell
    By SteveH in forum Newbie
    Replies: 6
    Last Post: 12th March 2010, 19:33

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.