Results 1 to 5 of 5

Thread: Q3CanvasView Definition

  1. #1
    Join Date
    Feb 2006
    Location
    New Delhi,India
    Posts
    226
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    14
    Thanked 4 Times in 4 Posts

    Default Q3CanvasView Definition

    Hi,

    I read thru the doc of Q3Canvas and Q3CanvasView...
    I have a small doubt...
    The doc says that a canvas can have multiple views...

    Does this mean that when i create a canvas and create 100 rectangles on it,
    Both the views will show me the 100 rectangles but the first view would colour the first 50 rectangles in red and the next view would color it in blue..

    Is this possible doing on canvas and is the solution the way i have understood or is done in a different manner....

    Thanking you a lot..

    with regards,
    Kapil
    All you have to decide is what to do with the time that is given to you

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Q3CanvasView Definition

    No, because the colour of the item is stored in the item itself and not in its view. Having different views means that they can show different regions of the canvas, with different scales. Of course you could reimplement QCanvasView in that way that it is the object which decides about the colour of the items, but it's not provided out-of-the-box.

  3. #3
    Join Date
    Feb 2006
    Location
    New Delhi,India
    Posts
    226
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    14
    Thanked 4 Times in 4 Posts

    Default Re: Q3CanvasView Definition

    Quote Originally Posted by wysota
    No, because the colour of the item is stored in the item itself and not in its view. Having different views means that they can show different regions of the canvas, with different scales. Of course you could reimplement QCanvasView in that way that it is the object which decides about the colour of the items, but it's not provided out-of-the-box.
    UhOhhhhhhhhh...

    The problem which i am facing is that, on my canvas i have created lot many items statically..
    Now when i click on Button 1, these independent objects are joined with the dynamically created lines...
    On my Button 2 click different sets of items get connected and the previous set of lines are removed...
    Now the problem is that when i click on Button 1 my things work fine..
    When i click on Button 2, the lines which were created by Button 1 are not removed.. how do i remove those lines from my canvas.. It is something like erasing them out of my canvas... And they are recreated when i click Button 1 again..
    How do i do that... i am not able to remove the created lines..

    I thought of setting them visible(false) but then for that i would have to keep the track of all the lines that are created which i am not able to 'coz its on user if he wants to create 100 new lines or 150... so am not able to create the line array with a specified number also..
    What should i do in this situation....

    Plz help me in getting a solution to the problem..

    Thanking you..
    with regards..
    Kapil
    All you have to decide is what to do with the time that is given to you

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Q3CanvasView Definition

    Use QList<Q3CanvasItem*> to store them.

  5. #5
    Join Date
    Feb 2006
    Location
    New Delhi,India
    Posts
    226
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    14
    Thanked 4 Times in 4 Posts

    Default Re: Q3CanvasView Definition

    Hi..

    Thanks a lot..
    It worked out using QList...


    with regards,
    Kapil
    All you have to decide is what to do with the time that is given to you

Similar Threads

  1. Compilation error wen using VTK in QT4.4
    By richardander in forum Qt Programming
    Replies: 3
    Last Post: 9th February 2009, 22:49
  2. Multiple Definition errors in moc_<Obj>.cpp and moc_<Obj>_obj.cpp
    By Doug Broadwell in forum Qt Programming
    Replies: 2
    Last Post: 27th October 2007, 19:10
  3. Omitting private part of a class definition
    By Raistlin in forum General Programming
    Replies: 2
    Last Post: 23rd March 2007, 11:51
  4. how to corss compile for windows in Linux
    By safknw in forum Qt Programming
    Replies: 24
    Last Post: 13th May 2006, 05:23
  5. Replies: 25
    Last Post: 15th January 2006, 00:53

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.