Results 1 to 4 of 4

Thread: Rotate QTextEdit Widget

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2011
    Posts
    32
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Rotate QTextEdit Widget

    Hello all,

    I am currently subclassing QTextEdit and dynamically creating what are (in effect) fancy labels that can be created and moved around the window, edited, etc. So far everything is working out beautifully.

    I would now like to add the ability to rotate these labels. Here is what I have tried:

    Each MyQTextEdit is created with the QMainWindow's centralwidget as parent. I have a QList of pointers to each of the MyQTextEdit objects. In the MyQTextEdit subclass, I have overridden the paintEvent, pass the event first to QTextEdit::paintEvent and then create a QPainter with MyQTextEdit::viewport() as its parent, call its rotate() and then continue on.

    This runs without error, but does not have the desired effect. I have also tried transform() without success. The MyQTextEdit objects are painted normally, no rotation occurs.

    To be clear, I wish to rotate the entire widget, not just the text in the widget.

    I feel like perhaps I am reaching for the wrong viewport() to rotate here. Yet QMainWindow does not have a viewport().

    Any ideas on how to accomplish this?
    Last edited by lxman; 6th February 2011 at 03:42. Reason: reformatted to look better

Similar Threads

  1. Replies: 2
    Last Post: 17th June 2010, 20:24
  2. How to rotate the control?
    By tszzp in forum Qt Programming
    Replies: 9
    Last Post: 25th November 2009, 09:05
  3. To rotate widget
    By ajit in forum Qt Programming
    Replies: 2
    Last Post: 26th September 2007, 10:03
  4. Scrolling in QTextEdit Widget
    By ajb_advance in forum Newbie
    Replies: 2
    Last Post: 25th September 2007, 11:34
  5. QPolygon rotate
    By xgoan in forum Qt Programming
    Replies: 3
    Last Post: 8th May 2007, 11:18

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.