Results 1 to 5 of 5

Thread: Newbie needs advice - QGraphicsLineItem

  1. #1
    Join Date
    Jul 2006
    Posts
    25
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Newbie needs advice - QGraphicsLineItem

    Hi All,

    (QT 4.2.3 using MinGW) Dont know much about programming (serious rookie) so starting from scratch and need advice.

    I have a main window up and running and want to add a Line using QGraphicsLineItem but dont know how to build that class.

    Where can I find information on how to add things like a Line using QGraphicsLineItem to a main Window?

    Thanks in advance

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Newbie needs advice - QGraphicsLineItem

    No need to build a class for that, at least not just yet.
    You need to:
    - add a QGraphicsView to your window( from Designer, or whatever );
    - add a QGraphicsScene to this view;
    - add a line item by:
    - create a QGraphicsLineItem and add it to the scene with QGraphicsScene::addItem
    - use the convenience functions from the QGraphiscScene::addLine familiy.

    But before you draw something read http://doc.trolltech.com/4.3/graphicsview.html.

    Regards

  3. #3
    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: Newbie needs advice - QGraphicsLineItem

    You want to have a line on your form or you want to use the graphics view? Because you can have lines without the graphicsview, so if you explained what you intend to do with this line, we might suggest an alternative solution.

  4. #4
    Join Date
    Jul 2006
    Posts
    25
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Newbie needs advice - QGraphicsLineItem

    Wysota, I want a line, I will manipulate that line eventually, making longer or shorter, adding characteristics to it like if its 1000 meters long it has 10 ohms of resistance per meter.

    So like I said I am so fresh never wrote a program before, so I need to start small, want to get a line up and running that I can make longer or shorter by means of another widget and then I will add characteristics like resistance and such.

    I have read
    But before you draw something read http://doc.trolltech.com/4.3/graphicsview.html.
    but I am having a hard time interpreting those fundamentals.

    Where is a good place to start learning the basics graphics view?

  5. #5
    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: Newbie needs advice - QGraphicsLineItem

    Quote Originally Posted by Seth View Post
    Wysota, I want a line, I will manipulate that line eventually, making longer or shorter, adding characteristics to it like if its 1000 meters long it has 10 ohms of resistance per meter.
    But is the line a goal of its own? What would you like to have in the end? Are you implementing some schematic drawing application or something?

    Where is a good place to start learning the basics graphics view?
    Start by taking a look at examples concerning the graphics view if that's really what you need (I'm not sure about that though).

Similar Threads

  1. Newbie needs advice
    By Seth in forum Newbie
    Replies: 3
    Last Post: 12th April 2007, 22:50
  2. Newbie needs advice on moving to designer
    By nbkhwjm in forum Newbie
    Replies: 2
    Last Post: 11th April 2007, 23:32

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.