Results 1 to 17 of 17

Thread: view/item

  1. #1
    Join Date
    Apr 2009
    Location
    China
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11

    Smile view/item

    Hi,
    I have a problem , I want to the view(like QGraphicsView) zoom in ,at the same time the items can't change,
    some one tell me rewrite the paint() ,but I don't know how to do it? I seek to a share of code about the View/Items .
    Thanks a lot!

  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: view/item

    I'm not sure I understand what you want, but assuming you want to zoom the view without zooming the items in it, you want to set QGraphicsItem::ItemIgnoresTransformations flag on each of the items.
    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.


  3. #3
    Join Date
    Apr 2009
    Location
    China
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: view/item

    I have rewrite new view and items, they are't QGraphicsView and QGrphicsItem
    But in the new Frame, I want to zoom the view without zooming the items in it

  4. #4
    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: view/item

    What's the problem then?
    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.


  5. #5
    Join Date
    Apr 2009
    Location
    China
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: view/item

    it show blank space in the drawtext() ,in the first it show a QString, and it also scale when the view scale.
    the code
    begin:
    Qt Code:
    1. void QzCanvasTagItem::paint(QPainter * painter)
    2. {
    3. drawText(Rect(), Qt::AlignLeft,_text);
    4. }
    To copy to clipboard, switch view to plain text mode 
    it show a rect with text

    after:
    Qt Code:
    1. void QzCanvasTagItem::paint(QPainter * painter,QWidget *widget)
    2. {
    3. painter->save();
    4. QWidget *w;
    5. w = widget->parentWidget();
    6.  
    7. QzCanvasView *v;
    8. v = (QzCanvasView *)w;
    9. //In there, I don't konw what to do
    10. drawText(Rect(), Qt::AlignLeft,_text);
    11. painter->restore();
    12. }
    To copy to clipboard, switch view to plain text mode 

    it show blank space ,the text disapper
    and the Item also scale with view scale
    Last edited by wysota; 15th April 2009 at 09:24.

  6. #6
    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: view/item

    And how is that related to zooming? What is QzCanvasTagItem? What drawText()? What is this code supposed to do?
    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.


  7. #7
    Join Date
    Apr 2009
    Location
    China
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: view/item

    the QzCanvasTagItem is similar to QGraphicsItem,
    QzcanvasView is similar to QGraphicsView
    the zoom is similar to scale
    but they don't inherit from QGraphicsView and QGraphicsItem,
    drawText () ------show a rect with text but the rect don't change with the view scale

  8. #8
    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: view/item

    What does "similar" mean in this context? How do you use those classes?

    Please use [code] tags in your posts.
    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.


  9. #9
    Join Date
    Apr 2009
    Location
    China
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: view/item

    they are inherit from class Canvas , the QGraphicesView replace the Canvas, I want to achieve the same effect as some function in QGraphiceItem ,
    I push a QPushButton the view zoom in or zoom out , but I want the Items on the view the don't zoom

  10. #10
    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: view/item

    As for now I have seen not a single line of code related to zooming.
    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.


  11. #11
    Join Date
    Apr 2009
    Location
    China
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: view/item

    yes, zoom in the view ,I have finished it ,It can run,
    now I want to ask for help about item,
    a list of item on the view ,
    for example : QGraphicsView::scale(); one item on the QGraphicsView also scale(),
    I want to "QGraphicsView::scale(); one item on the QGraphicsView not scale()"
    it don't related to view ,only what to do with item
    do you understand?

  12. #12
    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: view/item

    No, I don't understand
    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.


  13. #13
    Join Date
    Apr 2009
    Location
    China
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: view/item

    oh,my god!

  14. #14
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: view/item

    I'm also trying hard to understand but I failed with that... :P maybe draw your problem in ms paint or something cause your explanation is a bit messy...
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  15. #15
    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: view/item

    Quote Originally Posted by faldżip View Post
    I'm also trying hard to understand but I failed with that... :P maybe draw your problem in ms paint or something cause your explanation is a bit messy...
    It would be enough to use full sentences with simple English terms and simple grammar. Expressing full ideas instead of expecting one to guess them helps as well.
    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.


  16. #16
    Join Date
    Apr 2009
    Location
    China
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: view/item

    I'm sorry for the explanation .
    a QGraphicisView object and a QGraphicsItem on the object ,
    if QGraphicsView object scale
    but the QGraphicsItem does't scale,
    what to do it

  17. #17
    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: view/item

    I already told you at the very beginning - set ItemIgnoresTransformations flag on each of the items.
    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.


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.