Results 1 to 3 of 3

Thread: how to hide QgraphicsItem !!!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2008
    Location
    Morocco
    Posts
    47
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default how to hide QgraphicsItem !!!

    Hi..
    I have a problem of how to use correcty the QGraphicsItemGroup ..
    well. my application is about zooming on a map .. so depending on the zoom I should display or hide some details..
    for example to put the names of cities after zooming I used:

    Qt Code:
    1. void myview::zoomingin(){
    2.  
    3. for (int i=0;i<5;i++){
    4. QGraphicsTextItem * txt=new QGraphicsTextItem(citiesName[i]);
    5. txt->setPos(citiesX[i],citiesY[i]);
    6. scene->addItem(txt);
    7. group->addToGroup(txt);
    8. }
    9. graphicsView->scale(1.2,1.2);
    10. }
    To copy to clipboard, switch view to plain text mode 
    >> citiesName,citiesX,citiesY are QList containin' the names and coordonates of each citie..

    then I should hide them when we zoom out .. I try to used:
    Qt Code:
    1. void myview::zoomingout(){
    2.  
    3. scene->destroyItemGroup(group);
    4.  
    5. graphicsView->scale(1/1.2,1/1.2);
    6. }
    To copy to clipboard, switch view to plain text mode 

    but it doesnt work .. nd when the group became empty it stucks!!

    plz if someOne have a idea !!!!!!!!!!!!!!!!!!!!!!
    Last edited by jpn; 24th May 2008 at 22:07. Reason: missing [code] tags

Similar Threads

  1. Replies: 10
    Last Post: 20th April 2015, 22:24
  2. QGraphicsItem doesn't inherit QObject?
    By xyzt in forum Qt Programming
    Replies: 6
    Last Post: 26th September 2011, 14:59
  3. destruction of QGraphicsItem
    By killkolor in forum Qt Programming
    Replies: 2
    Last Post: 5th December 2009, 10:31
  4. Snap-to grid on QGraphicsItem
    By hardgeus in forum Qt Programming
    Replies: 9
    Last Post: 28th April 2008, 16:22
  5. model/view, can't hide row/col
    By grellsworth in forum Qt Programming
    Replies: 7
    Last Post: 17th September 2007, 14:21

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.