Results 1 to 2 of 2

Thread: Whats the right approach for drawing a simple graph?

  1. #1
    Join Date
    Sep 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Whats the right approach for drawing a simple graph?

    Hello,
    a while ago I was asked to develop an app in QT and being new to it I've done some things poorly.
    One of those things was to draw a graph..
    At first I did this by just adding QFrames with backgrounds and used fixed calculated positions.

    Now I wanted to do this with a layout, so that their positions would be calculated automatically and resize of widgets wouldnt be a problem.
    I then added QHBoxLayout but then the 'poles' of the graph were centered vertically instead of the bottom..

    After that I tried using QGraphicScene with the anchor property of QGraphicsView set to bottom but I'm still not getting results.

    How should I go about drawing a simple graph?

    Btw, some extra question of things I had in mind:
    1. Are there spacers you can use with QGraphicScene?
    2. Do you always need to hide and show a window in order to draw to it?

    Would really appreciate some help, thanks!

  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: Whats the right approach for drawing a simple graph?

    Quote Originally Posted by Menia View Post
    1. Are there spacers you can use with QGraphicScene?
    How about using QGraphicsLinearLayout?
    2. Do you always need to hide and show a window in order to draw to it?
    No, you should never need to do that. If you do then you probably foget to notify Qt that the contents of the widget changed (by calling update()).
    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.


Similar Threads

  1. Drawing of graph(data structure) !
    By Abeer in forum Newbie
    Replies: 1
    Last Post: 23rd May 2010, 21:47
  2. Replies: 4
    Last Post: 15th March 2010, 12:52
  3. Replies: 5
    Last Post: 21st March 2009, 09:10
  4. Replies: 3
    Last Post: 3rd March 2009, 12:24
  5. graph drawing
    By swathi in forum Qt Programming
    Replies: 1
    Last Post: 8th November 2008, 09:27

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.