Results 1 to 4 of 4

Thread: Advice for a new Project

  1. #1
    Join Date
    May 2006
    Posts
    58
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Advice for a new Project

    I am implementing a simple CAD-like program for laying out basic house layouts. I would like to have a snap-to grid, the ability to add points, lines and form shapes etc.

    I know that the scope of this is way beyond a help forum, but since I am going to be implementing it in QT, I'd like a general idea of which fundamental approach to take. There are many ways of going about it, and I'd hate to get 10,000 lines in before I realize I'm going down the wrong road.

    So what fundamental architecture would you guys recommend for something like this? On my last similar project I used a big QWorkspace where I overloaded the paintevent and did a lot of manual drawing, and for my "entities" I directly inherited from QWidget and handled all of my own events.

    I seem to remember something about a new flexible canvas widget in QT 4, but after a few searches I'm not seeing anything.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    258
    Thanks
    22
    Thanked 19 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Advice for a new Project


  3. The following user says thank you to momesana for this useful post:

    hardgeus (17th April 2008)

  4. #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: Advice for a new Project

    I'd suggest using QGraphicsView and use things like
    QGraphicsItem::itemChange() to handle snapping to grid and stuff. Should be pretty straightforward.

  5. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Advice for a new Project

    QGraphicsView (QGV) is a framework on top of QWidget/QPainter with a higher ( but not high ) level of abstraction. This can make your life easier, but also might limit your possibilities. As you already have implemented something similar with QWidget/QPainter you already know, that this isn't too difficult as well. IMHO using QGV is a fundamental decision you should spend more time with.

    Your task is to implement a high level framework dealing with objects from your application domain. I would start to make a design for this first. IMHO the design of QGV is good inspiration.

    Try to see QWidget/QPainter as the natural way to implement it. Then check your requirements, if QGV has something to offer, that makes your implementation easier. If you find enough useful features you need, go for it.

    But in the end QGV inherits a couple of problems from QPainter/QWidget, that you need to solve regardless of your design decision. F.e. you might need to implement a lot of clipping code to get an acceptable performance for zooming in.

    Uwe

Similar Threads

  1. Set up the Qt4.3.2 with Visual Studio 2005
    By lamoda in forum Installation and Deployment
    Replies: 6
    Last Post: 30th January 2008, 06:51
  2. Importing qt project to an eclipse workspace
    By isahin in forum Installation and Deployment
    Replies: 2
    Last Post: 28th January 2008, 18:00
  3. I need a project opinion.
    By hgedek in forum General Discussion
    Replies: 6
    Last Post: 25th September 2007, 18:54
  4. Qt4 open src mingw from a PC to another
    By nvictor in forum Installation and Deployment
    Replies: 11
    Last Post: 1st May 2007, 17:41
  5. Project generation on linux from QT Project
    By darpan in forum Qt Programming
    Replies: 6
    Last Post: 11th December 2006, 09:43

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.