Results 1 to 8 of 8

Thread: Rotating Items

  1. #1
    Join Date
    May 2013
    Posts
    10
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Exclamation Rotating Items

    I’m really new at C++, and this Qt thing. I’m trying to create a GUI Application, to plot some graphics.
    I’m aware of QGraphicsView, and I’ve made my own graphic (with grids and stuff), it’s pretty much ready to go.

    But there’s a problem, I want to rotate my Y-axis label, like we’re used to see them. I’ve used QGraphicsView::rotate, but it’s kinda ugly, and not really professional. I wanted to know if there’s a better way to do this (maybe with QTransform, I didn’t have the time to check yet). All I want is to get a label displayed with a -90º rotation.

    I’m sorry if there’s already a topic about this, if you could link it to me, would be awesome. This is kinda of an emergency.

    Just one more thing:
    If I want to use QwtPlot and QwtPlotCurve, how do I put it in a layout?

    Thanks in advance.

    PF91

  2. #2
    Join Date
    Sep 2011
    Location
    Bangalore
    Posts
    254
    Thanks
    92
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Rotating Items

    If I want to use QwtPlot and QwtPlotCurve, how do I put it in a layout?
    Draw the QwtPlot and QwtPlotCurve on a widget and place the widget on the layout.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Rotating Items

    If I want to use QwtPlot and QwtPlotCurve, how do I put it in a layout?
    Exactly the same way you put any other QWidget in a layout. Perhaps I don't understand the problem.
    "We can't solve problems by using the same kind of thinking we used when we created them." -- Einstein
    If you are posting code then please use [code] [/code] tags around it - makes addressing the problem easier.

  4. #4
    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: Rotating Items

    Quote Originally Posted by PauloF91 View Post
    I’ve used QGraphicsView::rotate, but it’s kinda ugly, and not really professional.
    What exactly is "ugly" and how did you implement your item?
    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.


  5. #5
    Join Date
    May 2013
    Posts
    10
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Rotating Items

    Quote Originally Posted by rawfool View Post
    Draw the QwtPlot and QwtPlotCurve on a widget and place the widget on the layout.
    Quote Originally Posted by ChrisW67 View Post
    Exactly the same way you put any other QWidget in a layout. Perhaps I don't understand the problem.

    Yes, that's what I'm saying, but I tried it as a widget and didn't work out. I'll check it again. Thanks.

    Quote Originally Posted by wysota View Post
    What exactly is "ugly" and how did you implement your item?
    I created another QGraphicsView with a label on it, and rotated it -90º. It's ok, but I'd like something diferent.
    I'll try QwtPlot again.

    I appreciate the effort.

    PF91

    PS: I tried to draw QwtPlot straight in a layout as a widget, that's what went wrong I guess. How do I draw it in a widget? Im trying to figure out..
    Last edited by PauloF91; 27th May 2013 at 16:12.

  6. #6
    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: Rotating Items

    Quote Originally Posted by PauloF91 View Post
    I created another QGraphicsView with a label on it, and rotated it -90º. It's ok, but I'd like something diferent.
    You should have subclassed QGraphicsItem and reimplemented its paint() routine.
    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.


  7. #7
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Rotating Items

    PS: I tried to draw QwtPlot straight in a layout as a widget, that's what went wrong I guess. How do I draw it in a widget? Im trying to figure out..
    QwtPlot is a QWidget. You put it into layout exactly the same way you put any QWidget in a layout... and it behaves as it should. Repeatedly saying "it doesn't work" neither describes the problem nor aids in its solution.

  8. #8
    Join Date
    May 2013
    Posts
    10
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Rotating Items

    That's the problem then... it just gives me this message: The program has unexpectedly finished.
    Somehow I failed installing qwt-6.0, but was still able to use its classes. Thats something else I have to worry about.

    Thanks for everything, should be enough.

    PF91

Similar Threads

  1. Rotating Gradient
    By JeffC in forum Newbie
    Replies: 3
    Last Post: 3rd June 2012, 12:11
  2. Rotating QGraphicsTextItem
    By meazza in forum Newbie
    Replies: 4
    Last Post: 2nd August 2011, 13:11
  3. Rotating a QGraphicsProxyWidget
    By Luc4 in forum Qt Programming
    Replies: 3
    Last Post: 16th June 2010, 14:53
  4. rotating a widget
    By oguzy in forum Qt Programming
    Replies: 2
    Last Post: 23rd November 2008, 01:08
  5. Rotating QGraphicsItem
    By Gopala Krishna in forum Qt Programming
    Replies: 3
    Last Post: 21st December 2006, 12:50

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.