Results 1 to 6 of 6

Thread: QTextEdit on top of QGraphicsView, not QGraphicsScene

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2010
    Posts
    37
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default QTextEdit on top of QGraphicsView, not QGraphicsScene

    I have a QGraphicsView and want to add a QTextEdit on top of that, which resizes with the whole window. I parent it to the view, instead of the scene since the text needs to remain the same size.

    screen.jpg


    Qt Code:
    1. def resizeEvent(self, event):
    2. # .....
    3. winSize = self.contentsRect().size()
    4. winw, winh = winSize.width(), winSize.height()
    5. self.chat.resize(winw*0.5, winh*0.5)
    6. self.chat.move(10,winh*0.5)
    To copy to clipboard, switch view to plain text mode 

    At the moment I resize it manually in the resizeEvent, but it's ugly since when you resize it updates and when scrollbars appear, it becomes transparent and I don't know how to turn it off.

    How should I be doing this?

    It's as if the widget has no 'sense' of the size of the window. If I could attach another widget to the window layered on top of the QGraphicsView below then this could be easily be solved by using layouts.

    window.setWidget(QGraphicsScene); window.setWidget2(interactableGui)

    That sort of thing
    Last edited by genjix; 30th October 2010 at 21:38.

Similar Threads

  1. QGraphicsScene & QGraphicsView help please
    By munna in forum Qt Programming
    Replies: 6
    Last Post: 13th February 2017, 12:30
  2. QGraphicsView and QGraphicsScene
    By alisami in forum Qt Programming
    Replies: 8
    Last Post: 4th December 2008, 10:10
  3. QGraphicsScene and QGraphicsView
    By sabeesh in forum Qt Programming
    Replies: 7
    Last Post: 1st August 2007, 06:59
  4. QGraphicsScene and QGraphicsView
    By rossd in forum Qt Programming
    Replies: 2
    Last Post: 25th April 2007, 14:43
  5. (QT4.2-RC1) QGraphicsScene QGraphicsView QGraphicsItem
    By antonio.r.tome in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2006, 10:56

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.