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!
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!
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.
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
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:
it show a rect with textQt Code:
{ drawText(Rect(), Qt::AlignLeft,_text); }To copy to clipboard, switch view to plain text mode
after:
Qt Code:
{ painter->save(); QWidget *w; w = widget->parentWidget(); QzCanvasView *v; v = (QzCanvasView *)w; //In there, I don't konw what to do drawText(Rect(), Qt::AlignLeft,_text); painter->restore(); }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.
And how is that related to zooming? What is QzCanvasTagItem? What drawText()? What is this code supposed to do?
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
What does "similar" mean in this context? How do you use those classes?
Please use [code] tags in your posts.
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
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?
oh,my god!
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):
- Use Qt Assistant
- Search the forum
If you haven't found solution yet then create new topic with smart question.
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
I already told you at the very beginning - set ItemIgnoresTransformations flag on each of the items.
Bookmarks